Magnetohydrodynamics

Aether.MHD.MHDStateType
struct MHDState{A5, A4}
MHDState(mesh, eos, stepper)
MHDState(mesh, eos)

Device arrays of one constrained-transport MHD state on every MeshBlock of mesh — the HydroState arrays plus the staggered magnetic machinery. The face-centered field b0 is the primary magnetic representation and gets the same two-register treatment as u0; bcc is its cell-centered average, derived after every update — it feeds reconstruction, the Riemann solvers, and the timestep. The flux arrays carry nvariables(eos) + 3 slots: the fluid fluxes followed by the induction fluxes F(B1), F(B2), F(B3), whose tangential entries are the face-averaged electric fields the corner assembly consumes ($E_{t2} = -F(B_{t1})$, $E_{t1} = +F(B_{t2})$). Corner EMFs live on emf edges; their curl updates b0, preserving $\nabla \cdot B = 0$ to round-off by construction.

  • u0::Any: conserved fluid variables (ρ, ρv1, ρv2, ρv3, E); E includes the magnetic energy

  • u1::Any: second conserved register for the SSP-RK stage combinations

  • w0::Any: primitive fluid variables (ρ, v1, v2, v3, e); reconstruction reads this

  • F1::Any: x1 face fluxes: nvariables(eos) fluid slots, then the three induction fluxes

  • F2::Any: x2 face fluxes

  • F3::Any: x3 face fluxes

  • b0::FaceField: face-centered magnetic field, the primary representation

  • b1::FaceField: second face-field register for the SSP-RK stage combinations

  • bcc::Any: cell-centered magnetic field, the face average of b0 (3 components)

  • emf::EdgeField: edge-centered electric fields, assembled from the stored fluxes each stage

using Aether

mesh = Mesh(CPU(); size = (8, 8, 8), extent = (1, 1, 1), cells_per_block = (4, 8, 8))
eos = IdealMHD(5/3, 1e-12, 1e-10)
MHDState(mesh, eos)

# output
MHDState{Float64}(8 × 12 × 12 cells, 5 + 3 variables, 2 blocks)
source
Aether.MHD.RiemannSolvers.HLLDType
struct HLLD <: Aether.Hydro.RiemannSolvers.RiemannSolver
HLLD()

The HLLD solver — the HLL fan with the rotational (Alfvén) discontinuities restored: five waves including the contact for ideal MHD (Miyoshi & Kusano 2005), four waves for isothermal MHD, whose fan has no contact (Mignone 2007). Resolves isolated rotational and tangential discontinuities (and, in the ideal system, contacts) exactly — the production solver for MHD.

source
Aether.MHD.RiemannSolvers.LHLLDType
struct LHLLD <: Aether.Hydro.RiemannSolvers.RiemannSolver
LHLLD()

The low-dissipation HLLD solver (Minoshima & Miyoshi 2021): HLLD with a carbuncle-cure factor θ on the contact-wave pressure jump and a Mach-number-scaled low-dissipation factor φ on the star pressure. More robust against the numerical shock instability that afflicts bare HLLD at strong grid-aligned shocks, and less dissipative for nearly incompressible flow, at negligible extra cost. Reduces to HLLD when θ = φ = 1 (ordinary or supersonic shocks). Multidimensional runs require nghost ≥ 2; one-dimensional runs need only the reconstruction's ghost width.

source
Aether.MHD.fast_magnetosonic_speedFunction
fast_magnetosonic_speed(
    eos::Union{IdealMHD, IdealMHDS},
    ρ,
    p,
    Bn,
    Bt1,
    Bt2
) -> Any

Fast magnetosonic speed along the Bn direction at gas density ρ and gas pressure p,

$c_f^2 = \frac{1}{2\rho}\left(\gamma p + |B|^2 + \sqrt{(\gamma p + |B|^2)^2 - 4 \gamma p B_n^2}\right)$

evaluated in a numerically stable grouping: the discriminant is computed as $(B_n^2 + B_t^2 - \gamma p)^2 + 4 \gamma p B_t^2 \ge 0$, so the square root never sees cancellation.

using Aether

eos = IdealMHD(2.0, 1e-12, 1e-10)
fast_magnetosonic_speed(eos, 1.0, 0.5, 0.0, 0.0, 0.0)

# output
1.0
source
fast_magnetosonic_speed(
    eos::IsothermalMHD,
    ρ,
    Bn,
    Bt1,
    Bt2
) -> Any

Isothermal fast magnetosonic speed along the Bn direction — the ideal expression with $\gamma p$ replaced by $\rho c_s^2$, the sound speed a constant of the EOS.

source
Aether.MHD.maximum_magnetic_divergenceFunction
maximum_magnetic_divergence(
    architecture::Aether.Architectures.AbstractArchitecture,
    state::MHDState,
    mesh::Mesh
) -> Any

Maximum over all interior cells of $|\nabla \cdot B|$ from the face-centered field — Gauss's law $(\Sigma A B)/V$ over the six faces, the constrained-transport invariant; round-off-sized for any evolution of a divergence-free initial condition, in any coordinate system. The areas are the very ones update_magnetic_fields! divides its circulations by, which is why the invariant holds. Synchronous.

source