Skip to content

Commit

Permalink
restore
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Jan 12, 2025
1 parent e7eb928 commit 952e90f
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 29 deletions.
1 change: 0 additions & 1 deletion networks/ignition_reaclib/URCA-medium/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ifeq ($(USE_REACT),TRUE)
CEXE_headers += actual_network.H
CEXE_headers += tfactors.H
CEXE_headers += partition_functions.H
CEXE_sources += partition_functions_data.cpp
CEXE_headers += actual_rhs.H
CEXE_headers += reaclib_rates.H
CEXE_headers += table_rates.H
Expand Down
18 changes: 9 additions & 9 deletions networks/ignition_reaclib/URCA-medium/actual_network.H
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,31 @@ namespace network
return 0.0_rt;
}
else if constexpr (spec == He4) {
return 28.295662457999697_rt;
return 28.29566_rt;
}
else if constexpr (spec == C12) {
return 92.16173498399803_rt;
return 92.16172800000001_rt;
}
else if constexpr (spec == N13) {
return 94.10522604799917_rt;
return 94.105219_rt;
}
else if constexpr (spec == O16) {
return 127.6193154119992_rt;
return 127.619296_rt;
}
else if constexpr (spec == Ne20) {
return 160.64482384000075_rt;
return 160.6448_rt;
}
else if constexpr (spec == Ne23) {
return 182.97089593999772_rt;
return 182.970888_rt;
}
else if constexpr (spec == Na23) {
return 186.56435240400242_rt;
return 186.56433900000002_rt;
}
else if constexpr (spec == Mg23) {
return 181.7258218679999_rt;
return 181.725645_rt;
}
else if constexpr (spec == Mg24) {
return 198.2570479679962_rt;
return 198.25701600000002_rt;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace NSE_INDEX
-1, -1, 8, -1, -1, 7, -1,
-1, -1, 7, -1, -1, 8, 18,
-1, -1, 9, -1, -1, 8, -1,
-1, -1, 0, -1, -1, 1, 22,
-1, -1, 0, -1, -1, 1, -1,
-1, -1, 1, -1, -1, 0, -1
};
}
Expand Down
14 changes: 9 additions & 5 deletions networks/ignition_reaclib/URCA-medium/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void evaluate_rates(const burn_t& state, T& rate_eval) {

// Fill approximate rates

fill_approx_rates<do_T_derivatives, T>(tfactors, state.rho, Y, rate_eval);
fill_approx_rates<do_T_derivatives, T>(tfactors, rate_eval);

// Calculate tabular rates

Expand Down Expand Up @@ -401,10 +401,12 @@ void get_ydot_weak(const burn_t& state,
auto screened_rates = rate_eval.screened_rates;

ydot_nuc(N) =
(-screened_rates(k_n_to_p)*Y(N) + screened_rates(k_p_to_n)*Y(H1));
-screened_rates(k_n_to_p)*Y(N) +
screened_rates(k_p_to_n)*Y(H1);

ydot_nuc(H1) =
(screened_rates(k_n_to_p)*Y(N) + -screened_rates(k_p_to_n)*Y(H1));
screened_rates(k_n_to_p)*Y(N) +
-screened_rates(k_p_to_n)*Y(H1);

ydot_nuc(He4) = 0.0_rt;

Expand Down Expand Up @@ -446,7 +448,8 @@ void rhs_nuc(const burn_t& state,
-screened_rates(k_n_Mg23_to_p_Na23)*Y(Mg23)*Y(N)*state.rho +
-screened_rates(k_n_Mg23_to_He4_Ne20)*Y(Mg23)*Y(N)*state.rho +
(-screened_rates(k_n_Mg23_to_C12_C12)*Y(Mg23)*Y(N)*state.rho + 0.5*screened_rates(k_C12_C12_to_n_Mg23)*amrex::Math::powi<2>(Y(C12))*state.rho) +
(-screened_rates(k_n_to_p)*Y(N) + screened_rates(k_p_to_n)*Y(H1));
-screened_rates(k_n_to_p)*Y(N) +
screened_rates(k_p_to_n)*Y(H1);

ydot_nuc(H1) =
-screened_rates(k_p_C12_to_N13)*Y(C12)*Y(H1)*state.rho +
Expand All @@ -455,7 +458,8 @@ void rhs_nuc(const burn_t& state,
screened_rates(k_He4_N13_to_p_O16)*Y(He4)*Y(N13)*state.rho +
(-screened_rates(k_p_Na23_to_He4_Ne20)*Y(Na23)*Y(H1)*state.rho + screened_rates(k_He4_Ne20_to_p_Na23)*Y(He4)*Y(Ne20)*state.rho) +
screened_rates(k_n_Mg23_to_p_Na23)*Y(Mg23)*Y(N)*state.rho +
(screened_rates(k_n_to_p)*Y(N) + -screened_rates(k_p_to_n)*Y(H1));
screened_rates(k_n_to_p)*Y(N) +
-screened_rates(k_p_to_n)*Y(H1);

ydot_nuc(He4) =
-screened_rates(k_He4_C12_to_O16)*Y(C12)*Y(He4)*state.rho +
Expand Down
17 changes: 8 additions & 9 deletions networks/ignition_reaclib/URCA-medium/partition_functions.H
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ namespace part_fun {

// interpolation routine

template <typename T>
template <int npts>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
void interpolate_pf(const amrex::Real t9, const T& temp_array, const T& pf_array,
void interpolate_pf(const amrex::Real t9, const amrex::Real (&temp_array)[npts], const amrex::Real (&pf_array)[npts],
amrex::Real& pf, amrex::Real& dpf_dT) {

if (t9 >= temp_array.lo() && t9 < temp_array.hi()) {
if (t9 >= temp_array[0] && t9 < temp_array[npts-1]) {

// find the largest temperature element <= t9 using a binary search

int left = temp_array.lo();
int right = temp_array.hi();
int left = 0;
int right = npts;

while (left < right) {
int mid = (left + right) / 2;
if (temp_array(mid) > t9) {
if (temp_array[mid] > t9) {
right = mid;
} else {
left = mid + 1;
Expand All @@ -44,12 +44,11 @@ namespace part_fun {

// construct the slope -- this is (log10(pf_{i+1}) - log10(pf_i)) / (T_{i+1} - T_i)

amrex::Real slope = (pf_array(idx+1) - pf_array(idx)) /
(temp_array(idx+1) - temp_array(idx));
amrex::Real slope = (pf_array[idx+1] - pf_array[idx]) / (temp_array[idx+1] - temp_array[idx]);

// find the PF

amrex::Real log10_pf = pf_array(idx) + slope * (t9 - temp_array(idx));
amrex::Real log10_pf = pf_array[idx] + slope * (t9 - temp_array[idx]);
pf = std::pow(10.0_rt, log10_pf);

// find the derivative (with respect to T, not T9)
Expand Down
5 changes: 1 addition & 4 deletions networks/ignition_reaclib/URCA-medium/reaclib_rates.H
Original file line number Diff line number Diff line change
Expand Up @@ -941,10 +941,7 @@ fill_reaclib_rates(const tf_t& tfactors, T& rate_eval)
template <int do_T_derivatives, typename T>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
void
fill_approx_rates([[maybe_unused]] const tf_t& tfactors,
[[maybe_unused]] const amrex::Real rho,
[[maybe_unused]] const amrex::Array1D<amrex::Real, 1, NumSpec>& Y,
[[maybe_unused]] T& rate_eval)
fill_approx_rates([[maybe_unused]] const tf_t& tfactors, [[maybe_unused]] T& rate_eval)
{

[[maybe_unused]] amrex::Real rate{};
Expand Down
Binary file modified networks/ignition_reaclib/URCA-medium/urca_medium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 952e90f

Please sign in to comment.