Skip to content

Commit

Permalink
AsterX: add support for EOS calls using temperature
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay Kalinani committed Dec 5, 2024
1 parent fb2feb6 commit feb3213
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
6 changes: 3 additions & 3 deletions AsterX/par/atmo_APR4.par
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ AsterX::update_tmunu = "no"

ReconX::reconstruction_method = "wenoz"

Con2PrimFactory::c2p_prime = "Noble"
Con2PrimFactory::c2p_prime = "Palenzuela"
Con2PrimFactory::c2p_second = "Palenzuela"
Con2PrimFactory::c2p_tol = 1e-8
Con2PrimFactory::max_iter = 100
Expand All @@ -81,9 +81,9 @@ Con2PrimFactory::vw_lim = 1e8
Con2PrimFactory::Ye_lenient = "yes"

EOSX::evolution_eos = "Tabulated3d"
EOSX::EOSTable_filename = "/ddnA/project/sbrandt/carpetx/acwen/EOS/APR_3335_rho393_temp133_ye66_gitM180edd5_20190225_adj_mineps0.h5"
EOSX::EOSTable_filename = "/work2/09228/jkalinan/frontera/AsterX_BNS/tabeos_tovid/APR_3335_rho393_temp133_ye66_gitM180edd5_20190225_adj_mineps0.h5"

ID_TabEOS_HydroQuantities::Y_e_filename = "/ddnA/project/sbrandt/carpetx/acwen/EOS/Ye_beq_SCAPR4_mineps0.txt"
ID_TabEOS_HydroQuantities::Y_e_filename = "/home1/09228/jkalinan/AsterX_BNS/tabeos_tovid/Ye_beq_SCAPR4_mineps0.txt"
ID_TabEOS_HydroQuantities::id_entropy_type = "from table"
ID_TabEOS_HydroQuantities::id_rho_atm_max = 1e-8
ID_TabEOS_HydroQuantities::id_Y_e_atm = 0.5
Expand Down
2 changes: 2 additions & 0 deletions AsterX/param.ccl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ USES CCTK_REAL rho_abs_min
USES CCTK_REAL atmo_tol
USES CCTK_REAL eps_atmo
USES CCTK_REAL p_atmo
USES CCTK_REAL t_atmo
USES CCTK_REAL Ye_atmo
USES CCTK_REAL B_lim
USES CCTK_REAL vw_lim
Expand All @@ -110,6 +111,7 @@ USES CCTK_REAL c2p_tol
USES CCTK_REAL r_atmo
USES CCTK_REAL n_rho_atmo
USES CCTK_REAL n_press_atmo
USES CCTK_REAL n_temp_atmo
USES BOOLEAN thermal_eos_atmo
USES CCTK_REAL alp_thresh
USES CCTK_REAL rho_BH
Expand Down
2 changes: 1 addition & 1 deletion AsterX/schedule.ccl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ SCHEDULE AsterX_Fluxes IN AsterX_RHSGroup
READS: ADMBaseX::lapse(everywhere)
READS: ADMBaseX::shift(everywhere)
READS: dens(everywhere) tau(everywhere) mom(everywhere)
READS: HydroBaseX::rho(everywhere) HydroBaseX::vel(everywhere) HydroBaseX::press(everywhere) HydroBaseX::eps(everywhere) HydroBaseX::Ye(everywhere)
READS: HydroBaseX::rho(everywhere) HydroBaseX::vel(everywhere) HydroBaseX::press(everywhere) HydroBaseX::eps(everywhere) HydroBaseX::temperature(everywhere) HydroBaseX::Ye(everywhere)
READS: HydroBaseX::Bvec(everywhere)
READS: dBx_stag(everywhere) dBy_stag(everywhere) dBz_stag(everywhere)
READS: zvec_x(everywhere) zvec_y(everywhere) zvec_z(everywhere)
Expand Down
6 changes: 5 additions & 1 deletion AsterX/src/con2prim.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void AsterX_Con2Prim_typeEoS(CCTK_ARGUMENTS, EOSIDType *eos_1p,
CCTK_REAL rho_atm = 0.0; // dummy initialization
CCTK_REAL press_atm = 0.0; // dummy initialization
CCTK_REAL eps_atm = 0.0; // dummy initialization
CCTK_REAL temp_atm = 0.0; // dummy initialization
CCTK_REAL local_eps_BH = eps_BH;
CCTK_REAL radial_distance = sqrt(p.x * p.x + p.y * p.y + p.z * p.z);

Expand All @@ -73,7 +74,10 @@ void AsterX_Con2Prim_typeEoS(CCTK_ARGUMENTS, EOSIDType *eos_1p,
press_atm = (radial_distance > r_atmo)
? (p_atmo * pow(r_atmo / radial_distance, n_press_atmo))
: p_atmo;
eps_atm = eos_3p->eps_from_valid_rho_press_ye(rho_atm, press_atm, Ye_atmo);
temp_atm = (radial_distance > t_atmo)
? (p_atmo * pow(r_atmo / radial_distance, n_temp_atmo))
: t_atmo;
eps_atm = eos_3p->eps_from_valid_rho_temp_ye(rho_atm, temp_atm, Ye_atmo);
} else {
const CCTK_REAL gm1 = eos_1p->gm1_from_valid_rho(rho_atm);
eps_atm = eos_1p->sed_from_valid_gm1(gm1);
Expand Down
18 changes: 12 additions & 6 deletions AsterX/src/fluxes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,20 @@ void CalcFlux(CCTK_ARGUMENTS, EOSType *eos_3p) {
rho_rc(1) = rho_abs_min;
}

vec<CCTK_REAL, 2> press_rc{reconstruct_pt(press, p, false, true)};
//vec<CCTK_REAL, 2> press_rc{reconstruct_pt(press, p, false, true)};
const vec<CCTK_REAL, 2> temp_rc{reconstruct_pt(temperature, p, false, false)};
const vec<CCTK_REAL, 2> Ye_rc{reconstruct_pt(Ye, p, false, false)};

vec<CCTK_REAL, 2> eps_rc([&](int f) ARITH_INLINE {
return eos_3p->eps_from_valid_rho_temp_ye(rho_rc(f), temp_rc(f),
Ye_rc(f));
});

vec<CCTK_REAL, 2> press_rc([&](int f) ARITH_INLINE {
return eos_3p->press_from_valid_rho_eps_ye(rho_rc(f), eps_rc(f),
Ye_rc(f));
});

// TODO: currently sets negative reconstructed pressure to 0 since eps_min=0
// for ideal gas
if (press_rc(0) < 0) {
Expand All @@ -235,11 +246,6 @@ void CalcFlux(CCTK_ARGUMENTS, EOSType *eos_3p) {
eos_3p->press_from_valid_rho_eps_ye(rho_rc(1), eos_3p->rgeps.min, Ye_rc(1));
}

vec<CCTK_REAL, 2> eps_rc([&](int f) ARITH_INLINE {
return eos_3p->eps_from_valid_rho_press_ye(rho_rc(f), press_rc(f),
Ye_rc(f));
});

const vec<CCTK_REAL, 2> rhoh_rc([&](int f) ARITH_INLINE {
return rho_rc(f) + rho_rc(f)*eps_rc(f) + press_rc(f);
});
Expand Down

0 comments on commit feb3213

Please sign in to comment.