Speedup and linearization on variational propagators
Solves the following issue(s):
Closes #330 (closed)
Core changes:
Few updates for the variational propagators (mostly for performance reasons).
- Now the linear solve in the newton iteration is preconditioned using a full solve of the mass matrix. (The system writes M + \Delta t ^2 A and we use a CG solve of M as preconditioner.)
- Use a linear approximation to instantiate newton solver (we approximate u^{n+1} \approx 2 u^n - u^{n-1}).
- Force at least one Newton iteration if the dissipative propagator to reduce the energy error caused by entropy change being too small.
Those changes results in a roughly 3 time speedup in the propagators (mostly because the number of iteration is greatly reduced).
Model-specific changes:
Add a linearize
flag to the variational propagator. When set to true it remove the initial forces caused by the fact that our equilibrium are approximate. This can be interpreted as modifying the MHD lagrangian to
l = \int \rho \frac{|u|^2}{2} - e(\rho,s) + \frac{\partial \rho e}{\partial \rho}|_{\rho_0, s_0} (\rho-\rho_0) + \frac{\partial \rho e}{\partial s}|_{\rho_0, s_0} (s-s_0) + e(\rho_0,s_0) + \frac{|B-B_0|^2}{2},
so that (\rho_0, s_0, B_0) is now a 0 energy equilibrium.
Add the possibility to have a linear dissipation (to stabilize more) \partial_t u + \alpha u=0.
Add the L^2 norm of \nabla \cdot B to the scalar quantities of ViscoresistiveMHD
Documentation changes:
None
Other
Formated struphy/models/fluid.py