38 double rhoh_g2,
scrh, g;
39 double beta_fix = 0.9999;
49 for (ii = ibeg; ii <= iend; ii++) {
58 print (
"! u^2 > 1 (%f) in PrimToCons\n", scrh);
67 g = beta_fix*beta_fix;
70 scrh = rhoh_g2 = v[
RHO]*h[ii]*g;
74 EXPAND(u[
MX1] = scrh*v[VX1]; ,
78 ucons[ii][ENG] = rhoh_g2 - v[PRS];
84 #if CHECK_CONSERVATIVE_VAR == YES
86 g = u[ENG] - sqrt(m2);
88 printf (
"! E - m < 0 in PrimToCons (%12.6e)\n",g);
91 g = u[
RHO]/u[ENG] - sqrt(1.0 - m2/u[ENG]/u[ENG]);
93 print (
"! g > 0.0 in PrimToCons(2) (%12.6e)\n",g);
102 int ConsToPrim (
double **ucons,
double **uprim,
int ibeg,
int iend,
123 int nv,
i, err, ifail;
124 int use_entropy, use_energy=1;
130 for (i = ibeg; i <= iend; i++) {
148 print(
"! ConsToPrim: negative density (%8.2e), ", u[
RHO]);
157 print(
"! ConsToPrim: negative energy (%8.2e), ", u[ENG]);
160 u[ENG] = sqrt(1.e-8 + par.
m2 + u[
RHO]*u[
RHO]);
172 use_energy = !use_entropy;
213 scrh = 1.0/(u[ENG] + v[PRS]);
215 EXPAND(v[
VX1] = u[MX1]*scrh; ,
220 g = 1.0/sqrt(1.0 - g);
double m2
Square of total momentum (input).
double D
Lab density (input).
double g_smallDensity
Small value for density fix.
int PressureFix(Map_param *)
void Enthalpy(double **v, real *h, int beg, int end)
int EnergySolve(Map_param *par)
#define FLAG_CONS2PRIM_FAIL
#define FLAG_ENTROPY
Update pressure using entropy equation.
int ConsToPrim(double **ucons, double **uprim, int ibeg, int iend, unsigned char *flag)
int EntropySolve(Map_param *par)
void print(const char *fmt,...)
#define ARRAY_1D(nx, type)
void Show(double **, int)
long int NMAX_POINT
Maximum number of points among the three directions, boundaries excluded.
void PrimToCons(double **uprim, double **ucons, int ibeg, int iend)
double prs
Thermal pressure (output).
double sigma_c
Conserved entropy (input).
#define QUIT_PLUTO(e_code)
double E
Total energy (input).