Skip to content

Isothermal and barotropic MHD ​

IDGroupMilestoneBackendsFigureRegression
EO (em1 to em10)Ideal MHDM13 (#100), P5a (CPU), P5b (FNL)CPU, FNLyesiso-mhd-tube2, baro-mhd-glm-hlld

Case and scope ​

The isothermal and barotropic gases gain a magnetic field. The result is ideal MHD without an energy equation, the total pressure P(ρ)+|B|2/2, with the energy slot inert as for the Euler gases (D-M13-1). Two literature pieces carry it (numerics, input):

  • the six-wave eigensystem of Kim et al. (1999), with a2=dP/dρ, for the characteristic projection;
  • the isothermal HLLD of Mignone (2007), on any P(ρ).

eos/mhd_oracle.py selftest checks both papers before any run. It checks LR=I and RΛL=∂F/∂U at random and degenerate states, and the HLLD's consistency, its exactness on a rotational discontinuity, its hydrodynamic limit and the positivity of its star states. The self-test found eq. 39 of Mignone misprinted (SR a minimum) and his speeds out of order on his own tube 1.

What the legs catch:

  • a wrong eigenvector: a linear wave of one family excites the others; its error stops converging at O(amplitude) instead of at fifth order (em1, em2);
  • the sound speed taken as P/ρ: the barotropic waves on ρ0=5, where dP/dρ=2.0198 and P/ρ=1.4427, would lag after one period by 12 % of a wavelength (fast) and 4 % (slow), an O(1) error (em1);
  • a wrong HLLD: the Alfvén waves of the circularly polarised wave (em3), Mignone's tubes and their convergence (em4), the rotational discontinuities that HLL smears (em6);
  • an axis-dependent frame: tube 2 along x, y and z (em5);
  • the barotropic path drifting from the isothermal one: a one-segment table with exponent 1 is the isothermal gas (em7);
  • the energy slot written: every leg checks rE exactly 0, gravity included (em10);
  • an input that would silently run wrong: EGLM, the floors, the gamma-law initial conditions (em8);
  • a backend that disagrees: one case per model, scheme and solver on CPU and FNL (em9).

Models and numerics ​

ItemChoiceCode
Modelsmhd-ideal with [eos] type = isothermal or barotropic: MODEL_MHD_ISO, MODEL_MHD_BARO, and with divergence_control = glm MODEL_MHD_GLM_ISO, MODEL_MHD_GLM_BAROadam_flume_physics_object.F90
Libraryone body behind the EOS hooks of the isothermal and barotropic modulesadam_flume_mhd_iso_library_body.INC, adam_flume_mhd_{iso,baro}_library.F90
Kernelsthe model-agnostic MHD kernel bodies on these libraries (16 CPU and 16 FNL modules; the barotropic table read from the device registry on FNL)adam_flume_{cpu,fnl}_mhd[_glm]_{iso,baro}[_{llf,hll,hlld}]_kernels.F90
Space, timeWENO5, characteristic flux splitting (weno) or weno-riemann with HLLD and the 6th-order correction; SSP-RK(3,3), CFL 0.5—

Initial and boundary conditions ​

The barotropic cases use POLY of eos_oracle.py (c0=1, breaks ρ=2,8, exponents 1,1.4,5/3). The tubes are Mignone's Table 1 (a=1, B=H/4π) on [0,1], the discontinuity at 0.5, extrapolated ends.

LegSetup
em1one wavelength of a fast, Alfvén or slow wave on the periodic box (the background of Stone et al. 2008, B=(1,2,1/2), at rest), amplitude 10−7, one period: isothermal (cf=2, ca=1, cs=1/2) along x (16, 32 cells) and inclined at tan⁡α=2 (32², 64²); barotropic on ρ0=5 along x; the fast wave with GLM (ch=1.1cf)
em2the em1 isothermal waves along x on weno-riemann HLLD
em3the circularly polarised Alfvén wave (Tóth 2000, B⊥=0.1), isothermal, inclined, right and left polarisation, 32² and 64², CFL 0.1
em4tubes 1–3 on weno-riemann HLLD, 200, 400, 800 and 3200 cells (one transverse cell per block); tube 3 at 400 cells with positivity_limiter = cell
em5tube 2 along x, y and z (the states permuted cyclically), 200 cells, weno and weno-riemann
em6tube 2 at 400 cells, HLLD and HLL, against the 3200-cell HLLD run
em7tube 2 with c0=1.3: the isothermal gas against the barotropic one-segment table of exponent 1
em8eglm; p_floor = 1e-6; orszag-tang; the entropy wave
em9the last checkpoints of CPU and FNL: em1-iso-2d-fast-64, em1-baro-1d-slow-32, em1-iso-glm-1d-fast-32, em2-iso-hlld-1d-alfven-32, em3-cpaw-right-64, em4-tube2-400, em5-weno-y, em7-baro, em10-barotropic (not the limited tube 3: the limiter is not bitwise across backends)
em10the em1 box with amplitude 0 under gx=0.5, 48 cells, GLM (ch=4), SSP(5,4), t=0.4: isothermal ρ0=1, barotropic ρ0=5

Input files ​

FileRole
src/tests/flume/verification/eos/make_eos_mhd.pywrites the cases: tube (from the Sod inputs), wave (from mhd/linear-wave/make_linear_wave.py, the period from the speed of the gas), cpaw (from mhd/cpaw/make_cpaw.py)
src/tests/flume/verification/eos/mhd.shruns the legs (--legs em1,...,em10, default all but em9, which compares the two backends' runs; FLUME_EXE, EM_NP ranks)
eos/mhd_oracle.py (selftest, rotation, selfconv, agree, hlld-gain, backends), mhd/linear-wave/linear_wave_oracle.py, mhd/cpaw/cpaw_oracle.py, eos/eos_oracle.py (freefall)the checks
src/tests/flume/regression/iso-mhd-tube2/input.ini, baro-mhd-glm-hlld/input.inithe frozen tube 2 (isothermal, weno) and a barotropic GLM HLLD tube
make_doc_runs.sh <runs> eosmhd, make_doc_figures.py --only barotropic-mhdthe figure
bash
cd src/tests/flume/verification/eos && ../../../../../exe/.regression-venv/bin/python mhd_oracle.py selftest
./mhd.sh                                                                                   # CPU
FLUME_EXE=$PWD/../../../../../exe/adam_flume_fnl ./mhd.sh                                   # FNL
./mhd.sh --legs em9                                                                        # CPU against FNL

Results ​

Isothermal and barotropic MHD: linear-wave convergence and Mignone's tubes 1-3

Top left: the linear waves along x on 16, 32 and 64 cells, the error after one period over the amplitude, isothermal and barotropic, the three families; the legend gives the order of the 32/64 pair, 4.97 to 5.05 (slope 5 dotted). Top right: tube 1, ρ at 400 cells against the 3200-cell run. Bottom left: tube 2, By at 400 cells with HLLD and with HLL against the reference: the rotational discontinuities. Bottom right: tube 3, the two Mach-5 streams with Bn=0.

LegAssertedBoundCPUFNL
—mhd_oracle.py selftest: Kim's eigensystem, the embedding, the speeds, the HLLD (consistency, rotational discontinuity, hydro limit, positivity), the CPAWround-off13 checks pass—
em1the order of the finest pair: isothermal fast, Alfvén, slow along x; inclined; barotropic; GLM fast≥4.74.96, 4.96, 4.96; 4.97, 4.97, 5.00; 4.97, 4.96, 4.96; 4.96the same to the printed digits
em2the same on weno-riemann HLLD: fast, Alfvén, slow≥4.74.96, 4.96, 4.964.96, 4.96, 4.96
em3the CPAW order, right and left; right against left≥4.7; 04.89, 4.89; 04.89, 4.89; 0
em4the ladder order of the L1 distance of ρ to 3200 cells, tubes 1, 2, 3; ρ>0, rE≥0.5; 01.15, 1.03, 0.66 (pairs 1.09 and 1.22, 1.03 and 1.03, 0.17 and 1.15); positive, 0the same
em4tube 3 with the limiter: ρ>0, rE; the L1 distance (reported)0positive, 0; 9.0⋅10−3 (unlimited 5.4⋅10−4)positive, 0; 9.0⋅10−3
em5tube 2 along x, y, z, weno and weno-riemann00, 00, 0
em6the L1 distance of By to 3200 cells, HLLD against HLLHLLD < HLL2.35⋅10−3 against 2.79⋅10−3 (0.84)the same
em7the one-segment table against the isothermal gas10−1006.2⋅10−13
em8the 4 invalid inputsrefusedrefusedrefused
em9CPU against FNL, the 9 cases: the largest gap over the fields10−10(the same comparison)2.9⋅10−13 (tube 2 along y, weno); the waves and the CPAW ≤1.7⋅10−14; rE 0
em10ρ uniform, ρu−ρgt relative, rE: isothermal, barotropic (SSP(5,4), since #104)10−12; 00, 1.1⋅10−14, 0; 0, 7.0⋅10−15, 00, 1.1⋅10−16, 0; 0, 2.2⋅10−15, 0

Related cases: the linear waves and the HLLD verification of the ideal gas.

Findings ​

  • The literature, checked before the code. Kim et al. normalise the fast pair with αf=cf2−bn2/cf2−cs2, which is the Ryu–Jones αf times cf/a. The printed set passes LR=I and RΛL=∂F/∂U at random and degenerate states, both gases. In Mignone's section 3, eq. 39 prints SR as a minimum: it must be the maximum, since it bounds both states' fast speeds. On his own tube 1 (ρL/ρR=10) the first face has SR∗=3.90>SR=3.37, a star region of negative width that the paper does not discuss, because u∗=Fρhll/ρhll is driven far off by a strong density jump. There FLUME's HLLD returns HLL's flux, as the adiabatic HLLD does.
  • The sound speed is dP/dρ, and only there. The Jacobian holds the gas law only through a2=dP/dρ, so one eigensystem serves both gases. On ρ0=5 the barotropic waves converge at fifth order with c2=2.0198; with P/ρ the fast and slow waves would lag by 12 % and 4 % of a wavelength per period.
  • HLLD's gain over HLL is modest at this resolution. On tube 2, 400 cells, its By is 16 % closer to the reference than HLL's (the leg asserts only that it is closer).
  • A collision with Bn=0 keeps its start-up error. With no normal field, isothermal MHD has a zero-speed tangential mode: a density jump at rest, balanced by the magnetic pressure. Where the two streams of tube 3 meet, the start-up error of the collision falls into that mode and stays, the MHD analogue of Noh's wall heating (an isothermal hydrodynamic contact cannot carry a density jump, so there the error leaves as sound). At 400 cells the centre reaches ρ=2.68 with weno (flux splitting) against a plateau of 0.40, two cells wide; weno-riemann HLLD keeps it at 0.405. The positivity limiter does act there on weno-riemann (the limited and unlimited runs differ; the likely trigger is its kinetic chord, which bounds a limited cell's speed by about 2|ub|+c of the first-order backbone, not measured cell by cell), and it raises the centre to 1.42 (L1 distance 9.0⋅10−3, unlimited 5.4⋅10−4). The same limiter on the isothermal hydrodynamic Mach-5 collision lowers the L1 error (from 1.99⋅10−2 to 1.43⋅10−2, weno-riemann HLLC), and on weno it never acts. For magnetised collisions with Bn≈0, prefer weno-riemann HLLD, and enable the limiter only where positivity is at risk.
  • The backends agree to round-off, the one-segment table only to 10−12 on FNL. On the CPU the one-segment table of exponent 1 and the isothermal gas give the same bits; on FNL they differ by 6.2⋅10−13. The table path evaluates KρΓ through a power and the isothermal path c02ρ directly, and the device rounds the two differently. Across backends the same input agrees to 2.9⋅10−13 at most (em9).
  • The tube-3 criterion was changed after its first run. Tube 3 has shocks only, so its L1 distance is set by where each shock falls within its cell: the pair orders are 0.17 and 1.15. em4 asserts the order over the whole ladder (0.66) and prints the pairs.
  • One transverse cell per block. The Sod inputs the tubes are built from carry four cells per block along each null axis: 16 copies of the same 1-D solution. make_eos_mhd.py sets one, bitwise the same profile (tube 2 at 400 cells, checked), and the 3200-cell references take minutes instead of hours.
  • The free fall found a defect of the library's SSP(5,4), now fixed. Its former weights, printed with 14 digits, summed to 1−8.8⋅10−11, so the free fall on SSP(5,4) gave ρu−ρgt of 3.5⋅10−11 after t=0.4; em10 ran on SSP(3,3) until the tableau was rebuilt from its Shu–Osher form (#104, time integration). On SSP(5,4) em10 now gives 1.1⋅10−14 and 7.0⋅10−15, and runs there as the solver-level regression of that fix.