Skip to content

Commit

Permalink
Update the remaining code with the two updated EOS_TYPE_GAMMA options
Browse files Browse the repository at this point in the history
  • Loading branch information
soumide1102 committed Mar 9, 2021
1 parent 24aee2a commit d136659
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 24 deletions.
10 changes: 6 additions & 4 deletions core/eos.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,12 @@ double EOS_enthalpy_rho0_u(double rho, double u, const double *extra) {

double EOS_entropy_rho0_u(double rho, double u, const double *extra) {
double ent;
#if EOS == EOS_TYPE_GAMMA_GASPRESS
ent = EOS_Gamma_Gaspress_entropy_rho0_u(rho, u);
#elif EOS == EOS_TYPE_GAMMA_RADPRESS
ent = EOS_Gamma_Radpress_entropy_rho0_u(rho, u);
#if EOS == EOS_TYPE_GAMMA
#if EOS_GAMMA == GASPRESS
ent = EOS_Gamma_Gaspress_entropy_rho0_u(rho, u);
#elif EOS_GAMMA == RADPRESS
ent = EOS_Gamma_Radpress_entropy_rho0_u(rho, u);
#endif
#elif EOS == EOS_TYPE_POLYTROPE
ent = EOS_Poly_entropy_rho0_u(rho, u, poly_K, poly_gam);
#elif EOS == EOS_TYPE_TABLE
Expand Down
6 changes: 5 additions & 1 deletion core/fixup.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ void fixup1zone(
fixup_passive(i, j, k, pv, pv_prefloor);
#endif

#if ELECTRONS && EOS == EOS_TYPE_GAMMA_GASPRESS
#if ELECTRONS && EOS == EOS_TYPE_GAMMA && GAMMA_EOS == GASPRESS
// Reset entropy after floors
pv[KTOT] = EOS_Gamma_Gaspress_entropy_rho0_u(pv[RHO], pv[UU]);

Expand All @@ -240,6 +240,10 @@ void fixup1zone(
pv[UU] = KTOTMAX * pow(pv[RHO], gam) / (gam - 1.);
pv[KTOT] = KTOTMAX;
}

#elif ELECTRONS && EOS == EOS_TYPE_GAMMA && GAMMA_EOS == RADPRESS
// Reset entropy after floors
pv[KTOT] = EOS_Gamma_Radpress_entropy_rho0_u(pv[RHO], pv[UU]);
#endif // ELECTRONS

// Limit gamma with respect to normal observer
Expand Down
6 changes: 3 additions & 3 deletions core/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ void dump() {
#endif // RADIATION
#endif // METRIC

#if EOS == EOS_TYPE_GAMMA || EOS_TYPE_GAMMA_GASPRESS || EOS_TYPE_GAMMA_RADPRESS || GAMMA_FALLBACK
#if EOS == EOS_TYPE_GAMMA || GAMMA_FALLBACK
WRITE_HDR(gam, TYPE_DBL);
#endif // GAMMA
#if EOS == EOS_TYPE_POLYTROPE
Expand Down Expand Up @@ -1099,7 +1099,7 @@ void restart_write(int restart_type) {
#endif // METRIC

// EOS
#if EOS == EOS_TYPE_GAMMA || EOS_TYPE_GAMMA_GASPRESS || EOS_TYPE_GAMMA_RADPRESS || GAMMA_FALLBACK
#if EOS == EOS_TYPE_GAMMA || GAMMA_FALLBACK
WRITE_HDR(gam, TYPE_DBL);
#endif // GAMMA EOS
#if EOS == EOS_TYPE_POLYTROPE
Expand Down Expand Up @@ -1381,7 +1381,7 @@ void restart_read(char *fname) {

READ_HDR(cour, TYPE_DBL);

#if EOS == EOS_TYPE_GAMMA || EOS_TYPE_GAMMA_GASPRESS || EOS_TYPE_GAMMA_RADPRESS || GAMMA_FALLBACK
#if EOS == EOS_TYPE_GAMMA || GAMMA_FALLBACK
READ_HDR(gam, TYPE_DBL);
#endif // EOS

Expand Down
11 changes: 5 additions & 6 deletions core/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ int main(int argc, char *argv[]) {
#endif
#if EOS == EOS_TYPE_GAMMA
fprintf(stdout, " * IDEAL GAS EOS *\n");
#endif
#if EOS == EOS_TYPE_GAMMA_GASPRESS
fprintf(stdout, " * GAS-PRESSURE DOMINATED EOS *\n");
#endif
#if EOS == EOS_TYPE_GAMMA_RADPRESS
fprintf(stdout, " * RADIATION-PRESSURE DOMINATED EOS *\n");
#if EOS_GAMMA == GASPRESS
fprintf(stdout, " * GAS-PRESSURE DOMINATED IDEAL GAS EOS *\n");
#elif EOS_GAMMA == RADPRESS
fprintf(stdout, " * RADIATION-PRESSURE DOMINATED IDEAL GAS EOS *\n");
#endif
#endif
#if RADIATION == RADTYPE_LIGHT
fprintf(stdout, " * RADIATION: PHOTON TRANSPORT *\n");
Expand Down
2 changes: 1 addition & 1 deletion core/phys.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void mhd_vchar(double *Pr, struct of_state *q, struct of_geom *geom, int js,
bsq = dot(q->bcon, q->bcov);
rho = fabs(Pr[RHO] + SMALL);
u = Pr[UU];
#if EOS == EOS_TYPE_GAMMA || EOS_TYPE_GAMMA_GASPRESS || EOS_TYPE_GAMMA_RADPRESS || GAMMA_FALLBACK
#if EOS == EOS_TYPE_GAMMA || GAMMA_FALLBACK
u = fabs(u + SMALL);
#endif
ef = EOS_enthalpy_rho0_u(rho, u, extra);
Expand Down
2 changes: 1 addition & 1 deletion core/utop.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ int Utoprim(double U[NVAR], struct of_geom *geom, double prim[NVAR]) {
// Return without updating non-B primitives
if (rho0 < 0)
return (5);
#if EOS == EOS_TYPE_GAMMA || EOS_TYPE_GAMMA_GASPRESS || EOS_TYPE_GAMMA_RADPRESS || GAMMA_FALLBACK
#if EOS == EOS_TYPE_GAMMA || GAMMA_FALLBACK
if (u < 0)
return (5);
#endif
Expand Down
16 changes: 8 additions & 8 deletions prob/torus_cbc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@
EOS_GAMMA = "GASPRESS"
GAMMA = 5./3.
else:
print("Using the default gas-pressure dominated ideal gas EoS.
You can choose gas-pressure dominated (add flag -gammagaspress),
radiation-pressure dominated (add flag -gammaradpress).")
print('Using the default gas-pressure dominated ideal gas EoS.',
'You can choose gas-pressure dominated (add flag -gammagaspress)',
'radiation-pressure dominated (add flag -gammaradpress).')
EOS_GAMMA = "GASPRESS"
GAMMA = 4./3.
else:
Expand All @@ -175,9 +175,9 @@
ENTROPY = float(sys.argv[sys.argv.index('-ent') + 1])
else:
ENTROPY = 4
if EOS_TYPE == "EOS_TYPE_GAMMA" and EOS_GAMMA == "RADPRESS":
print("Using the default initial entropy = 4.", end=' ')
print("Entropy is a required parameter in setting up radiation-pressure dominated disks.")
if EOS_TYPE == "EOS_TYPE_GAMMA" and EOS_GAMMA == "RADPRESS":
print('Using the default initial entropy = 4.',
'Entropy is a required parameter in setting up radiation-pressure dominated disks.')

bhl.report_var('ENTROPY',ENTROPY)

Expand All @@ -186,8 +186,8 @@
else:
KAPPA_EOS = 1.e-3
if EOS_TYPE == "EOS_TYPE_GAMMA" and EOS_GAMMA == "GASPRESS":
print("Using the default initial kappa = 1.e-3.", end=' ')
print("kappa is a required parameter in setting up gas-pressure dominated disks.")
print('Using the default initial kappa = 1.e-3.',
'kappa is a required parameter in setting up gas-pressure dominated disks.')

if CLASSIC: # classic harm disk
# Rmax and rho fixed
Expand Down

0 comments on commit d136659

Please sign in to comment.