Numerical Hydrodynamics: Part 2

  • Ian Hawke

What we covered

  • Balance laws are generic;
  • lead to shocks;
  • shocks appear in mergers;
  • start from Newtonian CFD;
  • GR gives
    • increased cost;
    • increased complexity;
  • Merger problem gives
    • surface/atmosphere;
    • lots more physics.

Balance laws

All the terms: $$ \partial_t {\bf q} + \nabla \cdot {\bf f} + A \cdot \nabla {\bf q} = \nabla \left( D \cdot \nabla {\bf q} \right) + {\bf s}. $$

In mergers

  • ignore diffusive term;
  • simple models don't have $A$ term;
  • source terms often local, well-behaved.

Characteristics

For $\partial_t q + \partial_x f = 0$ get local speed $$ \partial_t q + \color{red}{\partial_q f} \partial_x q = 0. $$

For system $\partial_t {\bf q} + A \partial_x {\bf q} = 0$ diagonalize to get $$ {\bf w} = L {\bf q}, \quad \partial_t {\bf w} + \Lambda \partial_x {\bf w} = 0. $$ Extend to nonlinear case with care.

Wave types

  • Rarefaction:
    • nonlinear
    • continuous;
  • Shocks:
    • nonlinear
    • discontinuous;
  • Contacts:
    • linear
    • discontinuous.
  • Compound waves:
    • nonlinear, a mess;
    • MHD, phase transitions.

    Martí & Müller, Liv. Rev.

Questions...

  • Stretch out;
  • have a break;
  • add questions to the chat.

Weih et al, 1912.09340.

Grids and approximations

  • Finite differences:
    store point values $q_i$.
  • Finite volumes:
    store cell averages $\hat{q}_i$.
  • Finite elements (DG):
    store modal coefficients $q^{(m)}_i$.

Fluxes and telescoping

Integrate over cell $i \to \hat{q}_i$: $$ \frac{\text{d}}{\text{d} t} \hat{q}_i + \frac{1}{|V_i|} \oint_{\partial V_i} f(q) = 0. $$ Restrict to one dimension: $$ \frac{\text{d}}{\text{d} t} \hat{q}_i = \frac{1}{\Delta x} \left[ f_{i-1/2} - f_{i+1/2} \right]. $$ Gives discrete conservation.

Computing the intercell flux

Godunov:

  • $q(x) = \hat{q}$ in cell $i$;
  • $$ f_{i+1/2} = F(\hat{q}_i, \hat{q}_{i+1}); $$
  • $$ \partial_q f > 0 \implies f_{i+1/2} = f(\hat{q}_i); $$
  • Systems: use characteristic variables;
  • Nonlinear: solve Riemann Problem, usually approximately!

Approximate Riemann Solvers

HLLE: to find $$ f_{i+1/2} = F(\hat{q}_i, \hat{q}_{i+1}) = F(q_L, q_R): $$

  • assume fastest speeds are $\xi_{\pm}$;
  • impose conservation;
  • $$ q_* = \frac{\xi_{+} q_R - \xi_{-} q_L - f(q_R) + f(q_R)}{\xi_{+} - \xi_{-}}; $$
  • get flux from appropriate state.

Questions...

  • Stretch out;
  • take a chance to refocus;
  • ensure you're ready for more detail;
  • add questions to the chat.

Bernuzzi, 2004.06419.

Dimensions, costs, and accuracy

Godunov isn't good enough:

  • Error $\propto (\Delta x)^1$.
  • Computational cost $\propto (\Delta x)^{-4}$.
  • Extrema are clipped.
  • GWs need better phase accuracy.
  • Need higher order methods. But...
  • ...leads to problems with shocks.

Reconstruct-Evolve-Average

Rethink Godunov as three steps:

  1. Reconstruct: $$\hat{q} \to q(x);$$
  2. Evolve: $$q(x);$$
  3. Average: $$q(x) \to \hat{q}.$$

Reconstruction loses accuracy.

Monotonicity, Gibbs oscillations, and Godunov's theorem

Fourier Series:
discontinuities $\implies$ oscillations.

  • Don't converge with $\Delta x$;
  • Don't converge with more modes;
  • Don't go away with different function basis.

Monotonicity: scheme doesn't introduce oscillations.

Godunov's theorem: linear monotonic schemes are first order accurate.

Slope limiting

Assume $q(x) = \hat{q}_i + \tfrac{x - x_i}{2} \sigma$.

Slope $\sigma$ could be

  • Upwind: $\sigma_{\text{u}} = \hat{q}_{i+1} - \hat{q}_i$;
  • Downwind: $\sigma_{\text{d}} = \hat{q}_{i} - \hat{q}_{i-1}$;
  • Centered: $\sigma_{\text{c}} = \tfrac{1}{2} ( \hat{q}_{i+1} - \hat{q}_{i-1})$.

All would give oscillations. Limit slope: $$ \bar{\sigma} \equiv \bar{\sigma}(\sigma_{\text{u}}, \sigma_{\text{d}}) \overset{\text{(eg)}}{=} \begin{cases} 0 & \text{if } \sigma_{\text{u}} \cdot \sigma_{\text{d}} \le 0 \\ \sigma_{\text{u}} & \text{if } | \sigma_{\text{u}} | < | \sigma_{\text{d}} | \\ \sigma_{\text{d}} & \text{if } | \sigma_{\text{u}} | > | \sigma_{\text{d}} | \end{cases}. $$

Finite difference methods

In $N$-d, finite volume needs a surface integral: expensive.

Instead, write a finite difference method as $$ \frac{\text{d}}{\text{d} t} q_i = \frac{1}{\Delta x} \left[ f_{i-1/2} - f_{i+1/2} \right]. $$ Now $f_{i \pm 1/2}$ not intercell fluxes. Directly reconstruct flux.

For stability must split flux: $$ f = f^{(+)} + f^{(-)}, \quad f^{(\pm)} = \tfrac{1}{2} \left( f \pm \max | \lambda | q \right). $$

Questions...

  • One topic left, so
  • deep breath;
  • stretch out;
  • drink something;
  • screen break;
  • add questions to the chat.

Ciolfi, 2001.10241.

MHD

Constraint ${\cal C} = \nabla \cdot {\bf B} = 0$ needed.

Either

  • Modify equations of motion so $$ \partial_t {\cal C} \sim -\alpha {\cal C} \quad \implies \quad {\cal C} \sim e^{-\alpha t}; $$
  • Find discrete scheme so, when $\nabla \to D$, $$ D \cdot {\bf B} = 0. $$

Vector Potentials

Use vector potential ${\bf A}$, so ${\bf B} = \nabla \times {\bf A}$.

  • Automatically preserves constraint.
  • EM gauge freedom. Prefer Lorenz gauge, $$ \begin{aligned} \partial_t {\bf A} + \nabla \Phi & \sim {\bf E}, \\ \partial_t \Phi + \nabla \cdot {\bf A} &\sim 0. \end{aligned} $$
  • Grid structure is conceptually more complex.

Summary

We have discussed

  • the three key approaches,
    • finite volumes;
    • finite differences;
    • finite elements,
  • discrete flux conservation;
  • reconstruction, monotonicity and Gibbs oscillations;
  • MHD and constraints.

Next lecture: some aspects of the future.

Alford et al, 1707.09475.