Test problems

Docstrings from src/problems/.

Exported

sod_shock_tube

Source: src/problems/hydro.jl:3

sod_shock_tube(; n = 256, gamma = 1.4, kwargs...) -> (sim, tmax)

The Sod (1978) shock tube in 1D: (rho, p) = (1, 1) for x < 0.5 and (0.125, 0.1) for x > 0.5, at rest, with outflow boundaries. Compare the result at tmax = 0.2 against sod_exact.

radiation_streaming

Source: src/problems/radiation.jl:6

radiation_streaming(; n = 128, chat_over_c = 1.0, closure = LevermoreClosure(),
                    beta_order = 0, kwargs...) -> (sim, tmax)

Free-streaming limit: radiation injected at the left boundary of a transparent (kappa = 0), static medium. The front must advance at exactly chat while keeping the reduced flux at the causal limit, which is where the M1 closure differs from flux-limited diffusion.

At tmax = 0.5 the front sits at x = 0.5 chat.

radhydro_shock_exact

Source: src/problems/exact.jl:7

radhydro_shock_exact() -> (x, rho, v, Tmat, Trad)

Semi-analytic solution of the Mach 3 radiative shock of Lowrie & Edwards (2008), in the dimensionless units of radhydro_shock.

Columns are position, density, velocity, matter temperature and radiation temperature, all as Vector{Float64} sorted by x. The table is a subsample of the one shipped with Quokka, generated by extern/LowrieEdwards/radshock.py, kept at full resolution across the Zel’dovich spike.

The solution is derived under the Eddington (P1) approximation, which is why radhydro_shock runs with EddingtonClosure.

The table is parsed once and cached; a convergence study scoring a dozen runs against it should not re-read 60 kB of text a dozen times. The returned arrays are shared, so do not mutate them.

brio_wu

Source: src/problems/mhd.jl:17

brio_wu(; n = 256, gamma = 2, kwargs...) -> (sim, tmax)

The MHD shock tube of Brio & Wu (1988) in 1D: (rho, p, b_y) = (1, 1, 1) for x < 0.5 and (0.125, 0.1, -1) for x > 0.5, at rest, with b_x = 0.75 and gamma = 2, to tmax = 0.1. The solution has a fast rarefaction, a slow compound wave, a contact, a slow shock and a fast rarefaction. Quokka’s MHDBrioWuShockTube, with outflow boundaries (Quokka holds the initial states), which make no difference until a fast wave reaches one.

smooth_advection

Source: src/problems/hydro.jl:19

smooth_advection(; n = 64, amplitude = 0.5, velocity = 1.0, gamma = 5/3, kwargs...)
    -> (sim, tmax)

A smooth density perturbation rho = 1 + A sin(2πx) advected at constant velocity and pressure through a periodic box. After tmax = 1/velocity the solution equals the initial condition exactly, which makes this the convergence test of the code: the L1 error should fall like dx^p with p set by the reconstruction.

stromgren_iliev

Source: src/problems/stromgren.jl:31

stromgren_iliev(; test = 1, n = 32, centered = false, chat_factor = 1e-3,
                solver = RosenbrockChem(), kwargs...) -> (sim, tmax)

Test 1 or 2 of the Stromgren-sphere comparison of Iliev et al. (2006): an ionizing point source switched on in a uniform, static, hydrogen-only medium, run with the network HydrogenIliev1 or HydrogenIliev2 and the photon band of Photochemistry. n is the number of cells along each side of the box; chat_factor is chat / c; solver is the chemistry integrator; the other keywords go to Simulation. tmax is 500 Myr, the end of the paper’s runs.

From the paper: the box side L = 6.6 kpc, the hydrogen density n_H = 1e-3 cm^-3, the photon rate Ndot = 5e48 s^-1, the source in the corner of the box with reflecting walls on the three low faces (the octant [0, L]^3 of a sphere about the source), and the two tests below. Test 1 is monochromatic at 13.6 eV, with the gas held at 1e4 K, the recombination coefficient alpha_B = 2.59e-13 cm^3 s^-1 and an initial ionization fraction 1.2e-3. Test 2 starts neutral and cold (100 K), and lets the gas heat and cool. The paper’s source in Test 2 is a 1e5 K blackbody.

Choices that the paper does not make, and that are ours:

  • One band for Test 2. The blackbody is replaced by a single band with sigma = 1.63e-18 cm^2 and photon_energy = 29.65 eV. These are the project’s values for the 1e5 K blackbody, the number-weighted mean energy of the ionizing photons and their photon-number-averaged cross-section, and not numbers the paper prescribes (a cross-section ~ nu^-3 gives 29.6 eV and 1.5e-18 cm^2). Each ionization heats the gas by 29.65 - 13.6 eV, Quokka’s default. That overheats the gas compared with the real spectrum, whose energy-weighted value is about 6.3 eV, so the Test 2 temperature behind the front is too high; and the paper prescribes no rates (each code used its own), so the result is checked for its shape and not against data. The network has the case B alpha_B(T), collisional ionization, and recombination, free-free and Lyman alpha cooling (networks/hydrogen_iliev2).
  • Test 1 in the network. isothermal = 1e4, no heating, a constant alpha_B, and no collisional ionization, which keeps the background ionization at 1.2e-3 instead of letting 1e4 K gas ionize itself (networks/hydrogen_iliev1).
  • The photon rate of the octant. With centered = false (the default) the box is the paper’s octant [0, L]^3, with Reflecting walls on the low faces and Outflow on the high ones. Emitting Ndot / 8 into it, so that the full sphere would receive Ndot, is our choice (it is also Quokka’s). centered = true is the whole sphere in [-L, L]^3, Outflow everywhere, and Ndot emitted, at eight times the cells for the same cell size.
  • The source. A Gaussian at the origin of width 1.5 dx, cut at 2.5 widths, whose rate is normalised so that the cells receive exactly Ndot / 8 (or Ndot) photons per second. The width and the cut are Quokka’s (testStromgrenSphere.cpp), not the paper’s.
  • The radiation. One group, zero opacity, beta_order = 0 and a constant reduced speed of light, as a chemistry run requires. The initial radiation energy is zero: the default a_r T^4 would put about 1e12 ionizing photons per cm^3 in the box.

The front is measured by ionized_radius and compared with stromgren_radius_analytic (chat = c) or stromgren_radius_finite_c (a reduced speed of light, an approximate reference). At n = 16 and chat_factor = 3e-4 the Test 1 radius is within 3% of the finite-chat reference from 0.5 to 2 recombination times, and the difference grows as chat_factor falls (test/test_stromgren.jl has the numbers and the causes not yet examined).

sim, tmax = stromgren_iliev(test = 1, n = 32, chat_factor = 3e-4)
run!(sim; tmax = 0.5 / (2.59e-13 * 1e-3))
r = ionized_radius(sim; x0 = 1.2e-3)

ryu_jones_2a

Source: src/problems/mhd.jl:33

ryu_jones_2a(; n = 256, gamma = 5/3, kwargs...) -> (sim, tmax)

The shock tube of Ryu & Jones (1995), their Fig. 2a, in 1D, to tmax = 0.2: all seven waves, with (rho, p, v, b_y) = (1.08, 0.95, (1.2, 0.01, 0.5), 3.6/sqrt(4 pi)) on the left, (1, 1, 0, 4/sqrt(4 pi)) on the right, and b_x = b_z = 2/sqrt(4 pi). Quokka’s MHDRyuJones2aShockTube, with outflow boundaries.

kelvin_helmholtz

Source: src/problems/hydro.jl:39

kelvin_helmholtz(; n = 256, gamma = 1.4, kwargs...) -> (sim, tmax)

The Kelvin-Helmholtz instability in a doubly periodic 2D box, in the smoothly seeded form of Springel (2010): a dense slab rho = 2 moving at vx = +1/2 between two rho = 1 layers moving at vx = -1/2, perturbed by a single transverse mode localised on the two shear layers.

radiation_diffusion

Source: src/problems/radiation.jl:39

radiation_diffusion(; n = 128, kappa = 300.0, sigma0 = 0.05,
                    closure = LevermoreClosure(), beta_order = 0, kwargs...)
    -> (sim, tmax)

Static-diffusion limit: a Gaussian pulse of radiation energy in a periodic, purely scattering medium (kappa_P = kappa_E = 0, kappa_F = kappa), with the matter held fixed.

The M1 system reduces to ∂E/∂t = D ∂²E/∂x² with D = c/(3 rho kappa), so the pulse stays Gaussian with sigma² = sigma0² + 2 D t and its peak falls as sigma0/sigma. This is the test of the scheme’s asymptotic-preserving property: the answer must not depend on how many mean free paths a cell spans.

Note that a reduced speed of light rescales D by chat/c, so this problem is set up with chat = c.

orszag_tang

Source: src/problems/mhd.jl:49

orszag_tang(; n = 128, gamma = 5/3, kwargs...) -> (sim, tmax)

The Orszag-Tang vortex in a doubly periodic unit square: rho = 25/(36 pi), p = 5/(12 pi), v = (-sin 2 pi y, sin 2 pi x), b = (-sin 2 pi y, sin 4 pi x)/sqrt(4 pi), to tmax = 0.5, where the shocks have interacted into the usual pattern. Quokka’s OrszagTang is the same vortex shifted by half the box. Each field component varies only across its own direction, so the faces set from it are exactly divergence-free.

interpolate_to

Source: src/problems/exact.jl:50

interpolate_to(xq, x, y) -> Vector

Linear interpolation of the samples (x, y), which must be sorted by x, onto the query points xq. Values outside the range of x are clamped to the end points.

sedov_blast

Source: src/problems/hydro.jl:62

sedov_blast(; n = 64, energy = 1.0, gamma = 5/3, kwargs...) -> (sim, tmax)

A Sedov-Taylor point explosion in 3D: energy deposited as thermal energy in a small sphere at the centre of a unit-density, cold, unit box with outflow boundaries. The blast radius should follow R(t) = ξ (E t² / rho)^(1/5) with ξ ≈ 1.15 for gamma = 5/3.

alfven_wave

Source: src/problems/mhd.jl:70

alfven_wave(; n = 32, amplitude = 0.1, kwargs...) -> (sim, tmax)

The circularly polarised Alfven wave of Toth (2000), an exact nonlinear solution, travelling obliquely across a 2D periodic box [0, 2] x [0, 1] of (2n, n) cells, to tmax = one period. The wave vector k = 2 pi (1/2, 1) puts one wavelength lambda = 2/sqrt(5) across each side, at atan 2 = 63.4 degrees to x. Along k: rho = 1, p = 0.1, b_par = 1, v_par = 0, and across it b_perp = A (sin phi, cos phi) and v_perp = -b_perp, with phi = k . x and A = amplitude, so the wave moves at v_A = 1 along k and the period is lambda. The uniform b_par is set from the keys and the rotating part from a vector potential, so div b starts at round-off. After one period the solution equals the initial condition, which makes this the convergence test of the MHD scheme (Gardiner & Stone 2005, Sec. 5.1).

diffusion_exact

Source: src/problems/radiation.jl:71

diffusion_exact(x, t; sigma0 = 0.05, E0 = 1.0, D = 1/900, x0 = 0.5)

Analytic solution of radiation_diffusion: a Gaussian of width sigma² = sigma0² + 2 D t whose integral is conserved.

sod_exact

Source: src/problems/exact.jl:75

sod_exact(x, t; rhoL = 1.0, uL = 0.0, pL = 1.0,
                rhoR = 0.125, uR = 0.0, pR = 0.1,
                gamma = 1.4, x0 = 0.5) -> (rho, u, p)

Exact solution of the Riemann problem with the given left and right states, sampled at position x and time t. The defaults are the standard Sod shock tube.

The star pressure is found by Newton iteration on the pressure function, then the solution is sampled along the ray S = (x - x0)/t.

matter_coupling

Source: src/problems/radiation.jl:82

matter_coupling(; n = 4, kappa = 1e3, T_gas = 1.0, T_rad = 0.1, cv = 1.0, kwargs...)
    -> (sim, tmax)

Stiff matter-radiation coupling with no spatial structure: a uniform box whose gas and radiation start far out of equilibrium and relax towards a_rad T⁴ = E_rad on a timescale 1/(c rho kappa) that is orders of magnitude shorter than the transport step.

Passing this test means the implicit solve is doing its job: total energy E_int + (c/chat) E_rad must be conserved to round-off, and the final state must sit on the equilibrium curve regardless of how large the step is.

The state is uniform, so n changes nothing but the number of cells solving the same problem; it exists so that every problem takes resolution under one name.

rad_dust

Source: src/problems/radiation.jl:111

rad_dust(; n = 8, groups = GREY, chat_over_c = 0.1, coefficient = 1e6,
         kappa = 1e4, kwargs...) -> (sim, tmax)

Gas, dust and radiation in a uniform static medium, from Quokka’s RadDust and RadDustMG tests: the gas starts at T = 1 with no radiation, and cools by colliding with dust that radiates. The radiation couples to the dust only (BateKetoDust), so the gas cools at the collisional rate coefficient n^2 sqrt(T) (T - T_d) rather than at the radiative one – here a hundred times slower – and the dust temperature sits between the two.

Units and numbers are Quokka’s: c = 1e8, chat = 0.1 c, rho = 1, a_rad = 1, cv = 1.5 (mu = 1, k_B = 1, gamma = 5/3), rho kappa = 1e4, coefficient = 1e6, and the radiation time step 0.8 dx / chat = 1e-8 at eight cells. One difference: Quokka replaces B = a T^4 by B = a T so that its reference solution is a linear ODE; this code has no hook for the emission law, so it keeps a T^4, and rad_dust_reference integrates the model’s own ODE instead.

groups other than GREY gives the multigroup form (RadDustMG uses edges 1e-3, 0.1, 1, 10, 1e3); with a constant opacity the answer does not depend on the grouping, which is the point of that test.

ionized_radius

Source: src/problems/stromgren.jl:127

ionized_radius(sim; centered = false, x0 = 0.0)

The radius of the ionized region of a stromgren_iliev run, r = (3 V / 4 pi)^(1/3), with V the volume of ionized gas, sum max(x - x0, 0) / (1 - x0) dV over the cells: the ionization fraction x = n_H+ / (n_H0 + n_H+) counted above the background x0, which is the initial 1.2e-3 of Test 1 and zero for Test 2. It is a volume-weighted radius, not the position of a front, so a sharp front and a smeared one of the same total give the same r. With centered = false the grid is the octant and V is multiplied by 8.

rad_dust_reference

Source: src/problems/radiation.jl:150

rad_dust_reference(ts; groups = GREY, chat_over_c = 0.1, coefficient = 1e6,
                   kappa = 1e4) -> (T_gas, E_rad)

The error-controlled solution of rad_dust at the times ts: the gas temperature and the total radiation energy density. The model’s ODE – E_gas and the E_g evolved, T_d solved at every evaluation from the dust balance – integrated with Rodas5P at reltol = 1e-10. With a constant opacity the dust balance is monotone in T_d, so that inner solve has one root and a bracket.

stromgren_radius_analytic

Source: src/problems/stromgren.jl:153

stromgren_radius_analytic(t; Ndot = 5e48, n = 1e-3, alpha_B = 2.59e-13)

The radius of the ionized sphere of a point source in a uniform neutral medium, at the speed of light, with the recombination of Test 1 of Iliev et al. (2006): r_I = r_S (1 - exp(-t / t_rec))^(1/3), with the Stromgren radius r_S = (3 Ndot / 4 pi alpha_B n^2)^(1/3) (5.39 kpc for the defaults) and the recombination time t_rec = 1 / (alpha_B n) (122.3 Myr). t is in seconds and the radius in cm. This is the paper’s equation for the front of Test 1, which holds when the front is much slower than light.

stromgren_radius_finite_c

Source: src/problems/stromgren.jl:169

stromgren_radius_finite_c(t; chat, Ndot = 5e48, n = 1e-3, alpha_B = 2.59e-13)

The radius of the ionized sphere at time t when the radiation travels at the speed chat, from the front equation of Shapiro et al. (2006),

dR/dt = (Ndot - 4 pi R^3 alpha_B n^2 / 3) / (Ndot / chat + 4 pi R^2 n),

which is approximate: its term Ndot / chat counts the photons in flight as Ndot R / chat and ignores how many of them recombinations inside R have used up. It is integrated from R = 0 with fourth-order Runge-Kutta. It starts with 256 steps and doubles the number of steps until two successive radii differ by less than 1e-6 of the result, as the integrate_radius of Quokka’s testStromgrenSphere.cpp does, and throws an error if that has not happened after 12 doublings. With chat the speed of light it approaches stromgren_radius_analytic, and it is the reference of Shapiro et al. (2006) for a run with a reduced speed of light, which stromgren_iliev reduces in the photon equation while it keeps the chemistry unchanged. t is in seconds and the radius in cm.

marshak_wave

Source: src/problems/radiation.jl:189

marshak_wave(; n = 256, kappa = 300.0, T_wall = 1.0, cv = 1.0,
             closure = LevermoreClosure(), beta_order = 0, kwargs...)
    -> (sim, tmax)

A non-equilibrium Marshak wave: a cold, static, optically thick slab heated from x = 0 by a wall held in radiative equilibrium at T_wall. Radiation diffuses inward and drags the matter temperature behind it, so the gas and radiation temperatures separate at the front and merge behind it.

The wall is imposed as a Dirichlet condition on the radiation moments, E = a_rad T_wall⁴ with zero flux; the HLL solver then supplies the inward flux set by the jump across the boundary.

radhydro_shock

Source: src/problems/radiation.jl:224

radhydro_shock(; n = 256, closure = EddingtonClosure(), beta_order = 1,
               chat_factor = 10.0, chat_limiter = ConstantChat(),
               kwargs...) -> (sim, tmax)

The Mach 3 radiative shock of Lowrie & Edwards (2008), in the form used by Quokka’s RadhydroShock test. This is the most demanding one-dimensional radiation-hydrodynamics problem here: every part of the scheme has to be right at once.

A Mach 3 shock sits in a medium that is optically thick (about nine mean free paths across the domain) and strongly coupled, so the radiation both preheats the gas ahead of the shock – the radiative precursor – and, immediately behind the front, leaves the matter temperature briefly above its downstream value. That overshoot is the Zel’dovich spike, T_matter reaching 4.26 against a downstream 3.66, and it is what the test is really for: it only appears if the velocity-dependent coupling terms, the implicit solve and the shock capturing are all correct together.

Everything is in the dimensionless units of the reference solution: c_s0 = 1 upstream, T = 1 upstream, rho = 1 upstream, a_rad = 1e-4, absorption cross section 1e6, so that c = sqrt(3 sigma_a) = 1732. The reduced speed of light is 10 (v_0 + c_s0) = 40.

Both ends are held at the upstream and downstream Rankine-Hugoniot states, and the shock is initialised slightly left of where it settles, because it drifts a little during the run.

Runs with EddingtonClosure rather than M1, to match the assumption the semi-analytic solution is derived under – exactly as Quokka overrides ComputeEddingtonFactor for this problem. Pass closure = LevermoreClosure() to measure what that assumption costs; the difference is the closure error, not a scheme error. chat_factor scales the reduced speed of light, whose default of 10 (v_0 + c_s0) is Quokka’s – and which is already a fairly aggressive reduction, phi0 = chat/c = 0.023. chat_factor = 433 recovers chat = c and is the reference a chat_limiter should be scored against.

Compare against radhydro_shock_exact; tmax is three shock-crossing times.

radhydro_shock_super

Source: src/problems/radiation.jl:279

radhydro_shock_super(; n = 128, chat_over_c = 0.025, closure = EddingtonClosure(),
                     beta_order = 1, chat_limiter = ConstantChat(), kwargs...)
    -> (sim, tmax)

The Mach 5 supercritical radiative shock of Lowrie & Edwards (2008), in the form of Quokka’s RadhydroShockSuper test: the same dimensionless units and opacity as radhydro_shock, downstream state rho = 3.5979, T = 8.5572, on x in [-0.04, 0.01] with the shock initially at x = 0.

Supercritical means the radiative precursor heats the upstream gas to nearly the downstream temperature, and that makes it the problem most sensitive to the RSLA: the strong exchange in the precursor amplifies the RSLA’s energy error. Quokka’s default reduction for it is chat/c = 0.025. chat_over_c = 1 is the reference a limiter should be scored against; tmax is three shock-crossing times.

radiation_shadow

Source: src/problems/radiation.jl:352

radiation_shadow(; n = (280, 112), kappa = 1.0, rho_blob = 1e3,
                 closure = LevermoreClosure(), beta_order = 0, kwargs...)
    -> (sim, tmax)

The shadow test of Hayes & Norman (2003) in 2D: a collimated beam enters from the left of a transparent box and strikes an opaque, absorbing elliptical clump of semi-axes (0.10, 0.06) centred at x = 0.25.

n may be the pair of cell counts or a single number, which is taken as the x resolution and gives ny = 2 nx / 5 – the ratio that makes cells square on this 1 x 0.4 domain, and the one the default (280, 112) already has.

A two-moment scheme with the M1 closure preserves the direction of the radiation and leaves a sharp shadow behind the clump; a diffusion-based scheme lets radiation leak around the obstacle and fills the shadow in. Far downstream M1 does fill the shadow in slowly, because it carries a single flux vector per cell and so cannot represent the two crossing beams that meet there.

The clump is given a very large heat capacity so that it absorbs without re-emitting, which isolates the transport.

marshak_vaytet

Source: src/problems/radiation.jl:403

marshak_vaytet(; n = 64, ngroups = 4, Lx = 20.0, chat_over_c = 1.0,
               chat_limiter = ConstantChat(), coupling = QuokkaCoupling(),
               closure = LevermoreClosure(), kwargs...) -> (sim, tmax)

The frequency-dependent Marshak wave of Vaytet et al. (2011), in the form of Quokka’s RadMarshakVaytet test: a cold slab of rho = 10⁻³ g cm⁻³ at 300 K, heated from x = 0 by a wall in radiative equilibrium at T_L = 1000 K, with an opacity that falls as nu⁻².

This is the multigroup counterpart of marshak_wave, and it is here because the two disagree: with kappa = 2000 (nu / 4×10¹³ Hz)⁻² cm² g⁻¹ the groups span four decades of optical depth at once — a mean free path of 10⁻⁵ cm in the lowest group and 10 cm in the highest — so the high-frequency groups run ahead of the wave while the low-frequency ones are trapped in it. A grey calculation, which has one opacity to describe all of that, cannot reproduce the front. The number of groups is the convergence parameter of the test, hence ngroups: its edges are always logarithmically spaced from 6×10¹⁰ to 6×10¹⁴ Hz, which reproduces Quokka’s tabulated edges exactly at every group count it lists (4 gives 6e10, 6e11, 6e12, 6e13, 6e14).

Everything is CGS, the medium is static (hydro = false, beta_order = 0) and chat = c unless chat_over_c says otherwise. This problem is genuinely time-dependent, so the answer does depend on the reduced speed of light: it is the one here that measures what a chat_limiter buys. The opacity is piecewise constant across a group, evaluated at the group’s geometric centre, which is Quokka’s piecewise_constant_opacity model.

The domain length is a keyword because the choice matters and Quokka keeps it in an inputs file rather than in the problem source. Lx = 20 cm is the value that file uses, and it is the right one: at tmax = 1.36×10⁻⁷ s and 64 cells the thermal front (T_gas = 650 K, half way from 300 K to the wall) sits at about 3.8 cm, so the wave itself is comfortably inside. What does reach the far boundary is the top group, whose mean free path is 11 cm: it is optically thin, it streams across the slab, and it has warmed the far end to about 370 K by tmax. That is the physics the test exists to show, not an error, and it is why the far boundary is outflow rather than a cold wall — a shorter Lx would simply move the outflow closer, while a longer one costs proportionally more steps for no extra physics.

Has a default_metrics method: the front position and the near-wall radiation temperature.

total_erad

Source: src/problems/radiation.jl:502

total_erad(sim) -> Array

Radiation energy density summed over every frequency group, over the interior.

Redundant, and kept only because default_metrics(marshak_vaytet) and test/test_radiation_multigroup.jl call it: first(field(sim, :Erad)) sums the groups too and returns the identical array, as does radiation_temperature for the temperature it implies. Prefer the accessors in new code — this dates from before they learned about groups.

radhydro_pulse_dyn

Source: src/problems/radiation.jl:524

radhydro_pulse_dyn(; n = 128, chat_over_c = 1.0, v0 = 3e7, kappa0 = 500.0,
                   chat_limiter = ConstantChat(), kwargs...) -> (sim, tmax)

The advecting radiation pulse in the dynamic diffusion limit of He, Wibking & Krumholz (2024a), in the form of Quokka’s RadhydroPulseDyn test, in CGS: a Gaussian temperature pulse, T from 1e7 to 2e7 K over a width of 24 cm, in pressure balance between gas and radiation, carried by a uniform flow of v0 = 3e7 cm/s through a periodic box 1024 cm wide. The opacity is 500 cm² g⁻¹ at rho ≈ 1.2 g cm⁻³, so a cell is thousands of mean free paths thick and the optical depth of the pulse times v0/c is about ten: the radiation is carried with the gas rather than diffusing through it.

This is the regime in which Wibking & Krumholz (2022) show the RSLA makes order-unity errors whatever chat is, and it is radiation-rich – radiation holds about a third of the heat capacity – which is the regime in which the stability bound caps phi at the RSLA step (see StabilityBound). chat_over_c = 1 is the reference; tmax = 4.8e-6 s moves the pulse by 144 cm.

Internals

Honghu.Problems

Source: src/problems/Problems.jl:1

Honghu.Problems

Ready-made test problems. Each function returns a fully initialised Simulation together with a suggested tmax, so that a complete run is

sim, tmax = Honghu.Problems.sod_shock_tube(nx = 512)
run!(sim; tmax)

The hydrodynamic problems are the standard verification suite (Sod, smooth advection, Kelvin-Helmholtz, Sedov); the radiation problems exercise each limit of the two-moment system in turn: free streaming, static diffusion, stiff matter coupling, dust-gas coupling, a Marshak wave, a shadow, and the Mach 3 radiative shock. The photoionization problem is the Stromgren sphere of Iliev et al. (2006), Tests 1 and 2. The MHD problems are the Brio-Wu and Ryu-Jones 2a shock tubes, the Orszag-Tang vortex and an oblique circularly polarised Alfven wave.

Varying a problem

Every factory forwards unrecognised keywords to Simulation, so the numerical choices are already free:

sod_shock_tube(nx = 512, reconstruction = PLM(), integrator = SSPRK2())

The physics inside a radiation problem is not reachable that way, because the factory builds its own RadiationPhysics from constants that only exist in its body. Overriding the whole object means re-deriving those constants and getting a running simulation with different physics if you get one wrong. The knobs worth varying are therefore named keywords in their own right – closure, beta_order, and chat_factor on radhydro_shock:

radhydro_shock(nx = 256, closure = LevermoreClosure())   # M1 instead of P1

which is also the shape compare expects: one flat NamedTuple per variant, splatted into the factory.

Honghu.default_metrics

Source: src/problems/metrics.jl:13

default_metrics(sod_shock_tube)

l1_density against the exact Riemann solution at the final time.

Source: src/problems/metrics.jl:27

default_metrics(smooth_advection)

l1_density against the initial profile, which the exact solution returns to after a whole number of periods. This is the problem the order-of-accuracy measurements use, so the metric is the one whose slope is the convergence rate.

Source: src/problems/metrics.jl:41

default_metrics(radiation_diffusion)

l1_Erad against the analytic Gaussian sigma² = sigma0² + 2Dt.

Source: src/problems/metrics.jl:56

default_metrics(radiation_streaming)

front_error, the relative error in the position of the radiation front, which must travel at exactly chat.

Source: src/problems/metrics.jl:72

default_metrics(radhydro_shock)

Quokka’s own pair for this test:

  • l1_Trad, the relative L1 error in the radiation temperature, with the numerical profile interpolated onto the reference abscissae. Quokka’s pass threshold is 1% at 256 cells.
  • spike, the peak matter temperature. The Zel’dovich spike is the feature the test exists for and an error norm alone would pass a solution with no spike at all; the reference value is 4.2618.

Source: src/problems/metrics.jl:93

default_metrics(sedov_blast)

radius_error, the relative error in the shock radius against the Sedov-Taylor similarity radius xi (E t²/rho)^(1/5) with xi = 1.15 for gamma = 5/3.

Source: src/problems/metrics.jl:110

default_metrics(marshak_vaytet)

Two diagnostics rather than errors, because this problem has no closed-form solution – the same shape as radhydro_shock’s spike:

  • front, the position of the T_gas = 650 K contour, linearly interpolated between the bracketing cells so that the number converges under refinement instead of stepping by dx. It is what a group-count study measures: more groups resolve more of the nu^-2 opacity range, and the front moves.
  • Trad_wall, the radiation temperature of the cell against the wall, summed over the groups. It must sit just below T_L = 1000 K; if it does not, the Dirichlet boundary is not driving the wave.