|
METHOD
|
#include <REGIME.h>


Public Member Functions | |
| REGIME () | |
| REGIME (Data *data, FluxMethod *fluxMethod) | |
| virtual | ~REGIME () |
| void | sourceExtension (double *cons, double *prims, double *aux, double *source) |
| void | set_vars (double *cons, double *prims, double *aux) |
| void | set_Dx (double *cons, double *prims, double *aux) |
| void | set_Dy (double *cons, double *prims, double *aux) |
| void | set_Dz (double *cons, double *prims, double *aux) |
| void | set_K (double *cons, double *prims, double *aux) |
| void | set_dfxdw (double *cons, double *prims, double *aux) |
| void | set_dfydw (double *cons, double *prims, double *aux) |
| void | set_dfzdw (double *cons, double *prims, double *aux) |
| void | set_dwdsb (double *cons, double *prims, double *aux) |
Public Member Functions inherited from ModelExtension | |
| ModelExtension () | |
| ModelExtension (Data *data) | |
| virtual | ~ModelExtension () |
| virtual void | fluxExtension (double *cons, double *prims, double *aux, double *flux) |
Public Attributes | |
| double * | dfxdw |
| double * | dfydw |
| double * | dfzdw |
| double * | dwdsb |
| double * | E |
| double * | q |
| double * | K |
| double * | Mx |
| double * | My |
| double * | Mz |
| double * | fbx |
| double * | fby |
| double * | fbz |
| double * | diffuX |
| double * | diffuY |
| double * | diffuZ |
| double * | alpha |
| FluxMethod * | fluxMethod |
Public Attributes inherited from ModelExtension | |
| Data * | data |
| bool | sourceExists |
| bool | fluxExists |
REGIME: Resistive extension upgrade for ideal MHD
This class represents the implementation of REGIME, a resistive extension to the special relativistic, ideal MHD equations. Details can be found in Wright & Hawke 2019 A resistive extension to ideal MHD.
REGIME extends the equations of ideal MHD by means of an additional, diffusive source term. The new system has the following form:
\begin{align} \frac{\partial q}{\partial t} + \frac{\partial f^i(q)}{\partial x^i} = \frac{\partial D^i}{\partial x^i} \end{align}
where the LHS corresponds to the standard, special relativistic ideal MHD (SRMHD) equations, and the RHD is the source term extension of REGIME.
The diffusion vector is defined by the following:
\begin{align} D^i = -\frac{\partial f^i}{\partial \overline{q}} \bigg( \frac{\partial \overline{s}_0}{\partial \overline{q}} \bigg)^{-1} \frac{\partial \overline{f}^j_0}{\partial x^j} \end{align}
where \( f^i \) is the \(i^{th}\) direction, ideal MHD flux, \( \overline{q} \) is the stiff variables (electric fields of resistive MHD), \( \overline{s} \) is the source of the stiff variables and \(\overline{f}^j\) is the \(j^{th}\) flux of the stiff variables.
Within this code, we use the following naming conventions:
dfxdw, dfydw and dfzdw are the derivatives of the \(x\), \(y\) and \(z\) direction fluxes with respect to the primitive variables. dwdsb is the inverse of the stiff source vector with respect to the primitive variables. Mx, My, and Mz are the matrices \( -\frac{\partial f^i}{\partial w} \bigg( \frac{\partial \overline{s}_0}{\partial w} \bigg)^{-1} \). diffuX, diffuY, and diffuZ are the \(D^i\) vectors. To understand the elements of this extension, please view the paper. Including this extension is as simple as declaring REGIME modelExtension(&data, &fluxMethod); in main, and including a pointer to modelExtension in the time integrator's constructor. With this, the SRMHD model will be able to capture resistive effects. You should play with the model to get a feel for how it behaves with \( \sigma \), and make sure that for high resolution simulations you check that the resolution criterion is met (available in the paper). You may need to reduce the CFL factor if simulations look unstable. Although simulations may converge with conductivities as low as \( \sigma = 10 \), I would be very careful for values less than 50. Conductivities of 100 or more are reliably converging, but remember for smaller conductivities, higher order moments may become important and solutions may differ from resistive MHD.
To improve the performance of REGIME, we have implemented a number of optimisations. These will make the source faster to compute, but may have led to a slightly less readable code (and less modular than I would have liked). We list some of these below:
dfdw with dwdsb, many of the elements are zero and so we manually multiply many of the non-zero entries to save on computation. The best way to understand this extension is to view the examples we have provided. Run the main programs with make run and observe the results using the interactivePlot script.
| REGIME::REGIME | ( | ) |
| REGIME::REGIME | ( | Data * | data, |
| FluxMethod * | fluxMethod | ||
| ) |
Constructor.
|
virtual |
Destructor.
| void REGIME::set_dfxdw | ( | double * | cons, |
| double * | prims, | ||
| double * | aux | ||
| ) |
Sets the derivative of the non-stiff flux wrt the primitive vector.
| void REGIME::set_dfydw | ( | double * | cons, |
| double * | prims, | ||
| double * | aux | ||
| ) |
| void REGIME::set_dfzdw | ( | double * | cons, |
| double * | prims, | ||
| double * | aux | ||
| ) |
| void REGIME::set_dwdsb | ( | double * | cons, |
| double * | prims, | ||
| double * | aux | ||
| ) |
Sets the derivative of the primitive vector wrt the stiff source vector.
| void REGIME::set_Dx | ( | double * | cons, |
| double * | prims, | ||
| double * | aux | ||
| ) |
Set the diffusion vector. Method assumes K and dwdsb are set.
| void REGIME::set_Dy | ( | double * | cons, |
| double * | prims, | ||
| double * | aux | ||
| ) |
| void REGIME::set_Dz | ( | double * | cons, |
| double * | prims, | ||
| double * | aux | ||
| ) |
| void REGIME::set_K | ( | double * | cons, |
| double * | prims, | ||
| double * | aux | ||
| ) |
Determines the RHS bracket of the diffusion terms.
I.e.
\begin{align} K &= \partial_a \overline{f}^a - \partial_w \overline{q}_0 (\partial_w q)^{-1} \partial_a f^a \\ &= \partial_a \overline{f}^a \end{align}
for the resistive model. Recall M2 = 0.
| void REGIME::set_vars | ( | double * | cons, |
| double * | prims, | ||
| double * | aux | ||
| ) |
Sets up variables including the electric field and charge density.
|
virtual |
Main user function for the modified source.
This method implements the modified source for REGIME. Given the current state of the system in cons, prims and aux, it writes into source the contribution from the derivative of the diffusion vector.
| [in] | *cons | pointer to conserved vector work array. Size is \(N_{cons} \times N_x \times N_y \times N_z\) |
| [in] | *prims | pointer to primitive vector work array. Size is \(N_{prims} \times N_x \times N_y \times N_z\) |
| [in] | *aux | pointer to auxiliary vector work array. Size is \(N_{aux} \times N_x \times N_y \times N_z\) |
| [out] | *source | pointer to source vector work array. Size is \(N_{cons} \times N_x \times N_y \times N_z\) |
Reimplemented from ModelExtension.
| double * REGIME::dfzdw |
| double * REGIME::dwdsb |
| FluxMethod* REGIME::fluxMethod |
| double * REGIME::Mz |