PLUTO
|
Module header file for relativistic MHD (RMHD). More...
Go to the source code of this file.
Classes | |
struct | MAP_PARAM |
Macros | |
#define | RESISTIVE_RMHD NO |
#define | RHO 0 |
#define | MX1 1 |
#define | MX2 (COMPONENTS >= 2 ? 2: 255) |
#define | MX3 (COMPONENTS == 3 ? 3: 255) |
#define | BX1 (COMPONENTS + 1) |
#define | BX2 (COMPONENTS >= 2 ? (BX1+1): 255) |
#define | BX3 (COMPONENTS == 3 ? (BX1+2): 255) |
#define | PSI_GLM (2*COMPONENTS + 1 + HAVE_ENERGY) |
#define | VX1 MX1 |
#define | VX2 MX2 |
#define | VX3 MX3 |
#define | NFLX (2 + 2*COMPONENTS + (DIVB_CONTROL == DIV_CLEANING)) |
#define | AX1 (NVAR + 1) |
#define | AX2 (NVAR + 2) |
#define | AX3 (NVAR + 3) |
#define | AX AX1 /* backward compatibility */ |
#define | AY AX2 |
#define | AZ AX3 |
#define | iVR VX1 |
#define | iVZ VX2 |
#define | iVPHI VX3 |
#define | iMR MX1 |
#define | iMZ MX2 |
#define | iMPHI MX3 |
#define | iBR BX1 |
#define | iBZ BX2 |
#define | iBPHI BX3 |
#define | iVR VX1 |
#define | iVPHI VX2 |
#define | iVZ VX3 |
#define | iMR MX1 |
#define | iMPHI MX2 |
#define | iMZ MX3 |
#define | iBR BX1 |
#define | iBPHI BX2 |
#define | iBZ BX3 |
#define | iVR VX1 |
#define | iVTH VX2 |
#define | iVPHI VX3 |
#define | iMR MX1 |
#define | iMTH MX2 |
#define | iMPHI MX3 |
#define | iBR BX1 |
#define | iBTH BX2 |
#define | iBPHI BX3 |
#define | RMHD_FAST_EIGENVALUES NO |
If set to YES, use approximate (and faster) expressions when computing the fast magnetosonic speed, see Sect. More... | |
#define | RMHD_REDUCED_ENERGY YES |
By turning RMHD_REDUCED_ENERGY to YES, we let PLUTO evolve the total energy minus the mass density contribution. More... | |
Typedefs | |
typedef struct MAP_PARAM | Map_param |
Enumerations | |
enum | KWAVES { KSOUNDM, KSOUNDP, KFASTM, KFASTP, KPSI_GLMM, KPSI_GLMP, KFASTM, KFASTP, KENTRP, KPSI_GLMM, KPSI_GLMP } |
Functions | |
int | ConsToPrim (double **, double **, int, int, unsigned char *) |
void | PRIM_EIGENVECTORS (double *, double, double, double *, double **, double **) |
int | Eigenvalues (double *, double, double, double *) |
int | EntropySolve (Map_param *) |
int | EnergySolve (Map_param *) |
int | PressureFix (Map_param *) |
void | Flux (double **, double **, double *, double **, double *, int, int) |
void | HLL_Speed (double **, double **, double *, double *, double *, double *, double *, double *, int, int) |
int | MaxSignalSpeed (double **, double *, double *, double *, double *, int, int) |
void | PrimToCons (double **, double **, int, int) |
void | VelocityLimiter (double *, double *, double *) |
int | Magnetosonic (double *vp, double cs2, double h, double *lambda) |
int | QuarticSolve (double, double, double, double, double *) |
int | CubicSolve (double, double, double, double *) |
void | POWELL_DIVB_SOURCE (const State_1D *, int, int, Grid *) |
void | HLL_DIVB_SOURCE (const State_1D *, double **, int, int, Grid *) |
Variables | |
Riemann_Solver | LF_Solver |
Riemann_Solver | HLL_Solver |
Riemann_Solver | HLLC_Solver |
Riemann_Solver | HLLD_Solver |
Riemann_Solver | HLL_Linde_Solver |
Module header file for relativistic MHD (RMHD).
Set label, indexes and basic prototyping for the relativistic MHD module.
Definition in file mod_defs.h.
#define AX AX1 /* backward compatibility */ |
Definition at line 115 of file mod_defs.h.
#define AX1 (NVAR + 1) |
Definition at line 111 of file mod_defs.h.
#define AX2 (NVAR + 2) |
Definition at line 112 of file mod_defs.h.
#define AX3 (NVAR + 3) |
Definition at line 113 of file mod_defs.h.
#define AY AX2 |
Definition at line 116 of file mod_defs.h.
#define AZ AX3 |
Definition at line 117 of file mod_defs.h.
#define BX1 (COMPONENTS + 1) |
Definition at line 29 of file mod_defs.h.
#define BX2 (COMPONENTS >= 2 ? (BX1+1): 255) |
Definition at line 30 of file mod_defs.h.
#define BX3 (COMPONENTS == 3 ? (BX1+2): 255) |
Definition at line 31 of file mod_defs.h.
#define iBPHI BX3 |
Definition at line 168 of file mod_defs.h.
#define iBPHI BX2 |
Definition at line 168 of file mod_defs.h.
#define iBPHI BX3 |
Definition at line 168 of file mod_defs.h.
#define iBR BX1 |
Definition at line 166 of file mod_defs.h.
#define iBR BX1 |
Definition at line 166 of file mod_defs.h.
#define iBR BX1 |
Definition at line 166 of file mod_defs.h.
#define iBTH BX2 |
Definition at line 167 of file mod_defs.h.
#define iBZ BX2 |
Definition at line 152 of file mod_defs.h.
#define iBZ BX3 |
Definition at line 152 of file mod_defs.h.
#define iMPHI MX3 |
Definition at line 164 of file mod_defs.h.
#define iMPHI MX2 |
Definition at line 164 of file mod_defs.h.
#define iMPHI MX3 |
Definition at line 164 of file mod_defs.h.
#define iMR MX1 |
Definition at line 162 of file mod_defs.h.
#define iMR MX1 |
Definition at line 162 of file mod_defs.h.
#define iMR MX1 |
Definition at line 162 of file mod_defs.h.
#define iMTH MX2 |
Definition at line 163 of file mod_defs.h.
#define iMZ MX2 |
Definition at line 148 of file mod_defs.h.
#define iMZ MX3 |
Definition at line 148 of file mod_defs.h.
#define iVPHI VX3 |
Definition at line 160 of file mod_defs.h.
#define iVPHI VX2 |
Definition at line 160 of file mod_defs.h.
#define iVPHI VX3 |
Definition at line 160 of file mod_defs.h.
#define iVR VX1 |
Definition at line 158 of file mod_defs.h.
#define iVR VX1 |
Definition at line 158 of file mod_defs.h.
#define iVR VX1 |
Definition at line 158 of file mod_defs.h.
#define iVTH VX2 |
Definition at line 159 of file mod_defs.h.
#define iVZ VX2 |
Definition at line 144 of file mod_defs.h.
#define iVZ VX3 |
Definition at line 144 of file mod_defs.h.
#define MX1 1 |
Definition at line 26 of file mod_defs.h.
#define MX2 (COMPONENTS >= 2 ? 2: 255) |
Definition at line 27 of file mod_defs.h.
#define MX3 (COMPONENTS == 3 ? 3: 255) |
Definition at line 28 of file mod_defs.h.
#define NFLX (2 + 2*COMPONENTS + (DIVB_CONTROL == DIV_CLEANING)) |
Definition at line 45 of file mod_defs.h.
#define PSI_GLM (2*COMPONENTS + 1 + HAVE_ENERGY) |
Definition at line 38 of file mod_defs.h.
#define RESISTIVE_RMHD NO |
Definition at line 16 of file mod_defs.h.
#define RHO 0 |
Definition at line 25 of file mod_defs.h.
#define RMHD_FAST_EIGENVALUES NO |
If set to YES, use approximate (and faster) expressions when computing the fast magnetosonic speed, see Sect.
3.3 of Del Zanna, A&A (2006), 473. Solutions of quartic equation is avoided and replace with upper bounds provided by quadratic equation.
Definition at line 177 of file mod_defs.h.
#define RMHD_REDUCED_ENERGY YES |
By turning RMHD_REDUCED_ENERGY to YES, we let PLUTO evolve the total energy minus the mass density contribution.
Definition at line 193 of file mod_defs.h.
#define VX1 MX1 |
Definition at line 41 of file mod_defs.h.
#define VX2 MX2 |
Definition at line 42 of file mod_defs.h.
#define VX3 MX3 |
Definition at line 43 of file mod_defs.h.
The Map_param structure is used to pass input/output arguments during the conversion from conservative to primitive variables operated by the ConsToPrim() function in the relativistic modules (RHD and RMHD). The output parameter, rho, W, lor and p, must be set at the end of every root-finder routine (EnergySolve(), EntropySolve() and PressureFix()). Additionally, some of the input parameters must be re-computed in EntropySolve() and PressureFix().
enum KWAVES |
Enumerator | |
---|---|
KSOUNDM | |
KSOUNDP | |
KFASTM | |
KFASTP | |
KPSI_GLMM | |
KPSI_GLMP | |
KFASTM | |
KFASTP | |
KENTRP | |
KPSI_GLMM | |
KPSI_GLMP |
Definition at line 58 of file mod_defs.h.
int ConsToPrim | ( | double ** | ucons, |
double ** | uprim, | ||
int | beg, | ||
int | end, | ||
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 |
[in,out] | flag | array of flags tagging, in input, zones where entropy must be used to recover pressure and, on output, zones where conversion was not successful. |
Definition at line 89 of file mappers.c.
int CubicSolve | ( | double | , |
double | , | ||
double | , | ||
double * | |||
) |
int Eigenvalues | ( | double * | v, |
double | cs2, | ||
double | h, | ||
double * | lambda | ||
) |
Compute an approximate expression for the fast magnetosonic speed using the upper-bound estimated outlined by Leismann et al. (A&A 2005, 436, 503), Eq. [27].
Definition at line 277 of file eigenv.c.
int EnergySolve | ( | Map_param * | par | ) |
Use Newton algorithm to recover pressure p0 from conservative quantities D, m and E
Solve f(W) = 0, where f(W) is Equation (A4) or (A6).
Definition at line 23 of file energy_solve.c.
int EntropySolve | ( | Map_param * | par | ) |
Convert the conservative variables {D, m, sigma_c} (where sigma_c = D*sigma is the conserved entropy) to primitive variable using a Newton-Raphson/Bisection scheme.
LAST MODIFIED
February 5th (2012) by C. Zanni & A. Mignone (zanni, @oat o.ina f.itmigno) ne@o ato.i naf. it
Definition at line 21 of file entropy_solve.c.
void Flux | ( | double ** | ucons, |
double ** | uprim, | ||
double * | h, | ||
double ** | fx, | ||
real * | pr, | ||
int | beg, | ||
int | end | ||
) |
[in] | u | 1D array of conserved quantities |
[in] | w | 1D array of primitive quantities |
[in] | a2 | 1D array of sound speeds |
[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 |
Definition at line 23 of file fluxes.c.
Definition at line 53 of file source.c.
void HLL_Speed | ( | double ** | vL, |
double ** | vR, | ||
double * | a2L, | ||
double * | a2R, | ||
double * | hL, | ||
double * | hR, | ||
double * | SL, | ||
double * | SR, | ||
int | beg, | ||
int | end | ||
) |
Compute leftmost (SL) and rightmost (SR) speed for the Riemann fan.
[in] | vL | left state for the Riemann solver |
[in] | vR | right state for the Riemann solver |
[in] | a2L | 1-D array containing the square of the sound speed for the left state |
[in] | a2R | 1-D array containing the square of the sound speed for the right state |
[out] | SL | the (estimated) leftmost speed of the Riemann fan |
[out] | SR | the (estimated) rightmost speed of the Riemann fan |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
Definition at line 18 of file hll_speed.c.
int Magnetosonic | ( | double * | vp, |
double | cs2, | ||
double | h, | ||
double * | lambda | ||
) |
Find the four magneto-sonic speeds (fast and slow) for the relativistic MHD equations (RMHD). We follow the notations introduced in Eq. (16) in
Del Zanna, Bucciantini and Londrillo, A&A, 400, 397–413, 2003
and also Eq. (57-58) of Mignone & Bodo, MNRAS, 2006 for the degenerate cases.
The quartic equation is solved analytically and the solver (function 'QuarticSolve') assumes all roots are real (which should be always the case here, since eigenvalues are recovered from primitive variables). The coefficients of the quartic were found through the following MAPLE script:
* ------------------------------------------------ restart; u[0] := gamma; u[x] := gamma*v[x]; b[0] := gamma*vB; b[x] := B[x]/gamma + b[0]*v[x]; wt := w + b^2; ############################################################# "fdZ will be equation (16) of Del Zanna 2003 times w_{tot}"; e2 := c[s]^2 + b^2*(1 - c[s]^2)/wt; fdZ := (1-e2)*(u[0]*lambda - u[x])^4 + (1-lambda^2)* (c[s]^2*(b[0]*lambda - b[x])^2/wt - e2*(u[0]*lambda - u[x])^2); ######################################################## "print the coefficients of the quartic polynomial fdZ"; coeff(fMB,lambda,4); coeff(fMB,lambda,3); coeff(fMB,lambda,2); coeff(fMB,lambda,1); coeff(fMB,lambda,0); fdZ := fdZ*wt; ###################################################### "fMB will be equation (56) of Mignone & Bodo (2006)"; a := gamma*(lambda-v[x]); BB := b[x] - lambda*b[0]; fMB := w*(1-c[s]^2)*a^4 - (1-lambda^2)*((b^2+w*c[s]^2)*a^2-c[s]^2*BB^2); ###################################### "check that fdZ = fMB"; simplify(fdZ - fMB); ######################################################## "print the coefficients of the quartic polynomial fMB"; coeff(fMB,lambda,4); coeff(fMB,lambda,3); coeff(fMB,lambda,2); coeff(fMB,lambda,1); coeff(fMB,lambda,0); ############################################### "Degenerate case 2: Bx = 0, Eq (58) in MB06"; B[x] := 0; a2 := w*(c[s]^2 + gamma^2*(1-c[s]^2)) + Q; a1 := -2*w*gamma^2*v[x]*(1-c[s]^2); a0 := w*(-c[s]^2 + gamma^2*v[x]^2*(1-c[s]^2))-Q; "delc is a good way to evaluate the determinant so that it is > 0"; del := a1^2 - 4*a2*a0; delc := 4*(w*c[s]^2 + Q)*(w*(1-c[s]^2)*gamma^2*(1-v[x]^2) + (w*c[s]^2+Q)); simplify(del-delc); ############################################################################ "check the correctness of the coefficients of Eq. (58) in MB06"; Q := b^2 - c[s]^2*vB^2; divide(fMB, (lambda-v[x])^2,'fMB2'); simplify(a2 - coeff(fMB2,lambda,2)/gamma^2); simplify(a1 - coeff(fMB2,lambda,1)/gamma^2); simplify(a0 - coeff(fMB2,lambda,0)/gamma^2);
Definition at line 34 of file eigenv.c.
int MaxSignalSpeed | ( | double ** | v, |
double * | a2, | ||
double * | h, | ||
double * | cmin, | ||
double * | cmax, | ||
int | beg, | ||
int | end | ||
) |
Return the rightmost (cmax) and leftmost (cmin) wave propagation speed in the Riemann fan
Definition at line 13 of file eigenv.c.
Definition at line 5 of file source.c.
int PressureFix | ( | Map_param * | par | ) |
Fix p to a small value, solve for the square of velocity by using secant algorithm applied to Eq (9) of Mignone, Plewa & Bodo (2005). This step involved re-computing W at each step of the iteration. Once the root has been found, we recompute total energy E. Return 0 if succesful, 1 otherwise.
Definition at line 22 of file pressure_fix.c.
void PRIM_EIGENVECTORS | ( | double * | , |
double | , | ||
double | , | ||
double * | , | ||
double ** | , | ||
double ** | |||
) |
void PrimToCons | ( | double ** | uprim, |
double ** | ucons, | ||
int | beg, | ||
int | end | ||
) |
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 |
Definition at line 26 of file mappers.c.
int QuarticSolve | ( | double | b, |
double | c, | ||
double | d, | ||
double | e, | ||
double * | z | ||
) |
Solve a quartic equation in the form
For its purpose, it is assumed that ALL roots are double. This makes things faster.
[in] | b | coefficient of the quartic |
[in] | c | coefficient of the quartic |
[in] | d | coefficient of the quartic |
[in] | e | coefficient of the quartic |
[out] | z | vector containing the (double) roots of the quartic |
Reference:
http://www.1728.com/quartic2.htm
Definition at line 23 of file quartic.c.
void VelocityLimiter | ( | double * | v, |
double * | vp, | ||
double * | vm | ||
) |
Check whether the total reconstructed velocity is > 1 If a superluminal value occurs, flatten distribution.
Definition at line 16 of file vel_limiter.c.
Riemann_Solver HLL_Linde_Solver |
Definition at line 221 of file mod_defs.h.
Riemann_Solver HLL_Solver |
Definition at line 221 of file mod_defs.h.
Riemann_Solver HLLC_Solver |
Definition at line 221 of file mod_defs.h.
void HLLD_Solver |
Solve Riemann problem for the isothermal MHD equations using the three-state HLLD Riemann solver of Mignone (2007).
[in,out] | state | pointer to State_1D structure |
[in] | beg | initial grid index |
[out] | end | final grid index |
[out] | cmax | 1D array of maximum characteristic speeds |
[in] | grid | pointer to array of Grid structures. |
Definition at line 221 of file mod_defs.h.
Riemann_Solver LF_Solver |
Definition at line 221 of file mod_defs.h.