METHOD
REGIME Class Reference

#include <REGIME.h>

Inheritance diagram for REGIME:
Collaboration diagram for REGIME:

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
 
FluxMethodfluxMethod
 
- Public Attributes inherited from ModelExtension
Datadata
 
bool sourceExists
 
bool fluxExists
 

Detailed Description

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.

Optimisations

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:

  • First note that the vector elements D1, D2, and D3 inside dwdsb (Note: not the diffusion vector!) are not calculated. This is because in all cases the elements are multiplied by zero.
  • When dotting dfdw with dwdsb, many of the elements are zero and so we manually multiply many of the non-zero entries to save on computation.
  • A number of loops have been fused together to improve the memory management.

Examples

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.

Definition at line 81 of file REGIME.h.

Constructor & Destructor Documentation

◆ REGIME() [1/2]

REGIME::REGIME ( )

◆ REGIME() [2/2]

REGIME::REGIME ( Data data,
FluxMethod fluxMethod 
)

Constructor.

◆ ~REGIME()

virtual REGIME::~REGIME ( )
virtual

Destructor.

Member Function Documentation

◆ set_dfxdw()

void REGIME::set_dfxdw ( double *  cons,
double *  prims,
double *  aux 
)

Sets the derivative of the non-stiff flux wrt the primitive vector.

◆ set_dfydw()

void REGIME::set_dfydw ( double *  cons,
double *  prims,
double *  aux 
)

◆ set_dfzdw()

void REGIME::set_dfzdw ( double *  cons,
double *  prims,
double *  aux 
)

◆ set_dwdsb()

void REGIME::set_dwdsb ( double *  cons,
double *  prims,
double *  aux 
)

Sets the derivative of the primitive vector wrt the stiff source vector.

◆ set_Dx()

void REGIME::set_Dx ( double *  cons,
double *  prims,
double *  aux 
)

Set the diffusion vector. Method assumes K and dwdsb are set.

◆ set_Dy()

void REGIME::set_Dy ( double *  cons,
double *  prims,
double *  aux 
)

◆ set_Dz()

void REGIME::set_Dz ( double *  cons,
double *  prims,
double *  aux 
)

◆ set_K()

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.

◆ set_vars()

void REGIME::set_vars ( double *  cons,
double *  prims,
double *  aux 
)

Sets up variables including the electric field and charge density.

◆ sourceExtension()

void REGIME::sourceExtension ( double *  cons,
double *  prims,
double *  aux,
double *  source 
)
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.

Parameters
[in]*conspointer to conserved vector work array. Size is \(N_{cons} \times N_x \times N_y \times N_z\)
[in]*primspointer to primitive vector work array. Size is \(N_{prims} \times N_x \times N_y \times N_z\)
[in]*auxpointer to auxiliary vector work array. Size is \(N_{aux} \times N_x \times N_y \times N_z\)
[out]*sourcepointer to source vector work array. Size is \(N_{cons} \times N_x \times N_y \times N_z\)
See also
ModelExtension

Reimplemented from ModelExtension.

Member Data Documentation

◆ alpha

double * REGIME::alpha

Prefactor for dwdsb.

Definition at line 87 of file REGIME.h.

◆ dfxdw

double* REGIME::dfxdw

Definition at line 87 of file REGIME.h.

◆ dfydw

double * REGIME::dfydw

Definition at line 87 of file REGIME.h.

◆ dfzdw

double * REGIME::dfzdw

Derivative of flux vector wrt to primitive variables.

Definition at line 87 of file REGIME.h.

◆ diffuX

double * REGIME::diffuX

Definition at line 87 of file REGIME.h.

◆ diffuY

double * REGIME::diffuY

Definition at line 87 of file REGIME.h.

◆ diffuZ

double * REGIME::diffuZ

Diffusion vector.

Definition at line 87 of file REGIME.h.

◆ dwdsb

double * REGIME::dwdsb

Derivative of primitive vector wrt stiff source.

Definition at line 87 of file REGIME.h.

◆ E

double * REGIME::E

Electric field vector.

Definition at line 87 of file REGIME.h.

◆ fbx

double * REGIME::fbx

Definition at line 87 of file REGIME.h.

◆ fby

double * REGIME::fby

Definition at line 87 of file REGIME.h.

◆ fbz

double * REGIME::fbz

Stiff flux vector.

Definition at line 87 of file REGIME.h.

◆ fluxMethod

FluxMethod* REGIME::fluxMethod

Pointer to the flux method class.

Definition at line 104 of file REGIME.h.

◆ K

double * REGIME::K

partial_a fbar^a

Definition at line 87 of file REGIME.h.

◆ Mx

double * REGIME::Mx

Definition at line 87 of file REGIME.h.

◆ My

double * REGIME::My

Definition at line 87 of file REGIME.h.

◆ Mz

double * REGIME::Mz

Directional matrices multiplying K. Dot prod(partial_w f^a, partial_sbar w)

Definition at line 87 of file REGIME.h.

◆ q

double * REGIME::q

Charge density.

Definition at line 87 of file REGIME.h.


The documentation for this class was generated from the following file: