Appearance
Numerical methods
FLUME discretises the conservation laws with high-order finite differences on point values: the state
integrated in time by an explicit Runge–Kutta scheme. The numerical flux [numerics] scheme_space:
scheme_space | Face flux | Models |
|---|---|---|
weno | WENO reconstruction of the Lax–Friedrichs-split fluxes, per characteristic field | Euler, MHD |
weno-riemann | WENO interpolation of the face states, a Riemann solver and a high-order correction (Chen, Tóth & Gombosi 2016) | Euler (LLF, HLL, HLLC); MHD (LLF, HLL, HLLD) |
Both operators store the face flux at the same place, so seams, AMR reflux and the flux difference are shared.
Grid, blocks and ghost cells
The domain is a forest of Cartesian blocks of ni × nj × nk cells, organised by an octree (or quadtree) with Morton ordering. Each block carries ngc ghost cells per side, filled before every residual evaluation from the neighbouring blocks (MPI exchange across ranks), from the physical boundary conditions, or by the coarse–fine interpolation at an AMR seam. A direction flagged null_x/y/z = .true. is inactive: its fluxes are not computed and the solution is constant along it (1-D and 2-D problems are 3-D runs with null directions). The ghost width must cover the stencil: ngc ≥ S for WENO of order ngc = 3 for WENO5), and ngc ≥ 2 for weno-riemann.
WENO reconstruction
A WENO scheme of order [weno] scheme = weno-u-{3,5,7,9},
with the optimal (linear) weights weno-c-* are refused by FLUME.
The absolute weno-riemann, whose sensor reads the same weights; NV-6). Two cures: the reference layer, which hands the solver numbers of order 1, or [weno] weights = si, scale-invariant weights after Don, Li, Wang and Wang (2022):
for the split fluxes (weno-riemann), js). Every term scales exactly like the field (test_flume_weno_weights on the host, test_flume_weno_interpolation_fnl on the device; the whole solver: the scaling oracle). si with weno-riemann on primitive variables is refused. One property of js is lost at round-off: the smoothness indicator of a uniform field is a quadratic form, round-off rather than zero, and the si descaler varies from face to face, so a uniform field in a non-uniform state (the
The default js is the first formula, bitwise unchanged: the kernel receives js, so the choice costs no branch in the kernels.
The WENO kernel takes its coefficient tables as arguments, so one kernel serves two purposes:
- reconstruction (
weno): from point values of a flux, the face value whose difference approximates the derivative; - interpolation (
weno-riemann): from point values of the state, the state at the face. The interpolation tables (for WENO5: candidates exact to degree 2, combination, linear weights ) are generated with exact rational arithmetic by riemann-flux/weno_interpolation_tables.py.
scheme_space = weno: flux splitting
At each face
- the eigenvectors are evaluated at the face (Euler: the Roe average of cells
, ; MHD: their arithmetic average); - the state and the physical flux of every stencil cell are projected on the left eigenvectors,
, ( reconstruction_variables = characteristic), or kept component by component (conservative); - each field is split with a local Lax–Friedrichs speed,
, where per characteristic field ( conservative: one speed, and with GLM at least ); is reconstructed from the left-biased stencil and from the right-biased one, and the face flux is projected back, .
For MHD the characteristic decomposition is block-diagonal: the 7×7 wave core plus the
scheme_space = weno-riemann: interpolation, Riemann flux and correction
The face flux of the hybrid scheme (Chen, Tóth & Gombosi 2016) is
with
Face states. The fields of the stencil are interpolated to the face from the left and from the right (
reconstruction_variables:characteristic, the recommended default for Euler and MHD, with the eigenvectors of the face; orprimitive,, plus and for MHD). A face state with non-positive density or pressure is replaced by the adjacent cell's state. Riemann flux (
riemann_solver):llf:, of the two states; hll(Harten, Lax & van Leer 1983) with the Einfeldt speeds, (Roe averages): for , the upwind physical flux otherwise; hllc(Toro, Spruce & Speares 1994) with the same outer speeds and the contact speed of Batten et al. (1997),; it resolves an isolated contact exactly.
Correction (
flux_correction), coefficients derived with sympy so that the flux difference approximates the derivative of point values:flux_correctionOrder of the flux difference 6th6 (the WENO5 interpolation limits the scheme to 5) 4th4 none2 Sensor (
flux_correction_sensor): withweno,where every interpolated field keeps its nonlinear weights close to the linear ones, on both sides of the face, and elsewhere: the correction, which amplifies jumps by , is switched off at discontinuities. nonekeeps it everywhere.
For MHD (riemann_solver = llf | hll | hlld) the solvers of adam_flume_mhd_riemann_library work in the frame of the direction, so the x, y and z runs of a rotated problem stay bitwise equal: LLF, HLL, and HLLD (Miyoshi & Kusano 2005) with its degenerate cases and a per-face fallback to HLL when a star state is not admissible or the wave speeds are out of order; the fallbacks are counted and logged per stage (HLLD fallbacks to HLL: N faces). With GLM the weno-riemann through the --numerics option of its scripts (issue #47, M3-P3c): the linear waves and the circularly polarised Alfvén wave converge at order 4.96–5.00, Brio–Wu and Ryu–Jones 4d need no floor and no HLLD fallback, Orszag–Tang keeps its symmetry and conserves to
Measured (np 2, WENO5, 6th-order correction, CPU and FNL identical to the printed digits; details in the verification gallery): on the isentropic vortex the HLLC variant reaches order 6.5 between 128² and 256² with
Positivity limiter
[numerics] positivity_limiter = cell (issue #47, D-9; both space schemes) makes each stage keep the density and the pressure positive, so the floors are no longer needed on hard problems. Per cell, the backbone is the forward-Euler update with the first-order Lax–Friedrichs fluxes of the cell states (Euler: Rusanov; MHD: the Wu speed, which adds
On the Balsara–Spicer blast (β = 2.5·10⁻⁴, EGLM) the splitting scheme fails at step 3 without the limiter and reaches weno-riemann HLLD passes with or without it.
At a 2:1 AMR seam the end-of-step reflux (below) would replace the coarse face flux with the restricted fine one, a correction that no cell factor bounds: on the blast across a refined box it drives coarse cells beside the seam to
- the fine seam faces take the backbone
, with the coarse cell as outer state; - the coarse cell's factor
uses, on the seam face, the means of the four fine backbone and high-order fluxes; the coarse backbone update with the mean of is a convex combination of Lax–Friedrichs updates of , so it is admissible; - both sides blend with
, so each cell stays in its corner box and the coarse flux is exactly the mean of the fine ones. The stage is conservative, and the reflux only corrects round-off.
With self-gravity the register also carries the seam gravity work (#81 P5b), so the end-of-step correction is not round-off: on a star whose surface a 2:1 seam cuts, in a reflux_positivity_theta; reflux positivity: +N coarse cells limited. On that star one cell was limited on five steps, and the run reached its end. reflux_cadence = stage needs no such bound: its correction acts inside the stages, before the limiter.
The coarse states, the fine means and the factors travel over the ranks in seam skins (four reductions of seam size per stage); on the GPU the seam cells are gathered to the host, which recomputes their factors and returns them with the seam face fluxes.
Dual energy
physical_model = euler-de (#91) adds the advected entropy sync_dual_energy compares each cell's internal energy [physics] dual_energy_eta (default 0.05; the cell-local test of Bryan et al. 2014). In a cold cell, sync_dual_energy, sync_dual_energy_dev).
Passive scalars
[physics] passive_scalars = N (#92, euler or euler-de: four more conserved variables
Isothermal and barotropic equations of state
[eos] type = isothermal (#100, M13 P1) closes the Euler equations with MODEL_EULER_ISO) with its own pointwise library (adam_flume_euler_iso_library) behind the same interface as the Euler one, so the model-agnostic kernel bodies run it unchanged; the EOS argument the kernels pass as gamma is
In direction
the transverse waves weno scheme splits on this eigensystem; weno-riemann interpolates the characteristic fields or the primitives llf and hll (Einfeldt speeds) are the standard fluxes on the two acoustic speeds. The isothermal HLLC is HLL on the mass and the normal momentum, the transverse momenta (and any advected scalar) the HLL mass flux times the upwind specific value: the isothermal system has one wave between the acoustic ones, the contact, and it carries only the transverse velocity, so the star state needs no pressure. A Riemann flux always returns 0 in the inert slot.
The isothermal Riemann problem is solved exactly with no energy equation: the shock jump src/tests/flume/verification/eos/eos_oracle.py builds these solutions independently of the code, and the runs match them (EO). A null direction freezes its momentum (null_freeze) for this model as for every Euler model: a 1-D run cannot carry a transverse velocity. CPU and FNL (P2) instantiate the same model-agnostic kernel bodies on the same library, so the backends run the same arithmetic.
[eos] type = barotropic (P3) is a continuous piecewise polytrope, MODEL_EULER_BARO, on the same body as the isothermal gas: the body takes the EOS from four hooks of the including module (the pressure, the temperature, the sound speed and the speed of the Roe average), and the two libraries differ only there. The isothermal hooks are the closed forms; the barotropic ones read the realm's table. The kernels receive the EOS through one scalar (physics%eos_arg: adam_flume_eos_tables_library): each realm registers its table at initialization, identical tables share an entry, and the FNL backend copies the registry to the device once.
The Roe average keeps the
Under gravity (P4) both gases take the momentum sources of the gamma-law gas, clear_inert_energy), the fourth-order energy correction of the constant gravity is not computed (nor its ngc >= 4 stencil required), and the AMR reflux carries no seam gravity work. Where the ideal gas reads internal_energy of the kernels) is the density, so a stage, and the end-of-step reflux, keep every cell's density above POSITIVITY_LIMITER_KAPPA times its first-order backbone value, and an inadmissible seam ghost takes its interior cell (AMR). A corner whose density the chord takes to the floor would keep its momentum, so its velocity
Isothermal and barotropic MHD
With physical_model = mhd-ideal (P5) the two gases close ideal MHD without an energy equation, the total pressure MODEL_MHD_ISO, MODEL_MHD_BARO and their mixed-GLM twins MODEL_MHD_GLM_ISO, MODEL_MHD_GLM_BARO. They keep the MHD layout adam_flume_mhd_iso_library_body.INC) behind the EOS hooks of the isothermal and barotropic modules. The normal field is a parameter of the 1-D core, as in the adiabatic library: decoupled at speed 0, or the GLM pair
Eigensystem. In direction
HLLD. The isothermal HLLD of Mignone (2007, section 3) has three states between the outer speeds
, and the first two flux components are the HLL averages, with ; - the transverse components follow eqs. 30–37, and the flux eq. 38.
The outer speeds are those of the adiabatic library (Miyoshi & Kusano 2005, eq. 67). They bound Mignone's Davis estimates, whose eq. 39 is misprinted with
LLF and HLL use each state's own
src/tests/flume/verification/eos/mhd_oracle.py checks the two papers independently of the code (
Positivity, cleaning and refusals.
- Floors: the
[mhd]density and pressure floors are refused, since there is no pressure to floor. - Positivity limiter:
positivity_limiter = celltakes the density and the kinetic chord of the Euler gases,of the backbone, and an inadmissible seam ghost takes its interior cell (P5b; P5a had left the MHD twins on the ideal gas's blend). - Cleaning: GLM is the mixed GLM of the ideal MHD (refused with that limiter, as there). EGLM is refused: its Derigs sources are built on the energy equation.
- Gravity: it moves the momentum only, as for the Euler gases.
- Initial conditions:
orszag-tang,mhd-vortexand theentropywave ofmhd-linear-waveneed a gamma-law gas and are refused. - Backends: CPU (P5a) and FNL (P5b), the FNL kernels the device twins of the CPU ones on the same library; the barotropic table is read from the device registry.
Verification: EO P5.
Radiative cooling
[cooling] (#93, M11) adds optically thin cooling, apply_cooling cools every cell isochorically over the step just advanced, at fixed
expm1 and log1p (written as series below
With euler-de the cooled cells take the entropy of their cooled energy,
[cooling] dt_factor (default off) limits the step to dt_factor times the shortest cooling time E_plus_radiated, constant to round-off). On a uniform box the temperature follows the ODE solution to apply_cooling_dev, apply_cooling_entropy_dev), the tables at the fixed size of 64 nodes.
Sink particles
[sinks] (#94, M12) adds point masses that act through self-gravity only. The list is replicated (D-M12-1): every rank holds every sink and updates it identically from MPI-reduced sums, so no sink is owned and none migrates; the replicated tree locates any sink's block on any rank.
Gravity (D-M12-2). Each sink's mass is spread over its cloud-in-cell stencil (the 8 cell centres of the level of its block around it) and added to the density the Poisson solver sees, through the packed path of both solvers: the periodic and isolated boundaries (the James step) and the AMR composite operator apply to the sinks as to the gas, and W
Time stepping. The gas step runs with the sinks at their positions
Creation (D-M12-3). Once per step, on the committed state (its ghost cells and its potential refreshed), a cell of the finest level present (with runtime regridding, of the finest level allowed) forms a sink when its density exceeds accretion_radius_cells cells), no sink lies within
Accretion (D-M12-4). A new sink has no mass; every sink then takes, once per step, the gas above the threshold from the cells within its radius that is bound to it and falls in (
Backends. CPU and FNL run the same arithmetic: the deposit, the gather and the kick-drift-kick are host work on both (FNL solves the Poisson equation on the host); accretion runs on the cells within the radii, which FNL gathers from the device and scatters back (a handful of cells per sink); creation reads the whole committed state, which FNL copies to the host every step when creation is on (correct, not scalable: a device screening of the candidates is a follow-up). The sink histories of the two backends agree to round-off.
Mergers. Two sinks within an accretion radius that are bound and converging (
Runtime AMR (D-M12-5). With runtime regridding ([amr] frequency > 0) the sinks live on the finest level allowed ([amr] max_level), as in Federrath et al. (2010): they form only there, frequency$ + 2$ cells of a sink (its accretion radius, the half cell a sink may move per step until the next regrid, its CIC stencil) is refined towards that level and never derefined, whatever the other markers vote. A sink formed on a coarser level would have its neighbourhood refined at the next regrid: the infall onto it prolongated (supersonic, cold: the children lost their pressure on the SI collapse) and its threshold quadrupled from one step to the next. A collapse on runtime AMR needs regrid_prolongation = conservative-state (#88). A sink at rest on a composite grid that is not symmetric about it feels its own potential through the 2:1 seams: a constant truncation force,
Dissipative fluxes (Navier–Stokes)
With a viscosity or a conductivity in [physics] (input), Euler becomes the compressible Navier–Stokes system (issue #65, P2), and so does each MHD model (P3), which also takes an Ohmic resistivity. Each term is the divergence of a flux, added to the inviscid one in direction
with no bulk viscosity (Stokes hypothesis), adam_flume_dissipation_library).
Ohmic resistivity (MHD). With the magnetic diffusivity
with
Where it enters. The dissipative face fluxes are computed by their own kernels, after the inviscid face fluxes and before the seam accumulation and the flux difference, in both space schemes. Two consequences: the AMR reflux and the inter-realm flux register see the total flux, so conservation across seams needs no new machinery; and the WENO face kernels are untouched (their FNL register count does not change). A run without coefficients never calls the kernels and stays bitwise identical to the ideal solver. The kernels read [numerics] dissipative_order), never a branch inside a loop.
Face derivatives. The scheme stores point values, so a face flux of order
dissipative_order = 2 | dissipative_order = 4 (default) | |
|---|---|---|
| face state | ||
| normal derivative | ||
| tangential derivative | mean of the 2nd-order central differences of cells 0 and 1 | the 4th-order central differences |
| flux |
where [grid] ngc
Walls. wall-noslip and wall-isothermal (boundary conditions) are mirrors, second-order at the wall: a 4th-order interior with them converges at order 2 overall (VV-3).
Time step. The explicit unsplit integration adds the diffusive limit to the cell sum of the CFL bound,
so under AMR the diffusive part tightens four times per level, against twice for the hyperbolic one. With a power law and an isothermal wall the laws in
Limits. Explicit only: a diffusion-limited run pays
Across seams. The dissipative fluxes enter the AMR reflux and the inter-realm register with the inviscid ones, so a 2:1 face conserves to round-off (VV-7). A 2:1 face is second order, for them as for the inviscid fluxes: the mean restriction of the coarse ghosts and the reflux of point-value fluxes each cap the order at 2 (issue #68 F1); without the reflux the dissipative flux at the face is first order (VV-8).
Subgrid-scale models
[turbulence] sgs_model (input) adds an eddy viscosity
| Model | Vanishes in | |
|---|---|---|
| Vreman (2004) | ||
| WALE (Nicoud & Ducros 1999) | pure shear | |
| Sigma (Nicoud et al. 2011) | pure shear, 2-D flow, solid rotation |
Where it enters. Once per stage, from the auxiliary variables with 2nd-order central gradients, on the interior cells and 2 ghost layers: the fluxes read it up to the second ghost. The kernels of the order then add to the face fluxes
Time step. The largest
Limits.
Hybrid central/WENO
scheme_space = hybrid-kep-weno (input, issue #119, T2) computes the WENO flux splitting as weno does, then replaces the flux by a non-dissipative one at the faces away from shocks.
Sensor. Ducros et al. (1999), per cell from 2nd-order central velocity gradients: hybrid_floor, not calibrated). A cell also counts as flagged where the relative density jump across it exceeds hybrid_jump (0.1, not calibrated): the Ducros ratio is zero at a contact. A face takes the central flux when hybrid_threshold (0.2) in the 4 cells
Central flux. 6th-order kinetic-energy- and pressure-equilibrium-preserving, conservative form (Pirozzoli 2011) with the two-point flux of Shima et al. (2021), with
One flux per face, so conservation holds whichever kernel set it; computing WENO everywhere costs what weno costs, plus the overwrite. The two kernel sets are not fused.
Seams and boundaries. The central stencil must not read ghost cells that are not a same-level copy: a face along weno. A flag acts along its own normal only, and on such grids the sensor is exchanged like a state, one more halo exchange per stage: otherwise the two blocks of a same-level interface could take different fluxes at their common face, and conservation is lost (measured:
hybrid_skin relaxes this for measurement (input); the default stays WENO: on a smooth flow the central skin is closer to the DNS, but with a shock at a seam there is no reference (verification).
With a subgrid-scale model. The eddy viscosity is zero on flagged cells (T2.6). The rule is per cell: a WENO face next to a flagged cell, or on a skin, can still carry the model. The sensor and its exchange then run twice per stage.
No-slip walls: closed inviscid fluxes
At a wall-noslip or wall-isothermal face of a hydrodynamic model every inviscid face flux but the normal momentum is set to zero before the dissipative fluxes are added (issue #119): the wall is impermeable. Before, the mirrored ghost of an isothermal wall, of another density, let the split flux carry mass, energy and scalars through the face at
Wall model
wall-modelled faces (input, issue #119, T3.3–T3.4) mirror their ghosts as wall-inviscid and replace the flux through the wall face, after every other dissipative flux: no mass, the parallel momentum by wall_model_height, interpolated linearly between the two cells around it. The literature collected in llm-wiki (equilibrium wall model, log-layer mismatch) matches at a fixed fraction of
The model is the equilibrium thin layer between the wall and the sample, pressure uniform across it:
semi-local, as Yang & Lv 2018 and Chen et al. 2022, cited in llm-wiki), test_wall_model):
Inverse-velocity-transformation model (wall_model = inverse-transformation, T3.5). Griffin, Fu & Moin (2023, J. Fluid Mech. 970, A36; in llm-wiki) keep the constant-property layer above, at the same semi-local height,
with the temperature from the Reynolds analogy anchored at the sample (Eq. 2.5), wall_model_edge_velocity, wall_model_edge_temperature): the paper locates the edge in the flow, which a face kernel cannot. Here the property gradients follow from test_wall_model): in the constant-property limit it is the equilibrium model to
Input filter (wall_model_filter <restart_basename>-proc<rank>.wmf, each block's averages after its Morton code, checked on load), so a restart continues the run bit for bit (leg wm9); a checkpoint without the file, written before it existed, restarts them with a warning. Leg wm7: near the steady state of a laminar channel,
Eddy viscosity below wall_model_eddy_viscosity = .true.). The face takes
Limits: isothermal walls only; the inverse model takes a fixed edge state; a restart needs the same ranks (as every FLUME checkpoint); the wall faces are rebuilt each step, so after a regrid, but no test regrids along a wall.
Digital-filter inflow
A face inflow-digital-filter (input, #119 T3.7) feeds a spatially developing turbulent boundary layer: the mean of a profile table plus fluctuations with its Reynolds stresses. The method is the digital filter of Klein, Sadiki & Janicka (2003) in the form of Touber & Sandham (2009) and Xie & Castro (2008):
- Plane. A uniform grid over the face,
df_spacingapart (adjusted to divide the domain), periodic along a periodic span. - Filter. Uniform random numbers of zero mean and unit variance are filtered along both plane axes with
, normalised to unit sum of squares, the integral length in nodes, half-width . The filtered field has unit variance and integral length , that of ; its correlation is . - Time. The streamwise correlation is a temporal one:
, , once per step. Unit variance is kept, and the correlation is . - Stresses. The signals become velocity fluctuations by the Cholesky factor of the table's stress tensor (Lund, Wu & Squires 1998), with
. - Thermodynamics. The strong Reynolds analogy,
, written so that it holds at the wall. The pressure is the free stream's, and .
The plane lives on the host, and every rank builds the same one: one random stream, and the forest's global step. Once per step, each rank lists the ghost rows beyond the face and interpolates their states bilinearly in the plane. The CPU writes them after the face pass of every boundary fill. On FNL they are copied to the device and written by a small kernel. In the edge and corner passes the face is extrapolated. The plane is saved with the restart, so a restart continues bit for bit (leg tb1).
Limits: Euler only, one face per realm, the wall on the minimum side of its axis.
- Periodic-span corners. With a periodic span, the ghosts beyond the face and the span are filled by the periodic exchange, so they lag the plane by one boundary fill.
- Recovery. A digital filter needs a recovery length after the inlet, about
at Mach 2.5 against for recycling (Huang, Duan & Choudhari 2022).
Turbulence diagnostics
[diagnostics] turbulence_history_save = N (input) writes every
with dissipative_order is. The integrals are sums, not divided by the volume.
The exact equation is
Time integration
The library Runge–Kutta schemes ([runge_kutta] scheme, listed in the input reference) integrate the semi-discrete system: strong-stability-preserving (SSP) and low-storage schemes. Each stage refills the ghost cells, recomputes the auxiliary variables, applies the positivity floors (MHD) and evaluates the residual. The time step follows the CFL bound, with the diffusive part of the dissipative fluxes when they are on; [time] it_max and time_max stop the run.
The SSP Butcher tableaux have one source, ssp_tableau of adam_rk_object (the PRISM boundary and PIC integrators call it too). SSP(5,4) is the optimal five-stage fourth-order scheme of Spiteri & Ruuth (2002, SIAM J. Numer. Anal. 40, 469), SSP coefficient 1.508: the library stores its Shu–Osher form as printed with 15 digits by Isherwood, Grant & Gottlieb (2018, arXiv:1810.04800, §4), every coefficient nonnegative, and derives the Butcher tableau from it. The order conditions then hold to test_rk_ssp_tableau pins every SSP tableau (unit tests).
Adaptive mesh refinement
The block tree is refined at initialisation ([initial_conditions] amr_iterations passes) by the markers of the [amr] section: a geometric box, a variable gradient, or the surface of an immersed solid. Neighbouring blocks differ by at most one level (2:1 balance). At a coarse–fine face:
- the ghost cells of the fine block are interpolated from the coarse one (the library seam ghost fill), and the coarse ghosts are restricted from the fine cells. The interpolant (tricubic by default) works variable by variable, so next to a strong shock it can return an inadmissible state: at low β the internal energy is a small residual of
, and on the Balsara–Spicer blast across a 2:1 seam the fine ghosts reach , which makes the high-order flux non-finite (issue #50). After every ghost fill, an inadmissible face ghost is therefore blended toward the adjacent interior cell, , with the largest that keeps and above the limiter's floors of (a non-finite ghost takes ). An admissible ghost is never touched, so the blend changes nothing else and costs one scan of the face ghosts; the log reports the ghosts blended, per rank. The isothermal and barotropic gases take outright (#100 P4): a ghost with makes the segment extrapolate the velocity , up to times the anchor's at the density floor. The internal-energy chord rejects that kinetic energy for the other models, but the density alone does not. On the Boss–Bodenheimer cloud the blended ghosts at the corners of the refined cube raised the velocity by a factor per step, until . Before the blend, the fill itself is bounded (#101), with a monotonicity-preserving clamp in the manner of Suresh and Huynh: the interpolated density is clamped to the range of the coarse cells that bracket the ghost, widened by the curvature of the data ( of the M4 minmod of the second differences, the largest over the bracketing lines; at the edge of the donor block, the widening of a quarter-cell extrapolation), and so is the velocity , against the coarse cells' velocities; the momentum is that density times that velocity. A ghost whose clamped density is still below a tenth of the coarse cell's that holds it ( SEAM_DENSITY_GUARD) takes, in every variable, that cell's state (the injection value). The energy and the other variables are interpolated unchanged. On smooth data the clamp moves nothing (the order across a 2:1 corner is unchanged, AOeuler-l6); FLUME turns it on for every model (maps%seam_density_var, the density index, the momenta following it). Without it, at the corners of a refined region the tricubic overshoots of density and momentum across the envelope of the Boss–Bodenheimer cloud gave ghosts whose velocity the blend extrapolated, and the corner cells ran away for about 150 steps, to 23 times the sound speed. Clamping the density and the momenta apart is not enough (the corner cells still reached 2.9 times the speed around them): the velocity, their ratio, is what must be bounded; - conservation is restored by the Berger–Colella reflux: the fluxes of every Runge–Kutta stage through the seam are accumulated in a flux register, weighted by the stage's coefficient in the step, and at the end of the step the coarse cells next to the seam are corrected by the difference between the fine fluxes and their own (
[numerics] reflux = .true.; withreflux_cadence = stagethe correction is applied at every stage instead). Under GLMand are refluxed; under EGLM is not, since the sources make it a non-conserved integral (G3b). With reflux the volume integrals of a periodic box stay constant to round-off, without it they drift at (conservation example).
With markers the tree is an octree (ratio = 8, and with a null axis nk ≥ 4) or a quadtree (ratio = 4, any nk, nk = 1 for a true 2-D run): a quadtree seam is 2:1 in x and y and 1:1 in z, and the ghost restriction, the coarse-fine interpolation, the reflux and the limiter's seam synchronisation work per axis (issue #46, verified by MV-15). For MHD, a cell-centred seam_max_divb).
Runtime regridding (#74). With [amr] frequency = n > 0, after every iters sweeps, each one refreshing the ghost cells, combining the markers into one set of flags (a block is refined when any marker asks for it, coarsened only when all agree, never below the base level), and calling the library regrid (2:1 balance, prolongation, restriction, redistribution, maps). The distance function of the immersed solids is recomputed on the new grid, the new state is checked (density and pressure positive, fatal otherwise, with the cell), and the forest rebuilds the 2:1 flux register, so the reflux follows seams that appear and disappear. The time step stays global (no subcycling). The FNL backend regrids by a host round trip: each sweep refreshes the ghosts on the device, copies the state to the host, marks and regrids there with the same code, and copies the state, the block coordinates, the maps and the distance function back (a map the new grid no longer has is freed on the device); its log line adds the wall time. The state and distance-function copies move the blocks in use only: the device array leads with the block index, so a kernel packs those blocks, transposed to the host layout, into a scratch buffer that one contiguous copy moves (#75; copying the whole capacity cost about 2.5 s per regrid on the development box, two ranks of 17195 blocks, whatever the grid, against 0.02 s now on a 52-block grid). The Löhner marker (Löhner 1987, mode 4) is the scale-free second-derivative estimator
in the dimension-sum form of FLASH and PLUTO (epsilon term filters ripples small relative to the variable; on a variable that vanishes in quiet regions it filters nothing, and round-off noise reads floor buffer ghost layers; it is refined above refine_tol, coarsened below derefine_tol, kept between. The Jeans marker (mode 5, #91) refines where a self-gravitating cell would be under-resolved: on every cell the Jeans length jeans_cells (default 8; Truelove et al. 1997 ask for at least 4, against artificial fragmentation), coarsened where every cell is above jeans_cells_derefine (default twice that, the hysteresis band of Federrath et al. 2010), kept between. It reads no ghost cell, so it also shapes the initial grid: a star refined before its collapse is never prolonged mid-collapse (SV-16). It needs self-gravity.
Keep shocks off the 2:1 seams. A captured shock that crosses a 2:1 seam into finer cells leaves a defect behind it (about 2 % of the jump in density, with an entropy defect of the same size) that does not shrink with the resolution and that no choice of seam operator removes: restriction, coarse-to-fine fill and reflux move it by at most ±30 % (A3, E0). The evidence points to the start-up error of a captured shock whose numerical structure is squeezed into finer cells. Refine ahead of the shocks instead: a gradient or Löhner marker on density or pressure with a buffer of a few cells and a regrid frequency short enough that a shock cannot outrun the refined region between two regrids, so shocks stay inside the finest level and never cross a seam (the standard AMR practice; E0 measured the defect, not this remedy).
Regridding transfers. When a block is derefined, the parent takes the mean of its children. When one is refined, [amr] regrid_prolongation chooses how the children are filled. FLUME's default is conservative: each child is the parent plus monotonized-central slopes (van Leer 1977) times a quarter of a cell, one per refined axis, scaled by the largest linear prolongation (tensor interpolation, weights 1/4 and 3/4) is second order too but not conservative (RG). The opt-in conservative-state (#88) keeps the children's mean on the parent but builds them from that tensor interpolation, which mixes whole coarse states with the same weights for every variable, and scales their offsets by one factor conservative-state they recover and the run ends (SV-15). It is not the default because it costs accuracy on smooth flow: an extremum of any one variable flattens the children of every variable, and the tracked vortex of AV misses its bound with it (L1 1.68 times the uniform fine run's, the bound 1.5). All three read the parent's first ghost layer.
Immersed boundary (Euler)
Static rigid solids ([solids], [solid_N], e.g. definition = analytical_circle) are imposed as inviscid walls:
- a signed distance function
marks the fluid and the solid cells; - the fluid state is extended into the solid by
n_eikonalsweeps of an eikonal extrapolation along the surface normal(Jacobi sweeps: every increment is computed from the old state, so the result does not depend on the loop order or the thread count, and the CPU and FNL backends agree); - the extended state is inverted into the mirror state of a slip wall (the normal velocity reversed);
- the fluid cells cut by the surface use the cut spacing in the flux difference, and the solid cells are masked in the Runge–Kutta stages. The cut spacing of a fluid cell
with a solid neighbour is ; the denominator is positive ( ), so it carries no guard (the absolute inherited from CHASE was a length, removed with issue #49).
The solid surface can drive the AMR (the refined ring of the shock-over-a-cylinder example). mhd-ideal with solids is refused.
Multi-realm runs
A forest manifest glues several realms, each with its own input file, through inter-realm seams (mirror coupling of blocks of the same resolution). The seam ghosts are filled from the peer realm at every Runge–Kutta stage (stage_coincident) or once per step (end_of_step); the union of a split problem is bitwise equal to the single-realm run (verification multirealm/).
Output and diagnostics
Checkpoints are XH5F files (one HDF5 file per rank plus an XDMF description readable by ParaView), written every it_save steps, with optional slices, residual and conservation histories, and restart files. MHD adds the div(B) history <basename>-divb_history.dat (it time max_divb l1_divb seam_max_divb, plus the D_flux columns with [diagnostics] divb_flux) and the divb_tol monitor, on the normalised D_flux max h|D_flux| / max|B| (#68 G1).
References
- Barth T. J., Jespersen D. C. (1989), The design and application of upwind schemes on unstructured meshes, AIAA paper 89-0366.
- Batten P. et al. (1997), On the choice of wavespeeds for the HLLC Riemann solver, SIAM J. Sci. Comput. 18, 1553–1570.
- Berger M. J., Colella P. (1989), Local adaptive mesh refinement for shock hydrodynamics, J. Comput. Phys. 82, 64–84.
- Bryan G. L. et al. (2014), ENZO: an adaptive mesh refinement code for astrophysics, ApJS 211, 19, doi:10.1088/0067-0049/211/2/19.
- Chen Y., Tóth G., Gombosi T. I. (2016), A fifth-order finite difference scheme for hyperbolic equations on block-adaptive curvilinear grids, J. Comput. Phys. 305, 604–621.
- Christlieb A. J., Liu Y., Tang Q., Xu Z. (2015), Positivity-preserving finite difference weighted ENO schemes with constrained transport for ideal magnetohydrodynamic equations, SIAM J. Sci. Comput. 37, A1825–A1845, doi:10.1137/140971208.
- Einfeldt B. et al. (1991), On Godunov-type methods near low densities, J. Comput. Phys. 92, 273–295.
- Federrath C., Banerjee R., Clark P. C., Klessen R. S. (2010), Modeling collapse and accretion in turbulent gas clouds: implementation and comparison of sink particles in AMR and SPH, ApJ 713, 269–290, doi:10.1088/0004-637X/713/1/269.
- Don W. S., Li R., Wang B.-S., Wang Y. H. (2022), A novel and robust scale-invariant WENO scheme for hyperbolic conservation laws, J. Comput. Phys. 448, 110724.
- Hockney R. W., Eastwood J. W. (1988), Computer Simulation Using Particles, Adam Hilger, Bristol.
- Jiang G.-S., Shu C.-W. (1996), Efficient implementation of weighted ENO schemes, J. Comput. Phys. 126, 202–228.
- Becker R. (1922), Stoßwelle und Detonation, Z. Phys. 8, 321–362.
- Löhner R. (1987), An adaptive finite element scheme for transient problems in CFD, Comput. Methods Appl. Mech. Engrg. 61, 323–338.
- Miyoshi T., Kusano K. (2005), A multi-state HLL approximate Riemann solver for ideal MHD, J. Comput. Phys. 208, 315–344.
- Shu C.-W., Osher S. (1989), Efficient implementation of essentially non-oscillatory shock-capturing schemes II, J. Comput. Phys. 83, 32–78.
- Toro E. F., Spruce M., Speares W. (1994), Restoration of the contact surface in the HLL-Riemann solver, Shock Waves 4, 25–34.
- Townsend R. H. D. (2009), An exact integration scheme for radiative cooling in hydrodynamical simulations, ApJS 181, 391–397, doi:10.1088/0067-0049/181/2/391.
- Truelove J. K., Klein R. I., McKee C. F., Holliman J. H. II, Howell L. H., Greenough J. A. (1997), The Jeans condition: a new constraint on spatial resolution in simulations of isothermal self-gravitational hydrodynamics, ApJ 489, L179–L183, doi:10.1086/310975.
- Tóth G., Roe P. L. (2002), Divergence- and curl-preserving prolongation and restriction formulas, J. Comput. Phys. 180, 736–750.
- Villasenor B., Robertson B., Madau P., Schneider E. (2021), Effects of photoionization and photoheating on Lyman-α forest properties from Cholla cosmological simulations, ApJ 912, 138, doi:10.3847/1538-4357/abed5a.
- van Leer B. (1977), Towards the ultimate conservative difference scheme. IV. A new approach to numerical convection, J. Comput. Phys. 23, 276–299.
- Wu K. (2018), doi:10.1137/18M1168017; Wu K., Shu C.-W. (2018), doi:10.1137/18M1168042: positivity of the first-order and high-order schemes for ideal MHD with the Godunov–Powell source.
- Xu Z. (2014), Parametrized maximum principle preserving flux limiters for high order schemes solving hyperbolic conservation laws, Math. Comp. 83, 2213–2238, doi:10.1090/S0025-5718-2013-02788-3.
- Zhang X., Shu C.-W. (2012), Positivity-preserving high order finite difference WENO schemes for compressible Euler equations, J. Comput. Phys. 231, 2245–2258, doi:10.1016/j.jcp.2011.11.020.