Skip to content

Commit

Permalink
AsterX: Final changes, remove EntropyInitial, change C2P interface, m…
Browse files Browse the repository at this point in the history
…inor changes
  • Loading branch information
Michail Chabanov committed Nov 26, 2024
1 parent 83084bb commit 1ee3a88
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 156 deletions.
23 changes: 13 additions & 10 deletions AsterX/src/con2prim.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,22 @@ void AsterX_Con2Prim_typeEoS(CCTK_ARGUMENTS, EOSIDType &eos_cold,
atmosphere atmo(rho_atm, eps_atm, Ye_atmo, press_atm, entropy_atm, rho_atmo_cut);

// Construct Noble c2p object:
c2p_2DNoble c2p_Noble(eos_th, atmo, max_iter, c2p_tol, vw_lim,
B_lim, Ye_lenient, cons_error_limit, use_z,
alp_thresh, rho_BH, eps_BH, vwlim_BH);
c2p_2DNoble c2p_Noble(eos_th, atmo, max_iter, c2p_tol,
alp_thresh, cons_error_limit,
vw_lim, B_lim, rho_BH, eps_BH, vwlim_BH,
Ye_lenient, use_z);

// Construct Palenzuela c2p object:
c2p_1DPalenzuela c2p_Pal(eos_th, atmo, max_iter, c2p_tol,
vw_lim, B_lim, Ye_lenient, cons_error_limit, use_z,
alp_thresh, rho_BH, eps_BH, vwlim_BH);
c2p_1DPalenzuela c2p_Pal(eos_th, atmo, max_iter, c2p_tol,
alp_thresh, cons_error_limit,
vw_lim, B_lim, rho_BH, eps_BH, vwlim_BH,
Ye_lenient, use_z);

// Construct Entropy c2p object:
c2p_1DEntropy c2p_Ent(eos_th, atmo, max_iter, c2p_tol,
vw_lim, B_lim, Ye_lenient, cons_error_limit, use_z,
alp_thresh, rho_BH, eps_BH, vwlim_BH);
c2p_1DEntropy c2p_Ent(eos_th, atmo, max_iter, c2p_tol,
alp_thresh, cons_error_limit,
vw_lim, B_lim, rho_BH, eps_BH, vwlim_BH,
Ye_lenient, use_z);

/* Get covariant metric */
const smat<CCTK_REAL, 3> glo(
Expand Down Expand Up @@ -253,7 +256,7 @@ void AsterX_Con2Prim_typeEoS(CCTK_ARGUMENTS, EOSIDType &eos_cold,
Avec_x(p.I), Avec_y(p.I), Avec_z(p.I));
}

if ( (alp(p.I) < alp_thresh) && ( (pv_seeds.rho > rho_BH) || (pv_seeds.eps > eps_BH) ) ) {
if ( (alp(p.I) < alp_thresh) ) {
c2p_Noble.bh_interior_fail(eos_th,pv,cv,glo);
} else {
// set to atmo
Expand Down
15 changes: 7 additions & 8 deletions Con2PrimFactory/src/c2p.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,20 @@ class c2p {
protected:
/* The constructor must initialize the following variables */

atmosphere atmo;
CCTK_INT maxIterations;
CCTK_REAL tolerance;
bool ye_lenient;
CCTK_REAL v_lim;
CCTK_REAL w_lim;
CCTK_REAL alp_thresh;
CCTK_REAL cons_error;
CCTK_REAL vw_lim;
CCTK_REAL w_lim;
CCTK_REAL v_lim;
CCTK_REAL Bsq_lim;
atmosphere atmo;
CCTK_REAL cons_error;
bool use_zprim;
// Parameters for BH interiors
CCTK_REAL alp_thresh;
CCTK_REAL rho_BH;
CCTK_REAL eps_BH;
CCTK_REAL vwlim_BH;
bool ye_lenient;
bool use_zprim;

CCTK_HOST CCTK_DEVICE CCTK_ATTRIBUTE_ALWAYS_INLINE inline CCTK_REAL
get_Ssq_Exact(const vec<CCTK_REAL, 3> &mom,
Expand Down
26 changes: 13 additions & 13 deletions Con2PrimFactory/src/c2p_1DEntropy.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public:
/* Constructor */
template <typename EOSType>
CCTK_HOST CCTK_DEVICE CCTK_ATTRIBUTE_ALWAYS_INLINE inline c2p_1DEntropy(
const EOSType &eos_th, const atmosphere &atm, CCTK_INT maxIter, CCTK_REAL tol,
CCTK_REAL vwlim, CCTK_REAL B_lim, bool ye_len,
CCTK_REAL consError, bool use_z, CCTK_REAL alp_thresh_in,
CCTK_REAL rho_BH_in, CCTK_REAL eps_BH_in, CCTK_REAL vwlim_BH_in);
const EOSType &eos_th, const atmosphere &atm, CCTK_INT maxIter, CCTK_REAL tol,
CCTK_REAL alp_thresh_in, CCTK_REAL consError,
CCTK_REAL vwlim, CCTK_REAL B_lim, CCTK_REAL rho_BH_in, CCTK_REAL eps_BH_in, CCTK_REAL vwlim_BH_in,
bool ye_len, bool use_z);

CCTK_HOST CCTK_DEVICE CCTK_ATTRIBUTE_ALWAYS_INLINE inline CCTK_REAL
get_Ssq_Exact(const vec<CCTK_REAL, 3> &mom, const smat<CCTK_REAL, 3> &gup) const;
Expand Down Expand Up @@ -55,26 +55,26 @@ public:
template <typename EOSType>
CCTK_HOST CCTK_DEVICE
CCTK_ATTRIBUTE_ALWAYS_INLINE inline c2p_1DEntropy::c2p_1DEntropy(
const EOSType &eos_th, const atmosphere &atm, CCTK_INT maxIter, CCTK_REAL tol,
CCTK_REAL vwlim, CCTK_REAL B_lim, bool ye_len,
CCTK_REAL consError, bool use_z, CCTK_REAL alp_thresh_in,
CCTK_REAL rho_BH_in, CCTK_REAL eps_BH_in, CCTK_REAL vwlim_BH_in) {
const EOSType &eos_th, const atmosphere &atm, CCTK_INT maxIter, CCTK_REAL tol,
CCTK_REAL alp_thresh_in, CCTK_REAL consError,
CCTK_REAL vwlim, CCTK_REAL B_lim, CCTK_REAL rho_BH_in, CCTK_REAL eps_BH_in, CCTK_REAL vwlim_BH_in,
bool ye_len, bool use_z) {

// Base
atmo = atm;
maxIterations = maxIter;
tolerance = tol;
ye_lenient = ye_len;
alp_thresh = alp_thresh_in;
cons_error = consError;
vw_lim = vwlim;
w_lim = sqrt(1.0 + vw_lim * vw_lim);
v_lim = vw_lim / w_lim;
Bsq_lim = B_lim * B_lim;
atmo = atm;
cons_error = consError;
use_zprim = use_z;
alp_thresh = alp_thresh_in;
rho_BH = rho_BH_in;
eps_BH = eps_BH_in;
vwlim_BH = vwlim_BH_in;
ye_lenient = ye_len;
use_zprim = use_z;

// Derived
GammaIdealFluid = eos_th.gamma;
Expand Down
24 changes: 12 additions & 12 deletions Con2PrimFactory/src/c2p_1DPalenzuela.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public:
/* Constructor */
template <typename EOSType>
CCTK_HOST CCTK_DEVICE CCTK_ATTRIBUTE_ALWAYS_INLINE inline c2p_1DPalenzuela(
const EOSType &eos_th, const atmosphere &atm, CCTK_INT maxIter, CCTK_REAL tol,
CCTK_REAL vwlim, CCTK_REAL B_lim, bool ye_len,
CCTK_REAL consError, bool use_z, CCTK_REAL alp_thresh_in,
CCTK_REAL rho_BH_in, CCTK_REAL eps_BH_in, CCTK_REAL vwlim_BH_in);
const EOSType &eos_th, const atmosphere &atm, CCTK_INT maxIter, CCTK_REAL tol,
CCTK_REAL alp_thresh_in, CCTK_REAL consError,
CCTK_REAL vwlim, CCTK_REAL B_lim, CCTK_REAL rho_BH_in, CCTK_REAL eps_BH_in, CCTK_REAL vwlim_BH_in,
bool ye_len, bool use_z);

CCTK_HOST CCTK_DEVICE CCTK_ATTRIBUTE_ALWAYS_INLINE inline CCTK_REAL
get_Ssq_Exact(const vec<CCTK_REAL, 3> &mom,
Expand Down Expand Up @@ -60,25 +60,25 @@ template <typename EOSType>
CCTK_HOST CCTK_DEVICE
CCTK_ATTRIBUTE_ALWAYS_INLINE inline c2p_1DPalenzuela::c2p_1DPalenzuela(
const EOSType &eos_th, const atmosphere &atm, CCTK_INT maxIter, CCTK_REAL tol,
CCTK_REAL vwlim, CCTK_REAL B_lim, bool ye_len,
CCTK_REAL consError, bool use_z, CCTK_REAL alp_thresh_in,
CCTK_REAL rho_BH_in, CCTK_REAL eps_BH_in, CCTK_REAL vwlim_BH_in) {
CCTK_REAL alp_thresh_in, CCTK_REAL consError,
CCTK_REAL vwlim, CCTK_REAL B_lim, CCTK_REAL rho_BH_in, CCTK_REAL eps_BH_in, CCTK_REAL vwlim_BH_in,
bool ye_len, bool use_z) {

// Base
atmo = atm;
maxIterations = maxIter;
tolerance = tol;
ye_lenient = ye_len;
alp_thresh = alp_thresh_in;
cons_error = consError;
vw_lim = vwlim;
w_lim = sqrt(1.0 + vw_lim * vw_lim);
v_lim = vw_lim / w_lim;
Bsq_lim = B_lim * B_lim;
atmo = atm;
cons_error = consError;
use_zprim = use_z;
alp_thresh = alp_thresh_in;
rho_BH = rho_BH_in;
eps_BH = eps_BH_in;
vwlim_BH = vwlim_BH_in;
ye_lenient = ye_len;
use_zprim = use_z;

// Derived
GammaIdealFluid = eos_th.gamma;
Expand Down
24 changes: 12 additions & 12 deletions Con2PrimFactory/src/c2p_2DNoble.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public:
/* Constructor */
template <typename EOSType>
CCTK_HOST CCTK_DEVICE CCTK_ATTRIBUTE_ALWAYS_INLINE inline c2p_2DNoble(
const EOSType &eos_th, const atmosphere &atm, CCTK_INT maxIter, CCTK_REAL tol,
CCTK_REAL vwlim, CCTK_REAL B_lim, bool ye_len,
CCTK_REAL consError, bool use_z, CCTK_REAL alp_thresh_in,
CCTK_REAL rho_BH_in, CCTK_REAL eps_BH_in, CCTK_REAL vwlim_BH_in);
const EOSType &eos_th, const atmosphere &atm, CCTK_INT maxIter, CCTK_REAL tol,
CCTK_REAL alp_thresh_in, CCTK_REAL consError,
CCTK_REAL vwlim, CCTK_REAL B_lim, CCTK_REAL rho_BH_in, CCTK_REAL eps_BH_in, CCTK_REAL vwlim_BH_in,
bool ye_len, bool use_z);

CCTK_HOST CCTK_DEVICE CCTK_ATTRIBUTE_ALWAYS_INLINE inline CCTK_REAL
get_Ssq_Exact(const vec<CCTK_REAL, 3> &mom,
Expand Down Expand Up @@ -72,25 +72,25 @@ template <typename EOSType>
CCTK_HOST
CCTK_DEVICE CCTK_ATTRIBUTE_ALWAYS_INLINE inline c2p_2DNoble::c2p_2DNoble(
const EOSType &eos_th, const atmosphere &atm, CCTK_INT maxIter, CCTK_REAL tol,
CCTK_REAL vwlim, CCTK_REAL B_lim, bool ye_len,
CCTK_REAL consError, bool use_z, CCTK_REAL alp_thresh_in,
CCTK_REAL rho_BH_in, CCTK_REAL eps_BH_in, CCTK_REAL vwlim_BH_in) {
CCTK_REAL alp_thresh_in, CCTK_REAL consError,
CCTK_REAL vwlim, CCTK_REAL B_lim, CCTK_REAL rho_BH_in, CCTK_REAL eps_BH_in, CCTK_REAL vwlim_BH_in,
bool ye_len, bool use_z) {

// Base
atmo = atm;
maxIterations = maxIter;
tolerance = tol;
ye_lenient = ye_len;
alp_thresh = alp_thresh_in;
cons_error = consError;
vw_lim = vwlim;
w_lim = sqrt(1.0 + vw_lim * vw_lim);
v_lim = vw_lim / w_lim;
Bsq_lim = B_lim * B_lim;
atmo = atm;
cons_error = consError;
use_zprim = use_z;
alp_thresh = alp_thresh_in;
rho_BH = rho_BH_in;
eps_BH = eps_BH_in;
vwlim_BH = vwlim_BH_in;
ye_lenient = ye_len;
use_zprim = use_z;

// Derived
GammaIdealFluid = eos_th.gamma;
Expand Down
13 changes: 7 additions & 6 deletions Con2PrimFactory/src/test.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ extern "C" void Con2PrimFactory_Test(CCTK_ARGUMENTS) {
const CCTK_REAL vwlim_BH = 1e20;

// Con2Prim objects
// (eos_th, atmo, max_iter, c2p_tol,
// vw_lim, B_lim, Ye_lenient, cons_error_limit, use_z, alp_thresh,
// rho_BH, eps_BH, vwlim_BH)
c2p_2DNoble c2p_Noble(eos_th, atmo, 100, 1e-8, 1, 1, true,-1.,false, alp_thresh, rho_BH, eps_BH, vwlim_BH);
c2p_1DPalenzuela c2p_Pal(eos_th, atmo, 100, 1e-8, 1, 1, true,-1.,false, alp_thresh, rho_BH, eps_BH, vwlim_BH);
c2p_1DEntropy c2p_Ent(eos_th, atmo, 100, 1e-8, 1, 1, true,-1.,false, alp_thresh, rho_BH, eps_BH, vwlim_BH);
// (eos_th, atmo, max_iter, c2p_tol
// alp_thresh, cons_error_limit,
// vw_lim, B_lim, rho_BH, eps_BH, vwlim_BH,
// Ye_lenient, use_z)
c2p_2DNoble c2p_Noble(eos_th, atmo, 100, 1e-8, alp_thresh, -1., 1, 1, rho_BH, eps_BH, vwlim_BH, true, false);
c2p_1DPalenzuela c2p_Pal(eos_th, atmo, 100, 1e-8, alp_thresh, -1., 1, 1, rho_BH, eps_BH, vwlim_BH, true, false);
c2p_1DEntropy c2p_Ent(eos_th, atmo, 100, 1e-8, alp_thresh, -1., 1, 1, rho_BH, eps_BH, vwlim_BH, true, false);

// Construct error report object:
c2p_report rep_Noble;
Expand Down
2 changes: 1 addition & 1 deletion EOSX/param.ccl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CCTK_REAL rho_max "Validity region: max density" STEERABLE=RECOVER
CCTK_REAL rho_min "Validity region: min density" STEERABLE=RECOVER
{
(0:* :: ""
} 1.0e-20
} 1.0e-100

CCTK_REAL eps_max "Validity region: max internal specific energy" STEERABLE=RECOVER
{
Expand Down
25 changes: 0 additions & 25 deletions EntropyInitial/LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion EntropyInitial/configuration.ccl

This file was deleted.

7 changes: 0 additions & 7 deletions EntropyInitial/interface.ccl

This file was deleted.

12 changes: 0 additions & 12 deletions EntropyInitial/param.ccl

This file was deleted.

9 changes: 0 additions & 9 deletions EntropyInitial/schedule.ccl

This file was deleted.

39 changes: 0 additions & 39 deletions EntropyInitial/src/SetEntropy.cxx

This file was deleted.

1 change: 0 additions & 1 deletion EntropyInitial/src/make.code.defn

This file was deleted.

0 comments on commit 1ee3a88

Please sign in to comment.