Set labels, indexes and prototypes for the MHD module. More...
Go to the source code of this file.
Enumerations | |
enum | KWAVES |
Functions | |
void | BackgroundField (double x1, double x2, double x3, double *B0) |
int | ConsToPrim (double **, real **, int, int, unsigned char *) |
void | Eigenvalues (double **, double *, double **, int, int) |
void | PrimEigenvectors (double *, double, double, double *, double **, double **) |
void | ConsEigenvectors (double *, double *, double, double **, double **, double *) |
void | Enthalpy (double **, double *, int, int) |
void | Entropy (double **, double *, int, int) |
void | Flux (double **, double **, double *, double **, double **, double *, int, int) |
void | MaxSignalSpeed (double **, double *, double *, double *, double **, int, int) |
void | PrimToCons (double **, double **, int, int) |
void | PrimRHS (double *, double *, double, double, double *) |
void | PrimSource (const State_1D *, int, int, double *, double *, double **, Grid *) |
Contains basic macro definitions, structure definitions and global variable declarations used by the MHD module.
enum KWAVES |
Label the different waves in increasing order following the number of vector components.
IMPORTANT: the KPSI_GLMM & KPSI_GLMP modes are present only in the MHD-GLM formulation. We keep them at the END of the enumeration so we can skip them in unnecessary loops. Please do NOT change them !
void BackgroundField | ( | double | x1, |
double | x2, | ||
double | x3, | ||
double * | B0 | ||
) |
Define the component of a static, curl-free background magnetic field.
[in] | x1 | position in the 1st coordinate direction ![]() |
[in] | x2 | position in the 2nd coordinate direction ![]() |
[in] | x3 | position in the 3rd coordinate direction ![]() |
[out] | B0 | array containing the vector componens of the background magnetic field |
void ConsEigenvectors | ( | double * | u, |
double * | v, | ||
double | a2, | ||
double ** | Lc, | ||
double ** | Rc, | ||
double * | lambda | ||
) |
Provide conservative eigenvectors for HD equations.
[in] | u | array of conservative variables |
[in] | v | array of primitive variables |
[in] | a2 | square of sound speed |
[out] | LL | left conservative eigenvectors |
[out] | RR | right conservative eigenvectors |
[out] | lambda | eigenvalues |
References:
Provide conservative eigenvectors for MHD equations.
[in] | u | array of conservative variables |
[in] | v | array of primitive variables |
[in] | a2 | square of sound speed |
[out] | Lc | left conservative eigenvectors |
[out] | Rc | right conservative eigenvectors |
[out] | lambda | eigenvalues |
Reference
With the following corrections:
The components (By, Bz) of L_{1,7} page 571 should be +{rho}a instead of -. Also, since Bx is not considered as a parameter, one must also add a component in the fast and slow waves. This can be seen by forming the conservative eigenvectors from the primitive ones, see the paper from Powell, Roe Linde.
The Lc_{1,3,5,7}[Bx] components, according to Serna 09 are -(1-g_gamma)*a_{f,s}*Bx and not (1-g_gamma)*a_{f,s}*Bx. Both are orthonormal though. She is WRONG! -Petros-
int ConsToPrim | ( | double ** | ucons, |
double ** | uprim, | ||
int | ibeg, | ||
int | iend, | ||
unsigned char * | flag | ||
) |
Convert from conservative to primitive variables.
[in] | ucons | array of conservative variables |
[out] | uprim | array of primitive variables |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
[out] | flag | array of flags tagging zones where conversion went wrong. |
Convert from conservative to primitive variables.
[in] | ucons | array of conservative variables |
[out] | uprim | array of primitive variables |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
[out] | flag | array of flags tagging zones where conversion went wrong. |
Convert from conservative to primitive variables.
[in] | ucons | array of conservative variables |
[out] | uprim | array of primitive variables |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
[out] | flag | array of flags tagging zones where conversion went wrong. |
Convert from conservative to primitive variables.
[in] | ucons | array of conservative variables |
[out] | uprim | array of primitive variables |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
[out] | flag | array of flags tagging zones where conversion went wrong. |
void Eigenvalues | ( | double ** | v, |
double * | csound2, | ||
double ** | lambda, | ||
int | beg, | ||
int | end | ||
) |
Compute eigenvalues for the HD equations
[in] | v | 1-D array of primitive variables |
[out] | csound2 | 1-D array containing the square of sound speed |
[out] | lambda | 1-D array [i][nv] containing the eigenvalues |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
Compute eigenvalues for the MHD equations
[in] | v | 1-D array of primitive variables |
[out] | csound2 | 1-D array containing the square of sound speed |
[out] | lambda | 1-D array [i][nv] containing the eigenvalues |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
void Enthalpy | ( | double ** | v, |
double * | h, | ||
int | beg, | ||
int | end | ||
) |
Compute the enthalpy.
[in] | v | 1D array of primitive quantities |
[in] | h | 1D array of enthalpy values |
[in] | beg | initial index of computation |
[in] | end | final index of computation |
void Entropy | ( | double ** | v, |
double * | s, | ||
int | beg, | ||
int | end | ||
) |
Compute the entropy.
[in] | v | 1D array of primitive quantities |
[in] | s | 1D array of entropy values |
[in] | is | initial index of computation |
[in] | ie | final index of computation |
Compute the entropy.
[in] | v | 1D array of primitive quantities |
[in] | s | 1D array of entropy values |
[in] | beg | initial index of computation |
[in] | end | final index of computation |
void Flux | ( | double ** | ucons, |
double ** | wprim, | ||
double * | a2, | ||
double ** | bck, | ||
double ** | fx, | ||
double * | p, | ||
int | beg, | ||
int | end | ||
) |
[in] | ucons | 1D array of conserved quantities |
[in] | wprim | 1D array of primitive quantities |
[in] | a2 | 1D array of sound speeds |
[in] | bck | 1D array of background field values |
[out] | fx | 1D array of fluxes (total pressure excluded) |
[out] | p | 1D array of pressure values |
[in] | beg | initial index of computation |
[in] | end | final index of computation |
void MaxSignalSpeed | ( | double ** | v, |
double * | cs2, | ||
double * | cmin, | ||
double * | cmax, | ||
double ** | bgf, | ||
int | beg, | ||
int | end | ||
) |
Compute the maximum and minimum characteristic velocities for the MHD equation, cmin= v - cf, cmax = v + cf
[in] | v | 1-D array of primitive variables |
[out] | cs2 | 1-D array containing the square of the sound speed |
[out] | cmin | 1-D array containing the leftmost characteristic |
[out] | cmin | 1-D array containing the rightmost characteristic |
[in] | bgf | 1-D array containing the background magnetic field |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
void PrimEigenvectors | ( | double * | q, |
double | a2, | ||
double | h, | ||
double * | lambda, | ||
double ** | LL, | ||
double ** | RR | ||
) |
Provide left and right eigenvectors and corresponding eigenvalues for the PRIMITIVE form of the HD equations (adiabatic & isothermal cases).
[in] | q | vector of primitive variables |
[in] | a2 | sound speed squared |
[in] | h | enthalpy |
[out] | lambda | eigenvalues |
[out] | LL | left primitive eigenvectors |
[out] | RR | right primitive eigenvectors |
Wave names and their order are defined as enumeration constants in mod_defs.h.
Advection modes associated with passive scalars are simple cases for which lambda = u (entropy mode) and l = r = (0, ... , 1, 0, ...). For this reason they are NOT defined here and must be treated seperately.
References:
Provide left and right eigenvectors and corresponding eigenvalues for the PRIMITIVE form of the MHD equations (adiabatic & isothermal cases).
[in] | q | vector of primitive variables |
[in] | a2 | sound speed squared |
[in] | h | enthalpy |
[out] | lambda | eigenvalues |
[out] | LL | left primitive eigenvectors |
[out] | RR | right primitive eigenvectors |
Wave names and their order are defined as enumeration constants in mod_defs.h. Notice that, the characteristic decomposition may differ depending on the way div.B is treated.
Advection modes associated with passive scalars are simple cases for which lambda = u (entropy mode) and l = r = (0, ... , 1, 0, ...). For this reason they are NOT defined here and must be treated seperately.
References:
The derivation of the isothermal eigenvectors follows the consideration given in roe.c
void PrimRHS | ( | real * | w, |
real * | dw, | ||
real | cs2, | ||
real | h, | ||
real * | Adw | ||
) |
Compute the matrix-vector multiplication where A is the matrix of the quasi-linear form of the HD equations.
[in] | w | vector of primitive variables; |
[in] | dw | limited (linear) slopes; |
[in] | cs2 | local sound speed; |
[in] | h | local enthalpy; |
[out] | Adw | matrix-vector product. |
Compute the matrix-vector multiplication where A is the matrix of the quasi-linear form of the MHD equations.
References
[in] | v | vector of primitive variables |
[in] | dv | limited (linear) slopes |
[in] | cs2 | local sound speed |
[in] | h | local enthalpy |
[out] | AdV | matrix-vector product |
Compute the matrix-vector multiplication where A is the matrix of the quasi-linear form of the HD equations.
[in] | w | vector of primitive variables; |
[in] | dw | limited (linear) slopes; |
[in] | cs2 | local sound speed; |
[in] | h | local enthalpy; |
[out] | Adw | matrix-vector product. |
Compute the matrix-vector multiplication where A is the matrix of the quasi-linear form of the MHD equations.
References
[in] | v | vector of primitive variables |
[in] | dv | limited (linear) slopes |
[in] | cs2 | local sound speed |
[in] | h | local enthalpy |
[out] | AdV | matrix-vector product |
void PrimSource | ( | const State_1D * | state, |
int | beg, | ||
int | end, | ||
double * | a2, | ||
double * | h, | ||
double ** | src, | ||
Grid * | grid | ||
) |
Compute source terms of the HD equations in primitive variables.
The rationale for choosing during which sweep a particular source term has to be incorporated should match the same criterion used during the conservative update. For instance, in polar or cylindrical coordinates, curvilinear source terms are included during the radial sweep only.
[in] | state | pointer to a State_1D structure; |
[in] | beg | initial index of computation; |
[in] | end | final index of computation; |
[in] | a2 | array of sound speed; |
[in] | h | array of enthalpies (not needed in MHD); |
[out] | src | array of source terms; |
[in] | grid | pointer to a Grid structure. |
Compute source terms of the MHD equations in primitive variables. These include:
The rationale for choosing during which sweep a particular source term has to be incorporated should match the same criterion used during the conservative update. For instance, in polar or cylindrical coordinates, curvilinear source terms are included during the radial sweep only.
[in] | state | pointer to a State_1D structure |
[in] | beg | initial index of computation |
[in] | end | final index of computation |
[in] | a2 | array of sound speed |
[in] | h | array of enthalpies (not needed in MHD) |
[out] | src | array of source terms |
[in] | grid | pointer to a Grid structure |
where
Compute source terms of the HD equations in primitive variables.
The rationale for choosing during which sweep a particular source term has to be incorporated should match the same criterion used during the conservative update. For instance, in polar or cylindrical coordinates, curvilinear source terms are included during the radial sweep only.
[in] | state | pointer to a State_1D structure; |
[in] | beg | initial index of computation; |
[in] | end | final index of computation; |
[in] | a2 | array of sound speed; |
[in] | h | array of enthalpies (not needed in MHD); |
[out] | src | array of source terms; |
[in] | grid | pointer to a Grid structure. |
Compute source terms of the MHD equations in primitive variables. These include:
The rationale for choosing during which sweep a particular source term has to be incorporated should match the same criterion used during the conservative update. For instance, in polar or cylindrical coordinates, curvilinear source terms are included during the radial sweep only.
[in] | state | pointer to a State_1D structure |
[in] | beg | initial index of computation |
[in] | end | final index of computation |
[in] | a2 | array of sound speed |
[in] | h | array of enthalpies (not needed in MHD) |
[out] | src | array of source terms |
[in] | grid | pointer to a Grid structure |
where
void PrimToCons | ( | double ** | uprim, |
double ** | ucons, | ||
int | ibeg, | ||
int | iend | ||
) |
Convert primitive variables to conservative variables.
[in] | uprim | array of primitive variables |
[out] | ucons | array of conservative variables |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
Convert primitive variables in conservative variables.
[in] | uprim | array of primitive variables |
[out] | ucons | array of conservative variables |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
Convert primitive variables to conservative variables.
[in] | uprim | array of primitive variables |
[out] | ucons | array of conservative variables |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
Convert primitive variables in conservative variables.
[in] | uprim | array of primitive variables |
[out] | ucons | array of conservative variables |
[in] | beg | starting index of computation |
[in] | end | final index of computation |