METHOD
Hybrid Class Reference

#include <hybrid.h>

Inheritance diagram for Hybrid:
Collaboration diagram for Hybrid:

Public Member Functions

 Hybrid ()
 
 Hybrid (Data *data, double sigmaCrossOver=150, double sigmaSpan=50, bool useREGIME=true)
 
virtual ~Hybrid ()
 
void setupREGIME (FluxMethod *fluxMethod)
 
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

double * icons
 
double * iprims
 
double * iaux
 
double * sicons
 
double * siprims
 
double * siaux
 
double * iflux
 
double * rflux
 
double * isource
 
double * rsource
 
double * regimeSource
 
double sigmaCrossOver
 
double sigmaSpan
 
bool useREGIME
 
SRRMHDresistiveModel
 
SRMHDidealModel
 
REGIMEsubgridModel = NULL
 
int * mask
 
- Public Attributes inherited from Model
Datadata
 
int Ncons
 
int Nprims
 
int Naux
 

Private Member Functions

double idealWeight (double *cons, double *prims, double *aux)
 
double idealWeightID (double *cons, double *prims, double *aux, int i, int j, int k)
 
bool useResistive (double *cons, double *prims, double *aux)
 
void setIdealCPAs (double *cons, double *prims, double *aux)
 
void setIdealCPAsAll (double *cons, double *prims, double *aux)
 
void setMasks (double *cons, double *prims, double *aux)
 

Detailed Description

Hybrid model

This hybrid model combines the ideal and resistive models, dynamically swutching between the two dependant upon the local (and nearest neighbours' if using REGIME) conductivity. This model is SRRMHD in disguise, that is, for any cons, prims, aux arguments, these refer to the resistive versions. Ideal vectors are prefixed with `i'.
Switching between the models uses the tanh function, centred around some crossover conductivity, \(\sigma_{crossover}\), and with in the span of \(\pm\sigma_{span}\). For conductivities less than \(\sigma_c-\sigma_s\) the resistive model is used, and for \(\simga_c+\sigma_s\) ideal is used. If REGIME is used, it is calculated across the entire domain and added to the ideal MHD contribution.
The source and flux vectors of the hybrid model are a combination of the SRMHD and SRRMHD source and flux vectors, weighted according to the tanh penalty function.
The C2P of this model utilises the resistive C2P for \(\sigma<\sigma_c\) and the ideal C2P otherwise.
If specified in the constructor, he REGIME source is calculated for the whole domain, but only added to the source vector if the cell, and its nearest 3 neighbours have conductivites \(\sigma\ge\sigma_c-\sigma_s\).

Definition at line 37 of file hybrid.h.

Constructor & Destructor Documentation

◆ Hybrid() [1/2]

Hybrid::Hybrid ( )

Default constructor.

◆ Hybrid() [2/2]

Hybrid::Hybrid ( Data data,
double  sigmaCrossOver = 150,
double  sigmaSpan = 50,
bool  useREGIME = true 
)

Parameterized constructor.

Stores a pointer to the Data class for reference in its methods. Sets up the parameters for the hybrid model.
Parameters

◆ ~Hybrid()

virtual Hybrid::~Hybrid ( )
virtual

Destructor.

Member Function Documentation

◆ finalise()

void Hybrid::finalise ( double *  cons,
double *  prims,
double *  aux 
)
virtual

Finalise the simulation variables.

At the end of each step, we need to calculate the ideal electric fields and add their contribution to hybrids electric fields.
Parameters
[in]conspointer to conserved vector. Size is \(N_{cons}*N_x*N_y*N_z\)
[in]primspointer to primitive vector. Size is \(N_{prims}*N_x*N_y*N_z\)
[in]auxpointer to auxiliary vector. Size is \(N_{aux}*N_x*N_y*N_z\)

Reimplemented from Model.

◆ fluxVector()

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

Flux vector.

Compute the flux vector for all cells. We weight the contributions from ideal and resistive MHD for this using the penalty function.
Parameters
[in]conspointer to conserved vector. Size is \(N_{cons}*N_x*N_y*N_z\)
[in]primspointer to primitive vector. Size is \(N_{prims}*N_x*N_y*N_z\)
[in]auxpointer to auxiliary vector. Size is \(N_{aux}*N_x*N_y*N_z\)
[in,out]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
SRMHD::fluxVector
SRRMHD::fluxVector

Implements Model.

◆ getPrimitiveVars()

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

Conservative to primitive transformation for all cells.

Conservative to primitive transformation for all cells. If local conductivity is less than the crossover conductivity we use the resistive C2P, otherwise we use ideal.
Parameters
[in]conspointer to conserved vector. Size is \(N_{cons}*N_x*N_y*N_z\)
[in]primspointer to primitive vector. Size is \(N_{prims}*N_x*N_y*N_z\)
[in]auxpointer to auxiliary vector. Size is \(N_{aux}*N_x*N_y*N_z\)
See also
Model::getPrimitiveVarsSingleCell
SRMHD::getPrimitiveVarsSingleCell
SRRMHD::getPrimitiveVarsSingleCell

Implements Model.

◆ getPrimitiveVarsSingleCell()

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

Single cell conservative to primitive transformation.

Conservative to primitive transformation for a single computational cell. If local conductivity is less than the crossover conductivity we use the resistive C2P, otherwise we use ideal.
Parameters
[in]conspointer to conserved vector. Size is \(N_{cons}\)
[in]primspointer to primitive vector. Size is \(N_{prims}\)
[in]auxpointer to auxiliary vector. Size is \(N_{aux}\)
iint cell number in x-direction (optional)
jint cell number in y-direction (optional)
kint cell number in z-direction (optional)
See also
Model::getPrimitiveVarsSingleCell
SRMHD::getPrimitiveVarsSingleCell
SRRMHD::getPrimitiveVarsSingleCell

Implements Model.

◆ idealWeight()

double Hybrid::idealWeight ( double *  cons,
double *  prims,
double *  aux 
)
private

Penalty function: ideal contribution.

Compute the contribution from idealMHD for a single cell. The arguments are the cons prims and aux of only one cell.
Parameters
[in]conspointer to conserved vector. Size is \(N_{cons}\).
[in]primspointer to primitive vector. Size is \(N_{prims}\).
[in]auxpointer to auxiliary vector. Size is \(N_{aux}\).
Returns
iW double fractional contribution of the ideal model. (1-iW) gives the resistive contribution.

◆ idealWeightID()

double Hybrid::idealWeightID ( double *  cons,
double *  prims,
double *  aux,
int  i,
int  j,
int  k 
)
private

Penalty function: ideal contribution.

Compute the contribution from idealMHD for a single cell. The arguments are the cons prims and aux of the whole domain, and a cell position to return the weighting for.
Parameters
[in]conspointer to conserved vector. Size is \(N_{cons}*N_x*N_y*N_z\).
[in]primspointer to primitive vector. Size is \(N_{prims}*N_x*N_y*N_z\).
[in]auxpointer to auxiliary vector. Size is \(N_{aux}*N_x*N_y*N_z\).
iint x-coordinate of cell to get weighting for.
jint y-coordinate of cell to get weighting for.
kint z-coordinate of cell to get weighting for.
Returns
iW double fractional contribution of the ideal model. (1-iW) gives the resistive contribution.

◆ primsToAll()

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

Primitive-to-all transformation.

Primitive to everything transformation. We weight the contributions from ideal and resistive MHD for this using the penalty function.
Parameters
[in]conspointer to conserved vector. Size is \(N_{cons}*N_x*N_y*N_z\)
[in]primspointer to primitive vector. Size is \(N_{prims}*N_x*N_y*N_z\)
[in]auxpointer to auxiliary vector. Size is \(N_{aux}*N_x*N_y*N_z\)
See also
Model::primsToAll
SRMHD::primsToAll
SRRMHD::primsToAll

Implements Model.

◆ setIdealCPAs()

void Hybrid::setIdealCPAs ( double *  cons,
double *  prims,
double *  aux 
)
private

Set ideal cons, prims and aux vectors for a single cell.

Set the ideal conserved, primitive and auxiliary vectors from the (given) resistive conserved, primitive and auxiliary vectors, for a single computational cell.
Parameters
[in]conspointer to resistive conserved vector. Size is \(N_{cons}\).
[in]primspointer to resistive primitive vector. Size is \(N_{prims}\).
[in]auxpointer to resistive auxiliary vector. Size is \(N_{aux}\).
[out]siconspointer to ideal conserved vector. Size is \(N_{cons}\).
[out]siprimspointer to ideal primitive vector. Size is \(N_{prims}\).
[out]siauxpointer to ideal auxiliary vector. Size is \(N_{aux}\).

◆ setIdealCPAsAll()

void Hybrid::setIdealCPAsAll ( double *  cons,
double *  prims,
double *  aux 
)
private

Set ideal cons, prims and aux vectors for all cells.

Set the ideal conserved, primitive and auxiliary vectors from the (given) resistive conserved, primitive and auxiliary vectors, for all computational cells.
Parameters
[in]conspointer to resistive conserved vector. Size is \(N_{cons}*N_x*N_y*N_z\).
[in]primspointer to resistive primitive vector. Size is \(N_{prims}*N_x*N_y*N_z\).
[in]auxpointer to resistive auxiliary vector. Size is \(N_{aux}*N_x*N_y*N_z\).
[out]iconspointer to ideal conserved vector. Size is \(N_{cons}*N_x*N_y*N_z\).
[out]iprimspointer to ideal primitive vector. Size is \(N_{prims}*N_x*N_y*N_z\).
[out]iauxpointer to ideal auxiliary vector. Size is \(N_{aux}*N_x*N_y*N_z\).

◆ setMasks()

void Hybrid::setMasks ( double *  cons,
double *  prims,
double *  aux 
)
private

Set the REGIME source mask.

Set the REGIME mask to indicate whether the REGIME source should be added to the hybrid->source vector.
Parameters
[in]conspointer to conserved vector. Size is \(N_{cons}*N_x*N_y*N_z\).
[in]primspointer to primitive vector. Size is \(N_{prims}*N_x*N_y*N_z\).
[in]auxpointer to auxiliary vector. Size is \(N_{aux}*N_x*N_y*N_z\).
[out]maskpointer to mask array.

◆ setupREGIME()

void Hybrid::setupREGIME ( FluxMethod fluxMethod)

Setup the REGIME model.

Initialise the REGIME model and store a pointer it. Also allocate memory for the REGIME source vector and the mask.
Parameters
[in]fluxMethodpointer to simulations FluxMethod

◆ sourceTerm()

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

Source term contribution.

Source term calculation for all cells. Weighted sum of ideal and resistive contributions.
Parameters
[in]conspointer to conserved vector. Size is \(N_{cons}*N_x*N_y*N_z\)
[in]primspointer to primitive vector. Size is \(N_{prims}*N_x*N_y*N_z\)
[in]auxpointer to auxiliary vector. Size is \(N_{aux}*N_x*N_y*N_z\)
[in,out]sourcepointer to source vector. Size is \(N_{cons}*N_x*N_y*N_z\)
See also
Model::sourceTermSingleCell
SRMHD::sourceTermSingleCell
SRRMHD::sourceTermSingleCell

Implements Model.

◆ sourceTermSingleCell()

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

Single cell source term contribution.

Source term calculation for a single computational cell. Weighted sum of ideal and resistive contributions
Parameters
[in]conspointer to conserved vector. Size is \(N_{cons}\)
[in]primspointer to primitive vector. Size is \(N_{prims}\)
[in]auxpointer to auxiliary vector. Size is \(N_{aux}\)
[in,out]sourcepointer to source vector. Size is \(N_{cons}\)
iint cell number in x-direction (optional)
jint cell number in y-direction (optional)
kint cell number in z-direction (optional)
See also
Model::sourceTermSingleCell
SRMHD::sourceTermSingleCell
SRRMHD::sourceTermSingleCell

Implements Model.

◆ useResistive()

bool Hybrid::useResistive ( double *  cons,
double *  prims,
double *  aux 
)
private

Use resistive C2P?

Should we use the resistive C2P? If the local conductivity is less than the crossover conductivity, we use the resistive C2P.
Parameters
[in]conspointer to conserved vector. Size is \(N_{cons}*N_x*N_y*N_z\).
[in]primspointer to primitive vector. Size is \(N_{prims}*N_x*N_y*N_z\).
[in]auxpointer to auxiliary vector. Size is \(N_{aux}*N_x*N_y*N_z\).
Returns
use bool do we use the resistive C2P?

Member Data Documentation

◆ iaux

double * Hybrid::iaux

Definition at line 43 of file hybrid.h.

◆ icons

double* Hybrid::icons

Definition at line 43 of file hybrid.h.

◆ idealModel

SRMHD* Hybrid::idealModel

Definition at line 56 of file hybrid.h.

◆ iflux

double * Hybrid::iflux

Definition at line 43 of file hybrid.h.

◆ iprims

double * Hybrid::iprims

Definition at line 43 of file hybrid.h.

◆ isource

double * Hybrid::isource

Definition at line 43 of file hybrid.h.

◆ mask

int* Hybrid::mask

Definition at line 60 of file hybrid.h.

◆ regimeSource

double * Hybrid::regimeSource

Definition at line 43 of file hybrid.h.

◆ resistiveModel

SRRMHD* Hybrid::resistiveModel

Definition at line 54 of file hybrid.h.

◆ rflux

double * Hybrid::rflux

Definition at line 43 of file hybrid.h.

◆ rsource

double * Hybrid::rsource

Definition at line 43 of file hybrid.h.

◆ siaux

double * Hybrid::siaux

Definition at line 43 of file hybrid.h.

◆ sicons

double * Hybrid::sicons

Definition at line 43 of file hybrid.h.

◆ sigmaCrossOver

double Hybrid::sigmaCrossOver

Definition at line 43 of file hybrid.h.

◆ sigmaSpan

double Hybrid::sigmaSpan

Definition at line 43 of file hybrid.h.

◆ siprims

double * Hybrid::siprims

Definition at line 43 of file hybrid.h.

◆ subgridModel

REGIME* Hybrid::subgridModel = NULL

Definition at line 58 of file hybrid.h.

◆ useREGIME

bool Hybrid::useREGIME

Definition at line 50 of file hybrid.h.


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