METHOD
SRMHD Class Reference

#include <srmhd.h>

Inheritance diagram for SRMHD:
Collaboration diagram for SRMHD:

Public Member Functions

 SRMHD ()
 
 SRMHD (Data *data)
 
virtual ~SRMHD ()
 
void sourceTermSingleCell (double *cons, double *prims, double *aux, double *source, int i=-1, int j=-1, int k=-1)
 
void sourceTerm (double *cons, double *prims, double *aux, double *source)
 
void getPrimitiveVarsSingleCell (double *cons, double *prims, double *aux, int i=-1, int j=-1, int k=-1)
 
void getPrimitiveVars (double *cons, double *prims, double *aux)
 
void primsToAll (double *cons, double *prims, double *aux)
 
void fluxVector (double *cons, double *prims, double *aux, double *f, const int dir)
 
void finalise (double *cons, double *prims, double *aux)
 
- Public Member Functions inherited from Model
 Model ()
 
 Model (Data *data)
 
virtual ~Model ()
 

Public Attributes

int smartGuesses
 
double * solution
 
- Public Attributes inherited from Model
Datadata
 
int Ncons
 
int Nprims
 
int Naux
 

Detailed Description

Special Relativistic MagnetHydroDynamics

The single fluid, special relativistic, ideal limit of the MHD equations. Ideal fluid, so resistivity does not play a part, hence no electric field evolution.
Note
Model has nine conserved variables:
\(\ \ \ D\), \(S_x\), \(S_y\), \(S_z\), \(\tau\), \(B_x\), \(B_y\), \(B_z\), \(\phi\)
Eight primitive variables:
\(\ \ \ \rho\), \(v_x\), \(v_y\), \(v_z\), \(p\), \(B_x\), \(B_y\), \(B_z\)
Thirteen auxiliary variables:
\(\ \ \ h\), \(W\), \(e\), \(c\), \(b_0\), \(b_x\), \(b_y\), \(b_z\), \(b^2\), \(v^2\), \(B \cdot S\), \(B^2\), \(S^2\)
The SRMHD fluid equations are derived from the consideration of the conservation of the rest-mass and stress-energy tensor, and the conservation of the Maxwell dual tensor for a perfect magneto-fluid. That is, starting from

\begin{align} \partial_\mu N^\mu &= 0 \\ \partial_mu T^{\mu \nu}&= 0 \\ \partial_mu {^*}F^{\mu \nu} &= 0 \end{align}

with \(N^\mu = \rho u^mu\) the rest-mass density, \(T^{\mu \nu} = \rho h^* u^\mu u^\nu + \eta^{\mu \nu} p^* - b^mu b^nu\) as the stress-energy tensor for a perfect magneto-fluid, and the Maxwell tensor given by \( {^*}F^{\mu \nu} = u^\mu b^\nu - u^\nu b^\mu\).
In addition, \( u^\mu, h^*=1+e+p/\rho+b^2/\rho, \rho, \eta, b^\mu \text{ and } p*=p+b^2/2\) are the fluid four-velocity, specific enthalpy including the magnetic contribution, mass-energy density, mostly positive flat space-time metric, four-vector magnetic field in the fluid rest-frame and the total pressure including the magnetic pressure.
Following this through, we arrive at the conservative form of the special relativistic, ideal limit, single fluid equations of motion:

\begin{align} \partial_t \begin{pmatrix} D \\ S^j \\ \tau \\ B^k \\ \phi \end{pmatrix} + \partial_i \begin{pmatrix} Dv^i \\ S^j v^i + p^* \delta^{ij} - b^j B^i / W \\ \tau v^i + p^* v^i - b^0 B^i/ W \\ v^i B^k - v^k B^i + \delta^{ij}\phi \\ B^i \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ -\phi / c_p^2 \end{pmatrix}. \end{align}

Here, we sum over the \(i\) coordinate directions, and note the following relations:

\begin{align} D &= \rho W \\ S^j &= \rho h^* W^2 v^j - b^0 b^j \\ \tau &= \rho h^* W^2 - p^* - (b^0)^2 - D \\ u^\mu &= W(c, v^i) \\ W &= 1 / \sqrt(1 - v_i v^i) \\ b^0 &= W B_i v^i \\ b^i &= B^i / W + b^0 v^i \\ b^2 &= B_i B^i / W^2 + (B_i v^i)^2 \\ c_p &= const. \end{align}

We have also included the additional scalar field \(\phi\) such that any errors in the evolution of the magnetic fields that break the divergence constraint set by Maxwell's equations, namely \(\nabla \cdot B = 0\), are driven to zero, on a timescale set by the constant parameter \(c_p\). See Dedner et al. 2002.
See also
Model

Definition at line 93 of file srmhd.h.

Constructor & Destructor Documentation

◆ SRMHD() [1/2]

SRMHD::SRMHD ( )

Default constructor.

◆ SRMHD() [2/2]

SRMHD::SRMHD ( Data data)

Parameterized constructor.

Stores a pointer to the Data class for reference in its methods
Parameters
*dataPointer to Data class containing global simulation data

◆ ~SRMHD()

virtual SRMHD::~SRMHD ( )
virtual

Destructor.

Member Function Documentation

◆ finalise()

void SRMHD::finalise ( double *  cons,
double *  prims,
double *  aux 
)
inlinevirtual

Finalise the simulation variables.

Mostly, this probably wont be needed, but if there is any final steps to finish off a timestep, this can be done here.

Reimplemented from Model.

Definition at line 230 of file srmhd.h.

◆ fluxVector()

void SRMHD::fluxVector ( double *  cons,
double *  prims,
double *  aux,
double *  f,
const int  dir 
)
virtual

Flux vector.

Method determines the value for the flux vector.
For the form of the fluxes see Anton 2010 with the inclusion of divergence cleaning from Dedner et al. 2002. interfaces, John Muddle.
Note
We are assuming that all primitive and auxiliary variables are up-to-date at the time of this function execution.
Parameters
*conspointer to conserved vector work array. Size is \(N_{cons}*N_x*N_y*N_z\)
*primspointer to primitive vector work array. Size is \(N_{prims}*N_x*N_y*N_z\)
*auxpointer to auxiliary vector work array. Size is \(N_{aux}*N_x*N_y*N_z\)
*fpointer to flux vector work array. Size is \(N_{cons}*N_x*N_y*N_z\)
dirdirection in which to generate flux vector. \((x, y, z) = (0, 1, 2)\)
See also
Model::fluxVector

Implements Model.

◆ getPrimitiveVars()

void SRMHD::getPrimitiveVars ( double *  cons,
double *  prims,
double *  aux 
)
virtual

Spectral decomposition.

Method outlined in Anton 2010, Relativistic Magnetohydrodynamcis: Renormalized Eignevectors and Full Wave Decompostiion Riemann Solver. Requires an N=2 rootfind using cminpack library.
Initial inputs will be the current values of the conserved vector and the old values for the prims and aux vectors. Output will be the current values of cons, prims and aux.
Parameters
*conspointer to conserved vector work array. Size is \(N_{cons}*N_x*N_y*N_z\)
*primspointer to primitive vector work array. Size is \(N_{prims}*N_x*N_y*N_z\)
*auxpointer to auxiliary vector work array. Size is \(N_{aux}*N_x*N_y*N_z\)
See also
Model::getPrimitiveVars

Implements Model.

◆ getPrimitiveVarsSingleCell()

void SRMHD::getPrimitiveVarsSingleCell ( double *  cons,
double *  prims,
double *  aux,
int  i = -1,
int  j = -1,
int  k = -1 
)
virtual

Single cell cons2prims conversion.

For the same reason as outlined in sourceTermSingleCell, some models will require a single celled primitive conversion method.
Each of the arguments are only for a single cell, ie, cons points to an (Ncons,) array, etc.
Parameters
*conspointer to conserved vector work array. Size is \(N_{cons}\)
*primspointer to primitive vector work array. Size is \(N_{prims}\)
*auxpointer to auxiliary vector work array. Size is \(N_{aux}\)
icell number in x-direction (optional)
jcell number in y-direction (optional)
kcell number in z-direction (optional)
See also
Model::getPrimitiveVarsSingleCell

Implements Model.

◆ primsToAll()

void SRMHD::primsToAll ( double *  cons,
double *  prims,
double *  aux 
)
virtual

Primitive-to-all transformation.

Transforms the initial state given in primitive form in to the conserved vector state. Relations have been taken from Anton 2010. Riemann Solver`
Parameters
*conspointer to conserved vector work array. Size is \(N_{cons}*N_x*N_y*N_z\)
*primspointer to primitive vector work array. Size is \(N_{prims}*N_x*N_y*N_z\)
*auxpointer to auxiliary vector work array. Size is \(N_{aux}*N_x*N_y*N_z\)
See also
Model::primsToAll

Implements Model.

◆ sourceTerm()

void SRMHD::sourceTerm ( double *  cons,
double *  prims,
double *  aux,
double *  source 
)
virtual

Source term contribution.

Non-zero flux for cons[8], phi, as a result of implementing divergence cleaning. For details see Muddle.
Parameters
*conspointer to conserved vector work array. Size is \(N_{cons}*N_x*N_y*N_z\)
*primspointer to primitive vector work array. Size is \(N_{prims}*N_x*N_y*N_z\)
*auxpointer to auxiliary vector work array. Size is \(N_{aux}*N_x*N_y*N_z\)
*sourcepointer to source vector work array. Size is \(N_{cons}*N_x*N_y*N_z\)
See also
Model::sourceTerm

Implements Model.

◆ sourceTermSingleCell()

void SRMHD::sourceTermSingleCell ( double *  cons,
double *  prims,
double *  aux,
double *  source,
int  i = -1,
int  j = -1,
int  k = -1 
)
virtual

Single cell source term contribution.

Models that can posess a stiff source term and hence (semi-)implicit time integrators will require a source contribution (and cons2prims method) that applies to a single cell.
Each of the arguments are only for a single cell, ie, cons points to an (Ncons,) array, etc.
Parameters
*conspointer to conserved vector work array. Size is \(N_{cons}\)
*primspointer to primitive vector work array. Size is \(N_{prims}\)
*auxpointer to auxiliary vector work array. Size is \(N_{aux}\)
*sourcepointer to source vector work array. Size is \(N_{cons}\)
icell number in x-direction (optional)
jcell number in y-direction (optional)
kcell number in z-direction (optional)
See also
Model::sourceTermSingleCell

Implements Model.

Member Data Documentation

◆ smartGuesses

int SRMHD::smartGuesses

Number of smart guess required.

Definition at line 98 of file srmhd.h.

◆ solution

double* SRMHD::solution

Pointer to array to hold solution of C2P for every cell. Size is 2*Nx*Ny*Nz.

Definition at line 100 of file srmhd.h.


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