upd intro parabola, cleanup

This commit is contained in:
NT 2021-01-31 12:13:00 +08:00
parent e3e72982a7
commit 4e9149becf
10 changed files with 1433 additions and 989 deletions

View File

@ -1,6 +1,8 @@
# PBDL Table of content (cf https://jupyterbook.org/customize/toc.html)
#
- file: intro
- file: intro.md
sections:
- file: intro-teaser.ipynb
- file: overview.md
sections:
- file: overview-equations.md
@ -21,6 +23,7 @@
- file: diffphys-discuss.md
- file: diffphys-code-ns.ipynb
- file: diffphys-code-sol.ipynb
- file: diffphys-outlook.md
- file: jupyter-book-reference
sections:
- file: markdown

View File

@ -9,15 +9,16 @@
"# Differentiable Fluid Simulations\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",
" \\frac{\\partial u_x}{\\partial{t}} + \\mathbf{u} \\cdot \\nabla u_x = - \\frac{1}{\\rho} \\nabla p \n",
"\n",
"$\\begin{aligned}\n",
" \\frac{\\partial u_x}{\\partial{t}} + \\mathbf{u} \\cdot \\nabla u_x &= - \\frac{1}{\\rho} \\nabla p \n",
" \\\\\n",
" \\frac{\\partial u_y}{\\partial{t}} + \\mathbf{u} \\cdot \\nabla u_y = - \\frac{1}{\\rho} \\nabla p + \\eta d\n",
" \\frac{\\partial u_y}{\\partial{t}} + \\mathbf{u} \\cdot \\nabla u_y &= - \\frac{1}{\\rho} \\nabla p + \\eta d\n",
" \\\\\n",
" \\text{subject to} \\quad \\nabla \\cdot \\mathbf{u} = 0,\n",
" \\text{s.t.} \\quad \\nabla \\cdot \\mathbf{u} &= 0,\n",
" \\\\\n",
" \\frac{\\partial d}{\\partial{t}} + \\mathbf{u} \\cdot \\nabla d = 0 \n",
"$\n",
" \\frac{\\partial d}{\\partial{t}} + \\mathbf{u} \\cdot \\nabla d &= 0 \n",
"\\end{aligned}$\n",
"\n",
"As optimization objective we'll consider a more difficult variant of the previous example: the state of the observed density $d$ should match a given target after $n=20$ steps of simulation. In contrast to before, the marker $d$ cannot be modified in any way, but only the initial state of the velocity $\\mathbf{u}$ at $t=0$. This gives us a split between observable quantities for the loss formulation, and quantities that we can interact with during the optimization (or later on via NNs).\n",
"\n",

File diff suppressed because it is too large Load Diff

418
intro-teaser.ipynb Normal file

File diff suppressed because one or more lines are too long

View File

@ -15,11 +15,12 @@ more tightly coupled learning algorithms with differentiable simulations.
height: 220px
name: pbdl-teaser
---
Some examples ... preview teaser ...
Some visual examples of hybrid solvers, i.e. numerical simulators that are enhanced by trained neural networks.
```
% Teaser, simple version:
% ![Teaser, simple version](resources/teaser.png)
## Coming up
As a _sneak preview_, in the next chapters we'll show:
@ -37,10 +38,7 @@ If you find mistakes, please also let us know! We're aware that this document is
and we're eager to improve it. Thanks in advance!
This collection of materials is a living document, and will grow and change over time.
Feel free to contribute 😀
[TUM Physics-based Simulation Group](https://ge.in.tum.de).
Feel free to contribute 😀
We also maintain a [link collection](https://github.com/thunil/Physics-Based-Deep-Learning) with recent research papers.
```{admonition} Code, executable, right here, right now
@ -52,16 +50,6 @@ immediately see what happens -- give it a try...
Oh, and it's great because it's [literate programming](https://en.wikipedia.org/wiki/Literate_programming).
```
## More Specifically
To be a bit more specific, _physics_ is a huge field, and we can't cover everything...
```{note}
For now our focus is:
- field-based simulations , less Lagrangian
- simulations, not experiments
- combination with _deep learning_ (plenty of other interesting ML techniques)
```
---

View File

@ -1,10 +1,12 @@
Model Equations
============================
overview of PDE models to be used later on ...
TODO
give an overview of PDE models to be used later on ...
continuous pde $\mathcal P^*$
$\vx \in \Omega \subseteq \mathbb{R}^d$
$\mathbf{x} \in \Omega \subseteq \mathbb{R}^d$
for the domain $\Omega$ in $d$ dimensions,
time $t \in \mathbb{R}^{+}$.
@ -47,11 +49,8 @@ and the abbreviations used inn: {doc}`notation`, at the bottom of the left panel
% \newcommand{\corr}{\mathcal{C}} % just C for now...
% \newcommand{\nnfunc}{F} % {\text{NN}}
Some notation from SoL, move with parts from overview into "appendix"?
We typically solve a discretized PDE $\mathcal{P}$ by performing discrete time steps of size $\Delta t$.
Each subsequent step can depend on any number of previous steps,
$\mathbf{u}(\mathbf{x},t+\Delta t) = \mathcal{P}(\mathbf{u}(\mathbf{x},t), \mathbf{u}(\mathbf{x},t-\Delta t),...)$,
@ -83,12 +82,13 @@ $\mathbf{u} = (u_x,u_y,u_z)^T$ for $d=3$.
Burgers' equation in 2D. It represents a well-studied advection-diffusion PDE:
$\frac{\partial u_x}{\partial{t}} + \mathbf{u} \cdot \nabla u_x =
$\begin{aligned}
\frac{\partial u_x}{\partial{t}} + \mathbf{u} \cdot \nabla u_x &=
\nu \nabla\cdot \nabla u_x + g_x(t),
\\
\frac{\partial u_y}{\partial{t}} + \mathbf{u} \cdot \nabla u_y =
\frac{\partial u_y}{\partial{t}} + \mathbf{u} \cdot \nabla u_y &=
\nu \nabla\cdot \nabla u_y + g_y(t)
$,
\end{aligned}$,
where $\nu$ and $\mathbf{g}$ denote diffusion constant and external forces, respectively.
@ -104,15 +104,15 @@ Later on, additional equations...
Navier-Stokes, in 2D:
$
\frac{\partial u_x}{\partial{t}} + \mathbf{u} \cdot \nabla u_x =
$\begin{aligned}
\frac{\partial u_x}{\partial{t}} + \mathbf{u} \cdot \nabla u_x &=
- \frac{1}{\rho}\nabla{p} + \nu \nabla\cdot \nabla u_x
\\
\frac{\partial u_y}{\partial{t}} + \mathbf{u} \cdot \nabla u_y =
\frac{\partial u_y}{\partial{t}} + \mathbf{u} \cdot \nabla u_y &=
- \frac{1}{\rho}\nabla{p} + \nu \nabla\cdot \nabla u_y
\\
\text{subject to} \quad \nabla \cdot \mathbf{u} = 0
$
\text{subject to} \quad \nabla \cdot \mathbf{u} &= 0
\end{aligned}$
@ -121,28 +121,29 @@ Navier-Stokes, in 2D with Boussinesq:
%$\frac{\partial u_x}{\partial{t}} + \mathbf{u} \cdot \nabla u_x$
%$ -\frac{1}{\rho} \nabla p $
$
\frac{\partial u_x}{\partial{t}} + \mathbf{u} \cdot \nabla u_x = - \frac{1}{\rho} \nabla p
$\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 + \eta d
\\
\text{subject to} \quad \nabla \cdot \mathbf{u} = 0,
\text{subject to} \quad \nabla \cdot \mathbf{u} &= 0,
\\
\frac{\partial d}{\partial{t}} + \mathbf{u} \cdot \nabla d = 0
$
\frac{\partial d}{\partial{t}} + \mathbf{u} \cdot \nabla d &= 0
\end{aligned}$
Navier-Stokes, in 3D:
$
\frac{\partial u_x}{\partial{t}} + \mathbf{u} \cdot \nabla u_x = - \frac{1}{\rho} \nabla p + \nu \nabla\cdot \nabla u_x
\begin{aligned}
\frac{\partial u_x}{\partial{t}} + \mathbf{u} \cdot \nabla u_x &= - \frac{1}{\rho} \nabla p + \nu \nabla\cdot \nabla u_x
\\
\frac{\partial u_y}{\partial{t}} + \mathbf{u} \cdot \nabla u_y = - \frac{1}{\rho} \nabla p + \nu \nabla\cdot \nabla u_y
\frac{\partial u_y}{\partial{t}} + \mathbf{u} \cdot \nabla u_y &= - \frac{1}{\rho} \nabla p + \nu \nabla\cdot \nabla u_y
\\
\frac{\partial u_z}{\partial{t}} + \mathbf{u} \cdot \nabla u_z = - \frac{1}{\rho} \nabla p + \nu \nabla\cdot \nabla u_z
\frac{\partial u_z}{\partial{t}} + \mathbf{u} \cdot \nabla u_z &= - \frac{1}{\rho} \nabla p + \nu \nabla\cdot \nabla u_z
\\
\text{subject to} \quad \nabla \cdot \mathbf{u} = 0.
\text{subject to} \quad \nabla \cdot \mathbf{u} &= 0.
\end{aligned}
$

View File

@ -11,6 +11,8 @@ a starting point for new researchers as well as a hands-on introduction into
state-of-the-art resarch topics.
```{figure} resources/overview-pano.jpg
---
height: 240px
@ -127,6 +129,21 @@ starting points with code examples, and illustrate pros and cons of the
different approaches. In particular, it's important to know in which scenarios
each of the different techniques is particularly useful.
## More Specifically
To be a bit more specific, _physics_ is a huge field, and we can't cover everything...
```{note}
For now our focus are:
- _field-based simulations_ (no Lagrangian methods)
- combinations with _deep learning_ (plenty of other interesting ML techniques, but not here)
- experiments as _outlook_ (replace synthetic data with real)
```
It's also worth noting that we're starting to build the methods from some very
fundamental steps. Here are some considerations for skipping ahead to the later chapters.
```{admonition} You can skip ahead if...
:class: tip
@ -138,6 +155,9 @@ A brief look at our _Notation_ won't hurt in both cases, though!
```
---
<br>
<br>
<br>
<!-- ## A brief history of PBDL in the context of Fluids
@ -154,6 +174,8 @@ PINNs ... and more ... -->
## Deep Learning and Neural Networks
TODO
Very brief intro, basic equations... approximate $f^*(x)=y$ with NN $f(x;\theta)$ ...
learn via GD, $\partial f / \partial \theta$

View File

@ -18,7 +18,7 @@
"\n",
"## Preliminaries\n",
"\n",
"Let's just load TF for..."
"Let's just load TF and phiflow for now, and initialize the random sampling."
]
},
{
@ -54,7 +54,7 @@
"from phi.tf.flow import *\n",
"import numpy as np\n",
"\n",
"#rnd = TF_BACKEND # sample different points in the domain each iteration\n",
"#rnd = TF_BACKEND # for phiflow: sample different points in the domain each iteration\n",
"rnd = math.choose_backend(1) # use same random points for all iterations"
]
},

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB