Functions | Variables

convert_var.c File Reference

Functions to convert conservative->primitive variables, and <-> More...

Go to the source code of this file.

Functions

Prim1DS vsq1D_fix (const Cons1DS *pU, const Real *pBx)
 Wrapper for the fix_vsq1D function, works only for SPECIAL_RELATIVITY && MHD only.
Prim1DS entropy_fix1D (const Cons1DS *pU, const Real *pBx, const Real *ent)
 entropy_fix: SPECIAL RELATIVISTIC MHD VERSION
static Real calc_func (Real Q, Real E, Real Bsq, Real Ssq, Real Vsq, Real pgas)
 Evaluate equation A25 for E, rather than E'.
static Real calc_dfunc (Real Q, Real Bsq, Real Msq, Real Ssq, Real d, Real Vsq, Real Gsq, Real Chi)
 Evaluate A8 for E & Q, rather than E', W'.
static Real calc_ent_func (Real rho, Real pgas, Real d, Real ent)
 Evaluate equation A25 for E, rather than E'.
static Real calc_ent_dfunc (Real Q, Real Bsq, Real Msq, Real Ssq, Real d, Real Vsq, Real Gsq, Real Chi, Real pgas, Real rho)
 Evaluate A8 for E & Q, rather than E', W'.
static Real calc_vsq (Real Bsq, Real Msq, Real Ssq, Real Q)
 Obtain v^2 via eqn.
static Real calc_chi (Real d, Real Vsq, Real Gsq, Real Q)
 Evaluate from eqn.
void FUNV2 (const Real d, const Real v2, const Real p, const Real Bsq, const Real Msq, const Real Ssq, Real *W, Real *f)
PrimS Cons_to_Prim (const ConsS *pCons)
 Wrapper for the Cons1D_to_Prim1D function, works for both NEWTONIAN and SPECIAL_RELATIVITY.
ConsS Prim_to_Cons (const PrimS *pW)
 Wrapper for the Prim1D_to_Cons1D function, works for both NEWTONIAN and SPECIAL_RELATIVITY.
PrimS fix_vsq (const ConsS *pCons)
 Wrapper for the fix_vsq1D function, works only for SPECIAL_RELATIVITY && MHD only.
PrimS entropy_fix (const ConsS *pCons, const Real *ent)
 Wrapper for the entropy_fix1D function, works only for SPECIAL_RELATIVITY && MHD only.
PrimS check_Prim (const ConsS *pCons)
 Wrapper for the check_Prim1D function, works only for SPECIAL_RELATIVITY.
Prim1DS Cons1D_to_Prim1D (const Cons1DS *pU, const Real *pBx)
 Cons1D_to_Prim1D: NEWTONIAN VERSION.
Cons1DS Prim1D_to_Cons1D (const Prim1DS *pW, const Real *pBx)
 Prim1D_to_Cons1D: NEWTONIAN VERSION.
Real cfast (const Cons1DS *U, const Real *Bx)
 Returns fast magnetosonic speed given input 1D vector of conserved variables and Bx -- NEWTONIAN PHYSICS ONLY.

Variables

Real Gamma_1overGamma
static Real tol = 1.0e-10

Detailed Description

Functions to convert conservative->primitive variables, and <->

PURPOSE: Functions to convert conservative->primitive variables, and vice-versa. Routines for both Newtonian and special relativistic physics are included. Also contains function to compute fast magnetosonic speed for Newtonian flows only.

CONTAINS PUBLIC FUNCTIONS:

For special relativity, there are two versions of the Cons1D_to_Prim1D functions, one for HYDRO and one for MHD. There is also a 'check_Prim' and 'check_Prim1D' routine for SRMHD which returns a primitve state without verifying physical status.

REFERENCE: S. Noble et al., "Primitive Variable Solvers for Conservative General Relativistic Magnetohydrodynamics", ApJ. 641, 626 (2006)

A. Mignone & J. McKinney, "Equation of state in relativistic MHD: variable versus constant adiabatic index", MNRAS, 378, 1118 (2007)

HISTORY: (functions for special relativity)

Definition in file convert_var.c.


Function Documentation

static Real calc_chi ( Real  d,
Real  Vsq,
Real  Gsq,
Real  Q 
) [static]

Evaluate from eqn.

A11 using Q, rathher than Q'

static Real calc_dfunc ( Real  Q,
Real  Bsq,
Real  Msq,
Real  Ssq,
Real  d,
Real  Vsq,
Real  Gsq,
Real  Chi 
) [static]

Evaluate A8 for E & Q, rather than E', W'.

static Real calc_ent_dfunc ( Real  Q,
Real  Bsq,
Real  Msq,
Real  Ssq,
Real  d,
Real  Vsq,
Real  Gsq,
Real  Chi,
Real  pgas,
Real  rho 
) [static]

Evaluate A8 for E & Q, rather than E', W'.

static Real calc_ent_func ( Real  rho,
Real  pgas,
Real  d,
Real  ent 
) [static]

Evaluate equation A25 for E, rather than E'.

static Real calc_func ( Real  Q,
Real  E,
Real  Bsq,
Real  Ssq,
Real  Vsq,
Real  pgas 
) [static]

Evaluate equation A25 for E, rather than E'.

static Real calc_vsq ( Real  Bsq,
Real  Msq,
Real  Ssq,
Real  Q 
) [static]

Obtain v^2 via eqn.

A3

Real cfast ( const Cons1DS U,
const Real Bx 
)

Returns fast magnetosonic speed given input 1D vector of conserved variables and Bx -- NEWTONIAN PHYSICS ONLY.

Definition at line 470 of file convert_var.c.

References Cons1DS::By, Cons1DS::Bz, Cons1DS::d, Cons1DS::E, Gamma, Gamma_1, Iso_csound2, Cons1DS::Mx, Cons1DS::My, and Cons1DS::Mz.

Referenced by integrate_2d_ctu(), integrate_2d_vl(), integrate_3d_ctu(), and integrate_3d_vl().

Here is the caller graph for this function:

PrimS check_Prim ( const ConsS pCons  ) 

Wrapper for the check_Prim1D function, works only for SPECIAL_RELATIVITY.

  • conserved variables = (d,M1,M2,M3,[E],[B1c,B2c,B3c],[s(n)])
  • primitive variables = (d,V1,V2,V3,[P],[B1c,B2c,B3c],[r(n)])

Definition at line 327 of file convert_var.c.

References PrimS::B1c, ConsS::B1c, PrimS::B2c, ConsS::B2c, PrimS::B3c, ConsS::B3c, Prim1DS::By, Cons1DS::By, Prim1DS::Bz, Cons1DS::Bz, check_Prim1D(), Cons1D_to_Prim1D(), Prim1DS::d, PrimS::d, ConsS::d, Cons1DS::d, ConsS::E, Cons1DS::E, ConsS::M1, ConsS::M2, ConsS::M3, Cons1DS::Mx, Cons1DS::My, Cons1DS::Mz, n, Prim1DS::P, PrimS::P, Prim1DS::r, PrimS::r, ConsS::s, Cons1DS::s, U, PrimS::V1, PrimS::V2, PrimS::V3, Prim1DS::Vx, Prim1DS::Vy, Prim1DS::Vz, and W.

Referenced by integrate_1d_vl(), integrate_2d_vl(), integrate_3d_vl(), and ProCon().

Here is the call graph for this function:

Here is the caller graph for this function:

Prim1DS Cons1D_to_Prim1D ( const Cons1DS U,
const Real Bx 
)

Cons1D_to_Prim1D: NEWTONIAN VERSION.

Cons1D_to_Prim1D: SPECIAL RELATIVISTIC HYDRODYNAMICS VERSION.

  • conserved variables = (d,Mx,My,Mz,[E],[By,Bz],[s(n)])
  • primitive variables = (d,Vx,Vy,Vz,[P],[By,Bz],[r(n)])
  • Bx is passed in through the argument list.
  • conserved variables = (d,Mx,My,Mz,[E],[By,Bz])
  • primitive variables = (d,Vx,Vy,Vz,[P],[By,Bz])
  • Bx is passed in through the argument list.

Definition at line 512 of file convert_var.c.

References Prim1DS::d, Cons1DS::d, Cons1DS::E, Gamma, Gamma_1, Cons1DS::Mx, Cons1DS::My, Cons1DS::Mz, Prim1DS::P, Prim1DS::Vx, Prim1DS::Vy, and Prim1DS::Vz.

Referenced by check_Prim(), Cons_to_Prim(), fluxes(), integrate_1d_ctu(), integrate_1d_vl(), integrate_2d_ctu(), integrate_2d_vl(), integrate_3d_ctu(), and integrate_3d_vl().

Here is the caller graph for this function:

PrimS Cons_to_Prim ( const ConsS pCons  ) 

Wrapper for the Cons1D_to_Prim1D function, works for both NEWTONIAN and SPECIAL_RELATIVITY.

  • conserved variables = (d,M1,M2,M3,[E],[B1c,B2c,B3c],[s(n)])
  • primitive variables = (d,V1,V2,V3,[P],[B1c,B2c,B3c],[r(n)])

Definition at line 104 of file convert_var.c.

References PrimS::B1c, ConsS::B1c, PrimS::B2c, ConsS::B2c, PrimS::B3c, ConsS::B3c, Prim1DS::By, Cons1DS::By, Prim1DS::Bz, Cons1DS::Bz, Cons1D_to_Prim1D(), Prim1DS::d, PrimS::d, ConsS::d, Cons1DS::d, ConsS::E, Cons1DS::E, ConsS::M1, ConsS::M2, ConsS::M3, Cons1DS::Mx, Cons1DS::My, Cons1DS::Mz, n, Prim1DS::P, PrimS::P, Prim1DS::r, PrimS::r, ConsS::s, Cons1DS::s, U, PrimS::V1, PrimS::V2, PrimS::V3, Prim1DS::Vx, Prim1DS::Vy, Prim1DS::Vz, and W.

Referenced by dump_binary(), dump_history(), dump_tab_prim(), dump_vtk(), expr_G(), integrate_1d_vl(), integrate_2d_vl(), and integrate_3d_vl().

Here is the call graph for this function:

Here is the caller graph for this function:

PrimS entropy_fix ( const ConsS pCons,
const Real ent 
)

Wrapper for the entropy_fix1D function, works only for SPECIAL_RELATIVITY && MHD only.

  • conserved variables = (d,M1,M2,M3,[E],[B1c,B2c,B3c],[s(n)])
  • primitive variables = (d,V1,V2,V3,[P],[B1c,B2c,B3c],[r(n)])

Definition at line 271 of file convert_var.c.

References PrimS::B1c, ConsS::B1c, PrimS::B2c, ConsS::B2c, PrimS::B3c, ConsS::B3c, Prim1DS::By, Cons1DS::By, Prim1DS::Bz, Cons1DS::Bz, Prim1DS::d, PrimS::d, ConsS::d, Cons1DS::d, ConsS::E, Cons1DS::E, entropy_fix1D(), ConsS::M1, ConsS::M2, ConsS::M3, Cons1DS::Mx, Cons1DS::My, Cons1DS::Mz, n, Prim1DS::P, PrimS::P, Prim1DS::r, PrimS::r, ConsS::s, Cons1DS::s, U, PrimS::V1, PrimS::V2, PrimS::V3, Prim1DS::Vx, Prim1DS::Vy, Prim1DS::Vz, and W.

Referenced by integrate_2d_vl(), and integrate_3d_vl().

Here is the call graph for this function:

Here is the caller graph for this function:

Prim1DS entropy_fix1D ( const Cons1DS pU,
const Real pBx,
const Real ent 
)

entropy_fix: SPECIAL RELATIVISTIC MHD VERSION

Referenced by entropy_fix().

Here is the caller graph for this function:

PrimS fix_vsq ( const ConsS pCons  ) 

Wrapper for the fix_vsq1D function, works only for SPECIAL_RELATIVITY && MHD only.

  • conserved variables = (d,M1,M2,M3,[E],[B1c,B2c,B3c],[s(n)])
  • primitive variables = (d,V1,V2,V3,[P],[B1c,B2c,B3c],[r(n)])

Definition at line 216 of file convert_var.c.

References PrimS::B1c, ConsS::B1c, PrimS::B2c, ConsS::B2c, PrimS::B3c, ConsS::B3c, Prim1DS::By, Cons1DS::By, Prim1DS::Bz, Cons1DS::Bz, Prim1DS::d, PrimS::d, ConsS::d, Cons1DS::d, ConsS::E, Cons1DS::E, ConsS::M1, ConsS::M2, ConsS::M3, Cons1DS::Mx, Cons1DS::My, Cons1DS::Mz, n, Prim1DS::P, PrimS::P, Prim1DS::r, PrimS::r, ConsS::s, Cons1DS::s, U, PrimS::V1, PrimS::V2, PrimS::V3, vsq1D_fix(), Prim1DS::Vx, Prim1DS::Vy, Prim1DS::Vz, and W.

Referenced by integrate_1d_vl(), integrate_2d_vl(), and integrate_3d_vl().

Here is the call graph for this function:

Here is the caller graph for this function:

void FUNV2 ( const Real  d,
const Real  v2,
const Real  p,
const Real  Bsq,
const Real  Msq,
const Real  Ssq,
Real W,
Real f 
)
Cons1DS Prim1D_to_Cons1D ( const Prim1DS pW,
const Real pBx 
)

Prim1D_to_Cons1D: NEWTONIAN VERSION.

  • primitive variables = (d,Vx,Vy,Vz,[P],[By,Bz],[r(n)])
  • conserved variables = (d,Mx,My,Mz,[E],[By,Bz],[s(n)])
  • Bx is passed in through the argument list.

Definition at line 432 of file convert_var.c.

References Cons1DS::By, Prim1DS::By, Cons1DS::Bz, Prim1DS::Bz, Prim1DS::d, Cons1DS::d, Cons1DS::E, Gamma_1, Cons1DS::Mx, Cons1DS::My, Cons1DS::Mz, Prim1DS::P, Prim1DS::r, Cons1DS::s, Prim1DS::Vx, Prim1DS::Vy, and Prim1DS::Vz.

Referenced by integrate_1d_ctu(), integrate_1d_vl(), integrate_2d_ctu(), integrate_2d_vl(), integrate_3d_ctu(), integrate_3d_vl(), Prim_to_Cons(), problem(), and problem_read_restart().

Here is the caller graph for this function:

ConsS Prim_to_Cons ( const PrimS pW  ) 

Wrapper for the Prim1D_to_Cons1D function, works for both NEWTONIAN and SPECIAL_RELATIVITY.

  • conserved variables = (d,M1,M2,M3,[E],[B1c,B2c,B3c],[s(n)])
  • primitive variables = (d,V1,V2,V3,[P],[B1c,B2c,B3c],[r(n)])

Definition at line 159 of file convert_var.c.

References ConsS::B1c, PrimS::B1c, ConsS::B2c, PrimS::B2c, ConsS::B3c, PrimS::B3c, Cons1DS::By, Prim1DS::By, Cons1DS::Bz, Prim1DS::Bz, Cons1DS::d, ConsS::d, PrimS::d, Prim1DS::d, Cons1DS::E, ConsS::E, ConsS::M1, ConsS::M2, ConsS::M3, Cons1DS::Mx, Cons1DS::My, Cons1DS::Mz, n, PrimS::P, Prim1DS::P, Prim1D_to_Cons1D(), PrimS::r, Prim1DS::r, Cons1DS::s, ConsS::s, U, PrimS::V1, PrimS::V2, PrimS::V3, Prim1DS::Vx, Prim1DS::Vy, Prim1DS::Vz, and W.

Referenced by integrate_1d_vl(), integrate_2d_vl(), and integrate_3d_vl().

Here is the call graph for this function:

Here is the caller graph for this function:

Prim1DS vsq1D_fix ( const Cons1DS pU,
const Real pBx 
)

Wrapper for the fix_vsq1D function, works only for SPECIAL_RELATIVITY && MHD only.

Referenced by fix_vsq().

Here is the caller graph for this function:


Variable Documentation

Definition at line 43 of file convert_var.c.

Real tol = 1.0e-10 [static]

Definition at line 91 of file convert_var.c.

Referenced by bisection(), and getP().