Hydro Unit
Kamayan's hydro unit uses a high-order Godunov scheme to solve the compressible Euler equations as the building block that can be extended to the ideal MHD and three temperature systems of equations. The basic principles are to
- Reconstruct high-order Riemann states biased to the left and right of the cell-interfaces in all directions from the cell-centered volume averaged fields.
- Use an approximate Riemann solver at the cell-face centers to get the upwinded high-order fluxes from the reconstructed Riemann states.
- Update the conserved fluid variables with a discrete divergence theorem to difference the face-centered fluxes.
Hydro Traits
The above described method can apply to a number of possible combinations of systems of equations from linear advection, to the compressible Euler equations, ideal MHD, three-temperature hydrodynamics and advection of material mixtures. Even though all these systems of equations can be solved with the same methodology supporting all of them in the same code isn't so trivial.
Kamayan tries to address this by constructing a type trait HydroTraits
that is templated on the runtime options used by hydro to define the
variables need for the reconstruct-evolve-average method.
template <Fluid fluid, Mhd mhd, ReconstructVars recon_vars>
struct HydroTraits {
using fluid_vars = hydro_vars<fluid>;
using mhd_vars = hydro_vars<mhd>;
using WithFlux =
ConcatTypeLists_t<typename fluid_vars::WithFlux, typename mhd_vars::WithFlux>;
using NonFlux =
ConcatTypeLists_t<typename fluid_vars::NonFlux, typename mhd_vars::NonFlux>;
using Conserved =
ConcatTypeLists_t<typename fluid_vars::Conserved, typename mhd_vars::Conserved>;
using Primitive =
ConcatTypeLists_t<typename fluid_vars::Primitive, typename mhd_vars::Primitive>;
using Reconstruct = typename ReconVars<Conserved, Primitive, recon_vars>::type;
using ConsPrim = ConcatTypeLists_t<Conserved, Primitive>;
using All = ConcatTypeLists_t<ConsPrim, NonFlux>;
static constexpr auto FLUID = fluid;
static constexpr auto MHD = mhd;
static constexpr std::size_t ncons = Conserved::n_types;
};
With the HydroTraits
kernels used in the hydro unit can dispatch
to specialized code that is specific to the system of equations
only when it is needed
Prim2Cons<hydro_traits>(vL, UL);
Prim2Cons<hydro_traits>(vR, UR);
Prim2Flux<dir1, hydro_traits>(vR, FR);
Prim2Flux<dir1, hydro_traits>(vL, FL);
Parameters
Paramter | Type | Default | Allowed | Description |
---|---|---|---|---|
<hydro> | ||||
EMF_averaging | String | arithmetic | [ arithmetic, ] | Method to use for averaging the Face fluxes to edge electric field |
ReconstructionVars | String | primitive | [ primitive, ] | Choice of variables used for reconstruction. |
cfl | Real | 8.00000e-01 | CFL stability number use in hydro | |
reconstruction | String | fog | [ fog, plm, ppm, wenoz, ] | reconstruction method used to get Riemann States |
riemann | String | hll | [ hll, hllc, ] | Riemann solver used for high order upwinded fluxes. |
slope_limiter | String | minmod | [ minmod, van_leer, mc, ] | Slope limiter used in reconstruction. |