Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 16 additions & 23 deletions PARCtorch/demos/NavierStokes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,36 @@
" <img src=\"../misc/iowa.png\" width=\"190\" alt=\"Image 3\" />\n",
" </div>\n",
"</div>\n",
"<p>A customizable framework to embed physics in Deep Learning. PARC's formulation is inspired by Advection-Diffusion-Reaction processes and uses an Inductive Bias approach to constrain the Neural Network.</p>\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Why PARC?\n",
"<p>PARC brings together deep learning with first prinicples physics - its recurrent convolutional core is able to learn complex spatiotemporal patterns, while built-in biases (conservation laws & advection-diffusion operators) ensure every prediction is physically plausible. PARC is constructed in such a manner that is does not need to \"re-learn\" fundemental dynamics - allowing faster training with far less data.</p>\n",
"\n",
"<p>PINN (Physics-Informed Neural Networks) exists as an adjacent model to PARC. While PINN may preform decently on generics, it struggles with advection or chaotic/non-linear systems - net leading to higher computational cost. In such situations PARC is deemed the superior model with it being more scalable, efficient, and accurate than other physics-based models.</p>\n",
"\n",
"### Goal\n",
"<p>The goal of this notebook is to walk you through the use cases of PARC via the Navier-Stokes equation. At the end of this notebook you will be presented with visualization in accordance to the equations representing conservation of momentum for fluids and fully describing fluid motion.</p>\n",
"<p>This notebook is to demonstrate how to configure PARC to model the dynamcis of the Navier-Stokes equation.</p>\n",
"\n",
"The notebook will guide you through from start to finish in preparing, training, and modeling a physics-based equation. The notebook will cover the following:\n",
"Particularly, this notebook will guide thorugh the complete cycle of statistical modelling, more specifically: \n",
"- load and prepare data for Navier-Stokes\n",
"- train PARC to learn the dynamcis of the Navier-Stokes equation\n",
"- evalaute performance to ground truth simulation.\n",
"\n",
"- loading and preparinf data for Navier-Stokes\n",
"- Using PARCv2 Model to learn and predict time evolution of $u(x,t)$\n",
"- Evaluating the model's preformance and compare predicted resutls to ground truth\n",
"\n",
"### Internal General PARC PDE\n",
"<p>Below is the general form of the partial differential equation that PARCv2 is learning - and its inital boundaries. In the case of the Navier-Stokes equations - we can describe the certain vairables to represent the nessearcy points in which PARC tries to model after the equation.</p>\n",
"### PARC for Navier-Stokes\n",
"<p>PARC is designed to learn the general dynamical system that follows: </p>\n",
"\n",
"$$\n",
"\\frac{\\partial X}{\\partial t} = f(X,\\mu) + \\epsilon\n",
"\\frac{\\partial X}{\\partial t} = f(X,U, c) + \\epsilon\n",
"$$\n",
"\n",
"- $X$ is the fields of interest - Temperature, Pressure, Reynolds, Velocities (U & V)\n",
"- $μ$ is the microstructure\n",
"- Scalar Fields ($X$): Pressure, Density\n",
"- Velocity Fields ($U$): Velocity\n",
"- Scalar Value ($c$): Reynolds number\n",
"\n",
"\n",
"### Setting Up\n",
"<p>This document serves as a guide to training a PARC model for the Navier-Stokes equation. Here are the inital steps to take before you begin training your PARC model!<p>\n",
"<p>This document serves as a guide to train PARC model for the Navier-Stokes equation. Here are the inital steps to take before you begin training your PARC model!<p>\n",
"\n",
"Download & Prepare Data:\n",
"- Download the data from https://zenodo.org/records/13909869 and unzip it.\n",
Expand All @@ -73,18 +67,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"from PARCtorch.data.normalization import compute_min_max\n",
"\n",
"# Define data directories\n",
"train_dir = Path(\"../data/navier_stokes/train\")\n",
"test_dir = Path(\"../data/navier_stokes/test\")\n",
"train_dir = Path(\"path/to/train/\")\n",
"test_dir = Path(\"path/to/test\")\n",
"min_max_file = train_dir.parent / \"ns_min_max.json\"\n",
"\n",
"compute_min_max([train_dir, test_dir], min_max_file)"
]
},
Expand Down Expand Up @@ -530,7 +523,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.2"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down