Appearance
Physical models
FLUME solves the conservation laws of compressible flow in the form
with
[physics] physical_model (euler, euler-de, mhd-ideal), [physics] passive_scalars, [mhd] divergence_control and [eos] type select one of 13 models. The model fixes the state width nv and selects, on the host, the compute kernels compiled for that width; no kernel branches on the model.
| Model | [physics] physical_model | [mhd] divergence_control | nv | |
|---|---|---|---|---|
| Compressible Euler | euler | — | 5 | |
| Euler with dual energy | euler-de | — | Euler + | 6 |
Euler, euler-de with passive scalars | euler, euler-de + passive_scalars > 0 | — | + 4 slots | 9, 10 |
| Ideal MHD with mixed GLM cleaning | mhd-ideal | glm | 9 | |
| Ideal MHD with EGLM cleaning ( | mhd-ideal | eglm | as GLM | 9 |
| Ideal MHD without divergence control | mhd-ideal | none | the first 8 of the above | 8 |
| Isothermal or barotropic Euler | euler + [eos] type | — | as Euler, energy slot inert | 5 |
| Isothermal or barotropic ideal MHD | mhd-ideal + [eos] type | glm, none | as MHD, energy slot inert | 9, 8 |
The gas is calorically perfect ([eos] type = ideal, the default) unless [eos] type is isothermal or barotropic, which apply to euler and mhd-ideal without passive scalars only. All models are inviscid by default. Viscosity, heat conduction and Ohmic resistivity (#65) are each given as a coefficient or as its dimensionless number (input). With a viscosity or a conductivity each model is its compressible Navier–Stokes form, and mhd-ideal with a resistivity is resistive MHD (Ohm's law
Thermodynamics
The gas is defined by the specific heats at constant pressure and volume, [physics] cp, cv (J/(kg K)), or by their ratio alone, [physics] gamma, with the gas constant then 1 (code units):
Air, the value of most inputs, is cp = 1040.004, cv = 742.86 (
Compressible Euler
The flux along direction
Eigensystem
The characteristic decomposition used by the WENO schemes is written once for every direction: the tangents are taken cyclically,
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 |
evaluated at the Roe average of the two cells adjacent to the face (test_flume_euler_library checks
Dual energy
physical_model = euler-de (#91) adds the advected entropy
a pure conservation law with no gravity source. Once per step each cell compares its internal energy [physics] dual_energy_eta (default 0.05; the cell-local test of Bryan et al. 2014):
- in a cold cell,
, the entropy is a floor: , , and is rebuilt from it; - then, everywhere,
follows .
A cell below its adiabat was drained by the truncation error of the total-energy scheme in a cold supersonic flow, and the floor lifts it back. A cell above its adiabat was heated by a shock, which the advected entropy does not see, and it keeps its energy. The floor only adds energy, and the log reports it per step. A reset of the energy from the entropy, as in Cholla (Villasenor et al. 2021), would remove a cold shock's heat (DE). The runtime-AMR collapse of #88 reaches its end with dual energy (SV-17). Discretisation: numerics.
Passive scalars
[physics] passive_scalars = N (#92, euler or euler-de: four more conserved variables
The first s1..sN keys of the initial-condition regions and of the inflows, the others are zero. The scalars do not act on the flow: the flow fields of a run with scalars are bitwise those of the same run without them. Discretisation: numerics.
Ideal MHD
In code units the magnetic permeability is absorbed into the field,
The flux of
Wave speeds. Along
FLUME evaluates the discriminant as
Eigensystem. The 7×7 core is the Roe–Balsara-normalised eigensystem of Stone et al. (2008, ApJS 178, appendix B), evaluated at the arithmetic average of the two face states (a physical state, so the Roe-matrix factors are test_flume_mhd_library checks the eigensystem, including the degenerate states.
Divergence control: mixed GLM
The induction equation preserves divergence_control = glm FLUME uses the mixed hyperbolic–parabolic cleaning of Dedner et al. (2002): a ninth variable
so the
with glm_alpha glm_damping_length min-cell for the minimum cell spacing of the realm, as Mignone & Tzeferacos 2010; with runtime regridding the spacing of the finest level allowed, so that the damping rate does not change with the grid). glm_ch) is constant and uniform, and it bounds the time step (below). glm_ch_check warns or stops when the fastest wave
The weno-riemann (Dedner et al. 2002, eq. 42):
divergence_control = none drops glm.
Divergence control: EGLM
In the mixed GLM divergence_control = eglm selects the ideal GLM-MHD of Derigs et al. (2018, eqs. 3.16–3.18), with
the
in the order weno-riemann the
Positivity floors
[mhd] rho_floor, p_floor (both
Dissipative terms
With a viscosity or a conductivity in [physics] (input), Euler becomes the compressible Navier–Stokes system (#65), and so does each MHD model, 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),
Ohmic resistivity (MHD). With the magnetic diffusivity
with
Discretisation: numerics.
Isothermal and barotropic gases
[eos] (#100) replaces the ideal gas by a pressure that depends on the density alone,
Isothermal (type = isothermal):
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).
Barotropic (type = barotropic): a continuous piecewise polytrope,
Under gravity both gases take the momentum sources of the gamma-law gas,
- the Jeans marker's
; - the sinks' threshold density
; - the sinks' Jeans test
, with the virial thermal energy .
The ideal gas keeps its internal energy in the Jeans test; the two agree at
Discretisation (eigensystem, Riemann fluxes, positivity): numerics.
Isothermal and barotropic MHD
With physical_model = mhd-ideal the two gases close ideal MHD without an energy equation, with the total pressure
- Floors: the
[mhd]density and pressure floors are refused, since there is no pressure to floor. - Cleaning: GLM is the mixed GLM of the ideal MHD. EGLM is refused: its Derigs sources are built on the energy equation.
- Gravity: it moves the momentum only, as for the Euler gases.
Discretisation: numerics; verification: EO MHD.
External gravity
A constant gravitational acceleration [gravity], input; #73) adds sources to every model, with the potential
- Momentum:
at the cell centre. - Energy: from the scheme's own mass fluxes
, never from at the centre (Mikami et al. 2008, Mullen et al. 2021): . A face's weights sum to one over the cells it touches, so changes only by boundary fluxes, to round-off, with periodic boundaries and across block interfaces. The fluxes of a finite-difference scheme are point values of the primitive function of , so the two-face average is a second-order cell value and takes the whole scheme to second order; the four-face form is fourth order (verification). It reads the face beyond each block end, so it takes one more ghost layer, ngc >= S + 1. - Walls: at a
wall-inviscidwall alongthe source reads the mirrored face beyond the wall, and the exactly conserved total is over the cells beside the wall (+ at the lower wall, − at the upper), which differs from the plain sum by . - Positivity limiter: the backbone carries the time-centred energy
, which leaves its internal energy unchanged, and the high-order excess of the source is limited with the fluxes by the cell factor . Gravity never makes the backbone inadmissible (near vacuum, or with above the sound speed), and stays exact wherever the limiter does not act. - Time step: no bound of its own. The first step logs
, at least the velocity gravity adds in a step over the fastest wave speed; near 1 or above, gravity is stiff. - Boundary:
hydrostaticfaces continue the isothermal equilibrium of the boundary cell into the ghosts. - Well-balanced mode (
[gravity] equilibrium = atmosphere): the residual of the initial atmosphere at rest is computed with the run's own space operator once per grid (at the first step, after a restart, after every regrid) and subtracted from every residual (the deviation method of Edelmann et al. 2021, §4.3). The atmosphere is then an exact discrete steady state, onwenoandweno-riemann, Euler and MHD, across 2:1 seams (the equilibrium's reflux is folded into its residual), and the scheme evolves the deviation from it. Without it a stratified atmosphere at rest drives a stationary flow of the truncation error's size (verification). It costs one more field and one residual evaluation per grid. The subtracted residual is outside the limiter's factor: it is the truncation error of the equilibrium, small against the state wherever the atmosphere is resolved. - Through a cell potential (
[gravity] potential = linear, #81): the same field as the cell potential, applied by the path self-gravity uses. The face gravity is , the cell gravity the mean of its two faces; the momentum gains times the cell gravity, the energy . That is the face form, second order, and is conserved without a wall term. The hydrostatic ghosts take the potential drop, and the limiter the face and cell gravity. It is a test of that path (SV-1).
The equilibria FLUME builds are the isothermal-atmosphere, polytropic-atmosphere and rayleigh-taylor initial conditions (initial conditions).
Self-gravity
[gravity] self_gravity (#81) adds the gravity of the gas itself:
with the mean density removed on a periodic domain (the Jeans swindle), or poisson_bc = isolated). The discretisation is that of Mullen et al. (2021):
What is conserved, and why. The solvers are linear and symmetric,
The coupling is second order in space whatever the WENO order. A linear Jeans mode obeys
Solvers. Every Runge–Kutta stage solves poisson_solver = auto takes the FFT solver on a uniform grid and the multigrid solver on an AMR grid.
- FFT (FFTW on the CPU, cuFFT on FNL; the
*-fftbuild modes): distributed over the z-planes of the transform array, bitwise the same on every rank count, withreturned with every ghost layer filled. Periodic: each Fourier mode is divided by the eigenvalue of , so the discrete residual is round-off. Isolated: the density sits in a zero-padded array of cells per direction and is convolved with the lattice Green's function of (Hockney–Eastwood), whose residual is about per offset ( scripts/lattice_green.py); the residual ofis that summed over the source, of at , and the ghosts beyond the domain hold the free-space potential. On FNL the slab transform runs on each rank's GPU ( adam_fnl_poisson_fft_object): cuFFT plane and line plans, the transposes packed on the device and exchanged byMPI_ALLTOALLVon device buffers (GPU-aware MPI, as the ghost exchange). The density andcross the host every stage: the backend hands the solver a host copy of the density and gets back on the host ( solve_potential_gpu). - Multigrid (
adam_poisson_mg_object): the composite Laplacian of the AMR leaves, flexible CG preconditioned by a V-cycle, its coarsest level solved by the FFT solver of the backend. On FNL (adam_fnl_poisson_mg_object) the FCG iteration and the V-cycle run on the device: the operators and work vectors stay there, the red-black Gauss–Seidel smoother runs one kernel per colour, the halo exchange is GPU-awareMPI_ALLTOALLV. The right-hand side, the coarsest level (through the host to cuFFT), the James step and the ghost fill's placement go through the host, and the potential returns to the host after each solve. On a uniform gridpoisson_solver = multigridis a check againstfft; isolated boundaries use the symmetric James step (#87).
On AMR grids the composite Laplacian carries a mimetic mean flux across each 2:1 face, symmetric in the volume-weighted form and consistent (SV-9). The face gravity there is first order, the potential second order. The gravity work across each seam rides on the reflux, so reflux_cadence = step and of the Runge–Kutta order with stage (SV-10). A runtime regrid changes
Limiter. With positivity_limiter = cell the limiter's gravity energy correction acts on the potential path too, so
Log. The first step logs WE_plus_W, the energy the scheme conserves.
Radiative cooling
[cooling] (#93) adds optically thin cooling to the hydrodynamic models,
at fixed
With euler-de a cooled cell takes the entropy of its cooled energy,
The cooling itself is integrated exactly, so it sets no limit on the step. [cooling] dt_factor (default off) limits the step to dt_factor times the shortest cooling time E_plus_radiated, constant to round-off). Discretisation: numerics.
Sink particles
[sinks] (#94) adds point masses that act on the gas through self-gravity only. It needs self-gravity and a hydrodynamic model.
Gravity. Each sink's mass is added to the density the Poisson solver sees, so the periodic and isolated boundaries and the AMR composite operator apply to the sinks as to the gas, and
Creation (creation = .true.). Once per step a cell of the finest level present (with runtime regridding, of the finest level allowed) forms a sink when all of these hold, after Federrath et al. (2010):
- its density exceeds
, with of the cell: a Jeans length of , = accretion_radius_cellscells; - no sink lies within
; - the cell is a minimum of the potential over its control volume, the cells within
(ties allowed: the 8 cells around a symmetric centre all qualify); - the flow converges along every principal axis (the symmetric velocity gradient is negative definite);
- the volume is Jeans-unstable,
, with summed over the pairs of its cells; - the volume is bound,
, the kinetic energy relative to its centre of mass.
The candidates of every rank are taken deepest potential first, one per accretion radius. A static box above the threshold is not enough: at
Accretion (accretion = .true.). 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 (
Mergers (merging = .true.). Two sinks within an accretion radius that are bound and converging (
Runtime AMR. 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, and 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 and its threshold quadrupled from one step to the next. A collapse on runtime AMR needs regrid_prolongation = conservative-state (#88).
Discretisation (deposit, time stepping, backends): numerics.
Units and scaling
The equations above carry no dimensionless number. Take three references, a density
| Quantity | Reference |
|---|---|
| time | |
| pressure, energy density | |
| magnetic field ( | |
| GLM speed | |
| temperature |
Dividing every variable by its reference, every term of the Euler and MHD systems, the GLM and EGLM terms and the GLM damping
What the invariance does not remove:
- The parameters move into the data. The Mach number, the Alfvén Mach number and the plasma
live in the initial and boundary states; one reference speed can set only one of the flow, sound and Alfvén speeds to 1. - The temperature needs
, and later a reference temperature, once conduction, cooling or a temperature-dependent resistivity exist. - Gravity is not free: an external field brings
(above), self-gravity (#81); the dissipative terms bring the Reynolds, Prandtl, magnetic Reynolds and Lundquist numbers, each accepted in place of its coefficient (input). - The discrete scheme must be scale-free too. FLUME's is, apart from the classic WENO weights: their absolute
stops the limiting at small magnitudes (numerics). With [weno] weights = sia run whose input is scaled by powers of two (lengths, velocities, density) equals the base run bit for bit (the scaling oracle, NV-4); the admissibility floor of the positivity limiter and the immersed-boundary cut spacing are relative.
FLUME uses the invariance in two ways. An input in physical units can carry a [reference] section: the values are divided by their references once, on the loaded file, and the solver runs on numbers of order 1, whatever the weights; output_units = dimensional writes the results back in the input units. Or the input runs as it is with weights = si. On Sod at an interstellar density both match the code-units run to
Time-step bound
The time step is the minimum over the realm of
with [time] CFL). With GLM the cleaning waves add the bound
Derived output fields
With [IO] save_auxiliary_fields = .true. the checkpoints also hold Bx, By, Bz, the total pressure pt beta, the field magnitude bmag and the discrete divergence divb. Their exact definitions are on the input reference page.
References
- 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.
- Dedner A. et al. (2002), Hyperbolic divergence cleaning for the MHD equations, J. Comput. Phys. 175, 645–673.
- Derigs D. et al. (2018), Ideal GLM-MHD: about the entropy consistent nine-wave magnetic field divergence diminishing ideal MHD equations, J. Comput. Phys. 364, 420–467.
- Edelmann P. V. F. et al. (2021), Well-balanced treatment of gravity in astrophysical fluid dynamics simulations at low Mach numbers, Astron. Astrophys. 652, A53, doi:10.1051/0004-6361/202140653.
- 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.
- Goedbloed J. P., Poedts S. (2004), Principles of Magnetohydrodynamics, Cambridge University Press.
- Hockney R. W., Eastwood J. W. (1988), Computer Simulation Using Particles, Adam Hilger, Bristol.
- Mathew S. S., Federrath C. (2021), MNRAS 507, 2448.
- Mignone A. (2007), A simple and accurate Riemann solver for isothermal MHD, J. Comput. Phys. 225, 1427–1441.
- Mignone A., Tzeferacos P. (2010), A second-order unsplit Godunov scheme for cell-centered MHD: the CTU-GLM scheme, J. Comput. Phys. 229, 2117–2138.
- Mikami H., Sato Y., Matsumoto T., Hanawa T. (2008), Astrophys. J. 683, 357, doi:10.1086/589759.
- Mullen P. D., Hanawa T., Gammie C. F. (2021), An extension of the Athena++ framework for fully conservative self-gravitating hydrodynamics, Astrophys. J. Suppl. 252, 30, doi:10.3847/1538-4365/abcfbd.
- Stone J. M. et al. (2008), Athena: a new code for astrophysical MHD, ApJS 178, 137–177.
- Toro E. F. (2009), Riemann Solvers and Numerical Methods for Fluid Dynamics, 3rd ed., Springer.
- 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.