PLUTO
4.4-patch2
|
Module header file for relativistic MHD (RMHD). More...
Go to the source code of this file.
Data Structures | |
struct | Map_param |
Macros | |
#define | RMHD_FAST_EIGENVALUES NO |
#define | RMHD_REDUCED_ENERGY YES |
Functions | |
int | ApproximateFastWaves (double *, double, double, double *) |
int | ConsToPrim (double **, double **, int, int, uint16_t *) |
void | Flux (const State *, int, int) |
void | HLL_Speed (const State *, const State *, double *, double *, int, int) |
int | MaxSignalSpeed (const State *, 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 | RMHD_EnergySolve (Map_param *) |
int | RMHD_PressureFix (Map_param *) |
void | HLL_DIVB_SOURCE (const Sweep *, double **, int, int, Grid *) |
Variables | |
Riemann_Solver | HLLD_Solver |
Set label, indexes and basic prototyping for the relativistic MHD module.
#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.
#define RMHD_REDUCED_ENERGY YES |
By turning RMHD_REDUCED_ENERGY to YES, we let PLUTO evolve the total energy minus the mass density contribution.
int ApproximateFastWaves | ( | 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].
[in] | v | an array of primitive variables |
[in] | cs2 | the sound speed |
[in] | h | the specific entropy |
[out] | lambda | an array containing the fast magnetosonic speeds |
int ConsToPrim | ( | double ** | ucons, |
double ** | uprim, | ||
int | beg, | ||
int | end, | ||
uint16_t * | 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. |
void Flux | ( | const State * | state, |
int | beg, | ||
int | end | ||
) |
[in,out] | state | Pointer to a state structure |
[in] | beg | initial index of computation |
[in] | end | final index of computation |
Compute the component of the flux tensor normal to the direction of integration.
[in,out] | state | Pointer to a state structure |
[in] | beg | initial index of computation |
[in] | end | final index of computation |
[in,out] | state | Pointer to a state structure |
[in] | beg | initial index of computation |
[in] | end | final index of computation |
Compute the component of the flux tensor normal to the direction of integration.
[in,out] | state | Pointer to a state structure |
[in] | beg | initial index of computation |
[in] | end | final index of computation |
Include div.B source term to momentum, induction and energy equation. Used in conjunction with an HLL-type Riemann solver.
LAST_MODIFIED
Setp 18th 2008, by Andrea Mignone (migno) ne@t o.ast ro.i t
void HLL_Speed | ( | const State * | stateL, |
const State * | stateR, | ||
double * | SL, | ||
double * | SR, | ||
int | beg, | ||
int | end | ||
) |
Compute leftmost (SL) and rightmost (SR) speeds for the Riemann fan.
[in] | stateL | pointer to a state structure for the left state |
[in] | stateR | pointer to a state structure 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 |
Switches:
ROE_ESTIMATE (YES/NO), DAVIS_ESTIMATE (YES/NO). TVD_ESTIMATE (YES/NO) JAN_HLL (YES/NO)
These switches set how the wave speed estimates are going to be computed. Only one can be set to 'YES', and the rest of them must be set to 'NO'
ROE_ESTIMATE: b_m = (0, (u_R - c_R, u_L - c_L, u_{roe} - c_{roe})) b_m = (0, (u_R + c_R, u_L + c_L, u_{roe} + c_{roe}))
where u_{roe} and c_{roe} are computed using Roe averages.
DAVIS_ESTIMATE: b_m = (0, (u_R - c_R, u_L - c_L)) b_m = (0, (u_R + c_R, u_L + c_L))
Compute leftmost (SL) and rightmost (SR) speeds for the Riemann fan.
[in] | stateL | pointer to a state structure for the left state |
[in] | stateR | pointer to a state structure 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 |
Switches:
ROE_ESTIMATE (YES/NO), DAVIS_ESTIMATE (YES/NO)
These switches set how the wave speed estimates are going to be computed. Only one can be set to 'YES', and the rest of them must be set to 'NO'
ROE_ESTIMATE: b_m = (0, (u_R - c_R, u_L - c_L, u_{roe} - c_{roe})) b_m = (0, (u_R + c_R, u_L + c_L, u_{roe} + c_{roe}))
where u_{roe} and c_{roe} are computed using Roe averages.
DAVIS_ESTIMATE: b_m = (0, (u_R - c_R, u_L - c_L)) b_m = (0, (u_R + c_R, u_L + c_L))
Compute leftmost (SL) and rightmost (SR) speeds for the Riemann fan.
[in] | stateL | pointer to a state structure for the left state |
[in] | stateR | pointer to a state structure 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 |
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(fdZ,lambda,4); coeff(fdZ,lambda,3); coeff(fdZ,lambda,2); coeff(fdZ,lambda,1); coeff(fdZ,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);
int MaxSignalSpeed | ( | const State * | state, |
double * | cmin, | ||
double * | cmax, | ||
int | beg, | ||
int | end | ||
) |
Compute the maximum and minimum characteristic velocities for the HD equations from the vector of primitive variables state->v.
[in] | state | pointer to a State structure |
[out] | cmin | 1-D array containing the leftmost characteristic |
[out] | cmin | 1-D array containing the rightmost characteristic |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
Compute the maximum and minimum characteristic velocities for the MHD equations, cmin= v - cf, cmax = v + cf
[in] | state | pointer to a State structure |
[out] | cmin | 1-D array containing the leftmost characteristic |
[out] | cmin | 1-D array containing the rightmost characteristic |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
Return the rightmost (cmax) and leftmost (cmin) wave propagation speed in the Riemann fan
Compute the maximum and minimum propagation speeds for the RHD equations.
[in] | state | pointer to a State structure |
[out] | cmin | 1-D array containing the leftmost characteristic |
[out] | cmin | 1-D array containing the rightmost characteristic |
[in] | beg | starting index of computation |
[in] | end | final index of computation |
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 a vector of primitive quantities to conservative
int RMHD_EnergySolve | ( | Map_param * | par | ) |
Solve f(W) = 0, where f(W) is Equation (A4) or (A6).
int RMHD_PressureFix | ( | Map_param * | par | ) |
void VelocityLimiter | ( | double * | v, |
double * | vp, | ||
double * | vm | ||
) |
Check whether the total reconstructed velocity is > 1 If a superluminal value occurs, flatten distribution.
void HLLD_Solver |
Solve Riemann problem for the isothermal MHD equations using the three-states HLLD Riemann solver of Mignone (2007).