added HIG code intro
This commit is contained in:
parent
dd03765dc4
commit
3d3022a429
@ -152,3 +152,20 @@ The third graph on the right side of figure {numref}`hig-toy-example-bad` shows
|
||||
Note that for all examples so far, we've improved upon the _differentiable physics_ (DP) training from the previous chapters. I.e., we've focused on combinations of neural networks and PDE solving operators. The latter need to be differentiable for training with regular SGD, as well as for HIG-based training. For the physical gradients, we even need them to provide an inverse solver. Thus, the HIGs described above share more similarities with, e.g., {doc}`diffphys-code-sol` and {doc}`diffphys-code-control`, than with {doc}`physgrad-code`.
|
||||
|
||||
This is a good time to give a specific code example of how to train physical NNs with HIGs: we'll look at a classic case, a system of coupled oscillators.
|
||||
|
||||
|
||||
## xxx TODO , merge into code later on xxx
|
||||
|
||||
As example problem for the Half-Inverse Gradients (HIGs) we'll consider controlling a system of coupled oscillators. This is a classical problem in physics, and a good case to evaluate the HIGs due to it's smaller size. We're using two mass points, and thus we'll only have four degrees of freedom for position and velocity of both points (compared to, e.g., the $32\times32\times2$ unknowns we'd get even for "only" a small fluid simulation with 32 cells along x and y). Nonetheless, the oscillators are a highly-non trivial case: we aim for applying a control such that the initial state is reached again after a chosen time interval. Here we'll 96 steps of a fourth-order Runge-Kutta scheme, and hence the NN has to learn how to best "nudge" the two mass points over the course of all time steps, so that they end up at the desired position with the right velocity at the right time.
|
||||
|
||||
A system of $N$ coupled oscillators is described by ...hamiltonian, TODO, replace by PDE ...
|
||||
|
||||
$$
|
||||
\mathcal{H}(x_i,p_i,t)=\sum_i \bigg( \frac{x_i^2}{2}+ \frac{p_i^2}{2} + \alpha \cdot (x_i-x_{i+1})^4+u(t) \cdot x_i \cdot c_i\bigg),
|
||||
$$
|
||||
|
||||
... which provides the basis for the RK4 time integration.
|
||||
|
||||
continue with notebook text ...
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user