WARPXM v1.10.0
|
This is a guide for users of WARPXM who want to use the physics and numerical applications that are already implemented, specificially targeted at MHD and neutral Euler fluids. It covers the basics of setting up and running a multiphysics simulation using the `warpy` toolkit. It does not cover how to implement new physics in the WARPXM framework, nor the numerical methods that WARPXM uses.
A WARPXM simulation has two top-level parameters:
RK1
, TVDRK2
, SSPRK3
, and others.firstOrder
, secondOrder
, thirdOrder
, etc. The spatial order must be specified several times during the setup script, so it should be defined at the top.When setting up a simulation, you will follow this general outline:
variables
, which have one or more "components". An example would be an MHD fluid, which has eight components: density, momentum x 3, energy, and B field x 3.variable_adjusters
for each gradient variable you need to calculate.apps
which act on your variables. For example, a resistive MHD simulation would have an imhd
app and a resistive_diffusion
app.bc_apps
to apply boundary conditions to your variables (both primary and gradient).variable_adjusters
that you want to apply at every Runge-Kutta stage. For example, limiters adjust the solution values directly.ic_variable_adjusters
to apply initial conditions to your variables at the start of the simulation.Once the lists of apps
, bc_apps
, variable_adjusters
, and ic_variable_adjusters
have been constructed, you will bring them together in a simulation:
spatial_solver
which will solve the apps
in the DG formulation.boundary_conditions
variable adjuster whose job is to execute the bc_apps
, and add it to the variable_adjusters
list.host_action
to apply the ic_variable_adjusters
spatial_solver
and the variable_adjusters
listhost_action
.These are the steps for a moderately complicated simulation. The absolute minimum to solve, say, advection with periodic boundary conditions are a variable
, an advection app
, an ic_variable_adjuster
to set up the initial condition, a spatial_solver
, and a time integrator.
Refer to the shock_1d_sod.py example.
To follow along with this section, refer to the shock_1d_brio-wu.py example script.
The convention in WARPXM is to use eight components for MHD fluids, no matter the dimensionality of the overall problem. This is typically baked into the C++ implementation of variables, which look for e.g. energy in the fifth index of the component vector. As such, the way to create an MHD variable is as follows:
The components should appear in that order: density, momentum x 3, energy, and B field x 3.
The actual ideal MHD fluxes are implemented by the WmApplication_IMHD_Flux application, which is constructed via the imhd constructor in warpy:
This will include the ideal MHD governing equations in the Runge-Kutta update. For more details on the meaning of the floor_density
and floor_pressure
parameters, see the section on flux floors.
Resistive MHD is implemented by the WmApplication_Resistive_Diffusion application. This is constructed in warpy via the resistive_diffusion constructor:
For information about the arguments, see the documentation of WmApplication_Resistive_Diffusion. Note that, since resistive diffusion is a second-order differential operator term, we need to set up calculation of gradient variables. See Gradient calculations for information on how to do that.
TODO
WARPXM implements a positivity-preserving Discontinuous Galerkin scheme, which is guaranteed to preserve positivity of solution cell averages for certain combinations of fluxes and source terms. A detailed writeup with references can be found in the Positivity-preserving DG writeup (PDF). When used correctly, this scheme should provide a robust solution that never crashes due to a negative density or pressure. This section describes the correct use of the positivity-preserving elements of WARPXM and the recommended combinations. It then describes some of the alternative limiters that are implemented.
From a user perspective, the main thing that is required to take advantage of positivity-preserving DG is to install one of the "positivity-enforcing" limiters. The role of the positivity-enforcing limiter is to categorically guarantee a positive cell average at the next RK stage, provided that a CFL condition is satisfied. To install this limiter:
priority=2
. It is critical that these limiters run last out of all the variable adjusters that are acting on their respective variables. For example, if you have a moment-slope limiter installed like the Moe-Rossmanith limiter, its priority
parameter must be lower (indicating that it will run before) the priority of the positivity-enforcing limiter.If your simulation is running in cylindrical geometry and you are using the GQ
(Gaussian quadrature) source quadrature style (see Cylindrical geometry, then you must pass include_gaussian_quad_nodes=True
. Similarly, if you are using LGL
source quadrature, and your simulation includes additional source terms, then you should pass the include_interior_lgl_nodes=True
parameter. There is no issue with passing True
for these parameters when they are not needed, merely a performance hit from evaluating the solution at more nodes than necessary.
The positivity-preserving DG scheme plays more or less nicely with other WARPXM physics features.
Recommended:
RK1
, TVDRK2
, and SSPRK3
.dt
"tanking" all the way to machine precision. A combination of a slope limiter with a positivity-enforcing limiter is very robust.priority
. Any slope limiter must have its priority
parameter set lower than the priority
of the positivity-enforcing limiter.Supported:
dt
set by the positivity_preserving_source_dt estimator, source terms present no difficulty to the positivity preservation scheme. Note: this applies to source terms arising from cylindrical geometry as well.Discouraged:
Despite our best efforts, it is possible for a high-order DG solution to take on negative values of density and pressure at the collocation nodes. This is a nuisance, but in itself does not necessarily indicate that the solution is destroyed. WARPXM includes options that allow the simulation to continue even if unphysical values are predicted at a collocation node.
The Euler and Ideal MHD applications provide the option to set floors on the value of density and pressure that will be used when calculating the flux functions. These options do not affect conservation of mass or energy. Rather, they will modify the values of density and pressure in the internal and numerical flux calculations. The update of the conserved variables occurs in the same way as always, just with a slightly different amount of flux in or out of the element.
To use these options, pass the floor_density
and floor_pressure
options to the Euler or Ideal MHD application. For example:
The following applications apply a non-conservative floor to the density and internal energy of the solution:
TODO
Slope limiters work in concert with the positivity-enforcing limiter to avoid crashes. While the positivity-enforcing limiters can keep the density and pressure positive, they cannot guarantee that the solution wavespeeds remain reasonable. For this, a limiter specifically designed to smooth out discontinuities is very helpful.
Currently the only supported slope limiter is the Moe-Rossmanith limiter.
TODO
radial index
ideaWARPXM supports simulations in cylindrical geometry in both 1D and 2D. Cylindrical geometry support is built in to applications, and is not a property of the mesh as such. To use cylindrical geometry, follow these steps:
When using cylindrical geometry, the divergence and curl operators introduce additional source terms due to the coordinate system. These must be included explicitly by the user in the list of applications. Applications which require a cylindrical geometry source term, and the corresponding source term app, are as follows: