phiflow 2 updates

This commit is contained in:
NT 2021-02-21 22:06:59 +08:00
parent 03233b7d78
commit e99b2a0b4a
10 changed files with 1012 additions and 963 deletions

View File

@ -6,8 +6,8 @@
- file: overview.md
sections:
- file: overview-equations.md
- file: overview-burgers-forw-v2.ipynb
- file: overview-ns-forw-v2.ipynb
- file: overview-burgers-forw.ipynb
- file: overview-ns-forw.ipynb
- file: supervised
sections:
- file: supervised-airfoils.ipynb
@ -26,8 +26,8 @@
- file: diffphys-outlook.md
- file: old-phiflow1.md
sections:
- file: overview-burgers-forw.ipynb
- file: overview-ns-forw.ipynb
- file: overview-burgers-forw-v1.ipynb
- file: overview-ns-forw-v1.ipynb
- file: diffphys-code-ns.ipynb
- file: jupyter-book-reference
sections:

View File

@ -8,8 +8,15 @@
"source": [
"# Differentiable Fluid Simulations\n",
"\n",
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",
"\n",
"**test version, rough... not newest one**\n",
"\n",
"\n",
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",
"\n",
"\n",
"\n",
"Next, we'll target a more complex example with the Navier-Stokes equations as model. We'll target a 2D case with velocity $\\mathbf{u}$, no explicit viscosity term, and a marker density $d$ that drives a simple Boussinesq buoyancy term $\\eta d$ adding a force along the y dimension:\n",
"\n",
"$\\begin{aligned}\n",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,10 +7,18 @@ In addition we'll discuss some _model equations_ below. Note that we won't use _
## Deep Learning and Neural Networks
There are lots of great introductions to deep learning - hence, we'll keep it short:
our goal is to approximate $f^*(x)=y$ with an NN $f(x;\theta)$,
given some formulation for an error $e(y,y^*)$ with $y=f(x;\theta)$ being the output
of the NN, and $y^*$ denoting a reference or ground truth value.
our goal is to approximate an unknown function
$f^*(x) = y^*$ ,
where $y^*$ denotes reference or "ground truth" solutions.
$f^*(x)$ should be approximated with an NN representation $f(x;\theta)$. We typically determine $f$
with the help of some formulation of an error function $e(y,y^*)$, where $y=f(x;\theta)$ is the output
of the NN.
This gives a minimization problem to find $f(x;\theta)$ such that $e$ is minimized.
In the simplest case, we can use an $L^2$ error, giving
$\text{min}_{\theta} || f(x;\theta) - y^* ||_2^2$
We typically optimize, i.e. _train_,
with some variant of a stochastic gradient descent (SGD) optimizer.
@ -177,7 +185,7 @@ $\begin{aligned}
\text{subject to} \quad \nabla \cdot \mathbf{u} &= 0
\end{aligned}$
where, like before, $\nu$ denotes a diffusion constant for viscosity, respectively.
where, like before, $\nu$ denotes a diffusion constant for viscosity.
An interesting variant is obtained by including the Boussinesq approximation
for varying densities, e.g., for simple temperature changes of the fluid.
@ -187,13 +195,14 @@ this yields the following set of equations:
$\begin{aligned}
\frac{\partial u_x}{\partial{t}} + \mathbf{u} \cdot \nabla u_x &= - \frac{1}{\rho} \nabla p
\\
\frac{\partial u_y}{\partial{t}} + \mathbf{u} \cdot \nabla u_y &= - \frac{1}{\rho} \nabla p + \eta d
\frac{\partial u_y}{\partial{t}} + \mathbf{u} \cdot \nabla u_y &= - \frac{1}{\rho} \nabla p + \xi d
\\
\text{subject to} \quad \nabla \cdot \mathbf{u} &= 0,
\\
\frac{\partial d}{\partial{t}} + \mathbf{u} \cdot \nabla d &= 0
\end{aligned}$
where $\xi$ denotes the strength of the buoyancy force.
And finally, we'll also consider 3D cases with the Navier-Stokes model, i.e.:

381
overview-ns-forw-v1.ipynb Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,8 @@
"source": [
"# Burgers Optimization with a Physics-Informed NN\n",
"\n",
"Warning: this example still needs phiflow1.x and tensorflow 1.x! \n",
"\n",
"To illustrate how the physics-informed losses work, let's consider a \n",
"reconstruction example with a simple yet non-linear equation in 1D:\n",
"Burgers equation $\\frac{\\partial u}{\\partial{t}} + u \\nabla u = \\nu \\nabla \\cdot \\nabla u$\n",