diff --git a/.github/workflows/jac_cell.yml b/.github/workflows/jac_cell.yml new file mode 100644 index 0000000000..91a05a46cd --- /dev/null +++ b/.github/workflows/jac_cell.yml @@ -0,0 +1,45 @@ +name: jac_cell + +on: [pull_request] +jobs: + nse_table: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get AMReX + run: | + mkdir external + cd external + git clone https://github.com/AMReX-Codes/amrex.git + cd amrex + git checkout development + echo 'AMREX_HOME=$(GITHUB_WORKSPACE)/external/amrex' >> $GITHUB_ENV + echo $AMREX_HOME + if [[ -n "${AMREX_HOME}" ]]; then exit 1; fi + cd ../.. + + - name: Install dependencies + run: | + sudo apt-get update -y -qq + sudo apt-get -qq -y install curl cmake jq clang g++>=9.3.0 + + - name: Compile jac_cell + run: | + cd unit_test/jac_cell + make -j 4 + + - name: Run jac_cell + run: | + cd unit_test/jac_cell + ./main3d.gnu.ex inputs_aprox13 > test.out + + - name: Compare to stored output + run: | + cd unit_test/jac_cell + diff -I "^Initializing AMReX" -I "^AMReX" test.out ci-benchmarks/jac_cell_aprox13.out + + + diff --git a/EOS/helmholtz/actual_eos.H b/EOS/helmholtz/actual_eos.H index 1152d8e1a0..62e8b03a3a 100644 --- a/EOS/helmholtz/actual_eos.H +++ b/EOS/helmholtz/actual_eos.H @@ -154,9 +154,9 @@ void apply_electrons (T& state) // hash locate this temperature and density int jat = int((std::log10(state.T) - tlo) * tstpi) + 1; - jat = amrex::max(1, amrex::min(jat, jmax-1)) - 1; + jat = std::clamp(jat, 1, jmax-1) - 1; int iat = int((std::log10(din) - dlo) * dstpi) + 1; - iat = amrex::max(1, amrex::min(iat, imax-1)) - 1; + iat = std::clamp(iat, 1, imax-1) - 1; amrex::Real fi[36]; @@ -1003,7 +1003,7 @@ void single_iter_update (T& state, int var, int dvar, amrex::Real xnew = x - (v - v_want) / dvdx; // Don't let the temperature/density change by more than a factor of two - xnew = amrex::max(0.5_rt * x, amrex::min(xnew, 2.0_rt * x)); + xnew = std::clamp(xnew, 0.5_rt * x, 2.0_rt * x); // Don't let us freeze/evacuate xnew = amrex::max(smallx, xnew); @@ -1118,8 +1118,8 @@ void double_iter_update (T& state, int var1, int var2, // Don't let the temperature or density change by more // than a factor of two - tnew = amrex::max(0.5e0_rt * told, amrex::min(tnew, 2.0e0_rt * told)); - rnew = amrex::max(0.5e0_rt * rold, amrex::min(rnew, 2.0e0_rt * rold)); + tnew = std::clamp(tnew, 0.5e0_rt * told, 2.0e0_rt * told); + rnew = std::clamp(rnew, 0.5e0_rt * rold, 2.0e0_rt * rold); // Don't let us freeze or evacuate tnew = amrex::max(EOSData::mintemp, tnew); diff --git a/integration/BackwardEuler/be_integrator.H b/integration/BackwardEuler/be_integrator.H index 7b4b984392..1a8e5c954c 100644 --- a/integration/BackwardEuler/be_integrator.H +++ b/integration/BackwardEuler/be_integrator.H @@ -272,7 +272,7 @@ int be_integrator (BurnT& state, BeT& be) // backward-Euler has a local truncation error of dt**2 amrex::Real dt_new = dt_sub * std::pow(1.0_rt / rel_error, 0.5_rt); - dt_sub = amrex::min(amrex::max(dt_new, dt_sub / 2.0), 2.0 * dt_sub); + dt_sub = std::clamp(dt_new, dt_sub / 2.0, 2.0 * dt_sub); } else { diff --git a/integration/ForwardEuler/actual_integrator.H b/integration/ForwardEuler/actual_integrator.H index dd09aaf99d..7bf5d6e8bc 100644 --- a/integration/ForwardEuler/actual_integrator.H +++ b/integration/ForwardEuler/actual_integrator.H @@ -84,7 +84,7 @@ void clean_state (const amrex::Real time, IntT& int_state, BurnT& state) // Ensure that the temperature always stays within reasonable limits. - state.T = amrex::min(integrator_rp::MAX_TEMP, amrex::max(state.T, EOSData::mintemp)); + state.T = std::clamp(state.T, EOSData::mintemp, integrator_rp::MAX_TEMP); } diff --git a/integration/RKC/rkc.H b/integration/RKC/rkc.H index d21d41c243..9598534f33 100644 --- a/integration/RKC/rkc.H +++ b/integration/RKC/rkc.H @@ -308,7 +308,7 @@ int rkclow (BurnT& state, RkcT& rstate) } } absh = std::max(0.1_rt, fac) * absh; - absh = std::max(hmin, std::min(rstate.hmax, absh)); + absh = std::clamp(absh, hmin, rstate.hmax); errold = err; hold = h; h = tdir * absh; diff --git a/integration/integrator_type_sdc.H b/integration/integrator_type_sdc.H index f212b747ac..99c058bccc 100644 --- a/integration/integrator_type_sdc.H +++ b/integration/integrator_type_sdc.H @@ -19,8 +19,8 @@ void clean_state(const amrex::Real time, BurnT& state, T& int_state) if (integrator_rp::do_species_clip) { for (int n = 1; n <= NumSpec; ++n) { // we use 1-based indexing, so we need to offset SFS - int_state.y(SFS+n) = amrex::max(amrex::min(int_state.y(SFS+n), state.rho), - state.rho * integrator_rp::SMALL_X_SAFE); + int_state.y(SFS+n) = std::clamp(int_state.y(SFS+n), + state.rho * integrator_rp::SMALL_X_SAFE, state.rho); } } diff --git a/integration/integrator_type_strang.H b/integration/integrator_type_strang.H index 99eeaf68c0..6efc3fcf4d 100644 --- a/integration/integrator_type_strang.H +++ b/integration/integrator_type_strang.H @@ -53,7 +53,7 @@ void clean_state (const amrex::Real time, BurnT& state, I& int_state) if (integrator_rp::do_species_clip) { for (int n = 1; n <= NumSpec; ++n) { - int_state.y(n) = amrex::max(amrex::min(int_state.y(n), 1.0_rt), integrator_rp::SMALL_X_SAFE); + int_state.y(n) = std::clamp(int_state.y(n), integrator_rp::SMALL_X_SAFE, 1.0_rt); } } diff --git a/integration/utils/initial_timestep.H b/integration/utils/initial_timestep.H index 4390559d1f..ce6c2ef0ac 100644 --- a/integration/utils/initial_timestep.H +++ b/integration/utils/initial_timestep.H @@ -87,7 +87,7 @@ amrex::Real initial_react_dt (BurnT& burn_state, IntT& int_state, // Save the final timestep, with a bias factor. amrex::Real dt = h / 2.0_rt; - dt = amrex::min(amrex::max(h, hL), hU); + dt = std::clamp(h, hL, hU); dt = amrex::min(dt, integrator_rp::ode_max_dt); diff --git a/networks/CNO_He_burn/CNO_He_burn.png b/networks/CNO_He_burn/CNO_He_burn.png new file mode 100644 index 0000000000..24c454e17c Binary files /dev/null and b/networks/CNO_He_burn/CNO_He_burn.png differ diff --git a/networks/CNO_He_burn/CNO_He_burn.py b/networks/CNO_He_burn/CNO_He_burn.py new file mode 100644 index 0000000000..945d1d69d0 --- /dev/null +++ b/networks/CNO_He_burn/CNO_He_burn.py @@ -0,0 +1,123 @@ +# a blend of CNO_extras and subch_simple + +import pynucastro as pyna +from pynucastro.networks import AmrexAstroCxxNetwork + +DO_DERIVED_RATES = False + +def get_library(): + + reaclib_lib = pyna.ReacLibLibrary() + + all_reactants = ["h1", "he4", + "c12", "c13", + "n13", "n14", "n15", + "o14", "o15", "o16", "o17", "o18", + "f17", "f18", "f19", + "ne18", "ne19", "ne20", "ne21", + "na22", "na23", + "mg22", "mg24", + "al27", "si28", "p31", "s32", + "cl35", "ar36", "k39", "ca40", + "sc43", "ti44", "v47", "cr48", + "mn51", "fe52", "co55", "ni56"] + + subch = reaclib_lib.linking_nuclei(all_reactants) + + # in this list, we have the reactants, the actual reactants, + # and modified products that we will use instead + other_rates = [("c12(c12,n)mg23", "mg24"), + ("o16(o16,n)s31", "s32"), + ("o16(c12,n)si27", "si28")] + + for r, mp in other_rates: + _r = reaclib_lib.get_rate_by_name(r) + _r.modify_products(mp) + subch += pyna.Library(rates=[_r]) + + # finally, the aprox nets don't include the reverse rates for + # C12+C12, C12+O16, and O16+O16, so remove those + + for r in subch.get_rates(): + if sorted(r.products) in [[pyna.Nucleus("c12"), pyna.Nucleus("c12")], + [pyna.Nucleus("c12"), pyna.Nucleus("o16")], + [pyna.Nucleus("o16"), pyna.Nucleus("o16")]]: + subch.remove_rate(r) + + # C12+Ne20 and reverse + # (a,g) links between Na23 and Al27 + # (a,g) links between Al27 and P31 + + rates_to_remove = ["p31(p,c12)ne20", + "si28(a,c12)ne20", + "ne20(c12,p)p31", + "ne20(c12,a)si28", + "na23(a,g)al27", + "al27(g,a)na23", + "al27(a,g)p31", + "p31(g,a)al27"] + + for r in rates_to_remove: + print("removing: ", r) + _r = subch.get_rate_by_name(r) + subch.remove_rate(_r) + + if DO_DERIVED_RATES: + rates_to_derive = [] + for r in subch.get_rates(): + if r.reverse: + # this rate was computed using detailed balance, regardless + # of whether Q < 0 or not. We want to remove it and then + # recompute it + rates_to_derive.append(r) + + # now for each of those derived rates, look to see if the pair exists + + for r in rates_to_derive: + fr = subch.get_rate_by_nuclei(r.products, r.reactants) + if fr: + print(f"modifying {r} from {fr}") + subch.remove_rate(r) + d = pyna.DerivedRate(rate=fr, compute_Q=False, use_pf=True) + subch.add_rate(d) + + return subch + +def doit(): + + subch = get_library() + + # these are the rates that we are going to allow to be optionally + # zeroed + r1 = subch.get_rate_by_name("c12(p,g)n13") + r2 = subch.get_rate_by_name("n13(he4,p)o16") + + net = AmrexAstroCxxNetwork(libraries=[subch], symmetric_screening=True, disable_rate_params=[r1, r2]) + net.make_ap_pg_approx(intermediate_nuclei=["cl35", "k39", "sc43", "v47", "mn51", "co55"]) + net.remove_nuclei(["cl35", "k39", "sc43", "v47", "mn51", "co55"]) + + # finally, the aprox nets don't include the reverse rates for + # C12+C12, C12+O16, and O16+O16, so remove those + + print(f"number of nuclei: {len(net.unique_nuclei)}") + print(f"number of rates: {len(net.rates)}") + + comp = pyna.Composition(net.get_nuclei()) + comp.set_all(0.1) + comp.set_nuc("he4", 0.95) + comp.normalize() + + rho = 1.e6 + T = 1.e9 + + net.plot(rho, T, comp, outfile="CNO_He_burn.png", + rotated=True, hide_xalpha=True, curved_edges=True, + size=(1500, 450), + node_size=500, node_font_size=11, node_color="#337dff", node_shape="s", + Z_range=(1,29)) + + net.write_network() + + +if __name__ == "__main__": + doit() diff --git a/networks/CNO_He_burn/Make.package b/networks/CNO_He_burn/Make.package new file mode 100644 index 0000000000..39c65eca7b --- /dev/null +++ b/networks/CNO_He_burn/Make.package @@ -0,0 +1,14 @@ +CEXE_headers += network_properties.H + +ifeq ($(USE_REACT),TRUE) + CEXE_sources += actual_network_data.cpp + CEXE_headers += actual_network.H + CEXE_headers += tfactors.H + CEXE_headers += partition_functions.H + CEXE_headers += actual_rhs.H + CEXE_headers += reaclib_rates.H + CEXE_headers += table_rates.H + CEXE_sources += table_rates_data.cpp + USE_SCREENING = TRUE + USE_NEUTRINOS = TRUE +endif diff --git a/networks/CNO_He_burn/_parameters b/networks/CNO_He_burn/_parameters new file mode 100644 index 0000000000..e98e970b5e --- /dev/null +++ b/networks/CNO_He_burn/_parameters @@ -0,0 +1,4 @@ +@namespace: network + +disable_p_C12_to_N13 int 0 +disable_He4_N13_to_p_O16 int 0 diff --git a/networks/CNO_He_burn/actual_network.H b/networks/CNO_He_burn/actual_network.H new file mode 100644 index 0000000000..a4c922e623 --- /dev/null +++ b/networks/CNO_He_burn/actual_network.H @@ -0,0 +1,518 @@ +#ifndef actual_network_H +#define actual_network_H + +#include +#include +#include + +#include +#include + +using namespace amrex; + +void actual_network_init(); + +const std::string network_name = "pynucastro-cxx"; + +namespace network +{ + + template + AMREX_GPU_HOST_DEVICE AMREX_INLINE + constexpr amrex::Real bion () { + using namespace Species; + + static_assert(spec >= 1 && spec <= NumSpec); + + // Set the binding energy of the element + + if constexpr (spec == H1) { + return 0.0_rt; + } + else if constexpr (spec == He4) { + return 28.29566_rt; + } + else if constexpr (spec == C12) { + return 92.16172800000001_rt; + } + else if constexpr (spec == C13) { + return 97.108037_rt; + } + else if constexpr (spec == N13) { + return 94.105219_rt; + } + else if constexpr (spec == N14) { + return 104.65859599999999_rt; + } + else if constexpr (spec == N15) { + return 115.4919_rt; + } + else if constexpr (spec == O14) { + return 98.731892_rt; + } + else if constexpr (spec == O15) { + return 111.95538_rt; + } + else if constexpr (spec == O16) { + return 127.619296_rt; + } + else if constexpr (spec == O17) { + return 131.76237600000002_rt; + } + else if constexpr (spec == O18) { + return 139.807746_rt; + } + else if constexpr (spec == F17) { + return 128.21957600000002_rt; + } + else if constexpr (spec == F18) { + return 137.369484_rt; + } + else if constexpr (spec == F19) { + return 147.801342_rt; + } + else if constexpr (spec == Ne18) { + return 132.142626_rt; + } + else if constexpr (spec == Ne19) { + return 143.779517_rt; + } + else if constexpr (spec == Ne20) { + return 160.6448_rt; + } + else if constexpr (spec == Ne21) { + return 167.405973_rt; + } + else if constexpr (spec == Na22) { + return 174.144674_rt; + } + else if constexpr (spec == Na23) { + return 186.56433900000002_rt; + } + else if constexpr (spec == Mg22) { + return 168.58074200000001_rt; + } + else if constexpr (spec == Mg24) { + return 198.25701600000002_rt; + } + else if constexpr (spec == Al27) { + return 224.951931_rt; + } + else if constexpr (spec == Si28) { + return 236.536832_rt; + } + else if constexpr (spec == P31) { + return 262.91617699999995_rt; + } + else if constexpr (spec == S32) { + return 271.78012800000005_rt; + } + else if constexpr (spec == Ar36) { + return 306.716724_rt; + } + else if constexpr (spec == Ca40) { + return 342.05212000000006_rt; + } + else if constexpr (spec == Ti44) { + return 375.47488000000004_rt; + } + else if constexpr (spec == Cr48) { + return 411.46891200000005_rt; + } + else if constexpr (spec == Fe52) { + return 447.697848_rt; + } + else if constexpr (spec == Ni56) { + return 483.995624_rt; + } + + + // Return zero if we don't recognize the species. + return 0.0_rt; + } + + template + AMREX_GPU_HOST_DEVICE AMREX_INLINE + constexpr amrex::Real mion () { + static_assert(spec >= 1 && spec <= NumSpec); + + constexpr amrex::Real A = NetworkProperties::aion(spec); + constexpr amrex::Real Z = NetworkProperties::zion(spec); + + return (A - Z) * C::Legacy::m_n + Z * (C::Legacy::m_p + C::Legacy::m_e) - bion() * C::Legacy::MeV2gr; + } + + // Legacy (non-templated) interfaces + + AMREX_GPU_HOST_DEVICE AMREX_INLINE + amrex::Real bion (int spec) { + using namespace Species; + + amrex::Real b = 0.0_rt; + + // Set the binding energy of the element + constexpr_for<1, NumSpec+1>([&] (auto n) { + if (n == spec) { + b = bion(); + } + }); + + return b; + } + + AMREX_GPU_HOST_DEVICE AMREX_INLINE + amrex::Real mion (int spec) { + using namespace Species; + + amrex::Real m = 0.0_rt; + + constexpr_for<1, NumSpec+1>([&] (auto n) { + if (n == spec) { + m = mion(); + } + }); + + return m; + } +} + +namespace Rates +{ + + enum NetworkRates + { + k_N13_to_C13_weak_wc12 = 1, + k_O14_to_N14_weak_wc12 = 2, + k_O15_to_N15_weak_wc12 = 3, + k_F17_to_O17_weak_wc12 = 4, + k_F18_to_O18_weak_wc12 = 5, + k_Ne18_to_F18_weak_wc12 = 6, + k_Ne19_to_F19_weak_wc12 = 7, + k_Mg22_to_Na22_weak_wc12 = 8, + k_N13_to_p_C12 = 9, + k_N14_to_p_C13 = 10, + k_O14_to_p_N13 = 11, + k_O15_to_p_N14 = 12, + k_O16_to_p_N15 = 13, + k_O16_to_He4_C12 = 14, + k_F17_to_p_O16 = 15, + k_F18_to_p_O17 = 16, + k_F18_to_He4_N14 = 17, + k_F19_to_p_O18 = 18, + k_F19_to_He4_N15 = 19, + k_Ne18_to_p_F17 = 20, + k_Ne18_to_He4_O14 = 21, + k_Ne19_to_p_F18 = 22, + k_Ne19_to_He4_O15 = 23, + k_Ne20_to_p_F19 = 24, + k_Ne20_to_He4_O16 = 25, + k_Ne21_to_He4_O17 = 26, + k_Na22_to_p_Ne21 = 27, + k_Na22_to_He4_F18 = 28, + k_Na23_to_He4_F19 = 29, + k_Mg22_to_He4_Ne18 = 30, + k_Mg24_to_p_Na23 = 31, + k_Mg24_to_He4_Ne20 = 32, + k_Si28_to_p_Al27 = 33, + k_Si28_to_He4_Mg24 = 34, + k_S32_to_p_P31 = 35, + k_S32_to_He4_Si28 = 36, + k_C12_to_He4_He4_He4 = 37, + k_p_C12_to_N13 = 38, + k_He4_C12_to_O16 = 39, + k_p_C13_to_N14 = 40, + k_p_N13_to_O14 = 41, + k_p_N14_to_O15 = 42, + k_He4_N14_to_F18 = 43, + k_p_N15_to_O16 = 44, + k_He4_N15_to_F19 = 45, + k_He4_O14_to_Ne18 = 46, + k_He4_O15_to_Ne19 = 47, + k_p_O16_to_F17 = 48, + k_He4_O16_to_Ne20 = 49, + k_p_O17_to_F18 = 50, + k_He4_O17_to_Ne21 = 51, + k_p_O18_to_F19 = 52, + k_p_F17_to_Ne18 = 53, + k_p_F18_to_Ne19 = 54, + k_He4_F18_to_Na22 = 55, + k_p_F19_to_Ne20 = 56, + k_He4_F19_to_Na23 = 57, + k_He4_Ne18_to_Mg22 = 58, + k_He4_Ne20_to_Mg24 = 59, + k_p_Ne21_to_Na22 = 60, + k_p_Na23_to_Mg24 = 61, + k_He4_Mg24_to_Si28 = 62, + k_p_Al27_to_Si28 = 63, + k_He4_Si28_to_S32 = 64, + k_p_P31_to_S32 = 65, + k_He4_C12_to_p_N15 = 66, + k_C12_C12_to_p_Na23 = 67, + k_C12_C12_to_He4_Ne20 = 68, + k_He4_N13_to_p_O16 = 69, + k_He4_N14_to_p_O17 = 70, + k_p_N15_to_He4_C12 = 71, + k_He4_N15_to_p_O18 = 72, + k_He4_O14_to_p_F17 = 73, + k_He4_O15_to_p_F18 = 74, + k_p_O16_to_He4_N13 = 75, + k_He4_O16_to_p_F19 = 76, + k_C12_O16_to_p_Al27 = 77, + k_C12_O16_to_He4_Mg24 = 78, + k_O16_O16_to_p_P31 = 79, + k_O16_O16_to_He4_Si28 = 80, + k_p_O17_to_He4_N14 = 81, + k_p_O18_to_He4_N15 = 82, + k_p_F17_to_He4_O14 = 83, + k_He4_F17_to_p_Ne20 = 84, + k_p_F18_to_He4_O15 = 85, + k_He4_F18_to_p_Ne21 = 86, + k_p_F19_to_He4_O16 = 87, + k_He4_Ne19_to_p_Na22 = 88, + k_p_Ne20_to_He4_F17 = 89, + k_He4_Ne20_to_p_Na23 = 90, + k_p_Ne21_to_He4_F18 = 91, + k_p_Na22_to_He4_Ne19 = 92, + k_p_Na23_to_He4_Ne20 = 93, + k_He4_Mg24_to_p_Al27 = 94, + k_p_Al27_to_He4_Mg24 = 95, + k_He4_Si28_to_p_P31 = 96, + k_p_P31_to_He4_Si28 = 97, + k_He4_He4_He4_to_C12 = 98, + k_C12_C12_to_Mg24_modified = 99, + k_O16_O16_to_S32_modified = 100, + k_C12_O16_to_Si28_modified = 101, + k_He4_S32_to_Ar36_removed = 102, + k_He4_S32_to_p_Cl35_removed = 103, + k_p_Cl35_to_Ar36_removed = 104, + k_Ar36_to_He4_S32_removed = 105, + k_Ar36_to_p_Cl35_removed = 106, + k_p_Cl35_to_He4_S32_removed = 107, + k_He4_Ar36_to_Ca40_removed = 108, + k_He4_Ar36_to_p_K39_removed = 109, + k_p_K39_to_Ca40_removed = 110, + k_Ca40_to_He4_Ar36_removed = 111, + k_Ca40_to_p_K39_removed = 112, + k_p_K39_to_He4_Ar36_removed = 113, + k_He4_Ca40_to_Ti44_removed = 114, + k_He4_Ca40_to_p_Sc43_removed = 115, + k_p_Sc43_to_Ti44_removed = 116, + k_Ti44_to_He4_Ca40_removed = 117, + k_Ti44_to_p_Sc43_removed = 118, + k_p_Sc43_to_He4_Ca40_removed = 119, + k_He4_Ti44_to_Cr48_removed = 120, + k_He4_Ti44_to_p_V47_removed = 121, + k_p_V47_to_Cr48_removed = 122, + k_Cr48_to_He4_Ti44_removed = 123, + k_Cr48_to_p_V47_removed = 124, + k_p_V47_to_He4_Ti44_removed = 125, + k_He4_Cr48_to_Fe52_removed = 126, + k_He4_Cr48_to_p_Mn51_removed = 127, + k_p_Mn51_to_Fe52_removed = 128, + k_Fe52_to_He4_Cr48_removed = 129, + k_Fe52_to_p_Mn51_removed = 130, + k_p_Mn51_to_He4_Cr48_removed = 131, + k_He4_Fe52_to_Ni56_removed = 132, + k_He4_Fe52_to_p_Co55_removed = 133, + k_p_Co55_to_Ni56_removed = 134, + k_Ni56_to_He4_Fe52_removed = 135, + k_Ni56_to_p_Co55_removed = 136, + k_p_Co55_to_He4_Fe52_removed = 137, + k_S32_He4_to_Ar36_approx = 138, + k_Ar36_to_S32_He4_approx = 139, + k_Ar36_He4_to_Ca40_approx = 140, + k_Ca40_to_Ar36_He4_approx = 141, + k_Ca40_He4_to_Ti44_approx = 142, + k_Ti44_to_Ca40_He4_approx = 143, + k_Ti44_He4_to_Cr48_approx = 144, + k_Cr48_to_Ti44_He4_approx = 145, + k_Cr48_He4_to_Fe52_approx = 146, + k_Fe52_to_Cr48_He4_approx = 147, + k_Fe52_He4_to_Ni56_approx = 148, + k_Ni56_to_Fe52_He4_approx = 149, + NumRates = k_Ni56_to_Fe52_He4_approx + }; + + // number of reaclib rates + + const int NrateReaclib = 137; + + // number of tabular rates + + const int NrateTabular = 0; + + // rate names -- note: the rates are 1-based, not zero-based, so we pad + // this vector with rate_names[0] = "" so the indices line up with the + // NetworkRates enum + + static const std::vector rate_names = { + "", // 0 + "N13_to_C13_weak_wc12", // 1, + "O14_to_N14_weak_wc12", // 2, + "O15_to_N15_weak_wc12", // 3, + "F17_to_O17_weak_wc12", // 4, + "F18_to_O18_weak_wc12", // 5, + "Ne18_to_F18_weak_wc12", // 6, + "Ne19_to_F19_weak_wc12", // 7, + "Mg22_to_Na22_weak_wc12", // 8, + "N13_to_p_C12", // 9, + "N14_to_p_C13", // 10, + "O14_to_p_N13", // 11, + "O15_to_p_N14", // 12, + "O16_to_p_N15", // 13, + "O16_to_He4_C12", // 14, + "F17_to_p_O16", // 15, + "F18_to_p_O17", // 16, + "F18_to_He4_N14", // 17, + "F19_to_p_O18", // 18, + "F19_to_He4_N15", // 19, + "Ne18_to_p_F17", // 20, + "Ne18_to_He4_O14", // 21, + "Ne19_to_p_F18", // 22, + "Ne19_to_He4_O15", // 23, + "Ne20_to_p_F19", // 24, + "Ne20_to_He4_O16", // 25, + "Ne21_to_He4_O17", // 26, + "Na22_to_p_Ne21", // 27, + "Na22_to_He4_F18", // 28, + "Na23_to_He4_F19", // 29, + "Mg22_to_He4_Ne18", // 30, + "Mg24_to_p_Na23", // 31, + "Mg24_to_He4_Ne20", // 32, + "Si28_to_p_Al27", // 33, + "Si28_to_He4_Mg24", // 34, + "S32_to_p_P31", // 35, + "S32_to_He4_Si28", // 36, + "C12_to_He4_He4_He4", // 37, + "p_C12_to_N13", // 38, + "He4_C12_to_O16", // 39, + "p_C13_to_N14", // 40, + "p_N13_to_O14", // 41, + "p_N14_to_O15", // 42, + "He4_N14_to_F18", // 43, + "p_N15_to_O16", // 44, + "He4_N15_to_F19", // 45, + "He4_O14_to_Ne18", // 46, + "He4_O15_to_Ne19", // 47, + "p_O16_to_F17", // 48, + "He4_O16_to_Ne20", // 49, + "p_O17_to_F18", // 50, + "He4_O17_to_Ne21", // 51, + "p_O18_to_F19", // 52, + "p_F17_to_Ne18", // 53, + "p_F18_to_Ne19", // 54, + "He4_F18_to_Na22", // 55, + "p_F19_to_Ne20", // 56, + "He4_F19_to_Na23", // 57, + "He4_Ne18_to_Mg22", // 58, + "He4_Ne20_to_Mg24", // 59, + "p_Ne21_to_Na22", // 60, + "p_Na23_to_Mg24", // 61, + "He4_Mg24_to_Si28", // 62, + "p_Al27_to_Si28", // 63, + "He4_Si28_to_S32", // 64, + "p_P31_to_S32", // 65, + "He4_C12_to_p_N15", // 66, + "C12_C12_to_p_Na23", // 67, + "C12_C12_to_He4_Ne20", // 68, + "He4_N13_to_p_O16", // 69, + "He4_N14_to_p_O17", // 70, + "p_N15_to_He4_C12", // 71, + "He4_N15_to_p_O18", // 72, + "He4_O14_to_p_F17", // 73, + "He4_O15_to_p_F18", // 74, + "p_O16_to_He4_N13", // 75, + "He4_O16_to_p_F19", // 76, + "C12_O16_to_p_Al27", // 77, + "C12_O16_to_He4_Mg24", // 78, + "O16_O16_to_p_P31", // 79, + "O16_O16_to_He4_Si28", // 80, + "p_O17_to_He4_N14", // 81, + "p_O18_to_He4_N15", // 82, + "p_F17_to_He4_O14", // 83, + "He4_F17_to_p_Ne20", // 84, + "p_F18_to_He4_O15", // 85, + "He4_F18_to_p_Ne21", // 86, + "p_F19_to_He4_O16", // 87, + "He4_Ne19_to_p_Na22", // 88, + "p_Ne20_to_He4_F17", // 89, + "He4_Ne20_to_p_Na23", // 90, + "p_Ne21_to_He4_F18", // 91, + "p_Na22_to_He4_Ne19", // 92, + "p_Na23_to_He4_Ne20", // 93, + "He4_Mg24_to_p_Al27", // 94, + "p_Al27_to_He4_Mg24", // 95, + "He4_Si28_to_p_P31", // 96, + "p_P31_to_He4_Si28", // 97, + "He4_He4_He4_to_C12", // 98, + "C12_C12_to_Mg24_modified", // 99, + "O16_O16_to_S32_modified", // 100, + "C12_O16_to_Si28_modified", // 101, + "He4_S32_to_Ar36_removed", // 102, + "He4_S32_to_p_Cl35_removed", // 103, + "p_Cl35_to_Ar36_removed", // 104, + "Ar36_to_He4_S32_removed", // 105, + "Ar36_to_p_Cl35_removed", // 106, + "p_Cl35_to_He4_S32_removed", // 107, + "He4_Ar36_to_Ca40_removed", // 108, + "He4_Ar36_to_p_K39_removed", // 109, + "p_K39_to_Ca40_removed", // 110, + "Ca40_to_He4_Ar36_removed", // 111, + "Ca40_to_p_K39_removed", // 112, + "p_K39_to_He4_Ar36_removed", // 113, + "He4_Ca40_to_Ti44_removed", // 114, + "He4_Ca40_to_p_Sc43_removed", // 115, + "p_Sc43_to_Ti44_removed", // 116, + "Ti44_to_He4_Ca40_removed", // 117, + "Ti44_to_p_Sc43_removed", // 118, + "p_Sc43_to_He4_Ca40_removed", // 119, + "He4_Ti44_to_Cr48_removed", // 120, + "He4_Ti44_to_p_V47_removed", // 121, + "p_V47_to_Cr48_removed", // 122, + "Cr48_to_He4_Ti44_removed", // 123, + "Cr48_to_p_V47_removed", // 124, + "p_V47_to_He4_Ti44_removed", // 125, + "He4_Cr48_to_Fe52_removed", // 126, + "He4_Cr48_to_p_Mn51_removed", // 127, + "p_Mn51_to_Fe52_removed", // 128, + "Fe52_to_He4_Cr48_removed", // 129, + "Fe52_to_p_Mn51_removed", // 130, + "p_Mn51_to_He4_Cr48_removed", // 131, + "He4_Fe52_to_Ni56_removed", // 132, + "He4_Fe52_to_p_Co55_removed", // 133, + "p_Co55_to_Ni56_removed", // 134, + "Ni56_to_He4_Fe52_removed", // 135, + "Ni56_to_p_Co55_removed", // 136, + "p_Co55_to_He4_Fe52_removed", // 137, + "S32_He4_to_Ar36_approx", // 138, + "Ar36_to_S32_He4_approx", // 139, + "Ar36_He4_to_Ca40_approx", // 140, + "Ca40_to_Ar36_He4_approx", // 141, + "Ca40_He4_to_Ti44_approx", // 142, + "Ti44_to_Ca40_He4_approx", // 143, + "Ti44_He4_to_Cr48_approx", // 144, + "Cr48_to_Ti44_He4_approx", // 145, + "Cr48_He4_to_Fe52_approx", // 146, + "Fe52_to_Cr48_He4_approx", // 147, + "Fe52_He4_to_Ni56_approx", // 148, + "Ni56_to_Fe52_He4_approx" // 149, + }; + +} + +#ifdef NSE_NET +namespace NSE_INDEX +{ + constexpr int H1_index = 0; + constexpr int N_index = -1; + constexpr int He4_index = 1; + + // Each row corresponds to the rate in NetworkRates enum + // First 3 row indices for reactants, followed by 3 product indices + // last index is the corresponding reverse rate index. + + extern AMREX_GPU_MANAGED amrex::Array2D rate_indices; +} +#endif + +#endif diff --git a/networks/CNO_He_burn/actual_network_data.cpp b/networks/CNO_He_burn/actual_network_data.cpp new file mode 100644 index 0000000000..7d0e4cf495 --- /dev/null +++ b/networks/CNO_He_burn/actual_network_data.cpp @@ -0,0 +1,164 @@ +#include + + +#ifdef NSE_NET +namespace NSE_INDEX +{ + AMREX_GPU_MANAGED amrex::Array2D rate_indices { + -1, -1, 4, -1, -1, 3, -1, + -1, -1, 7, -1, -1, 5, -1, + -1, -1, 8, -1, -1, 6, -1, + -1, -1, 12, -1, -1, 10, -1, + -1, -1, 13, -1, -1, 11, -1, + -1, -1, 15, -1, -1, 13, -1, + -1, -1, 16, -1, -1, 14, -1, + -1, -1, 21, -1, -1, 19, -1, + -1, -1, 4, -1, 0, 2, -1, + -1, -1, 5, -1, 0, 3, -1, + -1, -1, 7, -1, 0, 4, -1, + -1, -1, 8, -1, 0, 5, -1, + -1, -1, 9, -1, 0, 6, -1, + -1, -1, 9, -1, 1, 2, -1, + -1, -1, 12, -1, 0, 9, -1, + -1, -1, 13, -1, 0, 10, -1, + -1, -1, 13, -1, 1, 5, -1, + -1, -1, 14, -1, 0, 11, -1, + -1, -1, 14, -1, 1, 6, -1, + -1, -1, 15, -1, 0, 12, -1, + -1, -1, 15, -1, 1, 7, -1, + -1, -1, 16, -1, 0, 13, -1, + -1, -1, 16, -1, 1, 8, -1, + -1, -1, 17, -1, 0, 14, -1, + -1, -1, 17, -1, 1, 9, -1, + -1, -1, 18, -1, 1, 10, -1, + -1, -1, 19, -1, 0, 18, -1, + -1, -1, 19, -1, 1, 13, -1, + -1, -1, 20, -1, 1, 14, -1, + -1, -1, 21, -1, 1, 15, -1, + -1, -1, 22, -1, 0, 20, -1, + -1, -1, 22, -1, 1, 17, -1, + -1, -1, 24, -1, 0, 23, -1, + -1, -1, 24, -1, 1, 22, -1, + -1, -1, 26, -1, 0, 25, -1, + -1, -1, 26, -1, 1, 24, -1, + -1, -1, 2, 1, 1, 1, -1, + -1, 0, 2, -1, -1, 4, 9, + -1, 1, 2, -1, -1, 9, 14, + -1, 0, 3, -1, -1, 5, 10, + -1, 0, 4, -1, -1, 7, 11, + -1, 0, 5, -1, -1, 8, 12, + -1, 1, 5, -1, -1, 13, 17, + -1, 0, 6, -1, -1, 9, 13, + -1, 1, 6, -1, -1, 14, 19, + -1, 1, 7, -1, -1, 15, 21, + -1, 1, 8, -1, -1, 16, 23, + -1, 0, 9, -1, -1, 12, 15, + -1, 1, 9, -1, -1, 17, 25, + -1, 0, 10, -1, -1, 13, 16, + -1, 1, 10, -1, -1, 18, 26, + -1, 0, 11, -1, -1, 14, 18, + -1, 0, 12, -1, -1, 15, 20, + -1, 0, 13, -1, -1, 16, 22, + -1, 1, 13, -1, -1, 19, 28, + -1, 0, 14, -1, -1, 17, 24, + -1, 1, 14, -1, -1, 20, 29, + -1, 1, 15, -1, -1, 21, 30, + -1, 1, 17, -1, -1, 22, 32, + -1, 0, 18, -1, -1, 19, 27, + -1, 0, 20, -1, -1, 22, 31, + -1, 1, 22, -1, -1, 24, 34, + -1, 0, 23, -1, -1, 24, 33, + -1, 1, 24, -1, -1, 26, 36, + -1, 0, 25, -1, -1, 26, 35, + -1, 1, 2, -1, 0, 6, -1, + -1, 2, 2, -1, 0, 20, -1, + -1, 2, 2, -1, 1, 17, -1, + -1, 1, 4, -1, 0, 9, 75, + -1, 1, 5, -1, 0, 10, -1, + -1, 0, 6, -1, 1, 2, 66, + -1, 1, 6, -1, 0, 11, -1, + -1, 1, 7, -1, 0, 12, 83, + -1, 1, 8, -1, 0, 13, -1, + -1, 0, 9, -1, 1, 4, -1, + -1, 1, 9, -1, 0, 14, -1, + -1, 2, 9, -1, 0, 23, -1, + -1, 2, 9, -1, 1, 22, -1, + -1, 9, 9, -1, 0, 25, -1, + -1, 9, 9, -1, 1, 24, -1, + -1, 0, 10, -1, 1, 5, 70, + -1, 0, 11, -1, 1, 6, 72, + -1, 0, 12, -1, 1, 7, -1, + -1, 1, 12, -1, 0, 17, 89, + -1, 0, 13, -1, 1, 8, 74, + -1, 1, 13, -1, 0, 18, 91, + -1, 0, 14, -1, 1, 9, 76, + -1, 1, 16, -1, 0, 19, 92, + -1, 0, 17, -1, 1, 12, -1, + -1, 1, 17, -1, 0, 20, -1, + -1, 0, 18, -1, 1, 13, -1, + -1, 0, 19, -1, 1, 16, -1, + -1, 0, 20, -1, 1, 17, 90, + -1, 1, 22, -1, 0, 23, -1, + -1, 0, 23, -1, 1, 22, 94, + -1, 1, 24, -1, 0, 25, -1, + -1, 0, 25, -1, 1, 24, 96, + 1, 1, 1, -1, -1, 2, 37, + -1, 2, 2, -1, -1, 22, -1, + -1, 9, 9, -1, -1, 26, -1, + -1, 2, 9, -1, -1, 24, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, + -1, 1, 26, -1, -1, 27, 139, + -1, -1, 27, -1, 1, 26, -1, + -1, 1, 27, -1, -1, 28, 141, + -1, -1, 28, -1, 1, 27, -1, + -1, 1, 28, -1, -1, 29, 143, + -1, -1, 29, -1, 1, 28, -1, + -1, 1, 29, -1, -1, 30, 145, + -1, -1, 30, -1, 1, 29, -1, + -1, 1, 30, -1, -1, 31, 147, + -1, -1, 31, -1, 1, 30, -1, + -1, 1, 31, -1, -1, 32, 149, + -1, -1, 32, -1, 1, 31, -1 + }; +} +#endif + +void actual_network_init() +{ + +} diff --git a/networks/CNO_He_burn/actual_rhs.H b/networks/CNO_He_burn/actual_rhs.H new file mode 100644 index 0000000000..7985edf788 --- /dev/null +++ b/networks/CNO_He_burn/actual_rhs.H @@ -0,0 +1,2873 @@ +#ifndef actual_rhs_H +#define actual_rhs_H + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace amrex; +using namespace ArrayUtil; + +using namespace Species; +using namespace Rates; + +using namespace rate_tables; + + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void ener_gener_rate(T const& dydt, amrex::Real& enuc) +{ + + // Computes the instantaneous energy generation rate (from the nuclei) + + // This is basically e = m c**2 + + enuc = 0.0_rt; + + for (int n = 1; n <= NumSpec; ++n) { + enuc += dydt(n) * network::mion(n); + } + + enuc *= C::Legacy::enuc_conv2; +} + + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void evaluate_rates(const burn_t& state, T& rate_eval) { + + + // create molar fractions + + amrex::Array1D Y; + for (int n = 1; n <= NumSpec; ++n) { + Y(n) = state.xn[n-1] * aion_inv[n-1]; + } + + [[maybe_unused]] amrex::Real rhoy = state.rho * state.y_e; + + // Calculate Reaclib rates + + using number_t = std::conditional_t; + number_t temp = state.T; + if constexpr (do_T_derivatives) { + // seed the dual number for temperature before calculating anything with it + autodiff::seed(temp); + } + plasma_state_t pstate{}; + fill_plasma_state(pstate, temp, state.rho, Y); + + tf_t tfactors = evaluate_tfactors(state.T); + + fill_reaclib_rates(tfactors, rate_eval); + + if (disable_p_C12_to_N13) { + rate_eval.screened_rates(k_p_C12_to_N13) = 0.0; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_C12_to_N13) = 0.0; + } + rate_eval.screened_rates(k_N13_to_p_C12) = 0.0; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_N13_to_p_C12) = 0.0; + } + } + + if (disable_He4_N13_to_p_O16) { + rate_eval.screened_rates(k_He4_N13_to_p_O16) = 0.0; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_N13_to_p_O16) = 0.0; + } + rate_eval.screened_rates(k_p_O16_to_He4_N13) = 0.0; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_O16_to_He4_N13) = 0.0; + } + } + + + + // Evaluate screening factors + + amrex::Real ratraw, dratraw_dT; + amrex::Real scor, dscor_dt; + [[maybe_unused]] amrex::Real scor2, dscor2_dt; + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 6.0_rt, 12.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_N13_to_p_C12); + rate_eval.screened_rates(k_N13_to_p_C12) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_N13_to_p_C12); + rate_eval.dscreened_rates_dT(k_N13_to_p_C12) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_C12_to_N13); + rate_eval.screened_rates(k_p_C12_to_N13) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_C12_to_N13); + rate_eval.dscreened_rates_dT(k_p_C12_to_N13) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 6.0_rt, 13.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_N14_to_p_C13); + rate_eval.screened_rates(k_N14_to_p_C13) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_N14_to_p_C13); + rate_eval.dscreened_rates_dT(k_N14_to_p_C13) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_C13_to_N14); + rate_eval.screened_rates(k_p_C13_to_N14) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_C13_to_N14); + rate_eval.dscreened_rates_dT(k_p_C13_to_N14) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 7.0_rt, 13.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_O14_to_p_N13); + rate_eval.screened_rates(k_O14_to_p_N13) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_O14_to_p_N13); + rate_eval.dscreened_rates_dT(k_O14_to_p_N13) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_N13_to_O14); + rate_eval.screened_rates(k_p_N13_to_O14) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_N13_to_O14); + rate_eval.dscreened_rates_dT(k_p_N13_to_O14) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 7.0_rt, 14.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_O15_to_p_N14); + rate_eval.screened_rates(k_O15_to_p_N14) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_O15_to_p_N14); + rate_eval.dscreened_rates_dT(k_O15_to_p_N14) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_N14_to_O15); + rate_eval.screened_rates(k_p_N14_to_O15) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_N14_to_O15); + rate_eval.dscreened_rates_dT(k_p_N14_to_O15) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 7.0_rt, 15.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_O16_to_p_N15); + rate_eval.screened_rates(k_O16_to_p_N15) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_O16_to_p_N15); + rate_eval.dscreened_rates_dT(k_O16_to_p_N15) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_N15_to_O16); + rate_eval.screened_rates(k_p_N15_to_O16) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_N15_to_O16); + rate_eval.dscreened_rates_dT(k_p_N15_to_O16) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_C12_to_p_N15); + rate_eval.screened_rates(k_He4_C12_to_p_N15) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_C12_to_p_N15); + rate_eval.dscreened_rates_dT(k_He4_C12_to_p_N15) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_N15_to_He4_C12); + rate_eval.screened_rates(k_p_N15_to_He4_C12) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_N15_to_He4_C12); + rate_eval.dscreened_rates_dT(k_p_N15_to_He4_C12) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 6.0_rt, 12.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_O16_to_He4_C12); + rate_eval.screened_rates(k_O16_to_He4_C12) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_O16_to_He4_C12); + rate_eval.dscreened_rates_dT(k_O16_to_He4_C12) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_C12_to_O16); + rate_eval.screened_rates(k_He4_C12_to_O16) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_C12_to_O16); + rate_eval.dscreened_rates_dT(k_He4_C12_to_O16) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 8.0_rt, 16.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_F17_to_p_O16); + rate_eval.screened_rates(k_F17_to_p_O16) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_F17_to_p_O16); + rate_eval.dscreened_rates_dT(k_F17_to_p_O16) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_O16_to_F17); + rate_eval.screened_rates(k_p_O16_to_F17) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_O16_to_F17); + rate_eval.dscreened_rates_dT(k_p_O16_to_F17) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 8.0_rt, 17.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_F18_to_p_O17); + rate_eval.screened_rates(k_F18_to_p_O17) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_F18_to_p_O17); + rate_eval.dscreened_rates_dT(k_F18_to_p_O17) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_O17_to_F18); + rate_eval.screened_rates(k_p_O17_to_F18) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_O17_to_F18); + rate_eval.dscreened_rates_dT(k_p_O17_to_F18) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_N14_to_p_O17); + rate_eval.screened_rates(k_He4_N14_to_p_O17) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_N14_to_p_O17); + rate_eval.dscreened_rates_dT(k_He4_N14_to_p_O17) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_O17_to_He4_N14); + rate_eval.screened_rates(k_p_O17_to_He4_N14) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_O17_to_He4_N14); + rate_eval.dscreened_rates_dT(k_p_O17_to_He4_N14) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 7.0_rt, 14.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_F18_to_He4_N14); + rate_eval.screened_rates(k_F18_to_He4_N14) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_F18_to_He4_N14); + rate_eval.dscreened_rates_dT(k_F18_to_He4_N14) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_N14_to_F18); + rate_eval.screened_rates(k_He4_N14_to_F18) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_N14_to_F18); + rate_eval.dscreened_rates_dT(k_He4_N14_to_F18) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 8.0_rt, 18.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_F19_to_p_O18); + rate_eval.screened_rates(k_F19_to_p_O18) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_F19_to_p_O18); + rate_eval.dscreened_rates_dT(k_F19_to_p_O18) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_O18_to_F19); + rate_eval.screened_rates(k_p_O18_to_F19) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_O18_to_F19); + rate_eval.dscreened_rates_dT(k_p_O18_to_F19) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_N15_to_p_O18); + rate_eval.screened_rates(k_He4_N15_to_p_O18) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_N15_to_p_O18); + rate_eval.dscreened_rates_dT(k_He4_N15_to_p_O18) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_O18_to_He4_N15); + rate_eval.screened_rates(k_p_O18_to_He4_N15) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_O18_to_He4_N15); + rate_eval.dscreened_rates_dT(k_p_O18_to_He4_N15) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 7.0_rt, 15.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_F19_to_He4_N15); + rate_eval.screened_rates(k_F19_to_He4_N15) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_F19_to_He4_N15); + rate_eval.dscreened_rates_dT(k_F19_to_He4_N15) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_N15_to_F19); + rate_eval.screened_rates(k_He4_N15_to_F19) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_N15_to_F19); + rate_eval.dscreened_rates_dT(k_He4_N15_to_F19) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 9.0_rt, 17.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Ne18_to_p_F17); + rate_eval.screened_rates(k_Ne18_to_p_F17) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ne18_to_p_F17); + rate_eval.dscreened_rates_dT(k_Ne18_to_p_F17) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_F17_to_Ne18); + rate_eval.screened_rates(k_p_F17_to_Ne18) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_F17_to_Ne18); + rate_eval.dscreened_rates_dT(k_p_F17_to_Ne18) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 8.0_rt, 14.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Ne18_to_He4_O14); + rate_eval.screened_rates(k_Ne18_to_He4_O14) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ne18_to_He4_O14); + rate_eval.dscreened_rates_dT(k_Ne18_to_He4_O14) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_O14_to_Ne18); + rate_eval.screened_rates(k_He4_O14_to_Ne18) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_O14_to_Ne18); + rate_eval.dscreened_rates_dT(k_He4_O14_to_Ne18) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_O14_to_p_F17); + rate_eval.screened_rates(k_He4_O14_to_p_F17) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_O14_to_p_F17); + rate_eval.dscreened_rates_dT(k_He4_O14_to_p_F17) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_F17_to_He4_O14); + rate_eval.screened_rates(k_p_F17_to_He4_O14) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_F17_to_He4_O14); + rate_eval.dscreened_rates_dT(k_p_F17_to_He4_O14) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 9.0_rt, 18.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Ne19_to_p_F18); + rate_eval.screened_rates(k_Ne19_to_p_F18) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ne19_to_p_F18); + rate_eval.dscreened_rates_dT(k_Ne19_to_p_F18) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_F18_to_Ne19); + rate_eval.screened_rates(k_p_F18_to_Ne19) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_F18_to_Ne19); + rate_eval.dscreened_rates_dT(k_p_F18_to_Ne19) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_O15_to_p_F18); + rate_eval.screened_rates(k_He4_O15_to_p_F18) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_O15_to_p_F18); + rate_eval.dscreened_rates_dT(k_He4_O15_to_p_F18) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_F18_to_He4_O15); + rate_eval.screened_rates(k_p_F18_to_He4_O15) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_F18_to_He4_O15); + rate_eval.dscreened_rates_dT(k_p_F18_to_He4_O15) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 8.0_rt, 15.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Ne19_to_He4_O15); + rate_eval.screened_rates(k_Ne19_to_He4_O15) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ne19_to_He4_O15); + rate_eval.dscreened_rates_dT(k_Ne19_to_He4_O15) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_O15_to_Ne19); + rate_eval.screened_rates(k_He4_O15_to_Ne19) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_O15_to_Ne19); + rate_eval.dscreened_rates_dT(k_He4_O15_to_Ne19) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 9.0_rt, 19.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Ne20_to_p_F19); + rate_eval.screened_rates(k_Ne20_to_p_F19) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ne20_to_p_F19); + rate_eval.dscreened_rates_dT(k_Ne20_to_p_F19) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_F19_to_Ne20); + rate_eval.screened_rates(k_p_F19_to_Ne20) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_F19_to_Ne20); + rate_eval.dscreened_rates_dT(k_p_F19_to_Ne20) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_O16_to_p_F19); + rate_eval.screened_rates(k_He4_O16_to_p_F19) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_O16_to_p_F19); + rate_eval.dscreened_rates_dT(k_He4_O16_to_p_F19) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_F19_to_He4_O16); + rate_eval.screened_rates(k_p_F19_to_He4_O16) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_F19_to_He4_O16); + rate_eval.dscreened_rates_dT(k_p_F19_to_He4_O16) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 8.0_rt, 16.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Ne20_to_He4_O16); + rate_eval.screened_rates(k_Ne20_to_He4_O16) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ne20_to_He4_O16); + rate_eval.dscreened_rates_dT(k_Ne20_to_He4_O16) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_O16_to_Ne20); + rate_eval.screened_rates(k_He4_O16_to_Ne20) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_O16_to_Ne20); + rate_eval.dscreened_rates_dT(k_He4_O16_to_Ne20) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 8.0_rt, 17.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Ne21_to_He4_O17); + rate_eval.screened_rates(k_Ne21_to_He4_O17) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ne21_to_He4_O17); + rate_eval.dscreened_rates_dT(k_Ne21_to_He4_O17) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_O17_to_Ne21); + rate_eval.screened_rates(k_He4_O17_to_Ne21) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_O17_to_Ne21); + rate_eval.dscreened_rates_dT(k_He4_O17_to_Ne21) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 10.0_rt, 21.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Na22_to_p_Ne21); + rate_eval.screened_rates(k_Na22_to_p_Ne21) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Na22_to_p_Ne21); + rate_eval.dscreened_rates_dT(k_Na22_to_p_Ne21) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Ne21_to_Na22); + rate_eval.screened_rates(k_p_Ne21_to_Na22) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Ne21_to_Na22); + rate_eval.dscreened_rates_dT(k_p_Ne21_to_Na22) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 9.0_rt, 18.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Na22_to_He4_F18); + rate_eval.screened_rates(k_Na22_to_He4_F18) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Na22_to_He4_F18); + rate_eval.dscreened_rates_dT(k_Na22_to_He4_F18) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_F18_to_Na22); + rate_eval.screened_rates(k_He4_F18_to_Na22) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_F18_to_Na22); + rate_eval.dscreened_rates_dT(k_He4_F18_to_Na22) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_F18_to_p_Ne21); + rate_eval.screened_rates(k_He4_F18_to_p_Ne21) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_F18_to_p_Ne21); + rate_eval.dscreened_rates_dT(k_He4_F18_to_p_Ne21) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Ne21_to_He4_F18); + rate_eval.screened_rates(k_p_Ne21_to_He4_F18) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Ne21_to_He4_F18); + rate_eval.dscreened_rates_dT(k_p_Ne21_to_He4_F18) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 9.0_rt, 19.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Na23_to_He4_F19); + rate_eval.screened_rates(k_Na23_to_He4_F19) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Na23_to_He4_F19); + rate_eval.dscreened_rates_dT(k_Na23_to_He4_F19) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_F19_to_Na23); + rate_eval.screened_rates(k_He4_F19_to_Na23) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_F19_to_Na23); + rate_eval.dscreened_rates_dT(k_He4_F19_to_Na23) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 10.0_rt, 18.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Mg22_to_He4_Ne18); + rate_eval.screened_rates(k_Mg22_to_He4_Ne18) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Mg22_to_He4_Ne18); + rate_eval.dscreened_rates_dT(k_Mg22_to_He4_Ne18) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_Ne18_to_Mg22); + rate_eval.screened_rates(k_He4_Ne18_to_Mg22) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Ne18_to_Mg22); + rate_eval.dscreened_rates_dT(k_He4_Ne18_to_Mg22) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 11.0_rt, 23.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Mg24_to_p_Na23); + rate_eval.screened_rates(k_Mg24_to_p_Na23) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Mg24_to_p_Na23); + rate_eval.dscreened_rates_dT(k_Mg24_to_p_Na23) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Na23_to_Mg24); + rate_eval.screened_rates(k_p_Na23_to_Mg24) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Na23_to_Mg24); + rate_eval.dscreened_rates_dT(k_p_Na23_to_Mg24) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_Ne20_to_p_Na23); + rate_eval.screened_rates(k_He4_Ne20_to_p_Na23) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Ne20_to_p_Na23); + rate_eval.dscreened_rates_dT(k_He4_Ne20_to_p_Na23) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Na23_to_He4_Ne20); + rate_eval.screened_rates(k_p_Na23_to_He4_Ne20) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Na23_to_He4_Ne20); + rate_eval.dscreened_rates_dT(k_p_Na23_to_He4_Ne20) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 10.0_rt, 20.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Mg24_to_He4_Ne20); + rate_eval.screened_rates(k_Mg24_to_He4_Ne20) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Mg24_to_He4_Ne20); + rate_eval.dscreened_rates_dT(k_Mg24_to_He4_Ne20) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_Ne20_to_Mg24); + rate_eval.screened_rates(k_He4_Ne20_to_Mg24) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Ne20_to_Mg24); + rate_eval.dscreened_rates_dT(k_He4_Ne20_to_Mg24) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 13.0_rt, 27.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Si28_to_p_Al27); + rate_eval.screened_rates(k_Si28_to_p_Al27) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Si28_to_p_Al27); + rate_eval.dscreened_rates_dT(k_Si28_to_p_Al27) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Al27_to_Si28); + rate_eval.screened_rates(k_p_Al27_to_Si28) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Al27_to_Si28); + rate_eval.dscreened_rates_dT(k_p_Al27_to_Si28) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_Mg24_to_p_Al27); + rate_eval.screened_rates(k_He4_Mg24_to_p_Al27) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Mg24_to_p_Al27); + rate_eval.dscreened_rates_dT(k_He4_Mg24_to_p_Al27) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Al27_to_He4_Mg24); + rate_eval.screened_rates(k_p_Al27_to_He4_Mg24) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Al27_to_He4_Mg24); + rate_eval.dscreened_rates_dT(k_p_Al27_to_He4_Mg24) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 12.0_rt, 24.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_Si28_to_He4_Mg24); + rate_eval.screened_rates(k_Si28_to_He4_Mg24) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Si28_to_He4_Mg24); + rate_eval.dscreened_rates_dT(k_Si28_to_He4_Mg24) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_Mg24_to_Si28); + rate_eval.screened_rates(k_He4_Mg24_to_Si28) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Mg24_to_Si28); + rate_eval.dscreened_rates_dT(k_He4_Mg24_to_Si28) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 15.0_rt, 31.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_S32_to_p_P31); + rate_eval.screened_rates(k_S32_to_p_P31) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_S32_to_p_P31); + rate_eval.dscreened_rates_dT(k_S32_to_p_P31) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_P31_to_S32); + rate_eval.screened_rates(k_p_P31_to_S32) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_P31_to_S32); + rate_eval.dscreened_rates_dT(k_p_P31_to_S32) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_Si28_to_p_P31); + rate_eval.screened_rates(k_He4_Si28_to_p_P31) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Si28_to_p_P31); + rate_eval.dscreened_rates_dT(k_He4_Si28_to_p_P31) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_P31_to_He4_Si28); + rate_eval.screened_rates(k_p_P31_to_He4_Si28) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_P31_to_He4_Si28); + rate_eval.dscreened_rates_dT(k_p_P31_to_He4_Si28) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 14.0_rt, 28.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_S32_to_He4_Si28); + rate_eval.screened_rates(k_S32_to_He4_Si28) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_S32_to_He4_Si28); + rate_eval.dscreened_rates_dT(k_S32_to_He4_Si28) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_Si28_to_S32); + rate_eval.screened_rates(k_He4_Si28_to_S32) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Si28_to_S32); + rate_eval.dscreened_rates_dT(k_He4_Si28_to_S32) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 2.0_rt, 4.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + + { + constexpr auto scn_fac2 = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 4.0_rt, 8.0_rt); + + + static_assert(scn_fac2.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac2, scor2, dscor2_dt); + + } + + + ratraw = rate_eval.screened_rates(k_C12_to_He4_He4_He4); + rate_eval.screened_rates(k_C12_to_He4_He4_He4) *= scor * scor2; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_C12_to_He4_He4_He4); + rate_eval.dscreened_rates_dT(k_C12_to_He4_He4_He4) = ratraw * (scor * dscor2_dt + dscor_dt * scor2) + dratraw_dT * scor * scor2; + } + + ratraw = rate_eval.screened_rates(k_He4_He4_He4_to_C12); + rate_eval.screened_rates(k_He4_He4_He4_to_C12) *= scor * scor2; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_He4_He4_to_C12); + rate_eval.dscreened_rates_dT(k_He4_He4_He4_to_C12) = ratraw * (scor * dscor2_dt + dscor_dt * scor2) + dratraw_dT * scor * scor2; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(6.0_rt, 12.0_rt, 6.0_rt, 12.0_rt); + + + static_assert(scn_fac.z1 == 6.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_C12_C12_to_p_Na23); + rate_eval.screened_rates(k_C12_C12_to_p_Na23) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_C12_C12_to_p_Na23); + rate_eval.dscreened_rates_dT(k_C12_C12_to_p_Na23) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_C12_C12_to_He4_Ne20); + rate_eval.screened_rates(k_C12_C12_to_He4_Ne20) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_C12_C12_to_He4_Ne20); + rate_eval.dscreened_rates_dT(k_C12_C12_to_He4_Ne20) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_C12_C12_to_Mg24_modified); + rate_eval.screened_rates(k_C12_C12_to_Mg24_modified) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_C12_C12_to_Mg24_modified); + rate_eval.dscreened_rates_dT(k_C12_C12_to_Mg24_modified) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 7.0_rt, 13.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_N13_to_p_O16); + rate_eval.screened_rates(k_He4_N13_to_p_O16) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_N13_to_p_O16); + rate_eval.dscreened_rates_dT(k_He4_N13_to_p_O16) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_O16_to_He4_N13); + rate_eval.screened_rates(k_p_O16_to_He4_N13) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_O16_to_He4_N13); + rate_eval.dscreened_rates_dT(k_p_O16_to_He4_N13) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(6.0_rt, 12.0_rt, 8.0_rt, 16.0_rt); + + + static_assert(scn_fac.z1 == 6.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_C12_O16_to_p_Al27); + rate_eval.screened_rates(k_C12_O16_to_p_Al27) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_C12_O16_to_p_Al27); + rate_eval.dscreened_rates_dT(k_C12_O16_to_p_Al27) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_C12_O16_to_He4_Mg24); + rate_eval.screened_rates(k_C12_O16_to_He4_Mg24) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_C12_O16_to_He4_Mg24); + rate_eval.dscreened_rates_dT(k_C12_O16_to_He4_Mg24) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_C12_O16_to_Si28_modified); + rate_eval.screened_rates(k_C12_O16_to_Si28_modified) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_C12_O16_to_Si28_modified); + rate_eval.dscreened_rates_dT(k_C12_O16_to_Si28_modified) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(8.0_rt, 16.0_rt, 8.0_rt, 16.0_rt); + + + static_assert(scn_fac.z1 == 8.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_O16_O16_to_p_P31); + rate_eval.screened_rates(k_O16_O16_to_p_P31) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_O16_O16_to_p_P31); + rate_eval.dscreened_rates_dT(k_O16_O16_to_p_P31) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_O16_O16_to_He4_Si28); + rate_eval.screened_rates(k_O16_O16_to_He4_Si28) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_O16_O16_to_He4_Si28); + rate_eval.dscreened_rates_dT(k_O16_O16_to_He4_Si28) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_O16_O16_to_S32_modified); + rate_eval.screened_rates(k_O16_O16_to_S32_modified) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_O16_O16_to_S32_modified); + rate_eval.dscreened_rates_dT(k_O16_O16_to_S32_modified) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 9.0_rt, 17.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_F17_to_p_Ne20); + rate_eval.screened_rates(k_He4_F17_to_p_Ne20) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_F17_to_p_Ne20); + rate_eval.dscreened_rates_dT(k_He4_F17_to_p_Ne20) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Ne20_to_He4_F17); + rate_eval.screened_rates(k_p_Ne20_to_He4_F17) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Ne20_to_He4_F17); + rate_eval.dscreened_rates_dT(k_p_Ne20_to_He4_F17) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 10.0_rt, 19.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_Ne19_to_p_Na22); + rate_eval.screened_rates(k_He4_Ne19_to_p_Na22) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Ne19_to_p_Na22); + rate_eval.dscreened_rates_dT(k_He4_Ne19_to_p_Na22) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Na22_to_He4_Ne19); + rate_eval.screened_rates(k_p_Na22_to_He4_Ne19) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Na22_to_He4_Ne19); + rate_eval.dscreened_rates_dT(k_p_Na22_to_He4_Ne19) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 16.0_rt, 32.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_S32_to_Ar36_removed); + rate_eval.screened_rates(k_He4_S32_to_Ar36_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_S32_to_Ar36_removed); + rate_eval.dscreened_rates_dT(k_He4_S32_to_Ar36_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_Ar36_to_He4_S32_removed); + rate_eval.screened_rates(k_Ar36_to_He4_S32_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ar36_to_He4_S32_removed); + rate_eval.dscreened_rates_dT(k_Ar36_to_He4_S32_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 17.0_rt, 35.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_S32_to_p_Cl35_removed); + rate_eval.screened_rates(k_He4_S32_to_p_Cl35_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_S32_to_p_Cl35_removed); + rate_eval.dscreened_rates_dT(k_He4_S32_to_p_Cl35_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Cl35_to_Ar36_removed); + rate_eval.screened_rates(k_p_Cl35_to_Ar36_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Cl35_to_Ar36_removed); + rate_eval.dscreened_rates_dT(k_p_Cl35_to_Ar36_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_Ar36_to_p_Cl35_removed); + rate_eval.screened_rates(k_Ar36_to_p_Cl35_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ar36_to_p_Cl35_removed); + rate_eval.dscreened_rates_dT(k_Ar36_to_p_Cl35_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Cl35_to_He4_S32_removed); + rate_eval.screened_rates(k_p_Cl35_to_He4_S32_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Cl35_to_He4_S32_removed); + rate_eval.dscreened_rates_dT(k_p_Cl35_to_He4_S32_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 18.0_rt, 36.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_Ar36_to_Ca40_removed); + rate_eval.screened_rates(k_He4_Ar36_to_Ca40_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Ar36_to_Ca40_removed); + rate_eval.dscreened_rates_dT(k_He4_Ar36_to_Ca40_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_Ca40_to_He4_Ar36_removed); + rate_eval.screened_rates(k_Ca40_to_He4_Ar36_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ca40_to_He4_Ar36_removed); + rate_eval.dscreened_rates_dT(k_Ca40_to_He4_Ar36_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 19.0_rt, 39.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_Ar36_to_p_K39_removed); + rate_eval.screened_rates(k_He4_Ar36_to_p_K39_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Ar36_to_p_K39_removed); + rate_eval.dscreened_rates_dT(k_He4_Ar36_to_p_K39_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_K39_to_Ca40_removed); + rate_eval.screened_rates(k_p_K39_to_Ca40_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_K39_to_Ca40_removed); + rate_eval.dscreened_rates_dT(k_p_K39_to_Ca40_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_Ca40_to_p_K39_removed); + rate_eval.screened_rates(k_Ca40_to_p_K39_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ca40_to_p_K39_removed); + rate_eval.dscreened_rates_dT(k_Ca40_to_p_K39_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_K39_to_He4_Ar36_removed); + rate_eval.screened_rates(k_p_K39_to_He4_Ar36_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_K39_to_He4_Ar36_removed); + rate_eval.dscreened_rates_dT(k_p_K39_to_He4_Ar36_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 20.0_rt, 40.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_Ca40_to_Ti44_removed); + rate_eval.screened_rates(k_He4_Ca40_to_Ti44_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Ca40_to_Ti44_removed); + rate_eval.dscreened_rates_dT(k_He4_Ca40_to_Ti44_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_Ti44_to_He4_Ca40_removed); + rate_eval.screened_rates(k_Ti44_to_He4_Ca40_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ti44_to_He4_Ca40_removed); + rate_eval.dscreened_rates_dT(k_Ti44_to_He4_Ca40_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 21.0_rt, 43.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_Ca40_to_p_Sc43_removed); + rate_eval.screened_rates(k_He4_Ca40_to_p_Sc43_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Ca40_to_p_Sc43_removed); + rate_eval.dscreened_rates_dT(k_He4_Ca40_to_p_Sc43_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Sc43_to_Ti44_removed); + rate_eval.screened_rates(k_p_Sc43_to_Ti44_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Sc43_to_Ti44_removed); + rate_eval.dscreened_rates_dT(k_p_Sc43_to_Ti44_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_Ti44_to_p_Sc43_removed); + rate_eval.screened_rates(k_Ti44_to_p_Sc43_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ti44_to_p_Sc43_removed); + rate_eval.dscreened_rates_dT(k_Ti44_to_p_Sc43_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Sc43_to_He4_Ca40_removed); + rate_eval.screened_rates(k_p_Sc43_to_He4_Ca40_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Sc43_to_He4_Ca40_removed); + rate_eval.dscreened_rates_dT(k_p_Sc43_to_He4_Ca40_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 22.0_rt, 44.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_Ti44_to_Cr48_removed); + rate_eval.screened_rates(k_He4_Ti44_to_Cr48_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Ti44_to_Cr48_removed); + rate_eval.dscreened_rates_dT(k_He4_Ti44_to_Cr48_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_Cr48_to_He4_Ti44_removed); + rate_eval.screened_rates(k_Cr48_to_He4_Ti44_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Cr48_to_He4_Ti44_removed); + rate_eval.dscreened_rates_dT(k_Cr48_to_He4_Ti44_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 23.0_rt, 47.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_Ti44_to_p_V47_removed); + rate_eval.screened_rates(k_He4_Ti44_to_p_V47_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Ti44_to_p_V47_removed); + rate_eval.dscreened_rates_dT(k_He4_Ti44_to_p_V47_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_V47_to_Cr48_removed); + rate_eval.screened_rates(k_p_V47_to_Cr48_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_V47_to_Cr48_removed); + rate_eval.dscreened_rates_dT(k_p_V47_to_Cr48_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_Cr48_to_p_V47_removed); + rate_eval.screened_rates(k_Cr48_to_p_V47_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Cr48_to_p_V47_removed); + rate_eval.dscreened_rates_dT(k_Cr48_to_p_V47_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_V47_to_He4_Ti44_removed); + rate_eval.screened_rates(k_p_V47_to_He4_Ti44_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_V47_to_He4_Ti44_removed); + rate_eval.dscreened_rates_dT(k_p_V47_to_He4_Ti44_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 24.0_rt, 48.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_Cr48_to_Fe52_removed); + rate_eval.screened_rates(k_He4_Cr48_to_Fe52_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Cr48_to_Fe52_removed); + rate_eval.dscreened_rates_dT(k_He4_Cr48_to_Fe52_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_Cr48_to_p_Mn51_removed); + rate_eval.screened_rates(k_He4_Cr48_to_p_Mn51_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Cr48_to_p_Mn51_removed); + rate_eval.dscreened_rates_dT(k_He4_Cr48_to_p_Mn51_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_Fe52_to_He4_Cr48_removed); + rate_eval.screened_rates(k_Fe52_to_He4_Cr48_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Fe52_to_He4_Cr48_removed); + rate_eval.dscreened_rates_dT(k_Fe52_to_He4_Cr48_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Mn51_to_He4_Cr48_removed); + rate_eval.screened_rates(k_p_Mn51_to_He4_Cr48_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Mn51_to_He4_Cr48_removed); + rate_eval.dscreened_rates_dT(k_p_Mn51_to_He4_Cr48_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 25.0_rt, 51.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_p_Mn51_to_Fe52_removed); + rate_eval.screened_rates(k_p_Mn51_to_Fe52_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Mn51_to_Fe52_removed); + rate_eval.dscreened_rates_dT(k_p_Mn51_to_Fe52_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_Fe52_to_p_Mn51_removed); + rate_eval.screened_rates(k_Fe52_to_p_Mn51_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Fe52_to_p_Mn51_removed); + rate_eval.dscreened_rates_dT(k_Fe52_to_p_Mn51_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(2.0_rt, 4.0_rt, 26.0_rt, 52.0_rt); + + + static_assert(scn_fac.z1 == 2.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_He4_Fe52_to_Ni56_removed); + rate_eval.screened_rates(k_He4_Fe52_to_Ni56_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Fe52_to_Ni56_removed); + rate_eval.dscreened_rates_dT(k_He4_Fe52_to_Ni56_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_He4_Fe52_to_p_Co55_removed); + rate_eval.screened_rates(k_He4_Fe52_to_p_Co55_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_He4_Fe52_to_p_Co55_removed); + rate_eval.dscreened_rates_dT(k_He4_Fe52_to_p_Co55_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_Ni56_to_He4_Fe52_removed); + rate_eval.screened_rates(k_Ni56_to_He4_Fe52_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ni56_to_He4_Fe52_removed); + rate_eval.dscreened_rates_dT(k_Ni56_to_He4_Fe52_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_p_Co55_to_He4_Fe52_removed); + rate_eval.screened_rates(k_p_Co55_to_He4_Fe52_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Co55_to_He4_Fe52_removed); + rate_eval.dscreened_rates_dT(k_p_Co55_to_He4_Fe52_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + { + constexpr auto scn_fac = scrn::calculate_screen_factor(1.0_rt, 1.0_rt, 27.0_rt, 55.0_rt); + + + static_assert(scn_fac.z1 == 1.0_rt); + + + actual_screen(pstate, scn_fac, scor, dscor_dt); + } + + + ratraw = rate_eval.screened_rates(k_p_Co55_to_Ni56_removed); + rate_eval.screened_rates(k_p_Co55_to_Ni56_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_p_Co55_to_Ni56_removed); + rate_eval.dscreened_rates_dT(k_p_Co55_to_Ni56_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + ratraw = rate_eval.screened_rates(k_Ni56_to_p_Co55_removed); + rate_eval.screened_rates(k_Ni56_to_p_Co55_removed) *= scor; + if constexpr (std::is_same_v) { + dratraw_dT = rate_eval.dscreened_rates_dT(k_Ni56_to_p_Co55_removed); + rate_eval.dscreened_rates_dT(k_Ni56_to_p_Co55_removed) = ratraw * dscor_dt + dratraw_dT * scor; + } + + + // Fill approximate rates + + fill_approx_rates(tfactors, rate_eval); + + // Calculate tabular rates + + [[maybe_unused]] amrex::Real rate, drate_dt, edot_nu, edot_gamma; + + rate_eval.enuc_weak = 0.0_rt; + + +} + +#ifdef NSE_NET +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void get_ydot_weak(const burn_t& state, + amrex::Array1D& ydot_nuc, + amrex::Real& enuc_weak, + [[maybe_unused]] const amrex::Array1D& Y) { + /// + /// Calculate Ydots contribute only from weak reactions. + /// This is used to calculate dyedt and energy generation from + /// weak reactions for self-consistent NSE + /// + + + // initialize ydot_nuc to 0 + + for (int i = 1; i <= neqs; ++i) { + ydot_nuc(i) = 0.0_rt; + } + + rate_t rate_eval; + + [[maybe_unused]] amrex::Real rate, drate_dt, edot_nu, edot_gamma; + [[maybe_unused]] amrex::Real rhoy = state.rho * state.y_e; + + rate_eval.enuc_weak = 0.0_rt; + + // Calculate tabular rates and get ydot_weak + + + ydot_nuc(H1) = 0.0_rt; + + ydot_nuc(He4) = 0.0_rt; + + ydot_nuc(C12) = 0.0_rt; + + ydot_nuc(C13) = 0.0_rt; + + ydot_nuc(N13) = 0.0_rt; + + ydot_nuc(N14) = 0.0_rt; + + ydot_nuc(N15) = 0.0_rt; + + ydot_nuc(O14) = 0.0_rt; + + ydot_nuc(O15) = 0.0_rt; + + ydot_nuc(O16) = 0.0_rt; + + ydot_nuc(O17) = 0.0_rt; + + ydot_nuc(O18) = 0.0_rt; + + ydot_nuc(F17) = 0.0_rt; + + ydot_nuc(F18) = 0.0_rt; + + ydot_nuc(F19) = 0.0_rt; + + ydot_nuc(Ne18) = 0.0_rt; + + ydot_nuc(Ne19) = 0.0_rt; + + ydot_nuc(Ne20) = 0.0_rt; + + ydot_nuc(Ne21) = 0.0_rt; + + ydot_nuc(Na22) = 0.0_rt; + + ydot_nuc(Na23) = 0.0_rt; + + ydot_nuc(Mg22) = 0.0_rt; + + ydot_nuc(Mg24) = 0.0_rt; + + ydot_nuc(Al27) = 0.0_rt; + + ydot_nuc(Si28) = 0.0_rt; + + ydot_nuc(P31) = 0.0_rt; + + ydot_nuc(S32) = 0.0_rt; + + ydot_nuc(Ar36) = 0.0_rt; + + ydot_nuc(Ca40) = 0.0_rt; + + ydot_nuc(Ti44) = 0.0_rt; + + ydot_nuc(Cr48) = 0.0_rt; + + ydot_nuc(Fe52) = 0.0_rt; + + ydot_nuc(Ni56) = 0.0_rt; + + enuc_weak = rate_eval.enuc_weak; +} +#endif + + +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rhs_nuc(const burn_t& state, + amrex::Array1D& ydot_nuc, + const amrex::Array1D& Y, + const amrex::Array1D& screened_rates) { + + using namespace Rates; + + ydot_nuc(H1) = + (-screened_rates(k_p_C12_to_N13)*Y(C12)*Y(H1)*state.rho + screened_rates(k_N13_to_p_C12)*Y(N13)) + + (-screened_rates(k_p_C13_to_N14)*Y(C13)*Y(H1)*state.rho + screened_rates(k_N14_to_p_C13)*Y(N14)) + + (-screened_rates(k_p_N13_to_O14)*Y(N13)*Y(H1)*state.rho + screened_rates(k_O14_to_p_N13)*Y(O14)) + + (-screened_rates(k_p_N14_to_O15)*Y(N14)*Y(H1)*state.rho + screened_rates(k_O15_to_p_N14)*Y(O15)) + + (-screened_rates(k_p_N15_to_O16)*Y(N15)*Y(H1)*state.rho + screened_rates(k_O16_to_p_N15)*Y(O16)) + + (-screened_rates(k_p_O16_to_F17)*Y(O16)*Y(H1)*state.rho + screened_rates(k_F17_to_p_O16)*Y(F17)) + + (-screened_rates(k_p_O17_to_F18)*Y(O17)*Y(H1)*state.rho + screened_rates(k_F18_to_p_O17)*Y(F18)) + + (-screened_rates(k_p_O18_to_F19)*Y(O18)*Y(H1)*state.rho + screened_rates(k_F19_to_p_O18)*Y(F19)) + + (-screened_rates(k_p_F17_to_Ne18)*Y(F17)*Y(H1)*state.rho + screened_rates(k_Ne18_to_p_F17)*Y(Ne18)) + + (-screened_rates(k_p_F18_to_Ne19)*Y(F18)*Y(H1)*state.rho + screened_rates(k_Ne19_to_p_F18)*Y(Ne19)) + + (-screened_rates(k_p_F19_to_Ne20)*Y(F19)*Y(H1)*state.rho + screened_rates(k_Ne20_to_p_F19)*Y(Ne20)) + + (-screened_rates(k_p_Ne21_to_Na22)*Y(Ne21)*Y(H1)*state.rho + screened_rates(k_Na22_to_p_Ne21)*Y(Na22)) + + (-screened_rates(k_p_Na23_to_Mg24)*Y(Na23)*Y(H1)*state.rho + screened_rates(k_Mg24_to_p_Na23)*Y(Mg24)) + + (-screened_rates(k_p_Al27_to_Si28)*Y(Al27)*Y(H1)*state.rho + screened_rates(k_Si28_to_p_Al27)*Y(Si28)) + + (-screened_rates(k_p_P31_to_S32)*Y(P31)*Y(H1)*state.rho + screened_rates(k_S32_to_p_P31)*Y(S32)) + + 0.5*screened_rates(k_C12_C12_to_p_Na23)*amrex::Math::powi<2>(Y(C12))*state.rho + + (screened_rates(k_He4_N13_to_p_O16)*Y(He4)*Y(N13)*state.rho + -screened_rates(k_p_O16_to_He4_N13)*Y(O16)*Y(H1)*state.rho) + + (-screened_rates(k_p_N15_to_He4_C12)*Y(N15)*Y(H1)*state.rho + screened_rates(k_He4_C12_to_p_N15)*Y(C12)*Y(He4)*state.rho) + + (screened_rates(k_He4_O14_to_p_F17)*Y(He4)*Y(O14)*state.rho + -screened_rates(k_p_F17_to_He4_O14)*Y(F17)*Y(H1)*state.rho) + + screened_rates(k_C12_O16_to_p_Al27)*Y(C12)*Y(O16)*state.rho + + 0.5*screened_rates(k_O16_O16_to_p_P31)*amrex::Math::powi<2>(Y(O16))*state.rho + + (-screened_rates(k_p_O17_to_He4_N14)*Y(O17)*Y(H1)*state.rho + screened_rates(k_He4_N14_to_p_O17)*Y(He4)*Y(N14)*state.rho) + + (-screened_rates(k_p_O18_to_He4_N15)*Y(O18)*Y(H1)*state.rho + screened_rates(k_He4_N15_to_p_O18)*Y(He4)*Y(N15)*state.rho) + + (screened_rates(k_He4_F17_to_p_Ne20)*Y(F17)*Y(He4)*state.rho + -screened_rates(k_p_Ne20_to_He4_F17)*Y(Ne20)*Y(H1)*state.rho) + + (-screened_rates(k_p_F18_to_He4_O15)*Y(F18)*Y(H1)*state.rho + screened_rates(k_He4_O15_to_p_F18)*Y(He4)*Y(O15)*state.rho) + + (screened_rates(k_He4_F18_to_p_Ne21)*Y(F18)*Y(He4)*state.rho + -screened_rates(k_p_Ne21_to_He4_F18)*Y(Ne21)*Y(H1)*state.rho) + + (-screened_rates(k_p_F19_to_He4_O16)*Y(F19)*Y(H1)*state.rho + screened_rates(k_He4_O16_to_p_F19)*Y(He4)*Y(O16)*state.rho) + + (screened_rates(k_He4_Ne19_to_p_Na22)*Y(He4)*Y(Ne19)*state.rho + -screened_rates(k_p_Na22_to_He4_Ne19)*Y(Na22)*Y(H1)*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_p_Al27_to_He4_Mg24)*Y(Al27)*Y(H1)*state.rho + screened_rates(k_He4_Mg24_to_p_Al27)*Y(He4)*Y(Mg24)*state.rho) + + (-screened_rates(k_p_P31_to_He4_Si28)*Y(P31)*Y(H1)*state.rho + screened_rates(k_He4_Si28_to_p_P31)*Y(He4)*Y(Si28)*state.rho); + + ydot_nuc(He4) = + (-screened_rates(k_He4_C12_to_O16)*Y(C12)*Y(He4)*state.rho + screened_rates(k_O16_to_He4_C12)*Y(O16)) + + (-screened_rates(k_He4_N14_to_F18)*Y(He4)*Y(N14)*state.rho + screened_rates(k_F18_to_He4_N14)*Y(F18)) + + (-screened_rates(k_He4_N15_to_F19)*Y(He4)*Y(N15)*state.rho + screened_rates(k_F19_to_He4_N15)*Y(F19)) + + (-screened_rates(k_He4_O14_to_Ne18)*Y(He4)*Y(O14)*state.rho + screened_rates(k_Ne18_to_He4_O14)*Y(Ne18)) + + (-screened_rates(k_He4_O15_to_Ne19)*Y(He4)*Y(O15)*state.rho + screened_rates(k_Ne19_to_He4_O15)*Y(Ne19)) + + (-screened_rates(k_He4_O16_to_Ne20)*Y(He4)*Y(O16)*state.rho + screened_rates(k_Ne20_to_He4_O16)*Y(Ne20)) + + (-screened_rates(k_He4_O17_to_Ne21)*Y(He4)*Y(O17)*state.rho + screened_rates(k_Ne21_to_He4_O17)*Y(Ne21)) + + (-screened_rates(k_He4_F18_to_Na22)*Y(F18)*Y(He4)*state.rho + screened_rates(k_Na22_to_He4_F18)*Y(Na22)) + + (-screened_rates(k_He4_F19_to_Na23)*Y(F19)*Y(He4)*state.rho + screened_rates(k_Na23_to_He4_F19)*Y(Na23)) + + (-screened_rates(k_He4_Ne18_to_Mg22)*Y(He4)*Y(Ne18)*state.rho + screened_rates(k_Mg22_to_He4_Ne18)*Y(Mg22)) + + (-screened_rates(k_He4_Ne20_to_Mg24)*Y(He4)*Y(Ne20)*state.rho + screened_rates(k_Mg24_to_He4_Ne20)*Y(Mg24)) + + (-screened_rates(k_He4_Mg24_to_Si28)*Y(He4)*Y(Mg24)*state.rho + screened_rates(k_Si28_to_He4_Mg24)*Y(Si28)) + + (-screened_rates(k_He4_Si28_to_S32)*Y(He4)*Y(Si28)*state.rho + screened_rates(k_S32_to_He4_Si28)*Y(S32)) + + 0.5*screened_rates(k_C12_C12_to_He4_Ne20)*amrex::Math::powi<2>(Y(C12))*state.rho + + (-screened_rates(k_He4_N13_to_p_O16)*Y(He4)*Y(N13)*state.rho + screened_rates(k_p_O16_to_He4_N13)*Y(O16)*Y(H1)*state.rho) + + (screened_rates(k_p_N15_to_He4_C12)*Y(N15)*Y(H1)*state.rho + -screened_rates(k_He4_C12_to_p_N15)*Y(C12)*Y(He4)*state.rho) + + (-screened_rates(k_He4_O14_to_p_F17)*Y(He4)*Y(O14)*state.rho + screened_rates(k_p_F17_to_He4_O14)*Y(F17)*Y(H1)*state.rho) + + screened_rates(k_C12_O16_to_He4_Mg24)*Y(C12)*Y(O16)*state.rho + + 0.5*screened_rates(k_O16_O16_to_He4_Si28)*amrex::Math::powi<2>(Y(O16))*state.rho + + (screened_rates(k_p_O17_to_He4_N14)*Y(O17)*Y(H1)*state.rho + -screened_rates(k_He4_N14_to_p_O17)*Y(He4)*Y(N14)*state.rho) + + (screened_rates(k_p_O18_to_He4_N15)*Y(O18)*Y(H1)*state.rho + -screened_rates(k_He4_N15_to_p_O18)*Y(He4)*Y(N15)*state.rho) + + (-screened_rates(k_He4_F17_to_p_Ne20)*Y(F17)*Y(He4)*state.rho + screened_rates(k_p_Ne20_to_He4_F17)*Y(Ne20)*Y(H1)*state.rho) + + (screened_rates(k_p_F18_to_He4_O15)*Y(F18)*Y(H1)*state.rho + -screened_rates(k_He4_O15_to_p_F18)*Y(He4)*Y(O15)*state.rho) + + (-screened_rates(k_He4_F18_to_p_Ne21)*Y(F18)*Y(He4)*state.rho + screened_rates(k_p_Ne21_to_He4_F18)*Y(Ne21)*Y(H1)*state.rho) + + (screened_rates(k_p_F19_to_He4_O16)*Y(F19)*Y(H1)*state.rho + -screened_rates(k_He4_O16_to_p_F19)*Y(He4)*Y(O16)*state.rho) + + (-screened_rates(k_He4_Ne19_to_p_Na22)*Y(He4)*Y(Ne19)*state.rho + screened_rates(k_p_Na22_to_He4_Ne19)*Y(Na22)*Y(H1)*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_p_Al27_to_He4_Mg24)*Y(Al27)*Y(H1)*state.rho + -screened_rates(k_He4_Mg24_to_p_Al27)*Y(He4)*Y(Mg24)*state.rho) + + (screened_rates(k_p_P31_to_He4_Si28)*Y(P31)*Y(H1)*state.rho + -screened_rates(k_He4_Si28_to_p_P31)*Y(He4)*Y(Si28)*state.rho) + + (-0.5*screened_rates(k_He4_He4_He4_to_C12)*amrex::Math::powi<3>(Y(He4))*amrex::Math::powi<2>(state.rho) + 3.0*screened_rates(k_C12_to_He4_He4_He4)*Y(C12)) + + (-screened_rates(k_S32_He4_to_Ar36_approx)*Y(He4)*Y(S32)*state.rho + screened_rates(k_Ar36_to_S32_He4_approx)*Y(Ar36)) + + (-screened_rates(k_Ar36_He4_to_Ca40_approx)*Y(Ar36)*Y(He4)*state.rho + screened_rates(k_Ca40_to_Ar36_He4_approx)*Y(Ca40)) + + (-screened_rates(k_Ca40_He4_to_Ti44_approx)*Y(Ca40)*Y(He4)*state.rho + screened_rates(k_Ti44_to_Ca40_He4_approx)*Y(Ti44)) + + (-screened_rates(k_Ti44_He4_to_Cr48_approx)*Y(He4)*Y(Ti44)*state.rho + screened_rates(k_Cr48_to_Ti44_He4_approx)*Y(Cr48)) + + (-screened_rates(k_Cr48_He4_to_Fe52_approx)*Y(Cr48)*Y(He4)*state.rho + screened_rates(k_Fe52_to_Cr48_He4_approx)*Y(Fe52)) + + (-screened_rates(k_Fe52_He4_to_Ni56_approx)*Y(Fe52)*Y(He4)*state.rho + screened_rates(k_Ni56_to_Fe52_He4_approx)*Y(Ni56)); + + ydot_nuc(C12) = + (-screened_rates(k_p_C12_to_N13)*Y(C12)*Y(H1)*state.rho + screened_rates(k_N13_to_p_C12)*Y(N13)) + + (-screened_rates(k_He4_C12_to_O16)*Y(C12)*Y(He4)*state.rho + screened_rates(k_O16_to_He4_C12)*Y(O16)) + + -screened_rates(k_C12_C12_to_p_Na23)*amrex::Math::powi<2>(Y(C12))*state.rho + + -screened_rates(k_C12_C12_to_He4_Ne20)*amrex::Math::powi<2>(Y(C12))*state.rho + + (screened_rates(k_p_N15_to_He4_C12)*Y(N15)*Y(H1)*state.rho + -screened_rates(k_He4_C12_to_p_N15)*Y(C12)*Y(He4)*state.rho) + + -screened_rates(k_C12_O16_to_p_Al27)*Y(C12)*Y(O16)*state.rho + + -screened_rates(k_C12_O16_to_He4_Mg24)*Y(C12)*Y(O16)*state.rho + + (0.16666666666666667*screened_rates(k_He4_He4_He4_to_C12)*amrex::Math::powi<3>(Y(He4))*amrex::Math::powi<2>(state.rho) + -screened_rates(k_C12_to_He4_He4_He4)*Y(C12)) + + -screened_rates(k_C12_C12_to_Mg24_modified)*amrex::Math::powi<2>(Y(C12))*state.rho + + -screened_rates(k_C12_O16_to_Si28_modified)*Y(C12)*Y(O16)*state.rho; + + ydot_nuc(C13) = + screened_rates(k_N13_to_C13_weak_wc12)*Y(N13) + + (-screened_rates(k_p_C13_to_N14)*Y(C13)*Y(H1)*state.rho + screened_rates(k_N14_to_p_C13)*Y(N14)); + + ydot_nuc(N13) = + -screened_rates(k_N13_to_C13_weak_wc12)*Y(N13) + + (screened_rates(k_p_C12_to_N13)*Y(C12)*Y(H1)*state.rho + -screened_rates(k_N13_to_p_C12)*Y(N13)) + + (-screened_rates(k_p_N13_to_O14)*Y(N13)*Y(H1)*state.rho + screened_rates(k_O14_to_p_N13)*Y(O14)) + + (-screened_rates(k_He4_N13_to_p_O16)*Y(He4)*Y(N13)*state.rho + screened_rates(k_p_O16_to_He4_N13)*Y(O16)*Y(H1)*state.rho); + + ydot_nuc(N14) = + screened_rates(k_O14_to_N14_weak_wc12)*Y(O14) + + (screened_rates(k_p_C13_to_N14)*Y(C13)*Y(H1)*state.rho + -screened_rates(k_N14_to_p_C13)*Y(N14)) + + (-screened_rates(k_p_N14_to_O15)*Y(N14)*Y(H1)*state.rho + screened_rates(k_O15_to_p_N14)*Y(O15)) + + (-screened_rates(k_He4_N14_to_F18)*Y(He4)*Y(N14)*state.rho + screened_rates(k_F18_to_He4_N14)*Y(F18)) + + (screened_rates(k_p_O17_to_He4_N14)*Y(O17)*Y(H1)*state.rho + -screened_rates(k_He4_N14_to_p_O17)*Y(He4)*Y(N14)*state.rho); + + ydot_nuc(N15) = + screened_rates(k_O15_to_N15_weak_wc12)*Y(O15) + + (-screened_rates(k_p_N15_to_O16)*Y(N15)*Y(H1)*state.rho + screened_rates(k_O16_to_p_N15)*Y(O16)) + + (-screened_rates(k_He4_N15_to_F19)*Y(He4)*Y(N15)*state.rho + screened_rates(k_F19_to_He4_N15)*Y(F19)) + + (-screened_rates(k_p_N15_to_He4_C12)*Y(N15)*Y(H1)*state.rho + screened_rates(k_He4_C12_to_p_N15)*Y(C12)*Y(He4)*state.rho) + + (screened_rates(k_p_O18_to_He4_N15)*Y(O18)*Y(H1)*state.rho + -screened_rates(k_He4_N15_to_p_O18)*Y(He4)*Y(N15)*state.rho); + + ydot_nuc(O14) = + -screened_rates(k_O14_to_N14_weak_wc12)*Y(O14) + + (screened_rates(k_p_N13_to_O14)*Y(N13)*Y(H1)*state.rho + -screened_rates(k_O14_to_p_N13)*Y(O14)) + + (-screened_rates(k_He4_O14_to_Ne18)*Y(He4)*Y(O14)*state.rho + screened_rates(k_Ne18_to_He4_O14)*Y(Ne18)) + + (-screened_rates(k_He4_O14_to_p_F17)*Y(He4)*Y(O14)*state.rho + screened_rates(k_p_F17_to_He4_O14)*Y(F17)*Y(H1)*state.rho); + + ydot_nuc(O15) = + -screened_rates(k_O15_to_N15_weak_wc12)*Y(O15) + + (screened_rates(k_p_N14_to_O15)*Y(N14)*Y(H1)*state.rho + -screened_rates(k_O15_to_p_N14)*Y(O15)) + + (-screened_rates(k_He4_O15_to_Ne19)*Y(He4)*Y(O15)*state.rho + screened_rates(k_Ne19_to_He4_O15)*Y(Ne19)) + + (screened_rates(k_p_F18_to_He4_O15)*Y(F18)*Y(H1)*state.rho + -screened_rates(k_He4_O15_to_p_F18)*Y(He4)*Y(O15)*state.rho); + + ydot_nuc(O16) = + (screened_rates(k_He4_C12_to_O16)*Y(C12)*Y(He4)*state.rho + -screened_rates(k_O16_to_He4_C12)*Y(O16)) + + (screened_rates(k_p_N15_to_O16)*Y(N15)*Y(H1)*state.rho + -screened_rates(k_O16_to_p_N15)*Y(O16)) + + (-screened_rates(k_p_O16_to_F17)*Y(O16)*Y(H1)*state.rho + screened_rates(k_F17_to_p_O16)*Y(F17)) + + (-screened_rates(k_He4_O16_to_Ne20)*Y(He4)*Y(O16)*state.rho + screened_rates(k_Ne20_to_He4_O16)*Y(Ne20)) + + (screened_rates(k_He4_N13_to_p_O16)*Y(He4)*Y(N13)*state.rho + -screened_rates(k_p_O16_to_He4_N13)*Y(O16)*Y(H1)*state.rho) + + -screened_rates(k_C12_O16_to_p_Al27)*Y(C12)*Y(O16)*state.rho + + -screened_rates(k_C12_O16_to_He4_Mg24)*Y(C12)*Y(O16)*state.rho + + -screened_rates(k_O16_O16_to_p_P31)*amrex::Math::powi<2>(Y(O16))*state.rho + + -screened_rates(k_O16_O16_to_He4_Si28)*amrex::Math::powi<2>(Y(O16))*state.rho + + (screened_rates(k_p_F19_to_He4_O16)*Y(F19)*Y(H1)*state.rho + -screened_rates(k_He4_O16_to_p_F19)*Y(He4)*Y(O16)*state.rho) + + -screened_rates(k_O16_O16_to_S32_modified)*amrex::Math::powi<2>(Y(O16))*state.rho + + -screened_rates(k_C12_O16_to_Si28_modified)*Y(C12)*Y(O16)*state.rho; + + ydot_nuc(O17) = + screened_rates(k_F17_to_O17_weak_wc12)*Y(F17) + + (-screened_rates(k_p_O17_to_F18)*Y(O17)*Y(H1)*state.rho + screened_rates(k_F18_to_p_O17)*Y(F18)) + + (-screened_rates(k_He4_O17_to_Ne21)*Y(He4)*Y(O17)*state.rho + screened_rates(k_Ne21_to_He4_O17)*Y(Ne21)) + + (-screened_rates(k_p_O17_to_He4_N14)*Y(O17)*Y(H1)*state.rho + screened_rates(k_He4_N14_to_p_O17)*Y(He4)*Y(N14)*state.rho); + + ydot_nuc(O18) = + screened_rates(k_F18_to_O18_weak_wc12)*Y(F18) + + (-screened_rates(k_p_O18_to_F19)*Y(O18)*Y(H1)*state.rho + screened_rates(k_F19_to_p_O18)*Y(F19)) + + (-screened_rates(k_p_O18_to_He4_N15)*Y(O18)*Y(H1)*state.rho + screened_rates(k_He4_N15_to_p_O18)*Y(He4)*Y(N15)*state.rho); + + ydot_nuc(F17) = + -screened_rates(k_F17_to_O17_weak_wc12)*Y(F17) + + (screened_rates(k_p_O16_to_F17)*Y(O16)*Y(H1)*state.rho + -screened_rates(k_F17_to_p_O16)*Y(F17)) + + (-screened_rates(k_p_F17_to_Ne18)*Y(F17)*Y(H1)*state.rho + screened_rates(k_Ne18_to_p_F17)*Y(Ne18)) + + (screened_rates(k_He4_O14_to_p_F17)*Y(He4)*Y(O14)*state.rho + -screened_rates(k_p_F17_to_He4_O14)*Y(F17)*Y(H1)*state.rho) + + (-screened_rates(k_He4_F17_to_p_Ne20)*Y(F17)*Y(He4)*state.rho + screened_rates(k_p_Ne20_to_He4_F17)*Y(Ne20)*Y(H1)*state.rho); + + ydot_nuc(F18) = + -screened_rates(k_F18_to_O18_weak_wc12)*Y(F18) + + screened_rates(k_Ne18_to_F18_weak_wc12)*Y(Ne18) + + (screened_rates(k_He4_N14_to_F18)*Y(He4)*Y(N14)*state.rho + -screened_rates(k_F18_to_He4_N14)*Y(F18)) + + (screened_rates(k_p_O17_to_F18)*Y(O17)*Y(H1)*state.rho + -screened_rates(k_F18_to_p_O17)*Y(F18)) + + (-screened_rates(k_p_F18_to_Ne19)*Y(F18)*Y(H1)*state.rho + screened_rates(k_Ne19_to_p_F18)*Y(Ne19)) + + (-screened_rates(k_He4_F18_to_Na22)*Y(F18)*Y(He4)*state.rho + screened_rates(k_Na22_to_He4_F18)*Y(Na22)) + + (-screened_rates(k_p_F18_to_He4_O15)*Y(F18)*Y(H1)*state.rho + screened_rates(k_He4_O15_to_p_F18)*Y(He4)*Y(O15)*state.rho) + + (-screened_rates(k_He4_F18_to_p_Ne21)*Y(F18)*Y(He4)*state.rho + screened_rates(k_p_Ne21_to_He4_F18)*Y(Ne21)*Y(H1)*state.rho); + + ydot_nuc(F19) = + screened_rates(k_Ne19_to_F19_weak_wc12)*Y(Ne19) + + (screened_rates(k_He4_N15_to_F19)*Y(He4)*Y(N15)*state.rho + -screened_rates(k_F19_to_He4_N15)*Y(F19)) + + (screened_rates(k_p_O18_to_F19)*Y(O18)*Y(H1)*state.rho + -screened_rates(k_F19_to_p_O18)*Y(F19)) + + (-screened_rates(k_p_F19_to_Ne20)*Y(F19)*Y(H1)*state.rho + screened_rates(k_Ne20_to_p_F19)*Y(Ne20)) + + (-screened_rates(k_He4_F19_to_Na23)*Y(F19)*Y(He4)*state.rho + screened_rates(k_Na23_to_He4_F19)*Y(Na23)) + + (-screened_rates(k_p_F19_to_He4_O16)*Y(F19)*Y(H1)*state.rho + screened_rates(k_He4_O16_to_p_F19)*Y(He4)*Y(O16)*state.rho); + + ydot_nuc(Ne18) = + -screened_rates(k_Ne18_to_F18_weak_wc12)*Y(Ne18) + + (screened_rates(k_He4_O14_to_Ne18)*Y(He4)*Y(O14)*state.rho + -screened_rates(k_Ne18_to_He4_O14)*Y(Ne18)) + + (screened_rates(k_p_F17_to_Ne18)*Y(F17)*Y(H1)*state.rho + -screened_rates(k_Ne18_to_p_F17)*Y(Ne18)) + + (-screened_rates(k_He4_Ne18_to_Mg22)*Y(He4)*Y(Ne18)*state.rho + screened_rates(k_Mg22_to_He4_Ne18)*Y(Mg22)); + + ydot_nuc(Ne19) = + -screened_rates(k_Ne19_to_F19_weak_wc12)*Y(Ne19) + + (screened_rates(k_He4_O15_to_Ne19)*Y(He4)*Y(O15)*state.rho + -screened_rates(k_Ne19_to_He4_O15)*Y(Ne19)) + + (screened_rates(k_p_F18_to_Ne19)*Y(F18)*Y(H1)*state.rho + -screened_rates(k_Ne19_to_p_F18)*Y(Ne19)) + + (-screened_rates(k_He4_Ne19_to_p_Na22)*Y(He4)*Y(Ne19)*state.rho + screened_rates(k_p_Na22_to_He4_Ne19)*Y(Na22)*Y(H1)*state.rho); + + ydot_nuc(Ne20) = + (screened_rates(k_He4_O16_to_Ne20)*Y(He4)*Y(O16)*state.rho + -screened_rates(k_Ne20_to_He4_O16)*Y(Ne20)) + + (screened_rates(k_p_F19_to_Ne20)*Y(F19)*Y(H1)*state.rho + -screened_rates(k_Ne20_to_p_F19)*Y(Ne20)) + + (-screened_rates(k_He4_Ne20_to_Mg24)*Y(He4)*Y(Ne20)*state.rho + screened_rates(k_Mg24_to_He4_Ne20)*Y(Mg24)) + + 0.5*screened_rates(k_C12_C12_to_He4_Ne20)*amrex::Math::powi<2>(Y(C12))*state.rho + + (screened_rates(k_He4_F17_to_p_Ne20)*Y(F17)*Y(He4)*state.rho + -screened_rates(k_p_Ne20_to_He4_F17)*Y(Ne20)*Y(H1)*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); + + ydot_nuc(Ne21) = + (screened_rates(k_He4_O17_to_Ne21)*Y(He4)*Y(O17)*state.rho + -screened_rates(k_Ne21_to_He4_O17)*Y(Ne21)) + + (-screened_rates(k_p_Ne21_to_Na22)*Y(Ne21)*Y(H1)*state.rho + screened_rates(k_Na22_to_p_Ne21)*Y(Na22)) + + (screened_rates(k_He4_F18_to_p_Ne21)*Y(F18)*Y(He4)*state.rho + -screened_rates(k_p_Ne21_to_He4_F18)*Y(Ne21)*Y(H1)*state.rho); + + ydot_nuc(Na22) = + screened_rates(k_Mg22_to_Na22_weak_wc12)*Y(Mg22) + + (screened_rates(k_He4_F18_to_Na22)*Y(F18)*Y(He4)*state.rho + -screened_rates(k_Na22_to_He4_F18)*Y(Na22)) + + (screened_rates(k_p_Ne21_to_Na22)*Y(Ne21)*Y(H1)*state.rho + -screened_rates(k_Na22_to_p_Ne21)*Y(Na22)) + + (screened_rates(k_He4_Ne19_to_p_Na22)*Y(He4)*Y(Ne19)*state.rho + -screened_rates(k_p_Na22_to_He4_Ne19)*Y(Na22)*Y(H1)*state.rho); + + ydot_nuc(Na23) = + (screened_rates(k_He4_F19_to_Na23)*Y(F19)*Y(He4)*state.rho + -screened_rates(k_Na23_to_He4_F19)*Y(Na23)) + + (-screened_rates(k_p_Na23_to_Mg24)*Y(Na23)*Y(H1)*state.rho + screened_rates(k_Mg24_to_p_Na23)*Y(Mg24)) + + 0.5*screened_rates(k_C12_C12_to_p_Na23)*amrex::Math::powi<2>(Y(C12))*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); + + ydot_nuc(Mg22) = + -screened_rates(k_Mg22_to_Na22_weak_wc12)*Y(Mg22) + + (screened_rates(k_He4_Ne18_to_Mg22)*Y(He4)*Y(Ne18)*state.rho + -screened_rates(k_Mg22_to_He4_Ne18)*Y(Mg22)); + + ydot_nuc(Mg24) = + (screened_rates(k_He4_Ne20_to_Mg24)*Y(He4)*Y(Ne20)*state.rho + -screened_rates(k_Mg24_to_He4_Ne20)*Y(Mg24)) + + (screened_rates(k_p_Na23_to_Mg24)*Y(Na23)*Y(H1)*state.rho + -screened_rates(k_Mg24_to_p_Na23)*Y(Mg24)) + + (-screened_rates(k_He4_Mg24_to_Si28)*Y(He4)*Y(Mg24)*state.rho + screened_rates(k_Si28_to_He4_Mg24)*Y(Si28)) + + screened_rates(k_C12_O16_to_He4_Mg24)*Y(C12)*Y(O16)*state.rho + + (screened_rates(k_p_Al27_to_He4_Mg24)*Y(Al27)*Y(H1)*state.rho + -screened_rates(k_He4_Mg24_to_p_Al27)*Y(He4)*Y(Mg24)*state.rho) + + 0.5*screened_rates(k_C12_C12_to_Mg24_modified)*amrex::Math::powi<2>(Y(C12))*state.rho; + + ydot_nuc(Al27) = + (-screened_rates(k_p_Al27_to_Si28)*Y(Al27)*Y(H1)*state.rho + screened_rates(k_Si28_to_p_Al27)*Y(Si28)) + + screened_rates(k_C12_O16_to_p_Al27)*Y(C12)*Y(O16)*state.rho + + (-screened_rates(k_p_Al27_to_He4_Mg24)*Y(Al27)*Y(H1)*state.rho + screened_rates(k_He4_Mg24_to_p_Al27)*Y(He4)*Y(Mg24)*state.rho); + + ydot_nuc(Si28) = + (screened_rates(k_He4_Mg24_to_Si28)*Y(He4)*Y(Mg24)*state.rho + -screened_rates(k_Si28_to_He4_Mg24)*Y(Si28)) + + (screened_rates(k_p_Al27_to_Si28)*Y(Al27)*Y(H1)*state.rho + -screened_rates(k_Si28_to_p_Al27)*Y(Si28)) + + (-screened_rates(k_He4_Si28_to_S32)*Y(He4)*Y(Si28)*state.rho + screened_rates(k_S32_to_He4_Si28)*Y(S32)) + + 0.5*screened_rates(k_O16_O16_to_He4_Si28)*amrex::Math::powi<2>(Y(O16))*state.rho + + (screened_rates(k_p_P31_to_He4_Si28)*Y(P31)*Y(H1)*state.rho + -screened_rates(k_He4_Si28_to_p_P31)*Y(He4)*Y(Si28)*state.rho) + + screened_rates(k_C12_O16_to_Si28_modified)*Y(C12)*Y(O16)*state.rho; + + ydot_nuc(P31) = + (-screened_rates(k_p_P31_to_S32)*Y(P31)*Y(H1)*state.rho + screened_rates(k_S32_to_p_P31)*Y(S32)) + + 0.5*screened_rates(k_O16_O16_to_p_P31)*amrex::Math::powi<2>(Y(O16))*state.rho + + (-screened_rates(k_p_P31_to_He4_Si28)*Y(P31)*Y(H1)*state.rho + screened_rates(k_He4_Si28_to_p_P31)*Y(He4)*Y(Si28)*state.rho); + + ydot_nuc(S32) = + (screened_rates(k_He4_Si28_to_S32)*Y(He4)*Y(Si28)*state.rho + -screened_rates(k_S32_to_He4_Si28)*Y(S32)) + + (screened_rates(k_p_P31_to_S32)*Y(P31)*Y(H1)*state.rho + -screened_rates(k_S32_to_p_P31)*Y(S32)) + + 0.5*screened_rates(k_O16_O16_to_S32_modified)*amrex::Math::powi<2>(Y(O16))*state.rho + + (-screened_rates(k_S32_He4_to_Ar36_approx)*Y(He4)*Y(S32)*state.rho + screened_rates(k_Ar36_to_S32_He4_approx)*Y(Ar36)); + + ydot_nuc(Ar36) = + (screened_rates(k_S32_He4_to_Ar36_approx)*Y(He4)*Y(S32)*state.rho + -screened_rates(k_Ar36_to_S32_He4_approx)*Y(Ar36)) + + (-screened_rates(k_Ar36_He4_to_Ca40_approx)*Y(Ar36)*Y(He4)*state.rho + screened_rates(k_Ca40_to_Ar36_He4_approx)*Y(Ca40)); + + ydot_nuc(Ca40) = + (screened_rates(k_Ar36_He4_to_Ca40_approx)*Y(Ar36)*Y(He4)*state.rho + -screened_rates(k_Ca40_to_Ar36_He4_approx)*Y(Ca40)) + + (-screened_rates(k_Ca40_He4_to_Ti44_approx)*Y(Ca40)*Y(He4)*state.rho + screened_rates(k_Ti44_to_Ca40_He4_approx)*Y(Ti44)); + + ydot_nuc(Ti44) = + (screened_rates(k_Ca40_He4_to_Ti44_approx)*Y(Ca40)*Y(He4)*state.rho + -screened_rates(k_Ti44_to_Ca40_He4_approx)*Y(Ti44)) + + (-screened_rates(k_Ti44_He4_to_Cr48_approx)*Y(He4)*Y(Ti44)*state.rho + screened_rates(k_Cr48_to_Ti44_He4_approx)*Y(Cr48)); + + ydot_nuc(Cr48) = + (screened_rates(k_Ti44_He4_to_Cr48_approx)*Y(He4)*Y(Ti44)*state.rho + -screened_rates(k_Cr48_to_Ti44_He4_approx)*Y(Cr48)) + + (-screened_rates(k_Cr48_He4_to_Fe52_approx)*Y(Cr48)*Y(He4)*state.rho + screened_rates(k_Fe52_to_Cr48_He4_approx)*Y(Fe52)); + + ydot_nuc(Fe52) = + (screened_rates(k_Cr48_He4_to_Fe52_approx)*Y(Cr48)*Y(He4)*state.rho + -screened_rates(k_Fe52_to_Cr48_He4_approx)*Y(Fe52)) + + (-screened_rates(k_Fe52_He4_to_Ni56_approx)*Y(Fe52)*Y(He4)*state.rho + screened_rates(k_Ni56_to_Fe52_He4_approx)*Y(Ni56)); + + ydot_nuc(Ni56) = + (screened_rates(k_Fe52_He4_to_Ni56_approx)*Y(Fe52)*Y(He4)*state.rho + -screened_rates(k_Ni56_to_Fe52_He4_approx)*Y(Ni56)); + +} + + +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void actual_rhs (burn_t& state, amrex::Array1D& ydot) +{ + for (int i = 1; i <= neqs; ++i) { + ydot(i) = 0.0_rt; + } + + + // Set molar abundances + amrex::Array1D Y; + for (int i = 1; i <= NumSpec; ++i) { + Y(i) = state.xn[i-1] * aion_inv[i-1]; + } + + // build the rates + + rate_t rate_eval; + + constexpr int do_T_derivatives = 0; + + evaluate_rates(state, rate_eval); + + rhs_nuc(state, ydot, Y, rate_eval.screened_rates); + + // ion binding energy contributions + + amrex::Real enuc; + ener_gener_rate(ydot, enuc); + + // include any weak rate neutrino losses + enuc += rate_eval.enuc_weak; + + // Get the thermal neutrino losses + + amrex::Real sneut, dsneutdt, dsneutdd, dsnuda, dsnudz; + constexpr int do_derivatives{0}; + sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, dsnuda, dsnudz); + + // Append the energy equation (this is erg/g/s) + + ydot(net_ienuc) = enuc - sneut; + +} + + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void jac_nuc(const burn_t& state, + MatrixType& jac, + const amrex::Array1D& Y, + const amrex::Array1D& screened_rates) +{ + + amrex::Real scratch; + + scratch = -screened_rates(k_p_Al27_to_He4_Mg24)*Y(Al27)*state.rho - screened_rates(k_p_Al27_to_Si28)*Y(Al27)*state.rho - screened_rates(k_p_C12_to_N13)*Y(C12)*state.rho - screened_rates(k_p_C13_to_N14)*Y(C13)*state.rho - screened_rates(k_p_F17_to_He4_O14)*Y(F17)*state.rho - screened_rates(k_p_F17_to_Ne18)*Y(F17)*state.rho - screened_rates(k_p_F18_to_He4_O15)*Y(F18)*state.rho - screened_rates(k_p_F18_to_Ne19)*Y(F18)*state.rho - screened_rates(k_p_F19_to_He4_O16)*Y(F19)*state.rho - screened_rates(k_p_F19_to_Ne20)*Y(F19)*state.rho - screened_rates(k_p_N13_to_O14)*Y(N13)*state.rho - screened_rates(k_p_N14_to_O15)*Y(N14)*state.rho - screened_rates(k_p_N15_to_He4_C12)*Y(N15)*state.rho - screened_rates(k_p_N15_to_O16)*Y(N15)*state.rho - screened_rates(k_p_Na22_to_He4_Ne19)*Y(Na22)*state.rho - screened_rates(k_p_Na23_to_He4_Ne20)*Y(Na23)*state.rho - screened_rates(k_p_Na23_to_Mg24)*Y(Na23)*state.rho - screened_rates(k_p_Ne20_to_He4_F17)*Y(Ne20)*state.rho - screened_rates(k_p_Ne21_to_He4_F18)*Y(Ne21)*state.rho - screened_rates(k_p_Ne21_to_Na22)*Y(Ne21)*state.rho - screened_rates(k_p_O16_to_F17)*Y(O16)*state.rho - screened_rates(k_p_O16_to_He4_N13)*Y(O16)*state.rho - screened_rates(k_p_O17_to_F18)*Y(O17)*state.rho - screened_rates(k_p_O17_to_He4_N14)*Y(O17)*state.rho - screened_rates(k_p_O18_to_F19)*Y(O18)*state.rho - screened_rates(k_p_O18_to_He4_N15)*Y(O18)*state.rho - screened_rates(k_p_P31_to_He4_Si28)*Y(P31)*state.rho - screened_rates(k_p_P31_to_S32)*Y(P31)*state.rho; + jac.set(H1, H1, scratch); + + scratch = screened_rates(k_He4_C12_to_p_N15)*Y(C12)*state.rho + screened_rates(k_He4_F17_to_p_Ne20)*Y(F17)*state.rho + screened_rates(k_He4_F18_to_p_Ne21)*Y(F18)*state.rho + screened_rates(k_He4_Mg24_to_p_Al27)*Y(Mg24)*state.rho + screened_rates(k_He4_N13_to_p_O16)*Y(N13)*state.rho + screened_rates(k_He4_N14_to_p_O17)*Y(N14)*state.rho + screened_rates(k_He4_N15_to_p_O18)*Y(N15)*state.rho + screened_rates(k_He4_Ne19_to_p_Na22)*Y(Ne19)*state.rho + screened_rates(k_He4_Ne20_to_p_Na23)*Y(Ne20)*state.rho + screened_rates(k_He4_O14_to_p_F17)*Y(O14)*state.rho + screened_rates(k_He4_O15_to_p_F18)*Y(O15)*state.rho + screened_rates(k_He4_O16_to_p_F19)*Y(O16)*state.rho + screened_rates(k_He4_Si28_to_p_P31)*Y(Si28)*state.rho; + jac.set(H1, He4, scratch); + + scratch = 1.0*screened_rates(k_C12_C12_to_p_Na23)*Y(C12)*state.rho + screened_rates(k_C12_O16_to_p_Al27)*Y(O16)*state.rho + screened_rates(k_He4_C12_to_p_N15)*Y(He4)*state.rho - screened_rates(k_p_C12_to_N13)*Y(H1)*state.rho; + jac.set(H1, C12, scratch); + + scratch = -screened_rates(k_p_C13_to_N14)*Y(H1)*state.rho; + jac.set(H1, C13, scratch); + + scratch = screened_rates(k_He4_N13_to_p_O16)*Y(He4)*state.rho + screened_rates(k_N13_to_p_C12) - screened_rates(k_p_N13_to_O14)*Y(H1)*state.rho; + jac.set(H1, N13, scratch); + + scratch = screened_rates(k_He4_N14_to_p_O17)*Y(He4)*state.rho + screened_rates(k_N14_to_p_C13) - screened_rates(k_p_N14_to_O15)*Y(H1)*state.rho; + jac.set(H1, N14, scratch); + + scratch = screened_rates(k_He4_N15_to_p_O18)*Y(He4)*state.rho - screened_rates(k_p_N15_to_He4_C12)*Y(H1)*state.rho - screened_rates(k_p_N15_to_O16)*Y(H1)*state.rho; + jac.set(H1, N15, scratch); + + scratch = screened_rates(k_He4_O14_to_p_F17)*Y(He4)*state.rho + screened_rates(k_O14_to_p_N13); + jac.set(H1, O14, scratch); + + scratch = screened_rates(k_He4_O15_to_p_F18)*Y(He4)*state.rho + screened_rates(k_O15_to_p_N14); + jac.set(H1, O15, scratch); + + scratch = screened_rates(k_C12_O16_to_p_Al27)*Y(C12)*state.rho + screened_rates(k_He4_O16_to_p_F19)*Y(He4)*state.rho + 1.0*screened_rates(k_O16_O16_to_p_P31)*Y(O16)*state.rho + screened_rates(k_O16_to_p_N15) - screened_rates(k_p_O16_to_F17)*Y(H1)*state.rho - screened_rates(k_p_O16_to_He4_N13)*Y(H1)*state.rho; + jac.set(H1, O16, scratch); + + scratch = -screened_rates(k_p_O17_to_F18)*Y(H1)*state.rho - screened_rates(k_p_O17_to_He4_N14)*Y(H1)*state.rho; + jac.set(H1, O17, scratch); + + scratch = -screened_rates(k_p_O18_to_F19)*Y(H1)*state.rho - screened_rates(k_p_O18_to_He4_N15)*Y(H1)*state.rho; + jac.set(H1, O18, scratch); + + scratch = screened_rates(k_F17_to_p_O16) + screened_rates(k_He4_F17_to_p_Ne20)*Y(He4)*state.rho - screened_rates(k_p_F17_to_He4_O14)*Y(H1)*state.rho - screened_rates(k_p_F17_to_Ne18)*Y(H1)*state.rho; + jac.set(H1, F17, scratch); + + scratch = screened_rates(k_F18_to_p_O17) + screened_rates(k_He4_F18_to_p_Ne21)*Y(He4)*state.rho - screened_rates(k_p_F18_to_He4_O15)*Y(H1)*state.rho - screened_rates(k_p_F18_to_Ne19)*Y(H1)*state.rho; + jac.set(H1, F18, scratch); + + scratch = screened_rates(k_F19_to_p_O18) - screened_rates(k_p_F19_to_He4_O16)*Y(H1)*state.rho - screened_rates(k_p_F19_to_Ne20)*Y(H1)*state.rho; + jac.set(H1, F19, scratch); + + scratch = screened_rates(k_Ne18_to_p_F17); + jac.set(H1, Ne18, scratch); + + scratch = screened_rates(k_He4_Ne19_to_p_Na22)*Y(He4)*state.rho + screened_rates(k_Ne19_to_p_F18); + jac.set(H1, Ne19, scratch); + + scratch = screened_rates(k_He4_Ne20_to_p_Na23)*Y(He4)*state.rho + screened_rates(k_Ne20_to_p_F19) - screened_rates(k_p_Ne20_to_He4_F17)*Y(H1)*state.rho; + jac.set(H1, Ne20, scratch); + + scratch = -screened_rates(k_p_Ne21_to_He4_F18)*Y(H1)*state.rho - screened_rates(k_p_Ne21_to_Na22)*Y(H1)*state.rho; + jac.set(H1, Ne21, scratch); + + scratch = screened_rates(k_Na22_to_p_Ne21) - screened_rates(k_p_Na22_to_He4_Ne19)*Y(H1)*state.rho; + jac.set(H1, Na22, scratch); + + scratch = -screened_rates(k_p_Na23_to_He4_Ne20)*Y(H1)*state.rho - screened_rates(k_p_Na23_to_Mg24)*Y(H1)*state.rho; + jac.set(H1, Na23, scratch); + + scratch = screened_rates(k_He4_Mg24_to_p_Al27)*Y(He4)*state.rho + screened_rates(k_Mg24_to_p_Na23); + jac.set(H1, Mg24, scratch); + + scratch = -screened_rates(k_p_Al27_to_He4_Mg24)*Y(H1)*state.rho - screened_rates(k_p_Al27_to_Si28)*Y(H1)*state.rho; + jac.set(H1, Al27, scratch); + + scratch = screened_rates(k_He4_Si28_to_p_P31)*Y(He4)*state.rho + screened_rates(k_Si28_to_p_Al27); + jac.set(H1, Si28, scratch); + + scratch = -screened_rates(k_p_P31_to_He4_Si28)*Y(H1)*state.rho - screened_rates(k_p_P31_to_S32)*Y(H1)*state.rho; + jac.set(H1, P31, scratch); + + scratch = screened_rates(k_S32_to_p_P31); + jac.set(H1, S32, scratch); + + scratch = screened_rates(k_p_Al27_to_He4_Mg24)*Y(Al27)*state.rho + screened_rates(k_p_F17_to_He4_O14)*Y(F17)*state.rho + screened_rates(k_p_F18_to_He4_O15)*Y(F18)*state.rho + screened_rates(k_p_F19_to_He4_O16)*Y(F19)*state.rho + screened_rates(k_p_N15_to_He4_C12)*Y(N15)*state.rho + screened_rates(k_p_Na22_to_He4_Ne19)*Y(Na22)*state.rho + screened_rates(k_p_Na23_to_He4_Ne20)*Y(Na23)*state.rho + screened_rates(k_p_Ne20_to_He4_F17)*Y(Ne20)*state.rho + screened_rates(k_p_Ne21_to_He4_F18)*Y(Ne21)*state.rho + screened_rates(k_p_O16_to_He4_N13)*Y(O16)*state.rho + screened_rates(k_p_O17_to_He4_N14)*Y(O17)*state.rho + screened_rates(k_p_O18_to_He4_N15)*Y(O18)*state.rho + screened_rates(k_p_P31_to_He4_Si28)*Y(P31)*state.rho; + jac.set(He4, H1, scratch); + + scratch = -screened_rates(k_Ar36_He4_to_Ca40_approx)*Y(Ar36)*state.rho - screened_rates(k_Ca40_He4_to_Ti44_approx)*Y(Ca40)*state.rho - screened_rates(k_Cr48_He4_to_Fe52_approx)*Y(Cr48)*state.rho - screened_rates(k_Fe52_He4_to_Ni56_approx)*Y(Fe52)*state.rho - screened_rates(k_He4_C12_to_O16)*Y(C12)*state.rho - screened_rates(k_He4_C12_to_p_N15)*Y(C12)*state.rho - screened_rates(k_He4_F17_to_p_Ne20)*Y(F17)*state.rho - screened_rates(k_He4_F18_to_Na22)*Y(F18)*state.rho - screened_rates(k_He4_F18_to_p_Ne21)*Y(F18)*state.rho - screened_rates(k_He4_F19_to_Na23)*Y(F19)*state.rho - 1.5*screened_rates(k_He4_He4_He4_to_C12)*amrex::Math::powi<2>(Y(He4))*amrex::Math::powi<2>(state.rho) - screened_rates(k_He4_Mg24_to_Si28)*Y(Mg24)*state.rho - screened_rates(k_He4_Mg24_to_p_Al27)*Y(Mg24)*state.rho - screened_rates(k_He4_N13_to_p_O16)*Y(N13)*state.rho - screened_rates(k_He4_N14_to_F18)*Y(N14)*state.rho - screened_rates(k_He4_N14_to_p_O17)*Y(N14)*state.rho - screened_rates(k_He4_N15_to_F19)*Y(N15)*state.rho - screened_rates(k_He4_N15_to_p_O18)*Y(N15)*state.rho - screened_rates(k_He4_Ne18_to_Mg22)*Y(Ne18)*state.rho - screened_rates(k_He4_Ne19_to_p_Na22)*Y(Ne19)*state.rho - screened_rates(k_He4_Ne20_to_Mg24)*Y(Ne20)*state.rho - screened_rates(k_He4_Ne20_to_p_Na23)*Y(Ne20)*state.rho - screened_rates(k_He4_O14_to_Ne18)*Y(O14)*state.rho - screened_rates(k_He4_O14_to_p_F17)*Y(O14)*state.rho - screened_rates(k_He4_O15_to_Ne19)*Y(O15)*state.rho - screened_rates(k_He4_O15_to_p_F18)*Y(O15)*state.rho - screened_rates(k_He4_O16_to_Ne20)*Y(O16)*state.rho - screened_rates(k_He4_O16_to_p_F19)*Y(O16)*state.rho - screened_rates(k_He4_O17_to_Ne21)*Y(O17)*state.rho - screened_rates(k_He4_Si28_to_S32)*Y(Si28)*state.rho - screened_rates(k_He4_Si28_to_p_P31)*Y(Si28)*state.rho - screened_rates(k_S32_He4_to_Ar36_approx)*Y(S32)*state.rho - screened_rates(k_Ti44_He4_to_Cr48_approx)*Y(Ti44)*state.rho; + jac.set(He4, He4, scratch); + + scratch = 1.0*screened_rates(k_C12_C12_to_He4_Ne20)*Y(C12)*state.rho + screened_rates(k_C12_O16_to_He4_Mg24)*Y(O16)*state.rho + 3.0*screened_rates(k_C12_to_He4_He4_He4) - screened_rates(k_He4_C12_to_O16)*Y(He4)*state.rho - screened_rates(k_He4_C12_to_p_N15)*Y(He4)*state.rho; + jac.set(He4, C12, scratch); + + scratch = -screened_rates(k_He4_N13_to_p_O16)*Y(He4)*state.rho; + jac.set(He4, N13, scratch); + + scratch = -screened_rates(k_He4_N14_to_F18)*Y(He4)*state.rho - screened_rates(k_He4_N14_to_p_O17)*Y(He4)*state.rho; + jac.set(He4, N14, scratch); + + scratch = -screened_rates(k_He4_N15_to_F19)*Y(He4)*state.rho - screened_rates(k_He4_N15_to_p_O18)*Y(He4)*state.rho + screened_rates(k_p_N15_to_He4_C12)*Y(H1)*state.rho; + jac.set(He4, N15, scratch); + + scratch = -screened_rates(k_He4_O14_to_Ne18)*Y(He4)*state.rho - screened_rates(k_He4_O14_to_p_F17)*Y(He4)*state.rho; + jac.set(He4, O14, scratch); + + scratch = -screened_rates(k_He4_O15_to_Ne19)*Y(He4)*state.rho - screened_rates(k_He4_O15_to_p_F18)*Y(He4)*state.rho; + jac.set(He4, O15, scratch); + + scratch = screened_rates(k_C12_O16_to_He4_Mg24)*Y(C12)*state.rho - screened_rates(k_He4_O16_to_Ne20)*Y(He4)*state.rho - screened_rates(k_He4_O16_to_p_F19)*Y(He4)*state.rho + 1.0*screened_rates(k_O16_O16_to_He4_Si28)*Y(O16)*state.rho + screened_rates(k_O16_to_He4_C12) + screened_rates(k_p_O16_to_He4_N13)*Y(H1)*state.rho; + jac.set(He4, O16, scratch); + + scratch = -screened_rates(k_He4_O17_to_Ne21)*Y(He4)*state.rho + screened_rates(k_p_O17_to_He4_N14)*Y(H1)*state.rho; + jac.set(He4, O17, scratch); + + scratch = screened_rates(k_p_O18_to_He4_N15)*Y(H1)*state.rho; + jac.set(He4, O18, scratch); + + scratch = -screened_rates(k_He4_F17_to_p_Ne20)*Y(He4)*state.rho + screened_rates(k_p_F17_to_He4_O14)*Y(H1)*state.rho; + jac.set(He4, F17, scratch); + + scratch = screened_rates(k_F18_to_He4_N14) - screened_rates(k_He4_F18_to_Na22)*Y(He4)*state.rho - screened_rates(k_He4_F18_to_p_Ne21)*Y(He4)*state.rho + screened_rates(k_p_F18_to_He4_O15)*Y(H1)*state.rho; + jac.set(He4, F18, scratch); + + scratch = screened_rates(k_F19_to_He4_N15) - screened_rates(k_He4_F19_to_Na23)*Y(He4)*state.rho + screened_rates(k_p_F19_to_He4_O16)*Y(H1)*state.rho; + jac.set(He4, F19, scratch); + + scratch = -screened_rates(k_He4_Ne18_to_Mg22)*Y(He4)*state.rho + screened_rates(k_Ne18_to_He4_O14); + jac.set(He4, Ne18, scratch); + + scratch = -screened_rates(k_He4_Ne19_to_p_Na22)*Y(He4)*state.rho + screened_rates(k_Ne19_to_He4_O15); + jac.set(He4, Ne19, scratch); + + scratch = -screened_rates(k_He4_Ne20_to_Mg24)*Y(He4)*state.rho - screened_rates(k_He4_Ne20_to_p_Na23)*Y(He4)*state.rho + screened_rates(k_Ne20_to_He4_O16) + screened_rates(k_p_Ne20_to_He4_F17)*Y(H1)*state.rho; + jac.set(He4, Ne20, scratch); + + scratch = screened_rates(k_Ne21_to_He4_O17) + screened_rates(k_p_Ne21_to_He4_F18)*Y(H1)*state.rho; + jac.set(He4, Ne21, scratch); + + scratch = screened_rates(k_Na22_to_He4_F18) + screened_rates(k_p_Na22_to_He4_Ne19)*Y(H1)*state.rho; + jac.set(He4, Na22, scratch); + + scratch = screened_rates(k_Na23_to_He4_F19) + screened_rates(k_p_Na23_to_He4_Ne20)*Y(H1)*state.rho; + jac.set(He4, Na23, scratch); + + scratch = screened_rates(k_Mg22_to_He4_Ne18); + jac.set(He4, Mg22, scratch); + + scratch = -screened_rates(k_He4_Mg24_to_Si28)*Y(He4)*state.rho - screened_rates(k_He4_Mg24_to_p_Al27)*Y(He4)*state.rho + screened_rates(k_Mg24_to_He4_Ne20); + jac.set(He4, Mg24, scratch); + + scratch = screened_rates(k_p_Al27_to_He4_Mg24)*Y(H1)*state.rho; + jac.set(He4, Al27, scratch); + + scratch = -screened_rates(k_He4_Si28_to_S32)*Y(He4)*state.rho - screened_rates(k_He4_Si28_to_p_P31)*Y(He4)*state.rho + screened_rates(k_Si28_to_He4_Mg24); + jac.set(He4, Si28, scratch); + + scratch = screened_rates(k_p_P31_to_He4_Si28)*Y(H1)*state.rho; + jac.set(He4, P31, scratch); + + scratch = -screened_rates(k_S32_He4_to_Ar36_approx)*Y(He4)*state.rho + screened_rates(k_S32_to_He4_Si28); + jac.set(He4, S32, scratch); + + scratch = -screened_rates(k_Ar36_He4_to_Ca40_approx)*Y(He4)*state.rho + screened_rates(k_Ar36_to_S32_He4_approx); + jac.set(He4, Ar36, scratch); + + scratch = -screened_rates(k_Ca40_He4_to_Ti44_approx)*Y(He4)*state.rho + screened_rates(k_Ca40_to_Ar36_He4_approx); + jac.set(He4, Ca40, scratch); + + scratch = -screened_rates(k_Ti44_He4_to_Cr48_approx)*Y(He4)*state.rho + screened_rates(k_Ti44_to_Ca40_He4_approx); + jac.set(He4, Ti44, scratch); + + scratch = -screened_rates(k_Cr48_He4_to_Fe52_approx)*Y(He4)*state.rho + screened_rates(k_Cr48_to_Ti44_He4_approx); + jac.set(He4, Cr48, scratch); + + scratch = -screened_rates(k_Fe52_He4_to_Ni56_approx)*Y(He4)*state.rho + screened_rates(k_Fe52_to_Cr48_He4_approx); + jac.set(He4, Fe52, scratch); + + scratch = screened_rates(k_Ni56_to_Fe52_He4_approx); + jac.set(He4, Ni56, scratch); + + scratch = -screened_rates(k_p_C12_to_N13)*Y(C12)*state.rho + screened_rates(k_p_N15_to_He4_C12)*Y(N15)*state.rho; + jac.set(C12, H1, scratch); + + scratch = -screened_rates(k_He4_C12_to_O16)*Y(C12)*state.rho - screened_rates(k_He4_C12_to_p_N15)*Y(C12)*state.rho + 0.5*screened_rates(k_He4_He4_He4_to_C12)*amrex::Math::powi<2>(Y(He4))*amrex::Math::powi<2>(state.rho); + jac.set(C12, He4, scratch); + + scratch = -2.0*screened_rates(k_C12_C12_to_He4_Ne20)*Y(C12)*state.rho - 2.0*screened_rates(k_C12_C12_to_Mg24_modified)*Y(C12)*state.rho - 2.0*screened_rates(k_C12_C12_to_p_Na23)*Y(C12)*state.rho - screened_rates(k_C12_O16_to_He4_Mg24)*Y(O16)*state.rho - screened_rates(k_C12_O16_to_Si28_modified)*Y(O16)*state.rho - screened_rates(k_C12_O16_to_p_Al27)*Y(O16)*state.rho - screened_rates(k_C12_to_He4_He4_He4) - screened_rates(k_He4_C12_to_O16)*Y(He4)*state.rho - screened_rates(k_He4_C12_to_p_N15)*Y(He4)*state.rho - screened_rates(k_p_C12_to_N13)*Y(H1)*state.rho; + jac.set(C12, C12, scratch); + + scratch = screened_rates(k_N13_to_p_C12); + jac.set(C12, N13, scratch); + + scratch = screened_rates(k_p_N15_to_He4_C12)*Y(H1)*state.rho; + jac.set(C12, N15, scratch); + + scratch = -screened_rates(k_C12_O16_to_He4_Mg24)*Y(C12)*state.rho - screened_rates(k_C12_O16_to_Si28_modified)*Y(C12)*state.rho - screened_rates(k_C12_O16_to_p_Al27)*Y(C12)*state.rho + screened_rates(k_O16_to_He4_C12); + jac.set(C12, O16, scratch); + + scratch = -screened_rates(k_p_C13_to_N14)*Y(C13)*state.rho; + jac.set(C13, H1, scratch); + + scratch = -screened_rates(k_p_C13_to_N14)*Y(H1)*state.rho; + jac.set(C13, C13, scratch); + + scratch = screened_rates(k_N13_to_C13_weak_wc12); + jac.set(C13, N13, scratch); + + scratch = screened_rates(k_N14_to_p_C13); + jac.set(C13, N14, scratch); + + scratch = screened_rates(k_p_C12_to_N13)*Y(C12)*state.rho - screened_rates(k_p_N13_to_O14)*Y(N13)*state.rho + screened_rates(k_p_O16_to_He4_N13)*Y(O16)*state.rho; + jac.set(N13, H1, scratch); + + scratch = -screened_rates(k_He4_N13_to_p_O16)*Y(N13)*state.rho; + jac.set(N13, He4, scratch); + + scratch = screened_rates(k_p_C12_to_N13)*Y(H1)*state.rho; + jac.set(N13, C12, scratch); + + scratch = -screened_rates(k_He4_N13_to_p_O16)*Y(He4)*state.rho - screened_rates(k_N13_to_C13_weak_wc12) - screened_rates(k_N13_to_p_C12) - screened_rates(k_p_N13_to_O14)*Y(H1)*state.rho; + jac.set(N13, N13, scratch); + + scratch = screened_rates(k_O14_to_p_N13); + jac.set(N13, O14, scratch); + + scratch = screened_rates(k_p_O16_to_He4_N13)*Y(H1)*state.rho; + jac.set(N13, O16, scratch); + + scratch = screened_rates(k_p_C13_to_N14)*Y(C13)*state.rho - screened_rates(k_p_N14_to_O15)*Y(N14)*state.rho + screened_rates(k_p_O17_to_He4_N14)*Y(O17)*state.rho; + jac.set(N14, H1, scratch); + + scratch = -screened_rates(k_He4_N14_to_F18)*Y(N14)*state.rho - screened_rates(k_He4_N14_to_p_O17)*Y(N14)*state.rho; + jac.set(N14, He4, scratch); + + scratch = screened_rates(k_p_C13_to_N14)*Y(H1)*state.rho; + jac.set(N14, C13, scratch); + + scratch = -screened_rates(k_He4_N14_to_F18)*Y(He4)*state.rho - screened_rates(k_He4_N14_to_p_O17)*Y(He4)*state.rho - screened_rates(k_N14_to_p_C13) - screened_rates(k_p_N14_to_O15)*Y(H1)*state.rho; + jac.set(N14, N14, scratch); + + scratch = screened_rates(k_O14_to_N14_weak_wc12); + jac.set(N14, O14, scratch); + + scratch = screened_rates(k_O15_to_p_N14); + jac.set(N14, O15, scratch); + + scratch = screened_rates(k_p_O17_to_He4_N14)*Y(H1)*state.rho; + jac.set(N14, O17, scratch); + + scratch = screened_rates(k_F18_to_He4_N14); + jac.set(N14, F18, scratch); + + scratch = -screened_rates(k_p_N15_to_He4_C12)*Y(N15)*state.rho - screened_rates(k_p_N15_to_O16)*Y(N15)*state.rho + screened_rates(k_p_O18_to_He4_N15)*Y(O18)*state.rho; + jac.set(N15, H1, scratch); + + scratch = screened_rates(k_He4_C12_to_p_N15)*Y(C12)*state.rho - screened_rates(k_He4_N15_to_F19)*Y(N15)*state.rho - screened_rates(k_He4_N15_to_p_O18)*Y(N15)*state.rho; + jac.set(N15, He4, scratch); + + scratch = screened_rates(k_He4_C12_to_p_N15)*Y(He4)*state.rho; + jac.set(N15, C12, scratch); + + scratch = -screened_rates(k_He4_N15_to_F19)*Y(He4)*state.rho - screened_rates(k_He4_N15_to_p_O18)*Y(He4)*state.rho - screened_rates(k_p_N15_to_He4_C12)*Y(H1)*state.rho - screened_rates(k_p_N15_to_O16)*Y(H1)*state.rho; + jac.set(N15, N15, scratch); + + scratch = screened_rates(k_O15_to_N15_weak_wc12); + jac.set(N15, O15, scratch); + + scratch = screened_rates(k_O16_to_p_N15); + jac.set(N15, O16, scratch); + + scratch = screened_rates(k_p_O18_to_He4_N15)*Y(H1)*state.rho; + jac.set(N15, O18, scratch); + + scratch = screened_rates(k_F19_to_He4_N15); + jac.set(N15, F19, scratch); + + scratch = screened_rates(k_p_F17_to_He4_O14)*Y(F17)*state.rho + screened_rates(k_p_N13_to_O14)*Y(N13)*state.rho; + jac.set(O14, H1, scratch); + + scratch = -screened_rates(k_He4_O14_to_Ne18)*Y(O14)*state.rho - screened_rates(k_He4_O14_to_p_F17)*Y(O14)*state.rho; + jac.set(O14, He4, scratch); + + scratch = screened_rates(k_p_N13_to_O14)*Y(H1)*state.rho; + jac.set(O14, N13, scratch); + + scratch = -screened_rates(k_He4_O14_to_Ne18)*Y(He4)*state.rho - screened_rates(k_He4_O14_to_p_F17)*Y(He4)*state.rho - screened_rates(k_O14_to_N14_weak_wc12) - screened_rates(k_O14_to_p_N13); + jac.set(O14, O14, scratch); + + scratch = screened_rates(k_p_F17_to_He4_O14)*Y(H1)*state.rho; + jac.set(O14, F17, scratch); + + scratch = screened_rates(k_Ne18_to_He4_O14); + jac.set(O14, Ne18, scratch); + + scratch = screened_rates(k_p_F18_to_He4_O15)*Y(F18)*state.rho + screened_rates(k_p_N14_to_O15)*Y(N14)*state.rho; + jac.set(O15, H1, scratch); + + scratch = -screened_rates(k_He4_O15_to_Ne19)*Y(O15)*state.rho - screened_rates(k_He4_O15_to_p_F18)*Y(O15)*state.rho; + jac.set(O15, He4, scratch); + + scratch = screened_rates(k_p_N14_to_O15)*Y(H1)*state.rho; + jac.set(O15, N14, scratch); + + scratch = -screened_rates(k_He4_O15_to_Ne19)*Y(He4)*state.rho - screened_rates(k_He4_O15_to_p_F18)*Y(He4)*state.rho - screened_rates(k_O15_to_N15_weak_wc12) - screened_rates(k_O15_to_p_N14); + jac.set(O15, O15, scratch); + + scratch = screened_rates(k_p_F18_to_He4_O15)*Y(H1)*state.rho; + jac.set(O15, F18, scratch); + + scratch = screened_rates(k_Ne19_to_He4_O15); + jac.set(O15, Ne19, scratch); + + scratch = screened_rates(k_p_F19_to_He4_O16)*Y(F19)*state.rho + screened_rates(k_p_N15_to_O16)*Y(N15)*state.rho - screened_rates(k_p_O16_to_F17)*Y(O16)*state.rho - screened_rates(k_p_O16_to_He4_N13)*Y(O16)*state.rho; + jac.set(O16, H1, scratch); + + scratch = screened_rates(k_He4_C12_to_O16)*Y(C12)*state.rho + screened_rates(k_He4_N13_to_p_O16)*Y(N13)*state.rho - screened_rates(k_He4_O16_to_Ne20)*Y(O16)*state.rho - screened_rates(k_He4_O16_to_p_F19)*Y(O16)*state.rho; + jac.set(O16, He4, scratch); + + scratch = -screened_rates(k_C12_O16_to_He4_Mg24)*Y(O16)*state.rho - screened_rates(k_C12_O16_to_Si28_modified)*Y(O16)*state.rho - screened_rates(k_C12_O16_to_p_Al27)*Y(O16)*state.rho + screened_rates(k_He4_C12_to_O16)*Y(He4)*state.rho; + jac.set(O16, C12, scratch); + + scratch = screened_rates(k_He4_N13_to_p_O16)*Y(He4)*state.rho; + jac.set(O16, N13, scratch); + + scratch = screened_rates(k_p_N15_to_O16)*Y(H1)*state.rho; + jac.set(O16, N15, scratch); + + scratch = -screened_rates(k_C12_O16_to_He4_Mg24)*Y(C12)*state.rho - screened_rates(k_C12_O16_to_Si28_modified)*Y(C12)*state.rho - screened_rates(k_C12_O16_to_p_Al27)*Y(C12)*state.rho - screened_rates(k_He4_O16_to_Ne20)*Y(He4)*state.rho - screened_rates(k_He4_O16_to_p_F19)*Y(He4)*state.rho - 2.0*screened_rates(k_O16_O16_to_He4_Si28)*Y(O16)*state.rho - 2.0*screened_rates(k_O16_O16_to_S32_modified)*Y(O16)*state.rho - 2.0*screened_rates(k_O16_O16_to_p_P31)*Y(O16)*state.rho - screened_rates(k_O16_to_He4_C12) - screened_rates(k_O16_to_p_N15) - screened_rates(k_p_O16_to_F17)*Y(H1)*state.rho - screened_rates(k_p_O16_to_He4_N13)*Y(H1)*state.rho; + jac.set(O16, O16, scratch); + + scratch = screened_rates(k_F17_to_p_O16); + jac.set(O16, F17, scratch); + + scratch = screened_rates(k_p_F19_to_He4_O16)*Y(H1)*state.rho; + jac.set(O16, F19, scratch); + + scratch = screened_rates(k_Ne20_to_He4_O16); + jac.set(O16, Ne20, scratch); + + scratch = -screened_rates(k_p_O17_to_F18)*Y(O17)*state.rho - screened_rates(k_p_O17_to_He4_N14)*Y(O17)*state.rho; + jac.set(O17, H1, scratch); + + scratch = screened_rates(k_He4_N14_to_p_O17)*Y(N14)*state.rho - screened_rates(k_He4_O17_to_Ne21)*Y(O17)*state.rho; + jac.set(O17, He4, scratch); + + scratch = screened_rates(k_He4_N14_to_p_O17)*Y(He4)*state.rho; + jac.set(O17, N14, scratch); + + scratch = -screened_rates(k_He4_O17_to_Ne21)*Y(He4)*state.rho - screened_rates(k_p_O17_to_F18)*Y(H1)*state.rho - screened_rates(k_p_O17_to_He4_N14)*Y(H1)*state.rho; + jac.set(O17, O17, scratch); + + scratch = screened_rates(k_F17_to_O17_weak_wc12); + jac.set(O17, F17, scratch); + + scratch = screened_rates(k_F18_to_p_O17); + jac.set(O17, F18, scratch); + + scratch = screened_rates(k_Ne21_to_He4_O17); + jac.set(O17, Ne21, scratch); + + scratch = -screened_rates(k_p_O18_to_F19)*Y(O18)*state.rho - screened_rates(k_p_O18_to_He4_N15)*Y(O18)*state.rho; + jac.set(O18, H1, scratch); + + scratch = screened_rates(k_He4_N15_to_p_O18)*Y(N15)*state.rho; + jac.set(O18, He4, scratch); + + scratch = screened_rates(k_He4_N15_to_p_O18)*Y(He4)*state.rho; + jac.set(O18, N15, scratch); + + scratch = -screened_rates(k_p_O18_to_F19)*Y(H1)*state.rho - screened_rates(k_p_O18_to_He4_N15)*Y(H1)*state.rho; + jac.set(O18, O18, scratch); + + scratch = screened_rates(k_F18_to_O18_weak_wc12); + jac.set(O18, F18, scratch); + + scratch = screened_rates(k_F19_to_p_O18); + jac.set(O18, F19, scratch); + + scratch = -screened_rates(k_p_F17_to_He4_O14)*Y(F17)*state.rho - screened_rates(k_p_F17_to_Ne18)*Y(F17)*state.rho + screened_rates(k_p_Ne20_to_He4_F17)*Y(Ne20)*state.rho + screened_rates(k_p_O16_to_F17)*Y(O16)*state.rho; + jac.set(F17, H1, scratch); + + scratch = -screened_rates(k_He4_F17_to_p_Ne20)*Y(F17)*state.rho + screened_rates(k_He4_O14_to_p_F17)*Y(O14)*state.rho; + jac.set(F17, He4, scratch); + + scratch = screened_rates(k_He4_O14_to_p_F17)*Y(He4)*state.rho; + jac.set(F17, O14, scratch); + + scratch = screened_rates(k_p_O16_to_F17)*Y(H1)*state.rho; + jac.set(F17, O16, scratch); + + scratch = -screened_rates(k_F17_to_O17_weak_wc12) - screened_rates(k_F17_to_p_O16) - screened_rates(k_He4_F17_to_p_Ne20)*Y(He4)*state.rho - screened_rates(k_p_F17_to_He4_O14)*Y(H1)*state.rho - screened_rates(k_p_F17_to_Ne18)*Y(H1)*state.rho; + jac.set(F17, F17, scratch); + + scratch = screened_rates(k_Ne18_to_p_F17); + jac.set(F17, Ne18, scratch); + + scratch = screened_rates(k_p_Ne20_to_He4_F17)*Y(H1)*state.rho; + jac.set(F17, Ne20, scratch); + + scratch = -screened_rates(k_p_F18_to_He4_O15)*Y(F18)*state.rho - screened_rates(k_p_F18_to_Ne19)*Y(F18)*state.rho + screened_rates(k_p_Ne21_to_He4_F18)*Y(Ne21)*state.rho + screened_rates(k_p_O17_to_F18)*Y(O17)*state.rho; + jac.set(F18, H1, scratch); + + scratch = -screened_rates(k_He4_F18_to_Na22)*Y(F18)*state.rho - screened_rates(k_He4_F18_to_p_Ne21)*Y(F18)*state.rho + screened_rates(k_He4_N14_to_F18)*Y(N14)*state.rho + screened_rates(k_He4_O15_to_p_F18)*Y(O15)*state.rho; + jac.set(F18, He4, scratch); + + scratch = screened_rates(k_He4_N14_to_F18)*Y(He4)*state.rho; + jac.set(F18, N14, scratch); + + scratch = screened_rates(k_He4_O15_to_p_F18)*Y(He4)*state.rho; + jac.set(F18, O15, scratch); + + scratch = screened_rates(k_p_O17_to_F18)*Y(H1)*state.rho; + jac.set(F18, O17, scratch); + + scratch = -screened_rates(k_F18_to_He4_N14) - screened_rates(k_F18_to_O18_weak_wc12) - screened_rates(k_F18_to_p_O17) - screened_rates(k_He4_F18_to_Na22)*Y(He4)*state.rho - screened_rates(k_He4_F18_to_p_Ne21)*Y(He4)*state.rho - screened_rates(k_p_F18_to_He4_O15)*Y(H1)*state.rho - screened_rates(k_p_F18_to_Ne19)*Y(H1)*state.rho; + jac.set(F18, F18, scratch); + + scratch = screened_rates(k_Ne18_to_F18_weak_wc12); + jac.set(F18, Ne18, scratch); + + scratch = screened_rates(k_Ne19_to_p_F18); + jac.set(F18, Ne19, scratch); + + scratch = screened_rates(k_p_Ne21_to_He4_F18)*Y(H1)*state.rho; + jac.set(F18, Ne21, scratch); + + scratch = screened_rates(k_Na22_to_He4_F18); + jac.set(F18, Na22, scratch); + + scratch = -screened_rates(k_p_F19_to_He4_O16)*Y(F19)*state.rho - screened_rates(k_p_F19_to_Ne20)*Y(F19)*state.rho + screened_rates(k_p_O18_to_F19)*Y(O18)*state.rho; + jac.set(F19, H1, scratch); + + scratch = -screened_rates(k_He4_F19_to_Na23)*Y(F19)*state.rho + screened_rates(k_He4_N15_to_F19)*Y(N15)*state.rho + screened_rates(k_He4_O16_to_p_F19)*Y(O16)*state.rho; + jac.set(F19, He4, scratch); + + scratch = screened_rates(k_He4_N15_to_F19)*Y(He4)*state.rho; + jac.set(F19, N15, scratch); + + scratch = screened_rates(k_He4_O16_to_p_F19)*Y(He4)*state.rho; + jac.set(F19, O16, scratch); + + scratch = screened_rates(k_p_O18_to_F19)*Y(H1)*state.rho; + jac.set(F19, O18, scratch); + + scratch = -screened_rates(k_F19_to_He4_N15) - screened_rates(k_F19_to_p_O18) - screened_rates(k_He4_F19_to_Na23)*Y(He4)*state.rho - screened_rates(k_p_F19_to_He4_O16)*Y(H1)*state.rho - screened_rates(k_p_F19_to_Ne20)*Y(H1)*state.rho; + jac.set(F19, F19, scratch); + + scratch = screened_rates(k_Ne19_to_F19_weak_wc12); + jac.set(F19, Ne19, scratch); + + scratch = screened_rates(k_Ne20_to_p_F19); + jac.set(F19, Ne20, scratch); + + scratch = screened_rates(k_Na23_to_He4_F19); + jac.set(F19, Na23, scratch); + + scratch = screened_rates(k_p_F17_to_Ne18)*Y(F17)*state.rho; + jac.set(Ne18, H1, scratch); + + scratch = -screened_rates(k_He4_Ne18_to_Mg22)*Y(Ne18)*state.rho + screened_rates(k_He4_O14_to_Ne18)*Y(O14)*state.rho; + jac.set(Ne18, He4, scratch); + + scratch = screened_rates(k_He4_O14_to_Ne18)*Y(He4)*state.rho; + jac.set(Ne18, O14, scratch); + + scratch = screened_rates(k_p_F17_to_Ne18)*Y(H1)*state.rho; + jac.set(Ne18, F17, scratch); + + scratch = -screened_rates(k_He4_Ne18_to_Mg22)*Y(He4)*state.rho - screened_rates(k_Ne18_to_F18_weak_wc12) - screened_rates(k_Ne18_to_He4_O14) - screened_rates(k_Ne18_to_p_F17); + jac.set(Ne18, Ne18, scratch); + + scratch = screened_rates(k_Mg22_to_He4_Ne18); + jac.set(Ne18, Mg22, scratch); + + scratch = screened_rates(k_p_F18_to_Ne19)*Y(F18)*state.rho + screened_rates(k_p_Na22_to_He4_Ne19)*Y(Na22)*state.rho; + jac.set(Ne19, H1, scratch); + + scratch = -screened_rates(k_He4_Ne19_to_p_Na22)*Y(Ne19)*state.rho + screened_rates(k_He4_O15_to_Ne19)*Y(O15)*state.rho; + jac.set(Ne19, He4, scratch); + + scratch = screened_rates(k_He4_O15_to_Ne19)*Y(He4)*state.rho; + jac.set(Ne19, O15, scratch); + + scratch = screened_rates(k_p_F18_to_Ne19)*Y(H1)*state.rho; + jac.set(Ne19, F18, scratch); + + scratch = -screened_rates(k_He4_Ne19_to_p_Na22)*Y(He4)*state.rho - screened_rates(k_Ne19_to_F19_weak_wc12) - screened_rates(k_Ne19_to_He4_O15) - screened_rates(k_Ne19_to_p_F18); + jac.set(Ne19, Ne19, scratch); + + scratch = screened_rates(k_p_Na22_to_He4_Ne19)*Y(H1)*state.rho; + jac.set(Ne19, Na22, scratch); + + scratch = screened_rates(k_p_F19_to_Ne20)*Y(F19)*state.rho + screened_rates(k_p_Na23_to_He4_Ne20)*Y(Na23)*state.rho - screened_rates(k_p_Ne20_to_He4_F17)*Y(Ne20)*state.rho; + jac.set(Ne20, H1, scratch); + + scratch = screened_rates(k_He4_F17_to_p_Ne20)*Y(F17)*state.rho - screened_rates(k_He4_Ne20_to_Mg24)*Y(Ne20)*state.rho - screened_rates(k_He4_Ne20_to_p_Na23)*Y(Ne20)*state.rho + screened_rates(k_He4_O16_to_Ne20)*Y(O16)*state.rho; + jac.set(Ne20, He4, scratch); + + scratch = 1.0*screened_rates(k_C12_C12_to_He4_Ne20)*Y(C12)*state.rho; + jac.set(Ne20, C12, scratch); + + scratch = screened_rates(k_He4_O16_to_Ne20)*Y(He4)*state.rho; + jac.set(Ne20, O16, scratch); + + scratch = screened_rates(k_He4_F17_to_p_Ne20)*Y(He4)*state.rho; + jac.set(Ne20, F17, scratch); + + scratch = screened_rates(k_p_F19_to_Ne20)*Y(H1)*state.rho; + jac.set(Ne20, F19, scratch); + + scratch = -screened_rates(k_He4_Ne20_to_Mg24)*Y(He4)*state.rho - screened_rates(k_He4_Ne20_to_p_Na23)*Y(He4)*state.rho - screened_rates(k_Ne20_to_He4_O16) - screened_rates(k_Ne20_to_p_F19) - screened_rates(k_p_Ne20_to_He4_F17)*Y(H1)*state.rho; + jac.set(Ne20, Ne20, scratch); + + scratch = screened_rates(k_p_Na23_to_He4_Ne20)*Y(H1)*state.rho; + jac.set(Ne20, Na23, scratch); + + scratch = screened_rates(k_Mg24_to_He4_Ne20); + jac.set(Ne20, Mg24, scratch); + + scratch = -screened_rates(k_p_Ne21_to_He4_F18)*Y(Ne21)*state.rho - screened_rates(k_p_Ne21_to_Na22)*Y(Ne21)*state.rho; + jac.set(Ne21, H1, scratch); + + scratch = screened_rates(k_He4_F18_to_p_Ne21)*Y(F18)*state.rho + screened_rates(k_He4_O17_to_Ne21)*Y(O17)*state.rho; + jac.set(Ne21, He4, scratch); + + scratch = screened_rates(k_He4_O17_to_Ne21)*Y(He4)*state.rho; + jac.set(Ne21, O17, scratch); + + scratch = screened_rates(k_He4_F18_to_p_Ne21)*Y(He4)*state.rho; + jac.set(Ne21, F18, scratch); + + scratch = -screened_rates(k_Ne21_to_He4_O17) - screened_rates(k_p_Ne21_to_He4_F18)*Y(H1)*state.rho - screened_rates(k_p_Ne21_to_Na22)*Y(H1)*state.rho; + jac.set(Ne21, Ne21, scratch); + + scratch = screened_rates(k_Na22_to_p_Ne21); + jac.set(Ne21, Na22, scratch); + + scratch = -screened_rates(k_p_Na22_to_He4_Ne19)*Y(Na22)*state.rho + screened_rates(k_p_Ne21_to_Na22)*Y(Ne21)*state.rho; + jac.set(Na22, H1, scratch); + + scratch = screened_rates(k_He4_F18_to_Na22)*Y(F18)*state.rho + screened_rates(k_He4_Ne19_to_p_Na22)*Y(Ne19)*state.rho; + jac.set(Na22, He4, scratch); + + scratch = screened_rates(k_He4_F18_to_Na22)*Y(He4)*state.rho; + jac.set(Na22, F18, scratch); + + scratch = screened_rates(k_He4_Ne19_to_p_Na22)*Y(He4)*state.rho; + jac.set(Na22, Ne19, scratch); + + scratch = screened_rates(k_p_Ne21_to_Na22)*Y(H1)*state.rho; + jac.set(Na22, Ne21, scratch); + + scratch = -screened_rates(k_Na22_to_He4_F18) - screened_rates(k_Na22_to_p_Ne21) - screened_rates(k_p_Na22_to_He4_Ne19)*Y(H1)*state.rho; + jac.set(Na22, Na22, scratch); + + scratch = screened_rates(k_Mg22_to_Na22_weak_wc12); + jac.set(Na22, Mg22, scratch); + + scratch = -screened_rates(k_p_Na23_to_He4_Ne20)*Y(Na23)*state.rho - screened_rates(k_p_Na23_to_Mg24)*Y(Na23)*state.rho; + jac.set(Na23, H1, scratch); + + scratch = screened_rates(k_He4_F19_to_Na23)*Y(F19)*state.rho + screened_rates(k_He4_Ne20_to_p_Na23)*Y(Ne20)*state.rho; + jac.set(Na23, He4, scratch); + + scratch = 1.0*screened_rates(k_C12_C12_to_p_Na23)*Y(C12)*state.rho; + jac.set(Na23, C12, scratch); + + scratch = screened_rates(k_He4_F19_to_Na23)*Y(He4)*state.rho; + jac.set(Na23, F19, scratch); + + scratch = screened_rates(k_He4_Ne20_to_p_Na23)*Y(He4)*state.rho; + jac.set(Na23, Ne20, scratch); + + scratch = -screened_rates(k_Na23_to_He4_F19) - screened_rates(k_p_Na23_to_He4_Ne20)*Y(H1)*state.rho - screened_rates(k_p_Na23_to_Mg24)*Y(H1)*state.rho; + jac.set(Na23, Na23, scratch); + + scratch = screened_rates(k_Mg24_to_p_Na23); + jac.set(Na23, Mg24, scratch); + + scratch = screened_rates(k_He4_Ne18_to_Mg22)*Y(Ne18)*state.rho; + jac.set(Mg22, He4, scratch); + + scratch = screened_rates(k_He4_Ne18_to_Mg22)*Y(He4)*state.rho; + jac.set(Mg22, Ne18, scratch); + + scratch = -screened_rates(k_Mg22_to_He4_Ne18) - screened_rates(k_Mg22_to_Na22_weak_wc12); + jac.set(Mg22, Mg22, scratch); + + scratch = screened_rates(k_p_Al27_to_He4_Mg24)*Y(Al27)*state.rho + screened_rates(k_p_Na23_to_Mg24)*Y(Na23)*state.rho; + jac.set(Mg24, H1, scratch); + + scratch = -screened_rates(k_He4_Mg24_to_Si28)*Y(Mg24)*state.rho - screened_rates(k_He4_Mg24_to_p_Al27)*Y(Mg24)*state.rho + screened_rates(k_He4_Ne20_to_Mg24)*Y(Ne20)*state.rho; + jac.set(Mg24, He4, scratch); + + scratch = 1.0*screened_rates(k_C12_C12_to_Mg24_modified)*Y(C12)*state.rho + screened_rates(k_C12_O16_to_He4_Mg24)*Y(O16)*state.rho; + jac.set(Mg24, C12, scratch); + + scratch = screened_rates(k_C12_O16_to_He4_Mg24)*Y(C12)*state.rho; + jac.set(Mg24, O16, scratch); + + scratch = screened_rates(k_He4_Ne20_to_Mg24)*Y(He4)*state.rho; + jac.set(Mg24, Ne20, scratch); + + scratch = screened_rates(k_p_Na23_to_Mg24)*Y(H1)*state.rho; + jac.set(Mg24, Na23, scratch); + + scratch = -screened_rates(k_He4_Mg24_to_Si28)*Y(He4)*state.rho - screened_rates(k_He4_Mg24_to_p_Al27)*Y(He4)*state.rho - screened_rates(k_Mg24_to_He4_Ne20) - screened_rates(k_Mg24_to_p_Na23); + jac.set(Mg24, Mg24, scratch); + + scratch = screened_rates(k_p_Al27_to_He4_Mg24)*Y(H1)*state.rho; + jac.set(Mg24, Al27, scratch); + + scratch = screened_rates(k_Si28_to_He4_Mg24); + jac.set(Mg24, Si28, scratch); + + scratch = -screened_rates(k_p_Al27_to_He4_Mg24)*Y(Al27)*state.rho - screened_rates(k_p_Al27_to_Si28)*Y(Al27)*state.rho; + jac.set(Al27, H1, scratch); + + scratch = screened_rates(k_He4_Mg24_to_p_Al27)*Y(Mg24)*state.rho; + jac.set(Al27, He4, scratch); + + scratch = screened_rates(k_C12_O16_to_p_Al27)*Y(O16)*state.rho; + jac.set(Al27, C12, scratch); + + scratch = screened_rates(k_C12_O16_to_p_Al27)*Y(C12)*state.rho; + jac.set(Al27, O16, scratch); + + scratch = screened_rates(k_He4_Mg24_to_p_Al27)*Y(He4)*state.rho; + jac.set(Al27, Mg24, scratch); + + scratch = -screened_rates(k_p_Al27_to_He4_Mg24)*Y(H1)*state.rho - screened_rates(k_p_Al27_to_Si28)*Y(H1)*state.rho; + jac.set(Al27, Al27, scratch); + + scratch = screened_rates(k_Si28_to_p_Al27); + jac.set(Al27, Si28, scratch); + + scratch = screened_rates(k_p_Al27_to_Si28)*Y(Al27)*state.rho + screened_rates(k_p_P31_to_He4_Si28)*Y(P31)*state.rho; + jac.set(Si28, H1, scratch); + + scratch = screened_rates(k_He4_Mg24_to_Si28)*Y(Mg24)*state.rho - screened_rates(k_He4_Si28_to_S32)*Y(Si28)*state.rho - screened_rates(k_He4_Si28_to_p_P31)*Y(Si28)*state.rho; + jac.set(Si28, He4, scratch); + + scratch = screened_rates(k_C12_O16_to_Si28_modified)*Y(O16)*state.rho; + jac.set(Si28, C12, scratch); + + scratch = screened_rates(k_C12_O16_to_Si28_modified)*Y(C12)*state.rho + 1.0*screened_rates(k_O16_O16_to_He4_Si28)*Y(O16)*state.rho; + jac.set(Si28, O16, scratch); + + scratch = screened_rates(k_He4_Mg24_to_Si28)*Y(He4)*state.rho; + jac.set(Si28, Mg24, scratch); + + scratch = screened_rates(k_p_Al27_to_Si28)*Y(H1)*state.rho; + jac.set(Si28, Al27, scratch); + + scratch = -screened_rates(k_He4_Si28_to_S32)*Y(He4)*state.rho - screened_rates(k_He4_Si28_to_p_P31)*Y(He4)*state.rho - screened_rates(k_Si28_to_He4_Mg24) - screened_rates(k_Si28_to_p_Al27); + jac.set(Si28, Si28, scratch); + + scratch = screened_rates(k_p_P31_to_He4_Si28)*Y(H1)*state.rho; + jac.set(Si28, P31, scratch); + + scratch = screened_rates(k_S32_to_He4_Si28); + jac.set(Si28, S32, scratch); + + scratch = -screened_rates(k_p_P31_to_He4_Si28)*Y(P31)*state.rho - screened_rates(k_p_P31_to_S32)*Y(P31)*state.rho; + jac.set(P31, H1, scratch); + + scratch = screened_rates(k_He4_Si28_to_p_P31)*Y(Si28)*state.rho; + jac.set(P31, He4, scratch); + + scratch = 1.0*screened_rates(k_O16_O16_to_p_P31)*Y(O16)*state.rho; + jac.set(P31, O16, scratch); + + scratch = screened_rates(k_He4_Si28_to_p_P31)*Y(He4)*state.rho; + jac.set(P31, Si28, scratch); + + scratch = -screened_rates(k_p_P31_to_He4_Si28)*Y(H1)*state.rho - screened_rates(k_p_P31_to_S32)*Y(H1)*state.rho; + jac.set(P31, P31, scratch); + + scratch = screened_rates(k_S32_to_p_P31); + jac.set(P31, S32, scratch); + + scratch = screened_rates(k_p_P31_to_S32)*Y(P31)*state.rho; + jac.set(S32, H1, scratch); + + scratch = screened_rates(k_He4_Si28_to_S32)*Y(Si28)*state.rho - screened_rates(k_S32_He4_to_Ar36_approx)*Y(S32)*state.rho; + jac.set(S32, He4, scratch); + + scratch = 1.0*screened_rates(k_O16_O16_to_S32_modified)*Y(O16)*state.rho; + jac.set(S32, O16, scratch); + + scratch = screened_rates(k_He4_Si28_to_S32)*Y(He4)*state.rho; + jac.set(S32, Si28, scratch); + + scratch = screened_rates(k_p_P31_to_S32)*Y(H1)*state.rho; + jac.set(S32, P31, scratch); + + scratch = -screened_rates(k_S32_He4_to_Ar36_approx)*Y(He4)*state.rho - screened_rates(k_S32_to_He4_Si28) - screened_rates(k_S32_to_p_P31); + jac.set(S32, S32, scratch); + + scratch = screened_rates(k_Ar36_to_S32_He4_approx); + jac.set(S32, Ar36, scratch); + + scratch = -screened_rates(k_Ar36_He4_to_Ca40_approx)*Y(Ar36)*state.rho + screened_rates(k_S32_He4_to_Ar36_approx)*Y(S32)*state.rho; + jac.set(Ar36, He4, scratch); + + scratch = screened_rates(k_S32_He4_to_Ar36_approx)*Y(He4)*state.rho; + jac.set(Ar36, S32, scratch); + + scratch = -screened_rates(k_Ar36_He4_to_Ca40_approx)*Y(He4)*state.rho - screened_rates(k_Ar36_to_S32_He4_approx); + jac.set(Ar36, Ar36, scratch); + + scratch = screened_rates(k_Ca40_to_Ar36_He4_approx); + jac.set(Ar36, Ca40, scratch); + + scratch = screened_rates(k_Ar36_He4_to_Ca40_approx)*Y(Ar36)*state.rho - screened_rates(k_Ca40_He4_to_Ti44_approx)*Y(Ca40)*state.rho; + jac.set(Ca40, He4, scratch); + + scratch = screened_rates(k_Ar36_He4_to_Ca40_approx)*Y(He4)*state.rho; + jac.set(Ca40, Ar36, scratch); + + scratch = -screened_rates(k_Ca40_He4_to_Ti44_approx)*Y(He4)*state.rho - screened_rates(k_Ca40_to_Ar36_He4_approx); + jac.set(Ca40, Ca40, scratch); + + scratch = screened_rates(k_Ti44_to_Ca40_He4_approx); + jac.set(Ca40, Ti44, scratch); + + scratch = screened_rates(k_Ca40_He4_to_Ti44_approx)*Y(Ca40)*state.rho - screened_rates(k_Ti44_He4_to_Cr48_approx)*Y(Ti44)*state.rho; + jac.set(Ti44, He4, scratch); + + scratch = screened_rates(k_Ca40_He4_to_Ti44_approx)*Y(He4)*state.rho; + jac.set(Ti44, Ca40, scratch); + + scratch = -screened_rates(k_Ti44_He4_to_Cr48_approx)*Y(He4)*state.rho - screened_rates(k_Ti44_to_Ca40_He4_approx); + jac.set(Ti44, Ti44, scratch); + + scratch = screened_rates(k_Cr48_to_Ti44_He4_approx); + jac.set(Ti44, Cr48, scratch); + + scratch = -screened_rates(k_Cr48_He4_to_Fe52_approx)*Y(Cr48)*state.rho + screened_rates(k_Ti44_He4_to_Cr48_approx)*Y(Ti44)*state.rho; + jac.set(Cr48, He4, scratch); + + scratch = screened_rates(k_Ti44_He4_to_Cr48_approx)*Y(He4)*state.rho; + jac.set(Cr48, Ti44, scratch); + + scratch = -screened_rates(k_Cr48_He4_to_Fe52_approx)*Y(He4)*state.rho - screened_rates(k_Cr48_to_Ti44_He4_approx); + jac.set(Cr48, Cr48, scratch); + + scratch = screened_rates(k_Fe52_to_Cr48_He4_approx); + jac.set(Cr48, Fe52, scratch); + + scratch = screened_rates(k_Cr48_He4_to_Fe52_approx)*Y(Cr48)*state.rho - screened_rates(k_Fe52_He4_to_Ni56_approx)*Y(Fe52)*state.rho; + jac.set(Fe52, He4, scratch); + + scratch = screened_rates(k_Cr48_He4_to_Fe52_approx)*Y(He4)*state.rho; + jac.set(Fe52, Cr48, scratch); + + scratch = -screened_rates(k_Fe52_He4_to_Ni56_approx)*Y(He4)*state.rho - screened_rates(k_Fe52_to_Cr48_He4_approx); + jac.set(Fe52, Fe52, scratch); + + scratch = screened_rates(k_Ni56_to_Fe52_He4_approx); + jac.set(Fe52, Ni56, scratch); + + scratch = screened_rates(k_Fe52_He4_to_Ni56_approx)*Y(Fe52)*state.rho; + jac.set(Ni56, He4, scratch); + + scratch = screened_rates(k_Fe52_He4_to_Ni56_approx)*Y(He4)*state.rho; + jac.set(Ni56, Fe52, scratch); + + scratch = -screened_rates(k_Ni56_to_Fe52_He4_approx); + jac.set(Ni56, Ni56, scratch); + + +} + + + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void actual_jac(const burn_t& state, MatrixType& jac) +{ + + // Set molar abundances + amrex::Array1D Y; + for (int i = 1; i <= NumSpec; ++i) { + Y(i) = state.xn[i-1] * aion_inv[i-1]; + } + + + jac.zero(); + + rate_derivs_t rate_eval; + + constexpr int do_T_derivatives = 1; + + evaluate_rates(state, rate_eval); + + // Species Jacobian elements with respect to other species + + jac_nuc(state, jac, Y, rate_eval.screened_rates); + + // Energy generation rate Jacobian elements with respect to species + + for (int j = 1; j <= NumSpec; ++j) { + auto jac_slice_2 = [&](int i) -> amrex::Real { return jac.get(i, j); }; + ener_gener_rate(jac_slice_2, jac(net_ienuc,j)); + } + + // Account for the thermal neutrino losses + + amrex::Real sneut, dsneutdt, dsneutdd, dsnuda, dsnudz; + constexpr int do_derivatives{1}; + sneut5(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, dsnuda, dsnudz); + + for (int j = 1; j <= NumSpec; ++j) { + amrex::Real b1 = (-state.abar * state.abar * dsnuda + (zion[j-1] - state.zbar) * state.abar * dsnudz); + jac.add(net_ienuc, j, -b1); + } + + + // Evaluate the Jacobian elements with respect to energy by + // calling the RHS using d(rate) / dT and then transform them + // to our energy integration variable. + + amrex::Array1D yderivs; + + rhs_nuc(state, yderivs, Y, rate_eval.dscreened_rates_dT); + + for (int k = 1; k <= NumSpec; k++) { + jac.set(k, net_ienuc, temperature_to_energy_jacobian(state, yderivs(k))); + } + + + // finally, d(de/dt)/de + + amrex::Real jac_e_T; + ener_gener_rate(yderivs, jac_e_T); + jac_e_T -= dsneutdt; + jac.set(net_ienuc, net_ienuc, temperature_to_energy_jacobian(state, jac_e_T)); + +} + + +AMREX_INLINE +void actual_rhs_init () { + + init_tabular(); + +} + + +#endif diff --git a/networks/CNO_He_burn/inputs.burn_cell.VODE b/networks/CNO_He_burn/inputs.burn_cell.VODE new file mode 100644 index 0000000000..6615a6c258 --- /dev/null +++ b/networks/CNO_He_burn/inputs.burn_cell.VODE @@ -0,0 +1,59 @@ +unit_test.run_prefix = "react_pynucastro_" + +unit_test.small_temp = 1e5 +unit_test.small_dens = 1e5 + +integrator.burner_verbose = 0 + +# Set which jacobian to use +# 1 = analytic jacobian +# 2 = numerical jacobian +integrator.jacobian = 1 + +integrator.renormalize_abundances = 0 + +integrator.rtol_spec = 1.0e-6 +integrator.rtol_enuc = 1.0e-6 +integrator.atol_spec = 1.0e-6 +integrator.atol_enuc = 1.0e-6 + + +unit_test.tmax = 1.0 +unit_test.nsteps = 1000 + +unit_test.density = 1.0e7 +unit_test.temperature = 1.0e8 + +unit_test.X1 = 1.0 +unit_test.X2 = 0.0 +unit_test.X3 = 0.0 +unit_test.X4 = 0.0 +unit_test.X5 = 0.0 +unit_test.X6 = 0.0 +unit_test.X7 = 0.0 +unit_test.X8 = 0.0 +unit_test.X9 = 0.0 +unit_test.X10 = 0.0 +unit_test.X11 = 0.0 +unit_test.X12 = 0.0 +unit_test.X13 = 0.0 +unit_test.X14 = 0.0 +unit_test.X15 = 0.0 +unit_test.X16 = 0.0 +unit_test.X17 = 0.0 +unit_test.X18 = 0.0 +unit_test.X19 = 0.0 +unit_test.X20 = 0.0 +unit_test.X21 = 0.0 +unit_test.X22 = 0.0 +unit_test.X23 = 0.0 +unit_test.X24 = 0.0 +unit_test.X25 = 0.0 +unit_test.X26 = 0.0 +unit_test.X27 = 0.0 +unit_test.X28 = 0.0 +unit_test.X29 = 0.0 +unit_test.X30 = 0.0 +unit_test.X31 = 0.0 +unit_test.X32 = 0.0 +unit_test.X33 = 0.0 diff --git a/networks/CNO_He_burn/partition_functions.H b/networks/CNO_He_burn/partition_functions.H new file mode 100644 index 0000000000..38f06a550b --- /dev/null +++ b/networks/CNO_He_burn/partition_functions.H @@ -0,0 +1,192 @@ +#ifndef PARTITION_FUNCTIONS_H +#define PARTITION_FUNCTIONS_H + +#include +#include + +#include +#include +#include + +using namespace amrex; +using namespace Species; + +namespace part_fun { + + + + // interpolation routine + + template + AMREX_GPU_HOST_DEVICE AMREX_INLINE + 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[0] && t9 < temp_array[npts-1]) { + + // find the largest temperature element <= t9 using a binary search + + int left = 0; + int right = npts; + + while (left < right) { + int mid = (left + right) / 2; + if (temp_array[mid] > t9) { + right = mid; + } else { + left = mid + 1; + } + } + + const int idx = right - 1; + + // now we have temp_array[idx] <= t9 < temp_array[idx+1] + + // 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]); + + // find the PF + + 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) + + amrex::Real dpf_dT9 = pf * M_LN10 * slope; + dpf_dT = dpf_dT9 / 1.e9_rt; + + } else { + + // T < the smallest T or >= the largest T in the partition function table + pf = 1.0; + dpf_dT = 0.0; + + } + + } + + struct pf_cache_t { + // Store the coefficient and derivative adjacent in memory, as they're + // always accessed at the same time. + // The entries will be default-initialized to zero, which is fine since + // log10(x) is never zero. + amrex::Array2D data{}; + }; + +} + +// main interface + +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void get_partition_function(const int inuc, [[maybe_unused]] const tf_t& tfactors, + amrex::Real& pf, amrex::Real& dpf_dT) { + + // inuc is the 1-based index for the species + + switch (inuc) { + + + default: + + pf = 1.0_rt; + dpf_dT = 0.0_rt; + + } + +} + +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void get_partition_function_cached(const int inuc, const tf_t& tfactors, + part_fun::pf_cache_t& pf_cache, + amrex::Real& pf, amrex::Real& dpf_dT) { + if (pf_cache.data(inuc, 1) != 0.0_rt) { + // present in cache + amrex::ignore_unused(tfactors); + pf = pf_cache.data(inuc, 1); + dpf_dT = pf_cache.data(inuc, 2); + } else { + get_partition_function(inuc, tfactors, pf, dpf_dT); + pf_cache.data(inuc, 1) = pf; + pf_cache.data(inuc, 2) = dpf_dT; + } +} + +// spins + +AMREX_GPU_HOST_DEVICE AMREX_INLINE +constexpr amrex::Real get_spin_state(const int inuc) { + + amrex::Real spin = -1.0; + + switch (inuc) { // NOLINT(bugprone-switch-missing-default-case) + + case He4: + case C12: + case O14: + case O16: + case O18: + case Ne18: + case Ne20: + case Mg22: + case Mg24: + case Si28: + case S32: + case Ar36: + case Ca40: + case Ti44: + case Cr48: + case Fe52: + case Ni56: + spin = 1; + break; + + case H1: + case C13: + case N13: + case N15: + case O15: + case F19: + case Ne19: + case P31: + spin = 2; + break; + + case N14: + case F18: + spin = 3; + break; + + case Ne21: + case Na23: + case Cl35: + case K39: + case V47: + spin = 4; + break; + + case O17: + case F17: + case Al27: + case Mn51: + spin = 6; + break; + + case Na22: + spin = 7; + break; + + case Sc43: + case Co55: + spin = 8; + break; + + + } + + return spin; + +} + + +#endif diff --git a/networks/CNO_He_burn/pynucastro.net b/networks/CNO_He_burn/pynucastro.net new file mode 100644 index 0000000000..fe105064bd --- /dev/null +++ b/networks/CNO_He_burn/pynucastro.net @@ -0,0 +1,39 @@ +hydrogen-1 H1 1.0 1.0 +helium-4 He4 4.0 2.0 +carbon-12 C12 12.0 6.0 +carbon-13 C13 13.0 6.0 +nitrogen-13 N13 13.0 7.0 +nitrogen-14 N14 14.0 7.0 +nitrogen-15 N15 15.0 7.0 +oxygen-14 O14 14.0 8.0 +oxygen-15 O15 15.0 8.0 +oxygen-16 O16 16.0 8.0 +oxygen-17 O17 17.0 8.0 +oxygen-18 O18 18.0 8.0 +fluorine-17 F17 17.0 9.0 +fluorine-18 F18 18.0 9.0 +fluorine-19 F19 19.0 9.0 +neon-18 Ne18 18.0 10.0 +neon-19 Ne19 19.0 10.0 +neon-20 Ne20 20.0 10.0 +neon-21 Ne21 21.0 10.0 +sodium-22 Na22 22.0 11.0 +sodium-23 Na23 23.0 11.0 +magnesium-22 Mg22 22.0 12.0 +magnesium-24 Mg24 24.0 12.0 +aluminum-27 Al27 27.0 13.0 +silicon-28 Si28 28.0 14.0 +phosphorus-31 P31 31.0 15.0 +sulfur-32 S32 32.0 16.0 +argon-36 Ar36 36.0 18.0 +calcium-40 Ca40 40.0 20.0 +titanium-44 Ti44 44.0 22.0 +chromium-48 Cr48 48.0 24.0 +iron-52 Fe52 52.0 26.0 +nickel-56 Ni56 56.0 28.0 +__extra_chlorine-35 Cl35 35.0 17.0 +__extra_potassium-39 K39 39.0 19.0 +__extra_scandium-43 Sc43 43.0 21.0 +__extra_vanadium-47 V47 47.0 23.0 +__extra_manganese-51 Mn51 51.0 25.0 +__extra_cobalt-55 Co55 55.0 27.0 diff --git a/networks/CNO_He_burn/reaclib_rates.H b/networks/CNO_He_burn/reaclib_rates.H new file mode 100644 index 0000000000..f4078948a9 --- /dev/null +++ b/networks/CNO_He_burn/reaclib_rates.H @@ -0,0 +1,8426 @@ +#ifndef REACLIB_RATES_H +#define REACLIB_RATES_H + +#include +#include + +#include +#include +#include + +using namespace Rates; +using namespace Species; + +struct rate_t { + amrex::Array1D screened_rates; + amrex::Real enuc_weak; +}; + +struct rate_derivs_t { + amrex::Array1D screened_rates; + amrex::Array1D dscreened_rates_dT; + amrex::Real enuc_weak; +}; + + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_N13_to_C13_weak_wc12(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // N13 --> C13 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // wc12w + ln_set_rate = -6.7601; + amrex::ignore_unused(tfactors); + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.0; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_O14_to_N14_weak_wc12(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O14 --> N14 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // wc12w + ln_set_rate = -4.62354; + amrex::ignore_unused(tfactors); + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.0; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_O15_to_N15_weak_wc12(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O15 --> N15 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // wc12w + ln_set_rate = -5.17053; + amrex::ignore_unused(tfactors); + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.0; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_F17_to_O17_weak_wc12(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F17 --> O17 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // wc12w + ln_set_rate = -4.53318; + amrex::ignore_unused(tfactors); + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.0; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_F18_to_O18_weak_wc12(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F18 --> O18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // wc12w + ln_set_rate = -9.15982; + amrex::ignore_unused(tfactors); + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.0; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ne18_to_F18_weak_wc12(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne18 --> F18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // wc12w + ln_set_rate = -0.879336; + amrex::ignore_unused(tfactors); + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.0; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ne19_to_F19_weak_wc12(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne19 --> F19 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // wc12w + ln_set_rate = -3.21142; + amrex::ignore_unused(tfactors); + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.0; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Mg22_to_Na22_weak_wc12(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Mg22 --> Na22 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // wc12w + ln_set_rate = -1.72235; + amrex::ignore_unused(tfactors); + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.0; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_N13_to_p_C12(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // N13 --> p + C12 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ls09r + ln_set_rate = 40.4354 + -26.326 * tfactors.T9i + -5.10735 * tfactors.T913i + -2.24111 * tfactors.T913 + + 0.148883 * tfactors.T9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 26.326 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -5.10735 * tfactors.T943i + (1.0/3.0) * -2.24111 * tfactors.T923i + + 0.148883; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // ls09n + ln_set_rate = 40.0408 + -22.5475 * tfactors.T9i + -13.692 * tfactors.T913i + -0.230881 * tfactors.T913 + + 4.44362 * tfactors.T9 + -3.15898 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 22.5475 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -13.692 * tfactors.T943i + (1.0/3.0) * -0.230881 * tfactors.T923i + + 4.44362 + (5.0/3.0) * -3.15898 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_N14_to_p_C13(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // N14 --> p + C13 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nacrr + ln_set_rate = 37.1528 + -93.4071 * tfactors.T9i + -0.196703 * tfactors.T913 + + 0.142126 * tfactors.T9 + -0.0238912 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 93.4071 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * -0.196703 * tfactors.T923i + + 0.142126 + (5.0/3.0) * -0.0238912 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrr + ln_set_rate = 38.3716 + -101.18 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 101.18 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrn + ln_set_rate = 41.7046 + -87.6256 * tfactors.T9i + -13.72 * tfactors.T913i + -0.450018 * tfactors.T913 + + 3.70823 * tfactors.T9 + -1.70545 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 87.6256 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -13.72 * tfactors.T943i + (1.0/3.0) * -0.450018 * tfactors.T923i + + 3.70823 + (5.0/3.0) * -1.70545 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_O14_to_p_N13(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O14 --> p + N13 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // lg06r + ln_set_rate = 35.2849 + -59.8313 * tfactors.T9i + 1.57122 * tfactors.T913i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 59.8313 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 1.57122 * tfactors.T943i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // lg06n + ln_set_rate = 42.4234 + -53.7053 * tfactors.T9i + -15.1676 * tfactors.T913i + 0.0955166 * tfactors.T913 + + 3.0659 * tfactors.T9 + -0.507339 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 53.7053 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -15.1676 * tfactors.T943i + (1.0/3.0) * 0.0955166 * tfactors.T923i + + 3.0659 + (5.0/3.0) * -0.507339 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_O15_to_p_N14(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O15 --> p + N14 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // im05r + ln_set_rate = 30.7435 + -89.5667 * tfactors.T9i + + 1.5682 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 89.5667 * tfactors.T9i * tfactors.T9i + + 1.5682 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // im05r + ln_set_rate = 31.6622 + -87.6737 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 87.6737 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // im05n + ln_set_rate = 44.1246 + -84.6757 * tfactors.T9i + -15.193 * tfactors.T913i + -4.63975 * tfactors.T913 + + 9.73458 * tfactors.T9 + -9.55051 * tfactors.T953 + 1.83333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 84.6757 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -15.193 * tfactors.T943i + (1.0/3.0) * -4.63975 * tfactors.T923i + + 9.73458 + (5.0/3.0) * -9.55051 * tfactors.T923 + 1.83333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // im05n + ln_set_rate = 41.0177 + -84.6757 * tfactors.T9i + -15.193 * tfactors.T913i + -0.161954 * tfactors.T913 + + -7.52123 * tfactors.T9 + -0.987565 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 84.6757 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -15.193 * tfactors.T943i + (1.0/3.0) * -0.161954 * tfactors.T923i + + -7.52123 + (5.0/3.0) * -0.987565 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_O16_to_p_N15(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O16 --> p + N15 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // li10r + ln_set_rate = 38.8465 + -150.962 * tfactors.T9i + + 0.0459037 * tfactors.T9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 150.962 * tfactors.T9i * tfactors.T9i + + 0.0459037; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // li10r + ln_set_rate = 30.8927 + -143.656 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 143.656 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // li10n + ln_set_rate = 44.3197 + -140.732 * tfactors.T9i + -15.24 * tfactors.T913i + 0.334926 * tfactors.T913 + + 4.59088 * tfactors.T9 + -4.78468 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 140.732 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -15.24 * tfactors.T943i + (1.0/3.0) * 0.334926 * tfactors.T923i + + 4.59088 + (5.0/3.0) * -4.78468 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_O16_to_He4_C12(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O16 --> He4 + C12 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nac2 + ln_set_rate = 279.295 + -84.9515 * tfactors.T9i + 103.411 * tfactors.T913i + -420.567 * tfactors.T913 + + 64.0874 * tfactors.T9 + -12.4624 * tfactors.T953 + 138.803 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 84.9515 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 103.411 * tfactors.T943i + (1.0/3.0) * -420.567 * tfactors.T923i + + 64.0874 + (5.0/3.0) * -12.4624 * tfactors.T923 + 138.803 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nac2 + ln_set_rate = 94.3131 + -84.503 * tfactors.T9i + 58.9128 * tfactors.T913i + -148.273 * tfactors.T913 + + 9.08324 * tfactors.T9 + -0.541041 * tfactors.T953 + 71.8554 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 84.503 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 58.9128 * tfactors.T943i + (1.0/3.0) * -148.273 * tfactors.T923i + + 9.08324 + (5.0/3.0) * -0.541041 * tfactors.T923 + 71.8554 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_F17_to_p_O16(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F17 --> p + O16 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ia08n + ln_set_rate = 40.9135 + -6.96583 * tfactors.T9i + -16.696 * tfactors.T913i + -1.16252 * tfactors.T913 + + 0.267703 * tfactors.T9 + -0.0338411 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 6.96583 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -16.696 * tfactors.T943i + (1.0/3.0) * -1.16252 * tfactors.T923i + + 0.267703 + (5.0/3.0) * -0.0338411 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_F18_to_p_O17(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F18 --> p + O17 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = 33.7037 + -71.2889 * tfactors.T9i + 2.31435 * tfactors.T913 + + -0.302835 * tfactors.T9 + 0.020133 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 71.2889 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 2.31435 * tfactors.T923i + + -0.302835 + (5.0/3.0) * 0.020133 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 11.2362 + -65.8069 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 65.8069 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 40.2061 + -65.0606 * tfactors.T9i + -16.4035 * tfactors.T913i + 4.31885 * tfactors.T913 + + -0.709921 * tfactors.T9 + -2.0 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 65.0606 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -16.4035 * tfactors.T943i + (1.0/3.0) * 4.31885 * tfactors.T923i + + -0.709921 + (5.0/3.0) * -2.0 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_F18_to_He4_N14(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F18 --> He4 + N14 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10n + ln_set_rate = 46.249 + -51.2292 * tfactors.T9i + -36.2504 * tfactors.T913i + + -5.0 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 51.2292 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -36.2504 * tfactors.T943i + + (5.0/3.0) * -5.0 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 38.6146 + -62.1948 * tfactors.T9i + -5.6227 * tfactors.T913i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 62.1948 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -5.6227 * tfactors.T943i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 24.9119 + -56.3896 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 56.3896 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_F19_to_p_O18(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F19 --> p + O18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10n + ln_set_rate = 42.8485 + -92.7757 * tfactors.T9i + -16.7246 * tfactors.T913i + + -3.0 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 92.7757 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -16.7246 * tfactors.T943i + + (5.0/3.0) * -3.0 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 30.2003 + -99.501 * tfactors.T9i + 3.99059 * tfactors.T913 + + -0.593127 * tfactors.T9 + 0.0877534 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 99.501 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 3.99059 * tfactors.T923i + + -0.593127 + (5.0/3.0) * 0.0877534 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 28.008 + -94.4325 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 94.4325 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -12.0764 + -93.0204 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 93.0204 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_F19_to_He4_N15(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F19 --> He4 + N15 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = 15.3186 + -50.7554 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 50.7554 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 50.1291 + -46.5774 * tfactors.T9i + -36.2324 * tfactors.T913i + + -2.0 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 46.5774 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -36.2324 * tfactors.T943i + + (5.0/3.0) * -2.0 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -4.06142 + -50.7773 * tfactors.T9i + 35.4292 * tfactors.T913 + + -5.5767 * tfactors.T9 + 0.441293 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 50.7773 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 35.4292 * tfactors.T923i + + -5.5767 + (5.0/3.0) * 0.441293 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 28.2717 + -53.5621 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 53.5621 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ne18_to_p_F17(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne18 --> p + F17 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cb09 + ln_set_rate = 52.9895 + -50.492 * tfactors.T9i + -21.3249 * tfactors.T913i + -0.230774 * tfactors.T913 + + 0.917931 * tfactors.T9 + -0.0440377 * tfactors.T953 + -5.86014 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 50.492 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -21.3249 * tfactors.T943i + (1.0/3.0) * -0.230774 * tfactors.T923i + + 0.917931 + (5.0/3.0) * -0.0440377 * tfactors.T923 + -5.86014 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // cb09 + ln_set_rate = 17.5646 + -45.5647 * tfactors.T9i + -14.2191 * tfactors.T913i + 34.0647 * tfactors.T913 + + -16.5698 * tfactors.T9 + 2.48116 * tfactors.T953 + -0.63376 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 45.5647 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -14.2191 * tfactors.T943i + (1.0/3.0) * 34.0647 * tfactors.T923i + + -16.5698 + (5.0/3.0) * 2.48116 * tfactors.T923 + -0.63376 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ne18_to_He4_O14(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne18 --> He4 + O14 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // wh87r + ln_set_rate = 20.0156 + -71.5044 * tfactors.T9i + + 6.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 71.5044 * tfactors.T9i * tfactors.T9i + + 6.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // wh87r + ln_set_rate = 28.2415 + -81.9554 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 81.9554 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // wh87r + ln_set_rate = 22.5609 + -71.0754 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 71.0754 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // wh87n + ln_set_rate = 51.158 + -59.3454 * tfactors.T9i + -39.38 * tfactors.T913i + -0.0772187 * tfactors.T913 + + -0.635361 * tfactors.T9 + 0.106236 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 59.3454 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -39.38 * tfactors.T943i + (1.0/3.0) * -0.0772187 * tfactors.T923i + + -0.635361 + (5.0/3.0) * 0.106236 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ne19_to_p_F18(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne19 --> p + F18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -5.41887 + -74.7977 * tfactors.T9i + 22.4903 * tfactors.T913 + + 0.307872 * tfactors.T9 + -0.296226 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 74.7977 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 22.4903 * tfactors.T923i + + 0.307872 + (5.0/3.0) * -0.296226 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 81.4385 + -74.3988 * tfactors.T9i + -21.4023 * tfactors.T913i + -93.766 * tfactors.T913 + + 179.258 * tfactors.T9 + -202.561 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 74.3988 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -21.4023 * tfactors.T943i + (1.0/3.0) * -93.766 * tfactors.T923i + + 179.258 + (5.0/3.0) * -202.561 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 18.1729 + -77.2902 * tfactors.T9i + 13.1683 * tfactors.T913 + + -1.92023 * tfactors.T9 + 0.16901 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 77.2902 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 13.1683 * tfactors.T923i + + -1.92023 + (5.0/3.0) * 0.16901 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ne19_to_He4_O15(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne19 --> He4 + O15 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // dc11n + ln_set_rate = 51.0289 + -40.9534 * tfactors.T9i + -39.578 * tfactors.T913i + + -3.0 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 40.9534 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -39.578 * tfactors.T943i + + (5.0/3.0) * -3.0 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // dc11r + ln_set_rate = -7.51212 + -45.1578 * tfactors.T9i + -3.24609 * tfactors.T913i + 44.4647 * tfactors.T913 + + -9.79962 * tfactors.T9 + 0.841782 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 45.1578 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -3.24609 * tfactors.T943i + (1.0/3.0) * 44.4647 * tfactors.T923i + + -9.79962 + (5.0/3.0) * 0.841782 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // dc11r + ln_set_rate = 24.6922 + -46.8378 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 46.8378 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ne20_to_p_F19(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne20 --> p + F19 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nacrr + ln_set_rate = 18.691 + -156.781 * tfactors.T9i + 31.6442 * tfactors.T913i + -58.6563 * tfactors.T913 + + 67.7365 * tfactors.T9 + -22.9721 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 156.781 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 31.6442 * tfactors.T943i + (1.0/3.0) * -58.6563 * tfactors.T923i + + 67.7365 + (5.0/3.0) * -22.9721 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrr + ln_set_rate = 36.7036 + -150.75 * tfactors.T9i + -11.3832 * tfactors.T913i + 5.47872 * tfactors.T913 + + -1.07203 * tfactors.T9 + 0.11196 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 150.75 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -11.3832 * tfactors.T943i + (1.0/3.0) * 5.47872 * tfactors.T923i + + -1.07203 + (5.0/3.0) * 0.11196 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrn + ln_set_rate = 42.6027 + -149.037 * tfactors.T9i + -18.116 * tfactors.T913i + -1.4622 * tfactors.T913 + + 6.95113 * tfactors.T9 + -2.90366 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 149.037 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -18.116 * tfactors.T943i + (1.0/3.0) * -1.4622 * tfactors.T923i + + 6.95113 + (5.0/3.0) * -2.90366 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ne20_to_He4_O16(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne20 --> He4 + O16 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // co10r + ln_set_rate = 34.2658 + -67.6518 * tfactors.T9i + -3.65925 * tfactors.T913 + + 0.714224 * tfactors.T9 + -0.00107508 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 67.6518 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * -3.65925 * tfactors.T923i + + 0.714224 + (5.0/3.0) * -0.00107508 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // co10r + ln_set_rate = 28.6431 + -65.246 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 65.246 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // co10n + ln_set_rate = 48.6604 + -54.8875 * tfactors.T9i + -39.7262 * tfactors.T913i + -0.210799 * tfactors.T913 + + 0.442879 * tfactors.T9 + -0.0797753 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 54.8875 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -39.7262 * tfactors.T943i + (1.0/3.0) * -0.210799 * tfactors.T923i + + 0.442879 + (5.0/3.0) * -0.0797753 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ne21_to_He4_O17(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne21 --> He4 + O17 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // be13r + ln_set_rate = 27.3205 + -91.2722 * tfactors.T9i + 2.87641 * tfactors.T913i + -3.54489 * tfactors.T913 + + -2.11222e-08 * tfactors.T9 + -3.90649e-09 * tfactors.T953 + 6.25778 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 91.2722 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 2.87641 * tfactors.T943i + (1.0/3.0) * -3.54489 * tfactors.T923i + + -2.11222e-08 + (5.0/3.0) * -3.90649e-09 * tfactors.T923 + 6.25778 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // be13r + ln_set_rate = 0.0906657 + -90.782 * tfactors.T9i + 123.363 * tfactors.T913i + -87.4351 * tfactors.T913 + + -3.40974e-06 * tfactors.T9 + -57.0469 * tfactors.T953 + 83.7218 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 90.782 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 123.363 * tfactors.T943i + (1.0/3.0) * -87.4351 * tfactors.T923i + + -3.40974e-06 + (5.0/3.0) * -57.0469 * tfactors.T923 + 83.7218 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // be13r + ln_set_rate = -91.954 + -98.9487 * tfactors.T9i + 3.31162e-08 * tfactors.T913i + 130.258 * tfactors.T913 + + -7.92551e-05 * tfactors.T9 + -4.13772 * tfactors.T953 + -41.2753 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 98.9487 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 3.31162e-08 * tfactors.T943i + (1.0/3.0) * 130.258 * tfactors.T923i + + -7.92551e-05 + (5.0/3.0) * -4.13772 * tfactors.T923 + -41.2753 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Na22_to_p_Ne21(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Na22 --> p + Ne21 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -16.4098 + -82.4235 * tfactors.T9i + 21.1176 * tfactors.T913i + 34.0411 * tfactors.T913 + + -4.45593 * tfactors.T9 + 0.328613 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 82.4235 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 21.1176 * tfactors.T943i + (1.0/3.0) * 34.0411 * tfactors.T923i + + -4.45593 + (5.0/3.0) * 0.328613 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 24.8334 + -79.6093 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 79.6093 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -24.579 + -78.4059 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 78.4059 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 42.146 + -78.2097 * tfactors.T9i + -19.2096 * tfactors.T913i + + -1.0 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 78.2097 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -19.2096 * tfactors.T943i + + (5.0/3.0) * -1.0 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Na22_to_He4_F18(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Na22 --> He4 + F18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // rpsmr + ln_set_rate = 59.3224 + -100.236 * tfactors.T9i + 18.8956 * tfactors.T913i + -65.6134 * tfactors.T913 + + 1.71114 * tfactors.T9 + -0.0260999 * tfactors.T953 + 39.3396 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 100.236 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 18.8956 * tfactors.T943i + (1.0/3.0) * -65.6134 * tfactors.T923i + + 1.71114 + (5.0/3.0) * -0.0260999 * tfactors.T923 + 39.3396 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Na23_to_He4_F19(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Na23 --> He4 + F19 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // rpsmr + ln_set_rate = 76.8979 + -123.578 * tfactors.T9i + 39.7219 * tfactors.T913i + -100.401 * tfactors.T913 + + 3.15808 * tfactors.T9 + -0.0629822 * tfactors.T953 + 55.9823 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 123.578 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 39.7219 * tfactors.T943i + (1.0/3.0) * -100.401 * tfactors.T923i + + 3.15808 + (5.0/3.0) * -0.0629822 * tfactors.T923 + 55.9823 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Mg22_to_He4_Ne18(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Mg22 --> He4 + Ne18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 57.6776 + -94.4496 * tfactors.T9i + -46.4859 * tfactors.T913i + 0.956741 * tfactors.T913 + + -0.914402 * tfactors.T9 + 0.0722478 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 94.4496 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -46.4859 * tfactors.T943i + (1.0/3.0) * 0.956741 * tfactors.T923i + + -0.914402 + (5.0/3.0) * 0.0722478 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Mg24_to_p_Na23(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Mg24 --> p + Na23 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = 34.0876 + -138.968 * tfactors.T9i + -0.360588 * tfactors.T913 + + 1.4187 * tfactors.T9 + -0.184061 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 138.968 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * -0.360588 * tfactors.T923i + + 1.4187 + (5.0/3.0) * -0.184061 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 20.0024 + -137.3 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 137.3 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 43.9357 + -135.688 * tfactors.T9i + -20.6428 * tfactors.T913i + 1.52954 * tfactors.T913 + + 2.7487 * tfactors.T9 + -1.0 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 135.688 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -20.6428 * tfactors.T943i + (1.0/3.0) * 1.52954 * tfactors.T923i + + 2.7487 + (5.0/3.0) * -1.0 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Mg24_to_He4_Ne20(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Mg24 --> He4 + Ne20 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10n + ln_set_rate = 49.3244 + -108.114 * tfactors.T9i + -46.2525 * tfactors.T913i + 5.58901 * tfactors.T913 + + 7.61843 * tfactors.T9 + -3.683 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 108.114 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -46.2525 * tfactors.T943i + (1.0/3.0) * 5.58901 * tfactors.T923i + + 7.61843 + (5.0/3.0) * -3.683 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 16.0203 + -120.895 * tfactors.T9i + 16.9229 * tfactors.T913 + + -2.57325 * tfactors.T9 + 0.208997 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 120.895 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 16.9229 * tfactors.T923i + + -2.57325 + (5.0/3.0) * 0.208997 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 26.8017 + -117.334 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 117.334 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -13.8869 + -110.62 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 110.62 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Si28_to_p_Al27(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Si28 --> p + Al27 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = 11.7765 + -136.349 * tfactors.T9i + 23.8634 * tfactors.T913 + + -3.70135 * tfactors.T9 + 0.28964 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 136.349 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 23.8634 * tfactors.T923i + + -3.70135 + (5.0/3.0) * 0.28964 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 46.5494 + -134.445 * tfactors.T9i + -23.2205 * tfactors.T913i + + -2.0 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 134.445 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -23.2205 * tfactors.T943i + + (5.0/3.0) * -2.0 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 111.466 + -134.832 * tfactors.T9i + -26.8327 * tfactors.T913i + -116.137 * tfactors.T913 + + 0.00950567 * tfactors.T9 + 0.00999755 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 134.832 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -26.8327 * tfactors.T943i + (1.0/3.0) * -116.137 * tfactors.T923i + + 0.00950567 + (5.0/3.0) * 0.00999755 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Si28_to_He4_Mg24(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Si28 --> He4 + Mg24 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // st08r + ln_set_rate = 32.9006 + -131.488 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 131.488 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // st08r + ln_set_rate = -25.6886 + -128.693 * tfactors.T9i + 21.3721 * tfactors.T913i + 37.7649 * tfactors.T913 + + -4.10635 * tfactors.T9 + 0.249618 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 128.693 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 21.3721 * tfactors.T943i + (1.0/3.0) * 37.7649 * tfactors.T923i + + -4.10635 + (5.0/3.0) * 0.249618 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_S32_to_p_P31(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // S32 --> p + P31 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = 25.1729 + -106.637 * tfactors.T9i + 8.09341 * tfactors.T913 + + -0.615971 * tfactors.T9 + 0.031159 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 106.637 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 8.09341 * tfactors.T923i + + -0.615971 + (5.0/3.0) * 0.031159 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 21.6829 + -105.119 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 105.119 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 43.6109 + -102.86 * tfactors.T9i + -25.3278 * tfactors.T913i + 6.4931 * tfactors.T913 + + -9.27513 * tfactors.T9 + -0.610439 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 102.86 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -25.3278 * tfactors.T943i + (1.0/3.0) * 6.4931 * tfactors.T923i + + -9.27513 + (5.0/3.0) * -0.610439 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_S32_to_He4_Si28(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // S32 --> He4 + Si28 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 72.813 + -80.626 * tfactors.T9i + -59.4896 * tfactors.T913i + 4.47205 * tfactors.T913 + + -4.78989 * tfactors.T9 + 0.557201 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 80.626 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -59.4896 * tfactors.T943i + (1.0/3.0) * 4.47205 * tfactors.T923i + + -4.78989 + (5.0/3.0) * 0.557201 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_C12_to_He4_He4_He4(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // C12 --> He4 + He4 + He4 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // fy05n + ln_set_rate = 45.7734 + -84.4227 * tfactors.T9i + -37.06 * tfactors.T913i + 29.3493 * tfactors.T913 + + -115.507 * tfactors.T9 + -10.0 * tfactors.T953 + 1.66667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 84.4227 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -37.06 * tfactors.T943i + (1.0/3.0) * 29.3493 * tfactors.T923i + + -115.507 + (5.0/3.0) * -10.0 * tfactors.T923 + 1.66667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // fy05r + ln_set_rate = 22.394 + -88.5493 * tfactors.T9i + -13.49 * tfactors.T913i + 21.4259 * tfactors.T913 + + -1.34769 * tfactors.T9 + 0.0879816 * tfactors.T953 + -10.1653 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 88.5493 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -13.49 * tfactors.T943i + (1.0/3.0) * 21.4259 * tfactors.T923i + + -1.34769 + (5.0/3.0) * 0.0879816 * tfactors.T923 + -10.1653 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // fy05r + ln_set_rate = 34.9561 + -85.4472 * tfactors.T9i + -23.57 * tfactors.T913i + 20.4886 * tfactors.T913 + + -12.9882 * tfactors.T9 + -20.0 * tfactors.T953 + 0.83333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 85.4472 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -23.57 * tfactors.T943i + (1.0/3.0) * 20.4886 * tfactors.T923i + + -12.9882 + (5.0/3.0) * -20.0 * tfactors.T923 + 0.83333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_C12_to_N13(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // C12 + p --> N13 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ls09n + ln_set_rate = 17.1482 + -13.692 * tfactors.T913i + -0.230881 * tfactors.T913 + + 4.44362 * tfactors.T9 + -3.15898 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -13.692 * tfactors.T943i + (1.0/3.0) * -0.230881 * tfactors.T923i + + 4.44362 + (5.0/3.0) * -3.15898 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // ls09r + ln_set_rate = 17.5428 + -3.77849 * tfactors.T9i + -5.10735 * tfactors.T913i + -2.24111 * tfactors.T913 + + 0.148883 * tfactors.T9 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 3.77849 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -5.10735 * tfactors.T943i + (1.0/3.0) * -2.24111 * tfactors.T923i + + 0.148883 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_C12_to_O16(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // C12 + He4 --> O16 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nac2 + ln_set_rate = 254.634 + -1.84097 * tfactors.T9i + 103.411 * tfactors.T913i + -420.567 * tfactors.T913 + + 64.0874 * tfactors.T9 + -12.4624 * tfactors.T953 + 137.303 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.84097 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 103.411 * tfactors.T943i + (1.0/3.0) * -420.567 * tfactors.T923i + + 64.0874 + (5.0/3.0) * -12.4624 * tfactors.T923 + 137.303 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nac2 + ln_set_rate = 69.6526 + -1.39254 * tfactors.T9i + 58.9128 * tfactors.T913i + -148.273 * tfactors.T913 + + 9.08324 * tfactors.T9 + -0.541041 * tfactors.T953 + 70.3554 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.39254 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 58.9128 * tfactors.T943i + (1.0/3.0) * -148.273 * tfactors.T923i + + 9.08324 + (5.0/3.0) * -0.541041 * tfactors.T923 + 70.3554 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_C13_to_N14(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // C13 + p --> N14 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nacrr + ln_set_rate = 15.1825 + -13.5543 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 13.5543 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrn + ln_set_rate = 18.5155 + -13.72 * tfactors.T913i + -0.450018 * tfactors.T913 + + 3.70823 * tfactors.T9 + -1.70545 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -13.72 * tfactors.T943i + (1.0/3.0) * -0.450018 * tfactors.T923i + + 3.70823 + (5.0/3.0) * -1.70545 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrr + ln_set_rate = 13.9637 + -5.78147 * tfactors.T9i + -0.196703 * tfactors.T913 + + 0.142126 * tfactors.T9 + -0.0238912 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 5.78147 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * -0.196703 * tfactors.T923i + + 0.142126 + (5.0/3.0) * -0.0238912 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_N13_to_O14(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // N13 + p --> O14 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // lg06r + ln_set_rate = 10.9971 + -6.12602 * tfactors.T9i + 1.57122 * tfactors.T913i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 6.12602 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 1.57122 * tfactors.T943i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // lg06n + ln_set_rate = 18.1356 + -15.1676 * tfactors.T913i + 0.0955166 * tfactors.T913 + + 3.0659 * tfactors.T9 + -0.507339 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -15.1676 * tfactors.T943i + (1.0/3.0) * 0.0955166 * tfactors.T923i + + 3.0659 + (5.0/3.0) * -0.507339 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_N14_to_O15(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // N14 + p --> O15 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // im05n + ln_set_rate = 17.01 + -15.193 * tfactors.T913i + -0.161954 * tfactors.T913 + + -7.52123 * tfactors.T9 + -0.987565 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -15.193 * tfactors.T943i + (1.0/3.0) * -0.161954 * tfactors.T923i + + -7.52123 + (5.0/3.0) * -0.987565 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // im05r + ln_set_rate = 6.73578 + -4.891 * tfactors.T9i + + 0.0682 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 4.891 * tfactors.T9i * tfactors.T9i + + 0.0682 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // im05r + ln_set_rate = 7.65444 + -2.998 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 2.998 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // im05n + ln_set_rate = 20.1169 + -15.193 * tfactors.T913i + -4.63975 * tfactors.T913 + + 9.73458 * tfactors.T9 + -9.55051 * tfactors.T953 + 0.333333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -15.193 * tfactors.T943i + (1.0/3.0) * -4.63975 * tfactors.T923i + + 9.73458 + (5.0/3.0) * -9.55051 * tfactors.T923 + 0.333333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_N14_to_F18(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // N14 + He4 --> F18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10n + ln_set_rate = 21.5339 + -36.2504 * tfactors.T913i + + -5.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -36.2504 * tfactors.T943i + + (5.0/3.0) * -5.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 13.8995 + -10.9656 * tfactors.T9i + -5.6227 * tfactors.T913i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 10.9656 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -5.6227 * tfactors.T943i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 0.196838 + -5.16034 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 5.16034 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_N15_to_O16(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // N15 + p --> O16 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // li10n + ln_set_rate = 20.0176 + -15.24 * tfactors.T913i + 0.334926 * tfactors.T913 + + 4.59088 * tfactors.T9 + -4.78468 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -15.24 * tfactors.T943i + (1.0/3.0) * 0.334926 * tfactors.T923i + + 4.59088 + (5.0/3.0) * -4.78468 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // li10r + ln_set_rate = 14.5444 + -10.2295 * tfactors.T9i + + 0.0459037 * tfactors.T9 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 10.2295 * tfactors.T9i * tfactors.T9i + + 0.0459037 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // li10r + ln_set_rate = 6.59056 + -2.92315 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 2.92315 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_N15_to_F19(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // N15 + He4 --> F19 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -9.41892 + -4.17795 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 4.17795 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 25.3916 + -36.2324 * tfactors.T913i + + -2.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -36.2324 * tfactors.T943i + + (5.0/3.0) * -2.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -28.7989 + -4.19986 * tfactors.T9i + 35.4292 * tfactors.T913 + + -5.5767 * tfactors.T9 + 0.441293 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 4.19986 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 35.4292 * tfactors.T923i + + -5.5767 + (5.0/3.0) * 0.441293 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 3.5342 + -6.98462 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 6.98462 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_O14_to_Ne18(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O14 + He4 --> Ne18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // wh87r + ln_set_rate = -4.69948 + -12.159 * tfactors.T9i + + 5.0 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 12.159 * tfactors.T9i * tfactors.T9i + + 5.0 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // wh87r + ln_set_rate = 3.52636 + -22.61 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 22.61 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // wh87r + ln_set_rate = -2.15417 + -11.73 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 11.73 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // wh87n + ln_set_rate = 26.4429 + -39.38 * tfactors.T913i + -0.0772187 * tfactors.T913 + + -0.635361 * tfactors.T9 + 0.106236 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -39.38 * tfactors.T943i + (1.0/3.0) * -0.0772187 * tfactors.T923i + + -0.635361 + (5.0/3.0) * 0.106236 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_O15_to_Ne19(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O15 + He4 --> Ne19 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // dc11r + ln_set_rate = -32.2496 + -4.20439 * tfactors.T9i + -3.24609 * tfactors.T913i + 44.4647 * tfactors.T913 + + -9.79962 * tfactors.T9 + 0.841782 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 4.20439 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -3.24609 * tfactors.T943i + (1.0/3.0) * 44.4647 * tfactors.T923i + + -9.79962 + (5.0/3.0) * 0.841782 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // dc11r + ln_set_rate = -0.0452465 + -5.88439 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 5.88439 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // dc11n + ln_set_rate = 26.2914 + -39.578 * tfactors.T913i + + -3.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -39.578 * tfactors.T943i + + (5.0/3.0) * -3.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_O16_to_F17(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O16 + p --> F17 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ia08n + ln_set_rate = 19.0904 + -16.696 * tfactors.T913i + -1.16252 * tfactors.T913 + + 0.267703 * tfactors.T9 + -0.0338411 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -16.696 * tfactors.T943i + (1.0/3.0) * -1.16252 * tfactors.T923i + + 0.267703 + (5.0/3.0) * -0.0338411 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_O16_to_Ne20(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O16 + He4 --> Ne20 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // co10r + ln_set_rate = 9.50848 + -12.7643 * tfactors.T9i + -3.65925 * tfactors.T913 + + 0.714224 * tfactors.T9 + -0.00107508 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 12.7643 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * -3.65925 * tfactors.T923i + + 0.714224 + (5.0/3.0) * -0.00107508 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // co10r + ln_set_rate = 3.88571 + -10.3585 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 10.3585 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // co10n + ln_set_rate = 23.903 + -39.7262 * tfactors.T913i + -0.210799 * tfactors.T913 + + 0.442879 * tfactors.T9 + -0.0797753 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -39.7262 * tfactors.T943i + (1.0/3.0) * -0.210799 * tfactors.T923i + + 0.442879 + (5.0/3.0) * -0.0797753 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_O17_to_F18(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O17 + p --> F18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10n + ln_set_rate = 15.8929 + -16.4035 * tfactors.T913i + 4.31885 * tfactors.T913 + + -0.709921 * tfactors.T9 + -2.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -16.4035 * tfactors.T943i + (1.0/3.0) * 4.31885 * tfactors.T923i + + -0.709921 + (5.0/3.0) * -2.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 9.39048 + -6.22828 * tfactors.T9i + 2.31435 * tfactors.T913 + + -0.302835 * tfactors.T9 + 0.020133 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 6.22828 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 2.31435 * tfactors.T923i + + -0.302835 + (5.0/3.0) * 0.020133 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -13.077 + -0.746296 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.746296 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_O17_to_Ne21(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O17 + He4 --> Ne21 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // be13r + ln_set_rate = -25.0898 + -5.50926 * tfactors.T9i + 123.363 * tfactors.T913i + -87.4351 * tfactors.T913 + + -3.40974e-06 * tfactors.T9 + -57.0469 * tfactors.T953 + 82.2218 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 5.50926 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 123.363 * tfactors.T943i + (1.0/3.0) * -87.4351 * tfactors.T923i + + -3.40974e-06 + (5.0/3.0) * -57.0469 * tfactors.T923 + 82.2218 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // be13r + ln_set_rate = -117.134 + -13.6759 * tfactors.T9i + 3.31162e-08 * tfactors.T913i + 130.258 * tfactors.T913 + + -7.92551e-05 * tfactors.T9 + -4.13772 * tfactors.T953 + -42.7753 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 13.6759 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 3.31162e-08 * tfactors.T943i + (1.0/3.0) * 130.258 * tfactors.T923i + + -7.92551e-05 + (5.0/3.0) * -4.13772 * tfactors.T923 + -42.7753 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // be13r + ln_set_rate = 2.14 + -5.99952 * tfactors.T9i + 2.87641 * tfactors.T913i + -3.54489 * tfactors.T913 + + -2.11222e-08 * tfactors.T9 + -3.90649e-09 * tfactors.T953 + 4.75778 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 5.99952 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 2.87641 * tfactors.T943i + (1.0/3.0) * -3.54489 * tfactors.T923i + + -2.11222e-08 + (5.0/3.0) * -3.90649e-09 * tfactors.T923 + 4.75778 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_O18_to_F19(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O18 + p --> F19 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -35.0079 + -0.244743 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.244743 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 19.917 + -16.7246 * tfactors.T913i + + -3.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -16.7246 * tfactors.T943i + + (5.0/3.0) * -3.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 7.26876 + -6.7253 * tfactors.T9i + 3.99059 * tfactors.T913 + + -0.593127 * tfactors.T9 + 0.0877534 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 6.7253 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 3.99059 * tfactors.T923i + + -0.593127 + (5.0/3.0) * 0.0877534 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 5.07648 + -1.65681 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.65681 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_F17_to_Ne18(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F17 + p --> Ne18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cb09 + ln_set_rate = -7.84708 + -0.0323504 * tfactors.T9i + -14.2191 * tfactors.T913i + 34.0647 * tfactors.T913 + + -16.5698 * tfactors.T9 + 2.48116 * tfactors.T953 + -2.13376 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.0323504 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -14.2191 * tfactors.T943i + (1.0/3.0) * 34.0647 * tfactors.T923i + + -16.5698 + (5.0/3.0) * 2.48116 * tfactors.T923 + -2.13376 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // cb09 + ln_set_rate = 27.5778 + -4.95969 * tfactors.T9i + -21.3249 * tfactors.T913i + -0.230774 * tfactors.T913 + + 0.917931 * tfactors.T9 + -0.0440377 * tfactors.T953 + -7.36014 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 4.95969 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -21.3249 * tfactors.T943i + (1.0/3.0) * -0.230774 * tfactors.T923i + + 0.917931 + (5.0/3.0) * -0.0440377 * tfactors.T923 + -7.36014 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_F18_to_Ne19(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F18 + p --> Ne19 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10n + ln_set_rate = 57.4084 + -21.4023 * tfactors.T913i + -93.766 * tfactors.T913 + + 179.258 * tfactors.T9 + -202.561 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -21.4023 * tfactors.T943i + (1.0/3.0) * -93.766 * tfactors.T923i + + 179.258 + (5.0/3.0) * -202.561 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -5.85727 + -2.89147 * tfactors.T9i + 13.1683 * tfactors.T913 + + -1.92023 * tfactors.T9 + 0.16901 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 2.89147 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 13.1683 * tfactors.T923i + + -1.92023 + (5.0/3.0) * 0.16901 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -29.449 + -0.39895 * tfactors.T9i + 22.4903 * tfactors.T913 + + 0.307872 * tfactors.T9 + -0.296226 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.39895 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 22.4903 * tfactors.T923i + + 0.307872 + (5.0/3.0) * -0.296226 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_F18_to_Na22(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F18 + He4 --> Na22 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // rpsmr + ln_set_rate = 35.3786 + -1.82957 * tfactors.T9i + 18.8956 * tfactors.T913i + -65.6134 * tfactors.T913 + + 1.71114 * tfactors.T9 + -0.0260999 * tfactors.T953 + 37.8396 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.82957 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 18.8956 * tfactors.T943i + (1.0/3.0) * -65.6134 * tfactors.T923i + + 1.71114 + (5.0/3.0) * -0.0260999 * tfactors.T923 + 37.8396 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_F19_to_Ne20(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F19 + p --> Ne20 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nacrr + ln_set_rate = -5.63093 + -7.74414 * tfactors.T9i + 31.6442 * tfactors.T913i + -58.6563 * tfactors.T913 + + 67.7365 * tfactors.T9 + -22.9721 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 7.74414 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 31.6442 * tfactors.T943i + (1.0/3.0) * -58.6563 * tfactors.T923i + + 67.7365 + (5.0/3.0) * -22.9721 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrr + ln_set_rate = 12.3816 + -1.71383 * tfactors.T9i + -11.3832 * tfactors.T913i + 5.47872 * tfactors.T913 + + -1.07203 * tfactors.T9 + 0.11196 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.71383 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -11.3832 * tfactors.T943i + (1.0/3.0) * 5.47872 * tfactors.T923i + + -1.07203 + (5.0/3.0) * 0.11196 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrn + ln_set_rate = 18.2807 + -18.116 * tfactors.T913i + -1.4622 * tfactors.T913 + + 6.95113 * tfactors.T9 + -2.90366 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -18.116 * tfactors.T943i + (1.0/3.0) * -1.4622 * tfactors.T923i + + 6.95113 + (5.0/3.0) * -2.90366 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_F19_to_Na23(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F19 + He4 --> Na23 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // rpsmr + ln_set_rate = 52.7856 + -2.11408 * tfactors.T9i + 39.7219 * tfactors.T913i + -100.401 * tfactors.T913 + + 3.15808 * tfactors.T9 + -0.0629822 * tfactors.T953 + 54.4823 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 2.11408 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 39.7219 * tfactors.T943i + (1.0/3.0) * -100.401 * tfactors.T923i + + 3.15808 + (5.0/3.0) * -0.0629822 * tfactors.T923 + 54.4823 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Ne18_to_Mg22(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne18 + He4 --> Mg22 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 32.8865 + -46.4859 * tfactors.T913i + 0.956741 * tfactors.T913 + + -0.914402 * tfactors.T9 + 0.0722478 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -46.4859 * tfactors.T943i + (1.0/3.0) * 0.956741 * tfactors.T923i + + -0.914402 + (5.0/3.0) * 0.0722478 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Ne20_to_Mg24(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne20 + He4 --> Mg24 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -38.7055 + -2.50605 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 2.50605 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 24.5058 + -46.2525 * tfactors.T913i + 5.58901 * tfactors.T913 + + 7.61843 * tfactors.T9 + -3.683 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -46.2525 * tfactors.T943i + (1.0/3.0) * 5.58901 * tfactors.T923i + + 7.61843 + (5.0/3.0) * -3.683 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -8.79827 + -12.7809 * tfactors.T9i + 16.9229 * tfactors.T913 + + -2.57325 * tfactors.T9 + 0.208997 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 12.7809 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 16.9229 * tfactors.T923i + + -2.57325 + (5.0/3.0) * 0.208997 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 1.98307 + -9.22026 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 9.22026 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Ne21_to_Na22(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne21 + p --> Na22 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -47.6554 + -0.19618 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.19618 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 19.0696 + -19.2096 * tfactors.T913i + + -1.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -19.2096 * tfactors.T943i + + (5.0/3.0) * -1.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -39.4862 + -4.21385 * tfactors.T9i + 21.1176 * tfactors.T913i + 34.0411 * tfactors.T913 + + -4.45593 * tfactors.T9 + 0.328613 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 4.21385 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 21.1176 * tfactors.T943i + (1.0/3.0) * 34.0411 * tfactors.T923i + + -4.45593 + (5.0/3.0) * 0.328613 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 1.75704 + -1.39957 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.39957 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Na23_to_Mg24(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Na23 + p --> Mg24 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10n + ln_set_rate = 18.9075 + -20.6428 * tfactors.T913i + 1.52954 * tfactors.T913 + + 2.7487 * tfactors.T9 + -1.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -20.6428 * tfactors.T943i + (1.0/3.0) * 1.52954 * tfactors.T923i + + 2.7487 + (5.0/3.0) * -1.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 9.0594 + -3.28029 * tfactors.T9i + -0.360588 * tfactors.T913 + + 1.4187 * tfactors.T9 + -0.184061 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 3.28029 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * -0.360588 * tfactors.T923i + + 1.4187 + (5.0/3.0) * -0.184061 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -5.02585 + -1.61219 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.61219 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Mg24_to_Si28(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Mg24 + He4 --> Si28 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // st08r + ln_set_rate = -50.5494 + -12.8332 * tfactors.T9i + 21.3721 * tfactors.T913i + 37.7649 * tfactors.T913 + + -4.10635 * tfactors.T9 + 0.249618 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 12.8332 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 21.3721 * tfactors.T943i + (1.0/3.0) * 37.7649 * tfactors.T923i + + -4.10635 + (5.0/3.0) * 0.249618 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // st08r + ln_set_rate = 8.03977 + -15.629 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 15.629 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Al27_to_Si28(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Al27 + p --> Si28 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -13.6664 + -1.90396 * tfactors.T9i + 23.8634 * tfactors.T913 + + -3.70135 * tfactors.T9 + 0.28964 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.90396 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 23.8634 * tfactors.T923i + + -3.70135 + (5.0/3.0) * 0.28964 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 86.0234 + -0.387313 * tfactors.T9i + -26.8327 * tfactors.T913i + -116.137 * tfactors.T913 + + 0.00950567 * tfactors.T9 + 0.00999755 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.387313 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -26.8327 * tfactors.T943i + (1.0/3.0) * -116.137 * tfactors.T923i + + 0.00950567 + (5.0/3.0) * 0.00999755 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 21.1065 + -23.2205 * tfactors.T913i + + -2.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -23.2205 * tfactors.T943i + + (5.0/3.0) * -2.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Si28_to_S32(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Si28 + He4 --> S32 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 47.9212 + -59.4896 * tfactors.T913i + 4.47205 * tfactors.T913 + + -4.78989 * tfactors.T9 + 0.557201 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -59.4896 * tfactors.T943i + (1.0/3.0) * 4.47205 * tfactors.T923i + + -4.78989 + (5.0/3.0) * 0.557201 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_P31_to_S32(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // P31 + p --> S32 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = 0.821556 + -3.77704 * tfactors.T9i + 8.09341 * tfactors.T913 + + -0.615971 * tfactors.T9 + 0.031159 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 3.77704 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 8.09341 * tfactors.T923i + + -0.615971 + (5.0/3.0) * 0.031159 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -2.66839 + -2.25958 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 2.25958 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 19.2596 + -25.3278 * tfactors.T913i + 6.4931 * tfactors.T913 + + -9.27513 * tfactors.T9 + -0.610439 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -25.3278 * tfactors.T943i + (1.0/3.0) * 6.4931 * tfactors.T923i + + -9.27513 + (5.0/3.0) * -0.610439 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_C12_to_p_N15(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // C12 + He4 --> p + N15 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nacrn + ln_set_rate = 27.118 + -57.6279 * tfactors.T9i + -15.253 * tfactors.T913i + 1.59318 * tfactors.T913 + + 2.4479 * tfactors.T9 + -2.19708 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 57.6279 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -15.253 * tfactors.T943i + (1.0/3.0) * 1.59318 * tfactors.T923i + + 2.4479 + (5.0/3.0) * -2.19708 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrr + ln_set_rate = -6.93365 + -58.7917 * tfactors.T9i + 22.7105 * tfactors.T913 + + -2.90707 * tfactors.T9 + 0.205754 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 58.7917 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 22.7105 * tfactors.T923i + + -2.90707 + (5.0/3.0) * 0.205754 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrr + ln_set_rate = 20.5388 + -65.034 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 65.034 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrr + ln_set_rate = -5.2319 + -59.6491 * tfactors.T9i + 30.8497 * tfactors.T913 + + -8.50433 * tfactors.T9 + -1.54426 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 59.6491 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 30.8497 * tfactors.T923i + + -8.50433 + (5.0/3.0) * -1.54426 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_C12_C12_to_p_Na23(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // C12 + C12 --> p + Na23 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cf88r + ln_set_rate = 60.9649 + -84.165 * tfactors.T913i + -1.4191 * tfactors.T913 + + -0.114619 * tfactors.T9 + -0.070307 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -84.165 * tfactors.T943i + (1.0/3.0) * -1.4191 * tfactors.T923i + + -0.114619 + (5.0/3.0) * -0.070307 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_C12_C12_to_He4_Ne20(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // C12 + C12 --> He4 + Ne20 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cf88r + ln_set_rate = 61.2863 + -84.165 * tfactors.T913i + -1.56627 * tfactors.T913 + + -0.0736084 * tfactors.T9 + -0.072797 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -84.165 * tfactors.T943i + (1.0/3.0) * -1.56627 * tfactors.T923i + + -0.0736084 + (5.0/3.0) * -0.072797 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_N13_to_p_O16(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // N13 + He4 --> p + O16 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cf88n + ln_set_rate = 40.4644 + -35.829 * tfactors.T913i + -0.530275 * tfactors.T913 + + -0.982462 * tfactors.T9 + 0.0808059 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -35.829 * tfactors.T943i + (1.0/3.0) * -0.530275 * tfactors.T923i + + -0.982462 + (5.0/3.0) * 0.0808059 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_N14_to_p_O17(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // N14 + He4 --> p + O17 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -7.60954 + -14.5839 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 14.5839 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 19.1771 + -13.8305 * tfactors.T9i + -16.9078 * tfactors.T913i + + -2.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 13.8305 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -16.9078 * tfactors.T943i + + (5.0/3.0) * -2.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 9.77209 + -18.7891 * tfactors.T9i + 5.10182 * tfactors.T913 + + 0.379373 * tfactors.T9 + -0.0672515 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 18.7891 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 5.10182 * tfactors.T923i + + 0.379373 + (5.0/3.0) * -0.0672515 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 5.13169 + -15.9452 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 15.9452 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_N15_to_He4_C12(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // N15 + p --> He4 + C12 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nacrn + ln_set_rate = 27.4764 + -15.253 * tfactors.T913i + 1.59318 * tfactors.T913 + + 2.4479 * tfactors.T9 + -2.19708 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -15.253 * tfactors.T943i + (1.0/3.0) * 1.59318 * tfactors.T923i + + 2.4479 + (5.0/3.0) * -2.19708 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrr + ln_set_rate = -6.57522 + -1.1638 * tfactors.T9i + 22.7105 * tfactors.T913 + + -2.90707 * tfactors.T9 + 0.205754 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.1638 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 22.7105 * tfactors.T923i + + -2.90707 + (5.0/3.0) * 0.205754 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrr + ln_set_rate = 20.8972 + -7.406 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 7.406 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrr + ln_set_rate = -4.87347 + -2.02117 * tfactors.T9i + 30.8497 * tfactors.T913 + + -8.50433 * tfactors.T9 + -1.54426 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 2.02117 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 30.8497 * tfactors.T923i + + -8.50433 + (5.0/3.0) * -1.54426 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_N15_to_p_O18(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // N15 + He4 --> p + O18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -29.7104 + -46.4444 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 46.4444 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 25.1611 + -46.1986 * tfactors.T9i + -16.6979 * tfactors.T913i + + -3.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 46.1986 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -16.6979 * tfactors.T943i + + (5.0/3.0) * -3.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 7.13756 + -51.5219 * tfactors.T9i + 11.6568 * tfactors.T913 + + -2.16303 * tfactors.T9 + 0.209965 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 51.5219 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 11.6568 * tfactors.T923i + + -2.16303 + (5.0/3.0) * 0.209965 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 8.46654 + -47.8616 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 47.8616 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_O14_to_p_F17(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O14 + He4 --> p + F17 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // Ha96n + ln_set_rate = 40.8358 + -39.388 * tfactors.T913i + -17.4673 * tfactors.T913 + + 35.3029 * tfactors.T9 + -24.8162 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -39.388 * tfactors.T943i + (1.0/3.0) * -17.4673 * tfactors.T923i + + 35.3029 + (5.0/3.0) * -24.8162 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // Ha96r + ln_set_rate = 16.3087 + -22.51 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 22.51 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // Ha96r + ln_set_rate = 11.1184 + -13.6 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 13.6 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // Ha96r + ln_set_rate = -106.091 + -0.453036 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.453036 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // Ha96r + ln_set_rate = 12.1289 + -12.0223 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 12.0223 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // Ha96r + ln_set_rate = 18.6518 + -26.0 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 26.0 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_O15_to_p_F18(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O15 + He4 --> p + F18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = 1.04969 + -36.4627 * tfactors.T9i + 13.3223 * tfactors.T913 + + -1.36696 * tfactors.T9 + 0.0757363 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 36.4627 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 13.3223 * tfactors.T923i + + -1.36696 + (5.0/3.0) * 0.0757363 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -32.4461 + -33.8223 * tfactors.T9i + 61.738 * tfactors.T913 + + -108.29 * tfactors.T9 + -34.2365 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 33.8223 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 61.738 * tfactors.T923i + + -108.29 + (5.0/3.0) * -34.2365 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 61.2985 + -33.4459 * tfactors.T9i + -21.4023 * tfactors.T913i + -80.8891 * tfactors.T913 + + 134.6 * tfactors.T9 + -126.504 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 33.4459 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -21.4023 * tfactors.T943i + (1.0/3.0) * -80.8891 * tfactors.T923i + + 134.6 + (5.0/3.0) * -126.504 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_O16_to_He4_N13(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O16 + p --> He4 + N13 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cf88n + ln_set_rate = 42.2324 + -60.5523 * tfactors.T9i + -35.829 * tfactors.T913i + -0.530275 * tfactors.T913 + + -0.982462 * tfactors.T9 + 0.0808059 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 60.5523 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -35.829 * tfactors.T943i + (1.0/3.0) * -0.530275 * tfactors.T923i + + -0.982462 + (5.0/3.0) * 0.0808059 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_O16_to_p_F19(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O16 + He4 --> p + F19 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nacr + ln_set_rate = -53.1397 + -94.2866 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 94.2866 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacr + ln_set_rate = 25.8562 + -94.1589 * tfactors.T9i + -18.116 * tfactors.T913i + + 1.86674 * tfactors.T9 + -7.5666 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 94.1589 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -18.116 * tfactors.T943i + + 1.86674 + (5.0/3.0) * -7.5666 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrr + ln_set_rate = 13.9232 + -97.4449 * tfactors.T9i + + -0.21103 * tfactors.T9 + 2.87702 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 97.4449 * tfactors.T9i * tfactors.T9i + + -0.21103 + 2.87702 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacr + ln_set_rate = 14.7601 + -97.9108 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 97.9108 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacr + ln_set_rate = 7.80363 + -96.6272 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 96.6272 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_C12_O16_to_p_Al27(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O16 + C12 --> p + Al27 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cf88r + ln_set_rate = 68.5253 + 0.205134 * tfactors.T9i + -119.242 * tfactors.T913i + 13.3667 * tfactors.T913 + + 0.295425 * tfactors.T9 + -0.267288 * tfactors.T953 + -9.91729 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = -0.205134 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -119.242 * tfactors.T943i + (1.0/3.0) * 13.3667 * tfactors.T923i + + 0.295425 + (5.0/3.0) * -0.267288 * tfactors.T923 + -9.91729 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_C12_O16_to_He4_Mg24(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O16 + C12 --> He4 + Mg24 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cf88r + ln_set_rate = 48.5341 + 0.37204 * tfactors.T9i + -133.413 * tfactors.T913i + 50.1572 * tfactors.T913 + + -3.15987 * tfactors.T9 + 0.0178251 * tfactors.T953 + -23.7027 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = -0.37204 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -133.413 * tfactors.T943i + (1.0/3.0) * 50.1572 * tfactors.T923i + + -3.15987 + (5.0/3.0) * 0.0178251 * tfactors.T923 + -23.7027 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_O16_O16_to_p_P31(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O16 + O16 --> p + P31 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cf88r + ln_set_rate = 85.2628 + 0.223453 * tfactors.T9i + -145.844 * tfactors.T913i + 8.72612 * tfactors.T913 + + -0.554035 * tfactors.T9 + -0.137562 * tfactors.T953 + -6.88807 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = -0.223453 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -145.844 * tfactors.T943i + (1.0/3.0) * 8.72612 * tfactors.T923i + + -0.554035 + (5.0/3.0) * -0.137562 * tfactors.T923 + -6.88807 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_O16_O16_to_He4_Si28(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O16 + O16 --> He4 + Si28 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cf88r + ln_set_rate = 97.2435 + -0.268514 * tfactors.T9i + -119.324 * tfactors.T913i + -32.2497 * tfactors.T913 + + 1.46214 * tfactors.T9 + -0.200893 * tfactors.T953 + 13.2148 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.268514 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -119.324 * tfactors.T943i + (1.0/3.0) * -32.2497 * tfactors.T923i + + 1.46214 + (5.0/3.0) * -0.200893 * tfactors.T923 + 13.2148 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_O17_to_He4_N14(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O17 + p --> He4 + N14 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = 5.5336 + -2.11477 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 2.11477 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -7.20763 + -0.753395 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.753395 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 19.579 + -16.9078 * tfactors.T913i + + -2.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -16.9078 * tfactors.T943i + + (5.0/3.0) * -2.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 10.174 + -4.95865 * tfactors.T9i + 5.10182 * tfactors.T913 + + 0.379373 * tfactors.T9 + -0.0672515 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 4.95865 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 5.10182 * tfactors.T923i + + 0.379373 + (5.0/3.0) * -0.0672515 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_O18_to_He4_N15(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O18 + p --> He4 + N15 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = 10.2725 + -1.663 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.663 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -27.9044 + -0.245884 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.245884 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 26.9671 + -16.6979 * tfactors.T913i + + -3.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -16.6979 * tfactors.T943i + + (5.0/3.0) * -3.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 8.94352 + -5.32335 * tfactors.T9i + 11.6568 * tfactors.T913 + + -2.16303 * tfactors.T9 + 0.209965 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 5.32335 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 11.6568 * tfactors.T923i + + -2.16303 + (5.0/3.0) * 0.209965 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_F17_to_He4_O14(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F17 + p --> He4 + O14 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // Ha96r + ln_set_rate = 15.612 + -36.3426 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 36.3426 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // Ha96r + ln_set_rate = 10.4217 + -27.4326 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 27.4326 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // Ha96r + ln_set_rate = -106.788 + -14.2856 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 14.2856 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // Ha96r + ln_set_rate = 11.4322 + -25.8549 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 25.8549 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // Ha96r + ln_set_rate = 17.9551 + -39.8326 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 39.8326 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // Ha96n + ln_set_rate = 40.1391 + -13.8326 * tfactors.T9i + -39.388 * tfactors.T913i + -17.4673 * tfactors.T913 + + 35.3029 * tfactors.T9 + -24.8162 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 13.8326 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -39.388 * tfactors.T943i + (1.0/3.0) * -17.4673 * tfactors.T923i + + 35.3029 + (5.0/3.0) * -24.8162 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_F17_to_p_Ne20(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F17 + He4 --> p + Ne20 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nacr + ln_set_rate = 38.6287 + -43.18 * tfactors.T913i + 4.46827 * tfactors.T913 + + -1.63915 * tfactors.T9 + 0.123483 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -43.18 * tfactors.T943i + (1.0/3.0) * 4.46827 * tfactors.T923i + + -1.63915 + (5.0/3.0) * 0.123483 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_F18_to_He4_O15(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F18 + p --> He4 + O15 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10n + ln_set_rate = 62.0058 + -21.4023 * tfactors.T913i + -80.8891 * tfactors.T913 + + 134.6 * tfactors.T9 + -126.504 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -21.4023 * tfactors.T943i + (1.0/3.0) * -80.8891 * tfactors.T923i + + 134.6 + (5.0/3.0) * -126.504 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 1.75704 + -3.01675 * tfactors.T9i + 13.3223 * tfactors.T913 + + -1.36696 * tfactors.T9 + 0.0757363 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 3.01675 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 13.3223 * tfactors.T923i + + -1.36696 + (5.0/3.0) * 0.0757363 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -31.7388 + -0.376432 * tfactors.T9i + 61.738 * tfactors.T913 + + -108.29 * tfactors.T9 + -34.2365 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.376432 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 61.738 * tfactors.T923i + + -108.29 + (5.0/3.0) * -34.2365 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_F18_to_p_Ne21(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F18 + He4 --> p + Ne21 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // rpsmr + ln_set_rate = 49.7863 + -1.84559 * tfactors.T9i + 21.4461 * tfactors.T913i + -73.252 * tfactors.T913 + + 2.42329 * tfactors.T9 + -0.077278 * tfactors.T953 + 40.7604 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.84559 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 21.4461 * tfactors.T943i + (1.0/3.0) * -73.252 * tfactors.T923i + + 2.42329 + (5.0/3.0) * -0.077278 * tfactors.T923 + 40.7604 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_F19_to_He4_O16(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // F19 + p --> He4 + O16 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nacr + ln_set_rate = 8.239 + -2.46828 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 2.46828 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacr + ln_set_rate = -52.7043 + -0.12765 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.12765 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacr + ln_set_rate = 26.2916 + -18.116 * tfactors.T913i + + 1.86674 * tfactors.T9 + -7.5666 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -18.116 * tfactors.T943i + + 1.86674 + (5.0/3.0) * -7.5666 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacrr + ln_set_rate = 14.3586 + -3.286 * tfactors.T9i + + -0.21103 * tfactors.T9 + 2.87702 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 3.286 * tfactors.T9i * tfactors.T9i + + -0.21103 + 2.87702 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nacr + ln_set_rate = 15.1955 + -3.75185 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 3.75185 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Ne19_to_p_Na22(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne19 + He4 --> p + Na22 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 43.1874 + -46.6346 * tfactors.T913i + 0.866532 * tfactors.T913 + + -0.893541 * tfactors.T9 + 0.0747971 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -46.6346 * tfactors.T943i + (1.0/3.0) * 0.866532 * tfactors.T923i + + -0.893541 + (5.0/3.0) * 0.0747971 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Ne20_to_He4_F17(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne20 + p --> He4 + F17 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nacr + ln_set_rate = 41.563 + -47.9266 * tfactors.T9i + -43.18 * tfactors.T913i + 4.46827 * tfactors.T913 + + -1.63915 * tfactors.T9 + 0.123483 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 47.9266 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -43.18 * tfactors.T943i + (1.0/3.0) * 4.46827 * tfactors.T923i + + -1.63915 + (5.0/3.0) * 0.123483 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Ne20_to_p_Na23(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne20 + He4 --> p + Na23 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = 0.227472 + -29.4348 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 29.4348 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 19.1852 + -27.5738 * tfactors.T9i + -20.0024 * tfactors.T913i + 11.5988 * tfactors.T913 + + -1.37398 * tfactors.T9 + -1.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 27.5738 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -20.0024 * tfactors.T943i + (1.0/3.0) * 11.5988 * tfactors.T923i + + -1.37398 + (5.0/3.0) * -1.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -6.37772 + -29.8896 * tfactors.T9i + 19.7297 * tfactors.T913 + + -2.20987 * tfactors.T9 + 0.153374 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 29.8896 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 19.7297 * tfactors.T923i + + -2.20987 + (5.0/3.0) * 0.153374 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Ne21_to_He4_F18(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ne21 + p --> He4 + F18 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // rpsmr + ln_set_rate = 50.6536 + -22.049 * tfactors.T9i + 21.4461 * tfactors.T913i + -73.252 * tfactors.T913 + + 2.42329 * tfactors.T9 + -0.077278 * tfactors.T953 + 40.7604 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 22.049 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 21.4461 * tfactors.T943i + (1.0/3.0) * -73.252 * tfactors.T923i + + 2.42329 + (5.0/3.0) * -0.077278 * tfactors.T923 + 40.7604 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Na22_to_He4_Ne19(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Na22 + p --> He4 + Ne19 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 43.101 + -24.0192 * tfactors.T9i + -46.6346 * tfactors.T913i + 0.866532 * tfactors.T913 + + -0.893541 * tfactors.T9 + 0.0747971 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 24.0192 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -46.6346 * tfactors.T943i + (1.0/3.0) * 0.866532 * tfactors.T923i + + -0.893541 + (5.0/3.0) * 0.0747971 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Na23_to_He4_Ne20(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Na23 + p --> He4 + Ne20 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -6.58736 + -2.31577 * tfactors.T9i + 19.7297 * tfactors.T913 + + -2.20987 * tfactors.T9 + 0.153374 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 2.31577 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 19.7297 * tfactors.T923i + + -2.20987 + (5.0/3.0) * 0.153374 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 0.0178295 + -1.86103 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.86103 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 18.9756 + -20.0024 * tfactors.T913i + 11.5988 * tfactors.T913 + + -1.37398 * tfactors.T9 + -1.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -20.0024 * tfactors.T943i + (1.0/3.0) * 11.5988 * tfactors.T923i + + -1.37398 + (5.0/3.0) * -1.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Mg24_to_p_Al27(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Mg24 + He4 --> p + Al27 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10n + ln_set_rate = 30.0397 + -18.5791 * tfactors.T9i + -26.4162 * tfactors.T913i + + -2.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 18.5791 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -26.4162 * tfactors.T943i + + (5.0/3.0) * -2.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -26.2862 + -19.5422 * tfactors.T9i + 5.18642 * tfactors.T913i + -34.7936 * tfactors.T913 + + 168.225 * tfactors.T9 + -115.825 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 19.5422 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 5.18642 * tfactors.T943i + (1.0/3.0) * -34.7936 * tfactors.T923i + + 168.225 + (5.0/3.0) * -115.825 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -6.44575 + -22.8216 * tfactors.T9i + 18.0416 * tfactors.T913 + + -1.54137 * tfactors.T9 + 0.0847506 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 22.8216 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 18.0416 * tfactors.T923i + + -1.54137 + (5.0/3.0) * 0.0847506 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Al27_to_He4_Mg24(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Al27 + p --> He4 + Mg24 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -7.02789 + -4.2425 * tfactors.T9i + 18.0416 * tfactors.T913 + + -1.54137 * tfactors.T9 + 0.0847506 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 4.2425 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 18.0416 * tfactors.T923i + + -1.54137 + (5.0/3.0) * 0.0847506 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -26.8683 + -0.963012 * tfactors.T9i + 5.18642 * tfactors.T913i + -34.7936 * tfactors.T913 + + 168.225 * tfactors.T9 + -115.825 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.963012 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 5.18642 * tfactors.T943i + (1.0/3.0) * -34.7936 * tfactors.T923i + + 168.225 + (5.0/3.0) * -115.825 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 29.4576 + -26.4162 * tfactors.T913i + + -2.0 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -26.4162 * tfactors.T943i + + (5.0/3.0) * -2.0 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Si28_to_p_P31(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Si28 + He4 --> p + P31 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -11.4335 + -25.6606 * tfactors.T9i + 21.521 * tfactors.T913 + + -1.90355 * tfactors.T9 + 0.092724 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 25.6606 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 21.521 * tfactors.T923i + + -1.90355 + (5.0/3.0) * 0.092724 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 60.3424 + -22.2348 * tfactors.T9i + -31.932 * tfactors.T913i + -77.0334 * tfactors.T913 + + -43.6847 * tfactors.T9 + -4.28955 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 22.2348 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -31.932 * tfactors.T943i + (1.0/3.0) * -77.0334 * tfactors.T923i + + -43.6847 + (5.0/3.0) * -4.28955 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -13.4595 + -24.112 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 24.112 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_P31_to_He4_Si28(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // P31 + p --> He4 + Si28 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -10.893 + -3.42575 * tfactors.T9i + 21.521 * tfactors.T913 + + -1.90355 * tfactors.T9 + 0.092724 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 3.42575 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 21.521 * tfactors.T923i + + -1.90355 + (5.0/3.0) * 0.092724 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -12.919 + -1.87716 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.87716 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 60.8829 + -31.932 * tfactors.T913i + -77.0334 * tfactors.T913 + + -43.6847 * tfactors.T9 + -4.28955 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -31.932 * tfactors.T943i + (1.0/3.0) * -77.0334 * tfactors.T923i + + -43.6847 + (5.0/3.0) * -4.28955 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_He4_He4_to_C12(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // He4 + He4 + He4 --> C12 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // fy05r + ln_set_rate = -24.3505 + -4.12656 * tfactors.T9i + -13.49 * tfactors.T913i + 21.4259 * tfactors.T913 + + -1.34769 * tfactors.T9 + 0.0879816 * tfactors.T953 + -13.1653 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 4.12656 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -13.49 * tfactors.T943i + (1.0/3.0) * 21.4259 * tfactors.T923i + + -1.34769 + (5.0/3.0) * 0.0879816 * tfactors.T923 + -13.1653 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // fy05r + ln_set_rate = -11.7884 + -1.02446 * tfactors.T9i + -23.57 * tfactors.T913i + 20.4886 * tfactors.T913 + + -12.9882 * tfactors.T9 + -20.0 * tfactors.T953 + -2.16667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.02446 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -23.57 * tfactors.T943i + (1.0/3.0) * 20.4886 * tfactors.T923i + + -12.9882 + (5.0/3.0) * -20.0 * tfactors.T923 + -2.16667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // fy05n + ln_set_rate = -0.971052 + -37.06 * tfactors.T913i + 29.3493 * tfactors.T913 + + -115.507 * tfactors.T9 + -10.0 * tfactors.T953 + -1.33333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -37.06 * tfactors.T943i + (1.0/3.0) * 29.3493 * tfactors.T923i + + -115.507 + (5.0/3.0) * -10.0 * tfactors.T923 + -1.33333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_C12_C12_to_Mg24_modified(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // C12 + C12 --> Mg24 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cf88r + ln_set_rate = -12.8056 + -30.1498 * tfactors.T9i + 11.4826 * tfactors.T913 + + 1.82849 * tfactors.T9 + -0.34844 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 30.1498 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 11.4826 * tfactors.T923i + + 1.82849 + (5.0/3.0) * -0.34844 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_O16_O16_to_S32_modified(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O16 + O16 --> S32 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cf88r + ln_set_rate = 77.5491 + -0.373641 * tfactors.T9i + -120.83 * tfactors.T913i + -7.72334 * tfactors.T913 + + -2.27939 * tfactors.T9 + 0.167655 * tfactors.T953 + 7.62001 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.373641 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -120.83 * tfactors.T943i + (1.0/3.0) * -7.72334 * tfactors.T923i + + -2.27939 + (5.0/3.0) * 0.167655 * tfactors.T923 + 7.62001 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_C12_O16_to_Si28_modified(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // O16 + C12 --> Si28 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // cf88r + ln_set_rate = -132.213 + -1.46479 * tfactors.T9i + -293.089 * tfactors.T913i + 414.404 * tfactors.T913 + + -28.0562 * tfactors.T9 + 1.61807 * tfactors.T953 + -178.28 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.46479 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -293.089 * tfactors.T943i + (1.0/3.0) * 414.404 * tfactors.T923i + + -28.0562 + (5.0/3.0) * 1.61807 * tfactors.T923 + -178.28 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_S32_to_Ar36_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // S32 + He4 --> Ar36 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 48.901 + -65.3709 * tfactors.T913i + 5.68294 * tfactors.T913 + + -5.00388 * tfactors.T9 + 0.571407 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -65.3709 * tfactors.T943i + (1.0/3.0) * 5.68294 * tfactors.T923i + + -5.00388 + (5.0/3.0) * 0.571407 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_S32_to_p_Cl35_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // S32 + He4 --> p + Cl35 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = 2.42563 + -27.6662 * tfactors.T9i + 5.33756 * tfactors.T913 + + 1.64418 * tfactors.T9 + -0.246167 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 27.6662 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 5.33756 * tfactors.T923i + + 1.64418 + (5.0/3.0) * -0.246167 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -0.877602 + -25.5914 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 25.5914 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -57.395 + -22.1894 * tfactors.T9i + 25.5338 * tfactors.T913 + + 6.45824 * tfactors.T9 + -0.950294 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 22.1894 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 25.5338 * tfactors.T923i + + 6.45824 + (5.0/3.0) * -0.950294 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 32.2544 + -21.6564 * tfactors.T9i + -30.9147 * tfactors.T913i + -1.2345 * tfactors.T913 + + 22.5118 * tfactors.T9 + -33.0589 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 21.6564 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -30.9147 * tfactors.T943i + (1.0/3.0) * -1.2345 * tfactors.T923i + + 22.5118 + (5.0/3.0) * -33.0589 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Cl35_to_Ar36_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Cl35 + p --> Ar36 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = -9.03294 + -2.00996 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 2.00996 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -42.5249 + -0.564651 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.564651 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 35.6868 + -27.8971 * tfactors.T913i + -16.2304 * tfactors.T913 + + 35.255 * tfactors.T9 + -25.8411 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -27.8971 * tfactors.T943i + (1.0/3.0) * -16.2304 * tfactors.T923i + + 35.255 + (5.0/3.0) * -25.8411 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -7.84699 + -3.65092 * tfactors.T9i + 18.0179 * tfactors.T913 + + -2.86304 * tfactors.T9 + 0.250854 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 3.65092 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 18.0179 * tfactors.T923i + + -2.86304 + (5.0/3.0) * 0.250854 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ar36_to_He4_S32_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ar36 --> He4 + S32 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 73.8164 + -77.0627 * tfactors.T9i + -65.3709 * tfactors.T913i + 5.68294 * tfactors.T913 + + -5.00388 * tfactors.T9 + 0.571407 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 77.0627 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -65.3709 * tfactors.T943i + (1.0/3.0) * 5.68294 * tfactors.T923i + + -5.00388 + (5.0/3.0) * 0.571407 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ar36_to_p_Cl35_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ar36 --> p + Cl35 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10n + ln_set_rate = 60.7366 + -98.7191 * tfactors.T9i + -27.8971 * tfactors.T913i + -16.2304 * tfactors.T913 + + 35.255 * tfactors.T9 + -25.8411 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 98.7191 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -27.8971 * tfactors.T943i + (1.0/3.0) * -16.2304 * tfactors.T923i + + 35.255 + (5.0/3.0) * -25.8411 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 17.2028 + -102.37 * tfactors.T9i + 18.0179 * tfactors.T913 + + -2.86304 * tfactors.T9 + 0.250854 * tfactors.T953; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 102.37 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 18.0179 * tfactors.T923i + + -2.86304 + (5.0/3.0) * 0.250854 * tfactors.T923; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = 16.0169 + -100.729 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 100.729 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -17.4751 + -99.2838 * tfactors.T9i; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 99.2838 * tfactors.T9i * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Cl35_to_He4_S32_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Cl35 + p --> He4 + S32 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // il10r + ln_set_rate = 2.29121 + -6.00976 * tfactors.T9i + 5.33756 * tfactors.T913 + + 1.64418 * tfactors.T9 + -0.246167 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 6.00976 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 5.33756 * tfactors.T923i + + 1.64418 + (5.0/3.0) * -0.246167 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -1.01202 + -3.93495 * tfactors.T9i + + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 3.93495 * tfactors.T9i * tfactors.T9i + + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10r + ln_set_rate = -57.5294 + -0.532931 * tfactors.T9i + 25.5338 * tfactors.T913 + + 6.45824 * tfactors.T9 + -0.950294 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.532931 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 25.5338 * tfactors.T923i + + 6.45824 + (5.0/3.0) * -0.950294 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // il10n + ln_set_rate = 32.12 + -30.9147 * tfactors.T913i + -1.2345 * tfactors.T913 + + 22.5118 * tfactors.T9 + -33.0589 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -30.9147 * tfactors.T943i + (1.0/3.0) * -1.2345 * tfactors.T923i + + 22.5118 + (5.0/3.0) * -33.0589 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Ar36_to_Ca40_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ar36 + He4 --> Ca40 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 52.3486 + -71.0046 * tfactors.T913i + 4.0656 * tfactors.T913 + + -5.26509 * tfactors.T9 + 0.683546 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -71.0046 * tfactors.T943i + (1.0/3.0) * 4.0656 * tfactors.T923i + + -5.26509 + (5.0/3.0) * 0.683546 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Ar36_to_p_K39_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ar36 + He4 --> p + K39 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 20.6367 + -14.9533 * tfactors.T9i + -30.0732 * tfactors.T913i + 7.03263 * tfactors.T913 + + -1.10085 * tfactors.T9 + 0.133768 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 14.9533 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -30.0732 * tfactors.T943i + (1.0/3.0) * 7.03263 * tfactors.T923i + + -1.10085 + (5.0/3.0) * 0.133768 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_K39_to_Ca40_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // K39 + p --> Ca40 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // lo18r + ln_set_rate = 2761.38 + -5.22234 * tfactors.T9i + 802.18 * tfactors.T913i + -4010.27 * tfactors.T913 + + 1136.19 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 5.22234 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 802.18 * tfactors.T943i + (1.0/3.0) * -4010.27 * tfactors.T923i + + 1136.19 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // lo18r + ln_set_rate = 588.099 + -12.5647 * tfactors.T9i + 641.844 * tfactors.T913i + -1248.49 * tfactors.T913 + + 564.926 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 12.5647 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 641.844 * tfactors.T943i + (1.0/3.0) * -1248.49 * tfactors.T923i + + 564.926 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // lo18r + ln_set_rate = 102.252 + -1.66508 * tfactors.T9i + 41.1723 * tfactors.T913i + -149.299 * tfactors.T913 + + 10.5229 * tfactors.T9 + -0.68208 * tfactors.T953 + 59.2367 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 1.66508 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 41.1723 * tfactors.T943i + (1.0/3.0) * -149.299 * tfactors.T923i + + 10.5229 + (5.0/3.0) * -0.68208 * tfactors.T923 + 59.2367 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ca40_to_He4_Ar36_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ca40 --> He4 + Ar36 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 77.2826 + -81.6916 * tfactors.T9i + -71.0046 * tfactors.T913i + 4.0656 * tfactors.T913 + + -5.26509 * tfactors.T9 + 0.683546 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 81.6916 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -71.0046 * tfactors.T943i + (1.0/3.0) * 4.0656 * tfactors.T923i + + -5.26509 + (5.0/3.0) * 0.683546 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ca40_to_p_K39_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ca40 --> p + K39 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // lo18r + ln_set_rate = 613.153 + -109.213 * tfactors.T9i + 641.844 * tfactors.T913i + -1248.49 * tfactors.T913 + + 566.426 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 109.213 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 641.844 * tfactors.T943i + (1.0/3.0) * -1248.49 * tfactors.T923i + + 566.426 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // lo18r + ln_set_rate = 127.306 + -98.3134 * tfactors.T9i + 41.1723 * tfactors.T913i + -149.299 * tfactors.T913 + + 10.5229 * tfactors.T9 + -0.68208 * tfactors.T953 + 60.7367 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 98.3134 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 41.1723 * tfactors.T943i + (1.0/3.0) * -149.299 * tfactors.T923i + + 10.5229 + (5.0/3.0) * -0.68208 * tfactors.T923 + 60.7367 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // lo18r + ln_set_rate = 2786.44 + -101.871 * tfactors.T9i + 802.18 * tfactors.T913i + -4010.27 * tfactors.T913 + + 1137.69 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 101.871 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 802.18 * tfactors.T943i + (1.0/3.0) * -4010.27 * tfactors.T923i + + 1137.69 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_K39_to_He4_Ar36_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // K39 + p --> He4 + Ar36 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 20.5166 + -30.0732 * tfactors.T913i + 7.03263 * tfactors.T913 + + -1.10085 * tfactors.T9 + 0.133768 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -30.0732 * tfactors.T943i + (1.0/3.0) * 7.03263 * tfactors.T923i + + -1.10085 + (5.0/3.0) * 0.133768 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Ca40_to_Ti44_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ca40 + He4 --> Ti44 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // chw0 + ln_set_rate = 53.75 + -76.4273 * tfactors.T913i + 3.87451 * tfactors.T913 + + -3.61477 * tfactors.T9 + 0.367451 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -76.4273 * tfactors.T943i + (1.0/3.0) * 3.87451 * tfactors.T923i + + -3.61477 + (5.0/3.0) * 0.367451 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Ca40_to_p_Sc43_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ca40 + He4 --> p + Sc43 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 35.6575 + -40.8757 * tfactors.T9i + -32.1734 * tfactors.T913i + 0.0296879 * tfactors.T913 + + -0.95232 * tfactors.T9 + 0.129022 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 40.8757 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -32.1734 * tfactors.T943i + (1.0/3.0) * 0.0296879 * tfactors.T923i + + -0.95232 + (5.0/3.0) * 0.129022 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Sc43_to_Ti44_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Sc43 + p --> Ti44 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 36.8432 + -32.1734 * tfactors.T913i + -1.77078 * tfactors.T913 + + -2.21706 * tfactors.T9 + 0.298499 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -32.1734 * tfactors.T943i + (1.0/3.0) * -1.77078 * tfactors.T923i + + -2.21706 + (5.0/3.0) * 0.298499 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ti44_to_He4_Ca40_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ti44 --> He4 + Ca40 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // chw0 + ln_set_rate = 78.6991 + -59.4974 * tfactors.T9i + -76.4273 * tfactors.T913i + 3.87451 * tfactors.T913 + + -3.61477 * tfactors.T9 + 0.367451 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 59.4974 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -76.4273 * tfactors.T943i + (1.0/3.0) * 3.87451 * tfactors.T923i + + -3.61477 + (5.0/3.0) * 0.367451 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ti44_to_p_Sc43_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ti44 --> p + Sc43 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 62.5939 + -100.373 * tfactors.T9i + -32.1734 * tfactors.T913i + -1.77078 * tfactors.T913 + + -2.21706 * tfactors.T9 + 0.298499 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 100.373 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -32.1734 * tfactors.T943i + (1.0/3.0) * -1.77078 * tfactors.T923i + + -2.21706 + (5.0/3.0) * 0.298499 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Sc43_to_He4_Ca40_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Sc43 + p --> He4 + Ca40 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 34.8559 + -32.1734 * tfactors.T913i + 0.0296879 * tfactors.T913 + + -0.95232 * tfactors.T9 + 0.129022 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -32.1734 * tfactors.T943i + (1.0/3.0) * 0.0296879 * tfactors.T923i + + -0.95232 + (5.0/3.0) * 0.129022 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Ti44_to_Cr48_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ti44 + He4 --> Cr48 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 64.7958 + -81.667 * tfactors.T913i + -10.6333 * tfactors.T913 + + -0.672613 * tfactors.T9 + 0.161209 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -81.667 * tfactors.T943i + (1.0/3.0) * -10.6333 * tfactors.T923i + + -0.672613 + (5.0/3.0) * 0.161209 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Ti44_to_p_V47_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ti44 + He4 --> p + V47 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // chw0r + ln_set_rate = -76.5154 + -10.7931 * tfactors.T9i + 70.2835 * tfactors.T913 + + -7.99061 * tfactors.T9 + 0.486213 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 10.7931 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 70.2835 * tfactors.T923i + + -7.99061 + (5.0/3.0) * 0.486213 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_V47_to_Cr48_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // V47 + p --> Cr48 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nfisn + ln_set_rate = 42.6798 + -6.0593 * tfactors.T9i + -34.0548 * tfactors.T913i + -3.41973 * tfactors.T913 + + 1.16501 * tfactors.T9 + -0.105543 * tfactors.T953 + -7.70886 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 6.0593 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -34.0548 * tfactors.T943i + (1.0/3.0) * -3.41973 * tfactors.T923i + + 1.16501 + (5.0/3.0) * -0.105543 * tfactors.T923 + -7.70886 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nfisn + ln_set_rate = 511.463 + -5.29491 * tfactors.T9i + 317.171 * tfactors.T913i + -911.679 * tfactors.T913 + + 94.4245 * tfactors.T9 + -10.1973 * tfactors.T953 + 330.727 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 5.29491 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 317.171 * tfactors.T943i + (1.0/3.0) * -911.679 * tfactors.T923i + + 94.4245 + (5.0/3.0) * -10.1973 * tfactors.T923 + 330.727 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nfisn + ln_set_rate = 23.8315 + 0.246665 * tfactors.T9i + -45.9868 * tfactors.T913i + 13.6822 * tfactors.T913 + + -0.376902 * tfactors.T9 + -0.0194875 * tfactors.T953 + -8.42325 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = -0.246665 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -45.9868 * tfactors.T943i + (1.0/3.0) * 13.6822 * tfactors.T923i + + -0.376902 + (5.0/3.0) * -0.0194875 * tfactors.T923 + -8.42325 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nfisn + ln_set_rate = 40.5626 + -0.514414 * tfactors.T9i + -110.655 * tfactors.T913i + 83.0232 * tfactors.T913 + + -19.7762 * tfactors.T9 + 3.03961 * tfactors.T953 + -49.4742 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 0.514414 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -110.655 * tfactors.T943i + (1.0/3.0) * 83.0232 * tfactors.T923i + + -19.7762 + (5.0/3.0) * 3.03961 * tfactors.T923 + -49.4742 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Cr48_to_He4_Ti44_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Cr48 --> He4 + Ti44 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 89.7573 + -89.3041 * tfactors.T9i + -81.667 * tfactors.T913i + -10.6333 * tfactors.T913 + + -0.672613 * tfactors.T9 + 0.161209 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 89.3041 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -81.667 * tfactors.T943i + (1.0/3.0) * -10.6333 * tfactors.T923i + + -0.672613 + (5.0/3.0) * 0.161209 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Cr48_to_p_V47_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Cr48 --> p + V47 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // nfisn + ln_set_rate = 65.6231 + -94.5854 * tfactors.T9i + -110.655 * tfactors.T913i + 83.0232 * tfactors.T913 + + -19.7762 * tfactors.T9 + 3.03961 * tfactors.T953 + -47.9742 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 94.5854 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -110.655 * tfactors.T943i + (1.0/3.0) * 83.0232 * tfactors.T923i + + -19.7762 + (5.0/3.0) * 3.03961 * tfactors.T923 + -47.9742 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nfisn + ln_set_rate = 67.7403 + -100.13 * tfactors.T9i + -34.0548 * tfactors.T913i + -3.41973 * tfactors.T913 + + 1.16501 * tfactors.T9 + -0.105543 * tfactors.T953 + -6.20886 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 100.13 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -34.0548 * tfactors.T943i + (1.0/3.0) * -3.41973 * tfactors.T923i + + 1.16501 + (5.0/3.0) * -0.105543 * tfactors.T923 + -6.20886 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nfisn + ln_set_rate = 536.523 + -99.3659 * tfactors.T9i + 317.171 * tfactors.T913i + -911.679 * tfactors.T913 + + 94.4245 * tfactors.T9 + -10.1973 * tfactors.T953 + 332.227 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 99.3659 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * 317.171 * tfactors.T943i + (1.0/3.0) * -911.679 * tfactors.T923i + + 94.4245 + (5.0/3.0) * -10.1973 * tfactors.T923 + 332.227 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + + // nfisn + ln_set_rate = 48.892 + -93.8243 * tfactors.T9i + -45.9868 * tfactors.T913i + 13.6822 * tfactors.T913 + + -0.376902 * tfactors.T9 + -0.0194875 * tfactors.T953 + -6.92325 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 93.8243 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -45.9868 * tfactors.T943i + (1.0/3.0) * 13.6822 * tfactors.T923i + + -0.376902 + (5.0/3.0) * -0.0194875 * tfactors.T923 + -6.92325 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_V47_to_He4_Ti44_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // V47 + p --> He4 + Ti44 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // chw0r + ln_set_rate = -76.6143 + -6.02945 * tfactors.T9i + 70.2835 * tfactors.T913 + + -7.99061 * tfactors.T9 + 0.486213 * tfactors.T953 + -1.5 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 6.02945 * tfactors.T9i * tfactors.T9i + (1.0/3.0) * 70.2835 * tfactors.T923i + + -7.99061 + (5.0/3.0) * 0.486213 * tfactors.T923 + -1.5 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Cr48_to_Fe52_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Cr48 + He4 --> Fe52 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 65.1754 + -86.7459 * tfactors.T913i + -9.79373 * tfactors.T913 + + -0.772169 * tfactors.T9 + 0.155883 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -86.7459 * tfactors.T943i + (1.0/3.0) * -9.79373 * tfactors.T923i + + -0.772169 + (5.0/3.0) * 0.155883 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Cr48_to_p_Mn51_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Cr48 + He4 --> p + Mn51 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 59.2276 + -86.7459 * tfactors.T913i + 1.05653 * tfactors.T913 + + -1.15757 * tfactors.T9 + 0.0877546 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -86.7459 * tfactors.T943i + (1.0/3.0) * 1.05653 * tfactors.T923i + + -1.15757 + (5.0/3.0) * 0.0877546 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Mn51_to_Fe52_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Mn51 + p --> Fe52 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 36.2596 + -36.1825 * tfactors.T913i + 0.873042 * tfactors.T913 + + -2.89731 * tfactors.T9 + 0.364394 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -36.1825 * tfactors.T943i + (1.0/3.0) * 0.873042 * tfactors.T923i + + -2.89731 + (5.0/3.0) * 0.364394 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Fe52_to_He4_Cr48_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Fe52 --> He4 + Cr48 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 90.1474 + -92.109 * tfactors.T9i + -86.7459 * tfactors.T913i + -9.79373 * tfactors.T913 + + -0.772169 * tfactors.T9 + 0.155883 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 92.109 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -86.7459 * tfactors.T943i + (1.0/3.0) * -9.79373 * tfactors.T923i + + -0.772169 + (5.0/3.0) * 0.155883 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Fe52_to_p_Mn51_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Fe52 --> p + Mn51 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 61.728 + -85.6325 * tfactors.T9i + -36.1825 * tfactors.T913i + 0.873042 * tfactors.T913 + + -2.89731 * tfactors.T9 + 0.364394 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 85.6325 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -36.1825 * tfactors.T943i + (1.0/3.0) * 0.873042 * tfactors.T923i + + -2.89731 + (5.0/3.0) * 0.364394 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Mn51_to_He4_Cr48_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Mn51 + p --> He4 + Cr48 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 58.7312 + -6.47654 * tfactors.T9i + -86.7459 * tfactors.T913i + 1.05653 * tfactors.T913 + + -1.15757 * tfactors.T9 + 0.0877546 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 6.47654 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -86.7459 * tfactors.T943i + (1.0/3.0) * 1.05653 * tfactors.T923i + + -1.15757 + (5.0/3.0) * 0.0877546 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Fe52_to_Ni56_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Fe52 + He4 --> Ni56 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 66.6417 + -91.6819 * tfactors.T913i + -9.51885 * tfactors.T913 + + -0.533014 * tfactors.T9 + 0.0892607 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -91.6819 * tfactors.T943i + (1.0/3.0) * -9.51885 * tfactors.T923i + + -0.533014 + (5.0/3.0) * 0.0892607 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_He4_Fe52_to_p_Co55_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Fe52 + He4 --> p + Co55 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 62.2207 + -91.6819 * tfactors.T913i + -0.329235 * tfactors.T913 + + -0.780924 * tfactors.T9 + 0.0425179 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -91.6819 * tfactors.T943i + (1.0/3.0) * -0.329235 * tfactors.T923i + + -0.780924 + (5.0/3.0) * 0.0425179 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Co55_to_Ni56_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Co55 + p --> Ni56 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 37.3736 + -38.1053 * tfactors.T913i + -0.210947 * tfactors.T913 + + -2.68377 * tfactors.T9 + 0.355814 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = + -(1.0/3.0) * -38.1053 * tfactors.T943i + (1.0/3.0) * -0.210947 * tfactors.T923i + + -2.68377 + (5.0/3.0) * 0.355814 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ni56_to_He4_Fe52_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ni56 --> He4 + Fe52 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 91.6226 + -92.801 * tfactors.T9i + -91.6819 * tfactors.T913i + -9.51885 * tfactors.T913 + + -0.533014 * tfactors.T9 + 0.0892607 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 92.801 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -91.6819 * tfactors.T943i + (1.0/3.0) * -9.51885 * tfactors.T923i + + -0.533014 + (5.0/3.0) * 0.0892607 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ni56_to_p_Co55_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Ni56 --> p + Co55 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 63.1318 + -83.1473 * tfactors.T9i + -38.1053 * tfactors.T913i + -0.210947 * tfactors.T913 + + -2.68377 * tfactors.T9 + 0.355814 * tfactors.T953 + 0.833333 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 83.1473 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -38.1053 * tfactors.T943i + (1.0/3.0) * -0.210947 * tfactors.T923i + + -2.68377 + (5.0/3.0) * 0.355814 * tfactors.T923 + 0.833333 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_p_Co55_to_He4_Fe52_removed(const tf_t& tfactors, amrex::Real& rate, amrex::Real& drate_dT) { + + // Co55 + p --> He4 + Fe52 + + rate = 0.0; + drate_dT = 0.0; + + amrex::Real ln_set_rate{0.0}; + amrex::Real dln_set_rate_dT9{0.0}; + amrex::Real set_rate{0.0}; + + // ths8r + ln_set_rate = 61.4434 + -9.65363 * tfactors.T9i + -91.6819 * tfactors.T913i + -0.329235 * tfactors.T913 + + -0.780924 * tfactors.T9 + 0.0425179 * tfactors.T953 + -0.666667 * tfactors.lnT9; + + if constexpr (do_T_derivatives) { + dln_set_rate_dT9 = 9.65363 * tfactors.T9i * tfactors.T9i + -(1.0/3.0) * -91.6819 * tfactors.T943i + (1.0/3.0) * -0.329235 * tfactors.T923i + + -0.780924 + (5.0/3.0) * 0.0425179 * tfactors.T923 + -0.666667 * tfactors.T9i; + } + + // avoid underflows by zeroing rates in [0.0, 1.e-100] + ln_set_rate = std::max(ln_set_rate, -230.0); + set_rate = std::exp(ln_set_rate); + rate += set_rate; + if constexpr (do_T_derivatives) { + drate_dT += set_rate * dln_set_rate_dT9 / 1.0e9; + } + +} + + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_S32_He4_to_Ar36_approx(const T& rate_eval, amrex::Real& rate, amrex::Real& drate_dT) { + + amrex::Real r_ag = rate_eval.screened_rates(k_He4_S32_to_Ar36_removed); + amrex::Real r_ap = rate_eval.screened_rates(k_He4_S32_to_p_Cl35_removed); + amrex::Real r_pg = rate_eval.screened_rates(k_p_Cl35_to_Ar36_removed); + amrex::Real r_pa = rate_eval.screened_rates(k_p_Cl35_to_He4_S32_removed); + amrex::Real dd = 1.0_rt / (r_pg + r_pa); + rate = r_ag + r_ap * r_pg * dd; + if constexpr (std::is_same_v) { + amrex::Real drdT_ag = rate_eval.dscreened_rates_dT(k_He4_S32_to_Ar36_removed); + amrex::Real drdT_ap = rate_eval.dscreened_rates_dT(k_He4_S32_to_p_Cl35_removed); + amrex::Real drdT_pg = rate_eval.dscreened_rates_dT(k_p_Cl35_to_Ar36_removed); + amrex::Real drdT_pa = rate_eval.dscreened_rates_dT(k_p_Cl35_to_He4_S32_removed); + drate_dT = drdT_ag + drdT_ap * r_pg * dd + r_ap * drdT_pg * dd - r_ap * r_pg * dd * dd * (drdT_pg + drdT_pa); + } +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ar36_to_S32_He4_approx(const T& rate_eval, amrex::Real& rate, amrex::Real& drate_dT) { + + amrex::Real r_ga = rate_eval.screened_rates(k_Ar36_to_He4_S32_removed); + amrex::Real r_pa = rate_eval.screened_rates(k_p_Cl35_to_He4_S32_removed); + amrex::Real r_gp = rate_eval.screened_rates(k_Ar36_to_p_Cl35_removed); + amrex::Real r_pg = rate_eval.screened_rates(k_p_Cl35_to_Ar36_removed); + amrex::Real dd = 1.0_rt / (r_pg + r_pa); + rate = r_ga + r_gp * r_pa * dd; + if constexpr (std::is_same_v) { + amrex::Real drdT_ga = rate_eval.dscreened_rates_dT(k_Ar36_to_He4_S32_removed); + amrex::Real drdT_pa = rate_eval.dscreened_rates_dT(k_p_Cl35_to_He4_S32_removed); + amrex::Real drdT_gp = rate_eval.dscreened_rates_dT(k_Ar36_to_p_Cl35_removed); + amrex::Real drdT_pg = rate_eval.dscreened_rates_dT(k_p_Cl35_to_Ar36_removed); + drate_dT = drdT_ga + drdT_gp * r_pa * dd + r_gp * drdT_pa * dd - r_gp * r_pa * dd * dd * (drdT_pg + drdT_pa); + } +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ar36_He4_to_Ca40_approx(const T& rate_eval, amrex::Real& rate, amrex::Real& drate_dT) { + + amrex::Real r_ag = rate_eval.screened_rates(k_He4_Ar36_to_Ca40_removed); + amrex::Real r_ap = rate_eval.screened_rates(k_He4_Ar36_to_p_K39_removed); + amrex::Real r_pg = rate_eval.screened_rates(k_p_K39_to_Ca40_removed); + amrex::Real r_pa = rate_eval.screened_rates(k_p_K39_to_He4_Ar36_removed); + amrex::Real dd = 1.0_rt / (r_pg + r_pa); + rate = r_ag + r_ap * r_pg * dd; + if constexpr (std::is_same_v) { + amrex::Real drdT_ag = rate_eval.dscreened_rates_dT(k_He4_Ar36_to_Ca40_removed); + amrex::Real drdT_ap = rate_eval.dscreened_rates_dT(k_He4_Ar36_to_p_K39_removed); + amrex::Real drdT_pg = rate_eval.dscreened_rates_dT(k_p_K39_to_Ca40_removed); + amrex::Real drdT_pa = rate_eval.dscreened_rates_dT(k_p_K39_to_He4_Ar36_removed); + drate_dT = drdT_ag + drdT_ap * r_pg * dd + r_ap * drdT_pg * dd - r_ap * r_pg * dd * dd * (drdT_pg + drdT_pa); + } +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ca40_to_Ar36_He4_approx(const T& rate_eval, amrex::Real& rate, amrex::Real& drate_dT) { + + amrex::Real r_ga = rate_eval.screened_rates(k_Ca40_to_He4_Ar36_removed); + amrex::Real r_pa = rate_eval.screened_rates(k_p_K39_to_He4_Ar36_removed); + amrex::Real r_gp = rate_eval.screened_rates(k_Ca40_to_p_K39_removed); + amrex::Real r_pg = rate_eval.screened_rates(k_p_K39_to_Ca40_removed); + amrex::Real dd = 1.0_rt / (r_pg + r_pa); + rate = r_ga + r_gp * r_pa * dd; + if constexpr (std::is_same_v) { + amrex::Real drdT_ga = rate_eval.dscreened_rates_dT(k_Ca40_to_He4_Ar36_removed); + amrex::Real drdT_pa = rate_eval.dscreened_rates_dT(k_p_K39_to_He4_Ar36_removed); + amrex::Real drdT_gp = rate_eval.dscreened_rates_dT(k_Ca40_to_p_K39_removed); + amrex::Real drdT_pg = rate_eval.dscreened_rates_dT(k_p_K39_to_Ca40_removed); + drate_dT = drdT_ga + drdT_gp * r_pa * dd + r_gp * drdT_pa * dd - r_gp * r_pa * dd * dd * (drdT_pg + drdT_pa); + } +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ca40_He4_to_Ti44_approx(const T& rate_eval, amrex::Real& rate, amrex::Real& drate_dT) { + + amrex::Real r_ag = rate_eval.screened_rates(k_He4_Ca40_to_Ti44_removed); + amrex::Real r_ap = rate_eval.screened_rates(k_He4_Ca40_to_p_Sc43_removed); + amrex::Real r_pg = rate_eval.screened_rates(k_p_Sc43_to_Ti44_removed); + amrex::Real r_pa = rate_eval.screened_rates(k_p_Sc43_to_He4_Ca40_removed); + amrex::Real dd = 1.0_rt / (r_pg + r_pa); + rate = r_ag + r_ap * r_pg * dd; + if constexpr (std::is_same_v) { + amrex::Real drdT_ag = rate_eval.dscreened_rates_dT(k_He4_Ca40_to_Ti44_removed); + amrex::Real drdT_ap = rate_eval.dscreened_rates_dT(k_He4_Ca40_to_p_Sc43_removed); + amrex::Real drdT_pg = rate_eval.dscreened_rates_dT(k_p_Sc43_to_Ti44_removed); + amrex::Real drdT_pa = rate_eval.dscreened_rates_dT(k_p_Sc43_to_He4_Ca40_removed); + drate_dT = drdT_ag + drdT_ap * r_pg * dd + r_ap * drdT_pg * dd - r_ap * r_pg * dd * dd * (drdT_pg + drdT_pa); + } +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ti44_to_Ca40_He4_approx(const T& rate_eval, amrex::Real& rate, amrex::Real& drate_dT) { + + amrex::Real r_ga = rate_eval.screened_rates(k_Ti44_to_He4_Ca40_removed); + amrex::Real r_pa = rate_eval.screened_rates(k_p_Sc43_to_He4_Ca40_removed); + amrex::Real r_gp = rate_eval.screened_rates(k_Ti44_to_p_Sc43_removed); + amrex::Real r_pg = rate_eval.screened_rates(k_p_Sc43_to_Ti44_removed); + amrex::Real dd = 1.0_rt / (r_pg + r_pa); + rate = r_ga + r_gp * r_pa * dd; + if constexpr (std::is_same_v) { + amrex::Real drdT_ga = rate_eval.dscreened_rates_dT(k_Ti44_to_He4_Ca40_removed); + amrex::Real drdT_pa = rate_eval.dscreened_rates_dT(k_p_Sc43_to_He4_Ca40_removed); + amrex::Real drdT_gp = rate_eval.dscreened_rates_dT(k_Ti44_to_p_Sc43_removed); + amrex::Real drdT_pg = rate_eval.dscreened_rates_dT(k_p_Sc43_to_Ti44_removed); + drate_dT = drdT_ga + drdT_gp * r_pa * dd + r_gp * drdT_pa * dd - r_gp * r_pa * dd * dd * (drdT_pg + drdT_pa); + } +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ti44_He4_to_Cr48_approx(const T& rate_eval, amrex::Real& rate, amrex::Real& drate_dT) { + + amrex::Real r_ag = rate_eval.screened_rates(k_He4_Ti44_to_Cr48_removed); + amrex::Real r_ap = rate_eval.screened_rates(k_He4_Ti44_to_p_V47_removed); + amrex::Real r_pg = rate_eval.screened_rates(k_p_V47_to_Cr48_removed); + amrex::Real r_pa = rate_eval.screened_rates(k_p_V47_to_He4_Ti44_removed); + amrex::Real dd = 1.0_rt / (r_pg + r_pa); + rate = r_ag + r_ap * r_pg * dd; + if constexpr (std::is_same_v) { + amrex::Real drdT_ag = rate_eval.dscreened_rates_dT(k_He4_Ti44_to_Cr48_removed); + amrex::Real drdT_ap = rate_eval.dscreened_rates_dT(k_He4_Ti44_to_p_V47_removed); + amrex::Real drdT_pg = rate_eval.dscreened_rates_dT(k_p_V47_to_Cr48_removed); + amrex::Real drdT_pa = rate_eval.dscreened_rates_dT(k_p_V47_to_He4_Ti44_removed); + drate_dT = drdT_ag + drdT_ap * r_pg * dd + r_ap * drdT_pg * dd - r_ap * r_pg * dd * dd * (drdT_pg + drdT_pa); + } +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Cr48_to_Ti44_He4_approx(const T& rate_eval, amrex::Real& rate, amrex::Real& drate_dT) { + + amrex::Real r_ga = rate_eval.screened_rates(k_Cr48_to_He4_Ti44_removed); + amrex::Real r_pa = rate_eval.screened_rates(k_p_V47_to_He4_Ti44_removed); + amrex::Real r_gp = rate_eval.screened_rates(k_Cr48_to_p_V47_removed); + amrex::Real r_pg = rate_eval.screened_rates(k_p_V47_to_Cr48_removed); + amrex::Real dd = 1.0_rt / (r_pg + r_pa); + rate = r_ga + r_gp * r_pa * dd; + if constexpr (std::is_same_v) { + amrex::Real drdT_ga = rate_eval.dscreened_rates_dT(k_Cr48_to_He4_Ti44_removed); + amrex::Real drdT_pa = rate_eval.dscreened_rates_dT(k_p_V47_to_He4_Ti44_removed); + amrex::Real drdT_gp = rate_eval.dscreened_rates_dT(k_Cr48_to_p_V47_removed); + amrex::Real drdT_pg = rate_eval.dscreened_rates_dT(k_p_V47_to_Cr48_removed); + drate_dT = drdT_ga + drdT_gp * r_pa * dd + r_gp * drdT_pa * dd - r_gp * r_pa * dd * dd * (drdT_pg + drdT_pa); + } +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Cr48_He4_to_Fe52_approx(const T& rate_eval, amrex::Real& rate, amrex::Real& drate_dT) { + + amrex::Real r_ag = rate_eval.screened_rates(k_He4_Cr48_to_Fe52_removed); + amrex::Real r_ap = rate_eval.screened_rates(k_He4_Cr48_to_p_Mn51_removed); + amrex::Real r_pg = rate_eval.screened_rates(k_p_Mn51_to_Fe52_removed); + amrex::Real r_pa = rate_eval.screened_rates(k_p_Mn51_to_He4_Cr48_removed); + amrex::Real dd = 1.0_rt / (r_pg + r_pa); + rate = r_ag + r_ap * r_pg * dd; + if constexpr (std::is_same_v) { + amrex::Real drdT_ag = rate_eval.dscreened_rates_dT(k_He4_Cr48_to_Fe52_removed); + amrex::Real drdT_ap = rate_eval.dscreened_rates_dT(k_He4_Cr48_to_p_Mn51_removed); + amrex::Real drdT_pg = rate_eval.dscreened_rates_dT(k_p_Mn51_to_Fe52_removed); + amrex::Real drdT_pa = rate_eval.dscreened_rates_dT(k_p_Mn51_to_He4_Cr48_removed); + drate_dT = drdT_ag + drdT_ap * r_pg * dd + r_ap * drdT_pg * dd - r_ap * r_pg * dd * dd * (drdT_pg + drdT_pa); + } +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Fe52_to_Cr48_He4_approx(const T& rate_eval, amrex::Real& rate, amrex::Real& drate_dT) { + + amrex::Real r_ga = rate_eval.screened_rates(k_Fe52_to_He4_Cr48_removed); + amrex::Real r_pa = rate_eval.screened_rates(k_p_Mn51_to_He4_Cr48_removed); + amrex::Real r_gp = rate_eval.screened_rates(k_Fe52_to_p_Mn51_removed); + amrex::Real r_pg = rate_eval.screened_rates(k_p_Mn51_to_Fe52_removed); + amrex::Real dd = 1.0_rt / (r_pg + r_pa); + rate = r_ga + r_gp * r_pa * dd; + if constexpr (std::is_same_v) { + amrex::Real drdT_ga = rate_eval.dscreened_rates_dT(k_Fe52_to_He4_Cr48_removed); + amrex::Real drdT_pa = rate_eval.dscreened_rates_dT(k_p_Mn51_to_He4_Cr48_removed); + amrex::Real drdT_gp = rate_eval.dscreened_rates_dT(k_Fe52_to_p_Mn51_removed); + amrex::Real drdT_pg = rate_eval.dscreened_rates_dT(k_p_Mn51_to_Fe52_removed); + drate_dT = drdT_ga + drdT_gp * r_pa * dd + r_gp * drdT_pa * dd - r_gp * r_pa * dd * dd * (drdT_pg + drdT_pa); + } +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Fe52_He4_to_Ni56_approx(const T& rate_eval, amrex::Real& rate, amrex::Real& drate_dT) { + + amrex::Real r_ag = rate_eval.screened_rates(k_He4_Fe52_to_Ni56_removed); + amrex::Real r_ap = rate_eval.screened_rates(k_He4_Fe52_to_p_Co55_removed); + amrex::Real r_pg = rate_eval.screened_rates(k_p_Co55_to_Ni56_removed); + amrex::Real r_pa = rate_eval.screened_rates(k_p_Co55_to_He4_Fe52_removed); + amrex::Real dd = 1.0_rt / (r_pg + r_pa); + rate = r_ag + r_ap * r_pg * dd; + if constexpr (std::is_same_v) { + amrex::Real drdT_ag = rate_eval.dscreened_rates_dT(k_He4_Fe52_to_Ni56_removed); + amrex::Real drdT_ap = rate_eval.dscreened_rates_dT(k_He4_Fe52_to_p_Co55_removed); + amrex::Real drdT_pg = rate_eval.dscreened_rates_dT(k_p_Co55_to_Ni56_removed); + amrex::Real drdT_pa = rate_eval.dscreened_rates_dT(k_p_Co55_to_He4_Fe52_removed); + drate_dT = drdT_ag + drdT_ap * r_pg * dd + r_ap * drdT_pg * dd - r_ap * r_pg * dd * dd * (drdT_pg + drdT_pa); + } +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void rate_Ni56_to_Fe52_He4_approx(const T& rate_eval, amrex::Real& rate, amrex::Real& drate_dT) { + + amrex::Real r_ga = rate_eval.screened_rates(k_Ni56_to_He4_Fe52_removed); + amrex::Real r_pa = rate_eval.screened_rates(k_p_Co55_to_He4_Fe52_removed); + amrex::Real r_gp = rate_eval.screened_rates(k_Ni56_to_p_Co55_removed); + amrex::Real r_pg = rate_eval.screened_rates(k_p_Co55_to_Ni56_removed); + amrex::Real dd = 1.0_rt / (r_pg + r_pa); + rate = r_ga + r_gp * r_pa * dd; + if constexpr (std::is_same_v) { + amrex::Real drdT_ga = rate_eval.dscreened_rates_dT(k_Ni56_to_He4_Fe52_removed); + amrex::Real drdT_pa = rate_eval.dscreened_rates_dT(k_p_Co55_to_He4_Fe52_removed); + amrex::Real drdT_gp = rate_eval.dscreened_rates_dT(k_Ni56_to_p_Co55_removed); + amrex::Real drdT_pg = rate_eval.dscreened_rates_dT(k_p_Co55_to_Ni56_removed); + drate_dT = drdT_ga + drdT_gp * r_pa * dd + r_gp * drdT_pa * dd - r_gp * r_pa * dd * dd * (drdT_pg + drdT_pa); + } +} + + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void +fill_reaclib_rates(const tf_t& tfactors, T& rate_eval) +{ + + amrex::Real rate; + amrex::Real drate_dT; + + rate_N13_to_C13_weak_wc12(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_N13_to_C13_weak_wc12) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_N13_to_C13_weak_wc12) = drate_dT; + + } + rate_O14_to_N14_weak_wc12(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_O14_to_N14_weak_wc12) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_O14_to_N14_weak_wc12) = drate_dT; + + } + rate_O15_to_N15_weak_wc12(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_O15_to_N15_weak_wc12) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_O15_to_N15_weak_wc12) = drate_dT; + + } + rate_F17_to_O17_weak_wc12(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_F17_to_O17_weak_wc12) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_F17_to_O17_weak_wc12) = drate_dT; + + } + rate_F18_to_O18_weak_wc12(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_F18_to_O18_weak_wc12) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_F18_to_O18_weak_wc12) = drate_dT; + + } + rate_Ne18_to_F18_weak_wc12(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ne18_to_F18_weak_wc12) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ne18_to_F18_weak_wc12) = drate_dT; + + } + rate_Ne19_to_F19_weak_wc12(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ne19_to_F19_weak_wc12) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ne19_to_F19_weak_wc12) = drate_dT; + + } + rate_Mg22_to_Na22_weak_wc12(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Mg22_to_Na22_weak_wc12) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Mg22_to_Na22_weak_wc12) = drate_dT; + + } + rate_N13_to_p_C12(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_N13_to_p_C12) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_N13_to_p_C12) = drate_dT; + + } + rate_N14_to_p_C13(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_N14_to_p_C13) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_N14_to_p_C13) = drate_dT; + + } + rate_O14_to_p_N13(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_O14_to_p_N13) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_O14_to_p_N13) = drate_dT; + + } + rate_O15_to_p_N14(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_O15_to_p_N14) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_O15_to_p_N14) = drate_dT; + + } + rate_O16_to_p_N15(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_O16_to_p_N15) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_O16_to_p_N15) = drate_dT; + + } + rate_O16_to_He4_C12(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_O16_to_He4_C12) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_O16_to_He4_C12) = drate_dT; + + } + rate_F17_to_p_O16(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_F17_to_p_O16) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_F17_to_p_O16) = drate_dT; + + } + rate_F18_to_p_O17(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_F18_to_p_O17) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_F18_to_p_O17) = drate_dT; + + } + rate_F18_to_He4_N14(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_F18_to_He4_N14) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_F18_to_He4_N14) = drate_dT; + + } + rate_F19_to_p_O18(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_F19_to_p_O18) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_F19_to_p_O18) = drate_dT; + + } + rate_F19_to_He4_N15(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_F19_to_He4_N15) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_F19_to_He4_N15) = drate_dT; + + } + rate_Ne18_to_p_F17(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ne18_to_p_F17) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ne18_to_p_F17) = drate_dT; + + } + rate_Ne18_to_He4_O14(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ne18_to_He4_O14) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ne18_to_He4_O14) = drate_dT; + + } + rate_Ne19_to_p_F18(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ne19_to_p_F18) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ne19_to_p_F18) = drate_dT; + + } + rate_Ne19_to_He4_O15(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ne19_to_He4_O15) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ne19_to_He4_O15) = drate_dT; + + } + rate_Ne20_to_p_F19(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ne20_to_p_F19) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ne20_to_p_F19) = drate_dT; + + } + rate_Ne20_to_He4_O16(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ne20_to_He4_O16) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ne20_to_He4_O16) = drate_dT; + + } + rate_Ne21_to_He4_O17(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ne21_to_He4_O17) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ne21_to_He4_O17) = drate_dT; + + } + rate_Na22_to_p_Ne21(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Na22_to_p_Ne21) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Na22_to_p_Ne21) = drate_dT; + + } + rate_Na22_to_He4_F18(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Na22_to_He4_F18) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Na22_to_He4_F18) = drate_dT; + + } + rate_Na23_to_He4_F19(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Na23_to_He4_F19) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Na23_to_He4_F19) = drate_dT; + + } + rate_Mg22_to_He4_Ne18(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Mg22_to_He4_Ne18) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Mg22_to_He4_Ne18) = drate_dT; + + } + rate_Mg24_to_p_Na23(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Mg24_to_p_Na23) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Mg24_to_p_Na23) = drate_dT; + + } + rate_Mg24_to_He4_Ne20(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Mg24_to_He4_Ne20) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Mg24_to_He4_Ne20) = drate_dT; + + } + rate_Si28_to_p_Al27(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Si28_to_p_Al27) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Si28_to_p_Al27) = drate_dT; + + } + rate_Si28_to_He4_Mg24(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Si28_to_He4_Mg24) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Si28_to_He4_Mg24) = drate_dT; + + } + rate_S32_to_p_P31(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_S32_to_p_P31) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_S32_to_p_P31) = drate_dT; + + } + rate_S32_to_He4_Si28(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_S32_to_He4_Si28) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_S32_to_He4_Si28) = drate_dT; + + } + rate_C12_to_He4_He4_He4(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_C12_to_He4_He4_He4) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_C12_to_He4_He4_He4) = drate_dT; + + } + rate_p_C12_to_N13(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_C12_to_N13) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_C12_to_N13) = drate_dT; + + } + rate_He4_C12_to_O16(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_C12_to_O16) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_C12_to_O16) = drate_dT; + + } + rate_p_C13_to_N14(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_C13_to_N14) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_C13_to_N14) = drate_dT; + + } + rate_p_N13_to_O14(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_N13_to_O14) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_N13_to_O14) = drate_dT; + + } + rate_p_N14_to_O15(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_N14_to_O15) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_N14_to_O15) = drate_dT; + + } + rate_He4_N14_to_F18(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_N14_to_F18) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_N14_to_F18) = drate_dT; + + } + rate_p_N15_to_O16(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_N15_to_O16) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_N15_to_O16) = drate_dT; + + } + rate_He4_N15_to_F19(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_N15_to_F19) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_N15_to_F19) = drate_dT; + + } + rate_He4_O14_to_Ne18(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_O14_to_Ne18) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_O14_to_Ne18) = drate_dT; + + } + rate_He4_O15_to_Ne19(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_O15_to_Ne19) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_O15_to_Ne19) = drate_dT; + + } + rate_p_O16_to_F17(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_O16_to_F17) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_O16_to_F17) = drate_dT; + + } + rate_He4_O16_to_Ne20(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_O16_to_Ne20) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_O16_to_Ne20) = drate_dT; + + } + rate_p_O17_to_F18(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_O17_to_F18) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_O17_to_F18) = drate_dT; + + } + rate_He4_O17_to_Ne21(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_O17_to_Ne21) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_O17_to_Ne21) = drate_dT; + + } + rate_p_O18_to_F19(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_O18_to_F19) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_O18_to_F19) = drate_dT; + + } + rate_p_F17_to_Ne18(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_F17_to_Ne18) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_F17_to_Ne18) = drate_dT; + + } + rate_p_F18_to_Ne19(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_F18_to_Ne19) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_F18_to_Ne19) = drate_dT; + + } + rate_He4_F18_to_Na22(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_F18_to_Na22) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_F18_to_Na22) = drate_dT; + + } + rate_p_F19_to_Ne20(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_F19_to_Ne20) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_F19_to_Ne20) = drate_dT; + + } + rate_He4_F19_to_Na23(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_F19_to_Na23) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_F19_to_Na23) = drate_dT; + + } + rate_He4_Ne18_to_Mg22(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Ne18_to_Mg22) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Ne18_to_Mg22) = drate_dT; + + } + rate_He4_Ne20_to_Mg24(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Ne20_to_Mg24) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Ne20_to_Mg24) = drate_dT; + + } + rate_p_Ne21_to_Na22(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Ne21_to_Na22) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Ne21_to_Na22) = drate_dT; + + } + rate_p_Na23_to_Mg24(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Na23_to_Mg24) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Na23_to_Mg24) = drate_dT; + + } + rate_He4_Mg24_to_Si28(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Mg24_to_Si28) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Mg24_to_Si28) = drate_dT; + + } + rate_p_Al27_to_Si28(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Al27_to_Si28) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Al27_to_Si28) = drate_dT; + + } + rate_He4_Si28_to_S32(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Si28_to_S32) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Si28_to_S32) = drate_dT; + + } + rate_p_P31_to_S32(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_P31_to_S32) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_P31_to_S32) = drate_dT; + + } + rate_He4_C12_to_p_N15(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_C12_to_p_N15) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_C12_to_p_N15) = drate_dT; + + } + rate_C12_C12_to_p_Na23(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_C12_C12_to_p_Na23) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_C12_C12_to_p_Na23) = drate_dT; + + } + rate_C12_C12_to_He4_Ne20(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_C12_C12_to_He4_Ne20) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_C12_C12_to_He4_Ne20) = drate_dT; + + } + rate_He4_N13_to_p_O16(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_N13_to_p_O16) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_N13_to_p_O16) = drate_dT; + + } + rate_He4_N14_to_p_O17(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_N14_to_p_O17) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_N14_to_p_O17) = drate_dT; + + } + rate_p_N15_to_He4_C12(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_N15_to_He4_C12) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_N15_to_He4_C12) = drate_dT; + + } + rate_He4_N15_to_p_O18(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_N15_to_p_O18) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_N15_to_p_O18) = drate_dT; + + } + rate_He4_O14_to_p_F17(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_O14_to_p_F17) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_O14_to_p_F17) = drate_dT; + + } + rate_He4_O15_to_p_F18(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_O15_to_p_F18) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_O15_to_p_F18) = drate_dT; + + } + rate_p_O16_to_He4_N13(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_O16_to_He4_N13) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_O16_to_He4_N13) = drate_dT; + + } + rate_He4_O16_to_p_F19(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_O16_to_p_F19) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_O16_to_p_F19) = drate_dT; + + } + rate_C12_O16_to_p_Al27(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_C12_O16_to_p_Al27) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_C12_O16_to_p_Al27) = drate_dT; + + } + rate_C12_O16_to_He4_Mg24(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_C12_O16_to_He4_Mg24) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_C12_O16_to_He4_Mg24) = drate_dT; + + } + rate_O16_O16_to_p_P31(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_O16_O16_to_p_P31) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_O16_O16_to_p_P31) = drate_dT; + + } + rate_O16_O16_to_He4_Si28(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_O16_O16_to_He4_Si28) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_O16_O16_to_He4_Si28) = drate_dT; + + } + rate_p_O17_to_He4_N14(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_O17_to_He4_N14) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_O17_to_He4_N14) = drate_dT; + + } + rate_p_O18_to_He4_N15(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_O18_to_He4_N15) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_O18_to_He4_N15) = drate_dT; + + } + rate_p_F17_to_He4_O14(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_F17_to_He4_O14) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_F17_to_He4_O14) = drate_dT; + + } + rate_He4_F17_to_p_Ne20(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_F17_to_p_Ne20) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_F17_to_p_Ne20) = drate_dT; + + } + rate_p_F18_to_He4_O15(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_F18_to_He4_O15) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_F18_to_He4_O15) = drate_dT; + + } + rate_He4_F18_to_p_Ne21(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_F18_to_p_Ne21) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_F18_to_p_Ne21) = drate_dT; + + } + rate_p_F19_to_He4_O16(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_F19_to_He4_O16) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_F19_to_He4_O16) = drate_dT; + + } + rate_He4_Ne19_to_p_Na22(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Ne19_to_p_Na22) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Ne19_to_p_Na22) = drate_dT; + + } + rate_p_Ne20_to_He4_F17(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Ne20_to_He4_F17) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Ne20_to_He4_F17) = drate_dT; + + } + rate_He4_Ne20_to_p_Na23(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Ne20_to_p_Na23) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Ne20_to_p_Na23) = drate_dT; + + } + rate_p_Ne21_to_He4_F18(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Ne21_to_He4_F18) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Ne21_to_He4_F18) = drate_dT; + + } + rate_p_Na22_to_He4_Ne19(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Na22_to_He4_Ne19) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Na22_to_He4_Ne19) = drate_dT; + + } + rate_p_Na23_to_He4_Ne20(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Na23_to_He4_Ne20) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Na23_to_He4_Ne20) = drate_dT; + + } + rate_He4_Mg24_to_p_Al27(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Mg24_to_p_Al27) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Mg24_to_p_Al27) = drate_dT; + + } + rate_p_Al27_to_He4_Mg24(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Al27_to_He4_Mg24) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Al27_to_He4_Mg24) = drate_dT; + + } + rate_He4_Si28_to_p_P31(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Si28_to_p_P31) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Si28_to_p_P31) = drate_dT; + + } + rate_p_P31_to_He4_Si28(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_P31_to_He4_Si28) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_P31_to_He4_Si28) = drate_dT; + + } + rate_He4_He4_He4_to_C12(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_He4_He4_to_C12) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_He4_He4_to_C12) = drate_dT; + + } + rate_C12_C12_to_Mg24_modified(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_C12_C12_to_Mg24_modified) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_C12_C12_to_Mg24_modified) = drate_dT; + + } + rate_O16_O16_to_S32_modified(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_O16_O16_to_S32_modified) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_O16_O16_to_S32_modified) = drate_dT; + + } + rate_C12_O16_to_Si28_modified(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_C12_O16_to_Si28_modified) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_C12_O16_to_Si28_modified) = drate_dT; + + } + rate_He4_S32_to_Ar36_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_S32_to_Ar36_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_S32_to_Ar36_removed) = drate_dT; + + } + rate_He4_S32_to_p_Cl35_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_S32_to_p_Cl35_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_S32_to_p_Cl35_removed) = drate_dT; + + } + rate_p_Cl35_to_Ar36_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Cl35_to_Ar36_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Cl35_to_Ar36_removed) = drate_dT; + + } + rate_Ar36_to_He4_S32_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ar36_to_He4_S32_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ar36_to_He4_S32_removed) = drate_dT; + + } + rate_Ar36_to_p_Cl35_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ar36_to_p_Cl35_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ar36_to_p_Cl35_removed) = drate_dT; + + } + rate_p_Cl35_to_He4_S32_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Cl35_to_He4_S32_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Cl35_to_He4_S32_removed) = drate_dT; + + } + rate_He4_Ar36_to_Ca40_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Ar36_to_Ca40_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Ar36_to_Ca40_removed) = drate_dT; + + } + rate_He4_Ar36_to_p_K39_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Ar36_to_p_K39_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Ar36_to_p_K39_removed) = drate_dT; + + } + rate_p_K39_to_Ca40_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_K39_to_Ca40_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_K39_to_Ca40_removed) = drate_dT; + + } + rate_Ca40_to_He4_Ar36_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ca40_to_He4_Ar36_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ca40_to_He4_Ar36_removed) = drate_dT; + + } + rate_Ca40_to_p_K39_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ca40_to_p_K39_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ca40_to_p_K39_removed) = drate_dT; + + } + rate_p_K39_to_He4_Ar36_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_K39_to_He4_Ar36_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_K39_to_He4_Ar36_removed) = drate_dT; + + } + rate_He4_Ca40_to_Ti44_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Ca40_to_Ti44_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Ca40_to_Ti44_removed) = drate_dT; + + } + rate_He4_Ca40_to_p_Sc43_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Ca40_to_p_Sc43_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Ca40_to_p_Sc43_removed) = drate_dT; + + } + rate_p_Sc43_to_Ti44_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Sc43_to_Ti44_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Sc43_to_Ti44_removed) = drate_dT; + + } + rate_Ti44_to_He4_Ca40_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ti44_to_He4_Ca40_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ti44_to_He4_Ca40_removed) = drate_dT; + + } + rate_Ti44_to_p_Sc43_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ti44_to_p_Sc43_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ti44_to_p_Sc43_removed) = drate_dT; + + } + rate_p_Sc43_to_He4_Ca40_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Sc43_to_He4_Ca40_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Sc43_to_He4_Ca40_removed) = drate_dT; + + } + rate_He4_Ti44_to_Cr48_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Ti44_to_Cr48_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Ti44_to_Cr48_removed) = drate_dT; + + } + rate_He4_Ti44_to_p_V47_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Ti44_to_p_V47_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Ti44_to_p_V47_removed) = drate_dT; + + } + rate_p_V47_to_Cr48_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_V47_to_Cr48_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_V47_to_Cr48_removed) = drate_dT; + + } + rate_Cr48_to_He4_Ti44_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Cr48_to_He4_Ti44_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Cr48_to_He4_Ti44_removed) = drate_dT; + + } + rate_Cr48_to_p_V47_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Cr48_to_p_V47_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Cr48_to_p_V47_removed) = drate_dT; + + } + rate_p_V47_to_He4_Ti44_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_V47_to_He4_Ti44_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_V47_to_He4_Ti44_removed) = drate_dT; + + } + rate_He4_Cr48_to_Fe52_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Cr48_to_Fe52_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Cr48_to_Fe52_removed) = drate_dT; + + } + rate_He4_Cr48_to_p_Mn51_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Cr48_to_p_Mn51_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Cr48_to_p_Mn51_removed) = drate_dT; + + } + rate_p_Mn51_to_Fe52_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Mn51_to_Fe52_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Mn51_to_Fe52_removed) = drate_dT; + + } + rate_Fe52_to_He4_Cr48_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Fe52_to_He4_Cr48_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Fe52_to_He4_Cr48_removed) = drate_dT; + + } + rate_Fe52_to_p_Mn51_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Fe52_to_p_Mn51_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Fe52_to_p_Mn51_removed) = drate_dT; + + } + rate_p_Mn51_to_He4_Cr48_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Mn51_to_He4_Cr48_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Mn51_to_He4_Cr48_removed) = drate_dT; + + } + rate_He4_Fe52_to_Ni56_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Fe52_to_Ni56_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Fe52_to_Ni56_removed) = drate_dT; + + } + rate_He4_Fe52_to_p_Co55_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_He4_Fe52_to_p_Co55_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_He4_Fe52_to_p_Co55_removed) = drate_dT; + + } + rate_p_Co55_to_Ni56_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Co55_to_Ni56_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Co55_to_Ni56_removed) = drate_dT; + + } + rate_Ni56_to_He4_Fe52_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ni56_to_He4_Fe52_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ni56_to_He4_Fe52_removed) = drate_dT; + + } + rate_Ni56_to_p_Co55_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_Ni56_to_p_Co55_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ni56_to_p_Co55_removed) = drate_dT; + + } + rate_p_Co55_to_He4_Fe52_removed(tfactors, rate, drate_dT); + rate_eval.screened_rates(k_p_Co55_to_He4_Fe52_removed) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_p_Co55_to_He4_Fe52_removed) = drate_dT; + + } + +} + +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +void +fill_approx_rates([[maybe_unused]] const tf_t& tfactors, [[maybe_unused]] T& rate_eval) +{ + + [[maybe_unused]] amrex::Real rate{}; + [[maybe_unused]] amrex::Real drate_dT{}; + + rate_S32_He4_to_Ar36_approx(rate_eval, rate, drate_dT); + rate_eval.screened_rates(k_S32_He4_to_Ar36_approx) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_S32_He4_to_Ar36_approx) = drate_dT; + + } + rate_Ar36_to_S32_He4_approx(rate_eval, rate, drate_dT); + rate_eval.screened_rates(k_Ar36_to_S32_He4_approx) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ar36_to_S32_He4_approx) = drate_dT; + + } + rate_Ar36_He4_to_Ca40_approx(rate_eval, rate, drate_dT); + rate_eval.screened_rates(k_Ar36_He4_to_Ca40_approx) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ar36_He4_to_Ca40_approx) = drate_dT; + + } + rate_Ca40_to_Ar36_He4_approx(rate_eval, rate, drate_dT); + rate_eval.screened_rates(k_Ca40_to_Ar36_He4_approx) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ca40_to_Ar36_He4_approx) = drate_dT; + + } + rate_Ca40_He4_to_Ti44_approx(rate_eval, rate, drate_dT); + rate_eval.screened_rates(k_Ca40_He4_to_Ti44_approx) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ca40_He4_to_Ti44_approx) = drate_dT; + + } + rate_Ti44_to_Ca40_He4_approx(rate_eval, rate, drate_dT); + rate_eval.screened_rates(k_Ti44_to_Ca40_He4_approx) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ti44_to_Ca40_He4_approx) = drate_dT; + + } + rate_Ti44_He4_to_Cr48_approx(rate_eval, rate, drate_dT); + rate_eval.screened_rates(k_Ti44_He4_to_Cr48_approx) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ti44_He4_to_Cr48_approx) = drate_dT; + + } + rate_Cr48_to_Ti44_He4_approx(rate_eval, rate, drate_dT); + rate_eval.screened_rates(k_Cr48_to_Ti44_He4_approx) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Cr48_to_Ti44_He4_approx) = drate_dT; + + } + rate_Cr48_He4_to_Fe52_approx(rate_eval, rate, drate_dT); + rate_eval.screened_rates(k_Cr48_He4_to_Fe52_approx) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Cr48_He4_to_Fe52_approx) = drate_dT; + + } + rate_Fe52_to_Cr48_He4_approx(rate_eval, rate, drate_dT); + rate_eval.screened_rates(k_Fe52_to_Cr48_He4_approx) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Fe52_to_Cr48_He4_approx) = drate_dT; + + } + rate_Fe52_He4_to_Ni56_approx(rate_eval, rate, drate_dT); + rate_eval.screened_rates(k_Fe52_He4_to_Ni56_approx) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Fe52_He4_to_Ni56_approx) = drate_dT; + + } + rate_Ni56_to_Fe52_He4_approx(rate_eval, rate, drate_dT); + rate_eval.screened_rates(k_Ni56_to_Fe52_He4_approx) = rate; + if constexpr (std::is_same_v) { + rate_eval.dscreened_rates_dT(k_Ni56_to_Fe52_He4_approx) = drate_dT; + + } + +} + +#endif diff --git a/networks/CNO_He_burn/table_rates.H b/networks/CNO_He_burn/table_rates.H new file mode 100644 index 0000000000..a2c5b79b54 --- /dev/null +++ b/networks/CNO_He_burn/table_rates.H @@ -0,0 +1,399 @@ +#ifndef TABLE_RATES_H +#define TABLE_RATES_H + +#include +#include +#include +#include + +#include + +using namespace amrex; + +void init_tabular(); + +// Table is expected to be in terms of dens*ye and temp (logarithmic, cgs units) +// Table energy units are expected in terms of ergs + +// all tables are expected to have columns: +// Log(rhoY) Log(T) mu dQ Vs Log(e-cap-rate) Log(nu-energy-loss) Log(gamma-energy) +// Log(g/cm^3) Log(K) erg erg erg Log(1/s) Log(erg/s) Log(erg/s) +// + +const int num_tables = 0; + +enum TableVars +{ + jtab_mu = 1, + jtab_dq = 2, + jtab_vs = 3, + jtab_rate = 4, + jtab_nuloss = 5, + jtab_gamma = 6, + num_vars = jtab_gamma +}; + + +struct table_t +{ + int ntemp; + int nrhoy; + int nvars; + int nheader; +}; + +// we add a 7th index, k_index_dlogr_dlogt used for computing the derivative +// of Log(rate) with respect of Log(temperature) by using the table +// values. It isn't an index into the table but into the 'entries' +// array. Is important to mention that although we compute dlogr/dlogT is +// the computed quantity in 'entries', we pursue ultimately +// dr/dt as the final desired quantity to be computed for this index. + +const int k_index_dlogr_dlogt = 7; +const int add_vars = 1; // 1 Additional Var in entries + + +namespace rate_tables +{ +} + +template +void init_tab_info(const table_t& tf, const std::string& file, R& log_rhoy_table, T& log_temp_table, D& data) +{ + // This function initializes the selected tabular-rate tables. From the tables we are interested + // on the rate, neutrino-energy-loss and the gamma-energy entries. + + std::ifstream table; + table.open(file); + + if (!table.is_open()) { + // the table was not present or we could not open it; abort + amrex::Error("table could not be opened"); + } + + std::string line; + + // read and skip over the header + + for (int i = 0; i < tf.nheader; ++i) { + std::getline(table, line); + } + + // now the data -- there are 2 extra columns, for log_temp and log_rhoy + + for (int j = 1; j <= tf.nrhoy; ++j) { + for (int i = 1; i <= tf.ntemp; ++i) { + std::getline(table, line); + if (line.empty()) { + amrex::Error("Error reading table data"); + } + + std::istringstream sdata(line); + + sdata >> log_rhoy_table(j) >> log_temp_table(i); + + for (int n = 1; n <= tf.nvars; ++n) { + sdata >> data(i, j, n); + } + } + } + table.close(); +} + + +template +AMREX_INLINE AMREX_GPU_HOST_DEVICE +int vector_index_lu(const int vlen, const V& vector, const amrex::Real fvar) +{ + + // Returns the greatest index of vector for which vector(index) < fvar. + // Return 1 if fvar < vector(1) + // Return size(vector)-1 if fvar > vector(size(vector)) + // The interval [index, index+1] brackets fvar for fvar within the range of vector. + + int index; + + if (fvar < vector(1)) { + index = 1; + } else if (fvar > vector(vlen)) { + index = vlen - 1; + } else { + int nup = vlen; + int ndn = 1; + for (int i = 1; i <= vlen; ++i) { + int j = ndn + (nup - ndn)/2; + if (fvar < vector(j)) { + nup = j; + } else { + ndn = j; + } + if ((nup - ndn) == 1) { + break; + } + } + index = ndn; + } + return index; +} + + +AMREX_INLINE AMREX_GPU_HOST_DEVICE +amrex::Real +evaluate_linear_1d(const amrex::Real fhi, const amrex::Real flo, const amrex::Real xhi, const amrex::Real xlo, const amrex::Real x) +{ + // This function is a 1-D linear interpolator, that keeps x constant to xlo or xhi, based + // on the side, if x is outside [xlo, xhi] respectively. + + amrex::Real xx = Clamp(x, xlo, xhi); + amrex::Real f = flo + (fhi - flo) * (xx - xlo) / (xhi - xlo); + + return f; +} + +AMREX_INLINE AMREX_GPU_HOST_DEVICE +amrex::Real +evaluate_linear_2d(const amrex::Real fip1jp1, const amrex::Real fip1j, const amrex::Real fijp1, const amrex::Real fij, + const amrex::Real xhi, const amrex::Real xlo, const amrex::Real yhi, const amrex::Real ylo, + const amrex::Real x, const amrex::Real y) +{ + // This is the 2-D linear interpolator, as an extension of evaluate_linear_1d. + + amrex::Real f; + amrex::Real dx = xhi - xlo; + amrex::Real dy = yhi - ylo; + + amrex::Real E = fij; + amrex::Real C = (fijp1 - fij) / dy; + amrex::Real B = (fip1j - fij) / dx; + amrex::Real A = (fip1jp1 - B * dx - C * dy - E) / (dx * dy); + + amrex::Real xx = Clamp(x, xlo, xhi); + amrex::Real yy = Clamp(y, ylo, yhi); + + f = A * (xx - xlo) * (yy - ylo) + + B * (xx - xlo) + + C * (yy - ylo) + + E; + + return f; +} + + +template +AMREX_INLINE AMREX_GPU_HOST_DEVICE +amrex::Real +evaluate_vars(const table_t& table_meta, const R& log_rhoy_table, const T& log_temp_table, const D& data, + const amrex::Real log_rhoy, const amrex::Real log_temp, const int component) +{ + // This function evaluates the 2-D interpolator, for several pairs of rho_ye and temperature. + + int jtemp_lo = vector_index_lu(table_meta.ntemp, log_temp_table, log_temp); + int jtemp_hi = jtemp_lo + 1; + + int irhoy_lo = vector_index_lu(table_meta.nrhoy, log_rhoy_table, log_rhoy); + int irhoy_hi = irhoy_lo + 1; + + amrex::Real rhoy_lo = log_rhoy_table(irhoy_lo); + amrex::Real rhoy_hi = log_rhoy_table(irhoy_hi); + + amrex::Real t_lo = log_temp_table(jtemp_lo); + amrex::Real t_hi = log_temp_table(jtemp_hi); + + amrex::Real fij = data(jtemp_lo, irhoy_lo, component); + amrex::Real fip1j = data(jtemp_lo, irhoy_hi, component); + amrex::Real fijp1 = data(jtemp_hi, irhoy_lo, component); + amrex::Real fip1jp1 = data(jtemp_hi, irhoy_hi, component); + + amrex::Real r = evaluate_linear_2d(fip1jp1, fip1j, fijp1, fij, + rhoy_hi, rhoy_lo, t_hi, t_lo, log_rhoy, log_temp); + + return r; +} + + +template +AMREX_INLINE AMREX_GPU_HOST_DEVICE +amrex::Real +evaluate_dr_dtemp(const table_t& table_meta, const R& log_rhoy_table, const T& log_temp_table, const D& data, + const amrex::Real log_rhoy, const amrex::Real log_temp) +{ + // The main objective of this function is compute dlogr_dlogt. + + int irhoy_lo = vector_index_lu(table_meta.nrhoy, log_rhoy_table, log_rhoy); + int irhoy_hi = irhoy_lo + 1; + + int jtemp_lo = vector_index_lu(table_meta.ntemp, log_temp_table, log_temp); + int jtemp_hi = jtemp_lo + 1; + + amrex::Real dlogr_dlogt; + + //Now we compute the forward finite difference on the boundary + + if ((jtemp_lo - 1 < 1) || (jtemp_hi + 1 > table_meta.ntemp)) { + + // In this case we are in the boundaries of the table. + // At the boundary, we compute the forward-j finite difference + // to compute dlogr_dlogt_i and dlogr_dlogt_ip1, using the + // following stencil: + // + // + // fijp1-----------fip1jp1 + // | | + // | | + // | | + // | | + // | | + // | | + // | | + // fij-------------fip1j + // + // with the following result: + // + // dlogr_dlogt_i --------dlogr_dlogt_ip1 + // + // Finally, we perform a 1d-linear interpolation between dlogr_dlogt_ip1 + // and dlogr_dlogt_i to compute dlogr_dlogt + + amrex::Real log_rhoy_lo = log_rhoy_table(irhoy_lo); + amrex::Real log_rhoy_hi = log_rhoy_table(irhoy_hi); + + amrex::Real log_temp_lo = log_temp_table(jtemp_lo); + amrex::Real log_temp_hi = log_temp_table(jtemp_hi); + + amrex::Real fij = data(jtemp_lo, irhoy_lo, jtab_rate); + amrex::Real fip1j = data(jtemp_lo, irhoy_hi, jtab_rate); + amrex::Real fijp1 = data(jtemp_hi, irhoy_lo, jtab_rate); + amrex::Real fip1jp1 = data(jtemp_hi, irhoy_hi, jtab_rate); + + amrex::Real dlogr_dlogt_i = (fijp1 - fij) / (log_temp_hi - log_temp_lo); + amrex::Real dlogr_dlogt_ip1 = (fip1jp1 - fip1j) / (log_temp_hi - log_temp_lo); + + if ((log_temp < log_temp_lo) || (log_temp > log_temp_hi)) { + dlogr_dlogt = 0.0_rt; + } else { + dlogr_dlogt = evaluate_linear_1d(dlogr_dlogt_ip1, dlogr_dlogt_i, log_rhoy_hi, log_rhoy_lo, log_rhoy); + } + + } else { + + // In this case, we use a bigger stencil to reconstruct the + // temperature derivatives in the j and j+1 temperature positions, + // using the cetral-j finite differences: + // + // fijp2 ------------fip1jp2 + // | | + // | | + // | | + // | | + // | | + // | | + // | | + // fijp1------------fip1jp1 + // | | + // | | + // | | + // | | + // | | + // | | + // | | + // fij------------- fip1j + // | | + // | | + // | | + // | | + // | | + // | | + // | | + // fijm1------------fip1jm1 + // + // with the following result: + // + // + // dr_dt_ijp1 --------dr_dt_ip1jp1 + // | | + // | | + // | | + // | | + // | | + // | | + // | | + // dr_dt_ij-----------dr_dt_ip1j + // + // Finally, we perform a 2d-linear interpolation to + // compute dlogr_dlogt. + + amrex::Real log_temp_jm1 = log_temp_table(jtemp_lo-1); + amrex::Real log_temp_j = log_temp_table(jtemp_lo); + amrex::Real log_temp_jp1 = log_temp_table(jtemp_hi); + amrex::Real log_temp_jp2 = log_temp_table(jtemp_hi+1); + + amrex::Real log_rhoy_lo = log_rhoy_table(irhoy_lo); + amrex::Real log_rhoy_hi = log_rhoy_table(irhoy_hi); + + amrex::Real fijm1 = data(jtemp_lo-1, irhoy_lo, jtab_rate); + amrex::Real fij = data(jtemp_lo, irhoy_lo, jtab_rate); + amrex::Real fijp1 = data(jtemp_hi, irhoy_lo, jtab_rate); + amrex::Real fijp2 = data(jtemp_hi+1, irhoy_lo, jtab_rate); + + amrex::Real fip1jm1 = data(jtemp_lo-1, irhoy_hi, jtab_rate); + amrex::Real fip1j = data(jtemp_lo, irhoy_hi, jtab_rate); + amrex::Real fip1jp1 = data(jtemp_hi, irhoy_hi, jtab_rate); + amrex::Real fip1jp2 = data(jtemp_hi+1, irhoy_hi, jtab_rate); + + amrex::Real dlogr_dlogt_ij = (fijp1 - fijm1)/(log_temp_jp1 - log_temp_jm1); + amrex::Real dlogr_dlogt_ijp1 = (fijp2 - fij)/(log_temp_jp2 - log_temp_j); + amrex::Real dlogr_dlogt_ip1j = (fip1jp1 - fip1jm1)/(log_temp_jp1 - log_temp_jm1); + amrex::Real dlogr_dlogt_ip1jp1 = (fip1jp2 - fip1j)/(log_temp_jp2 - log_temp_j); + + dlogr_dlogt = evaluate_linear_2d(dlogr_dlogt_ip1jp1, dlogr_dlogt_ip1j, dlogr_dlogt_ijp1, dlogr_dlogt_ij, + log_rhoy_hi, log_rhoy_lo, log_temp_jp1, log_temp_j, + log_rhoy, log_temp); + + } + return dlogr_dlogt; +} + + +template +AMREX_INLINE AMREX_GPU_HOST_DEVICE +void +get_entries(const table_t& table_meta, const R& log_rhoy_table, const T& log_temp_table, const D& data, + const amrex::Real log_rhoy, const amrex::Real log_temp, amrex::Array1D& entries) +{ + for (int ivar = 1; ivar <= num_vars; ivar++) { + entries(ivar) = evaluate_vars(table_meta, log_rhoy_table, log_temp_table, data, + log_rhoy, log_temp, ivar); + } + + entries(k_index_dlogr_dlogt) = evaluate_dr_dtemp(table_meta, log_rhoy_table, log_temp_table, data, + log_rhoy, log_temp); +} + +template +AMREX_INLINE AMREX_GPU_HOST_DEVICE +void +tabular_evaluate(const table_t& table_meta, + const R& log_rhoy_table, const T& log_temp_table, const D& data, + const amrex::Real rhoy, const amrex::Real temp, + amrex::Real& rate, amrex::Real& drate_dt, amrex::Real& edot_nu, amrex::Real& edot_gamma) +{ + amrex::Array1D entries; + + // Get the table entries at this rhoy, temp + + amrex::Real log_rhoy = std::log10(rhoy); + amrex::Real log_temp = std::log10(temp); + + get_entries(table_meta, log_rhoy_table, log_temp_table, data, + log_rhoy, log_temp, entries); + + // Fill outputs: rate, d(rate)/d(temperature), and + // (negative) neutrino loss contribution to energy generation + + rate = std::pow(10.0_rt, entries(jtab_rate)); + drate_dt = rate * entries(k_index_dlogr_dlogt) / temp; + edot_nu = -std::pow(10.0_rt, entries(jtab_nuloss)); + edot_gamma = std::pow(10.0_rt, entries(jtab_gamma)); +} + +#endif diff --git a/networks/CNO_He_burn/table_rates_data.cpp b/networks/CNO_He_burn/table_rates_data.cpp new file mode 100644 index 0000000000..63b38aff19 --- /dev/null +++ b/networks/CNO_He_burn/table_rates_data.cpp @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +using namespace amrex; + +namespace rate_tables +{ + + +} + + +void init_tabular() +{ + + amrex::Print() << "reading in network electron-capture / beta-decay tables..." << std::endl; + + using namespace rate_tables; + + +} diff --git a/networks/CNO_He_burn/tfactors.H b/networks/CNO_He_burn/tfactors.H new file mode 100644 index 0000000000..3ec02d562f --- /dev/null +++ b/networks/CNO_He_burn/tfactors.H @@ -0,0 +1,34 @@ +#ifndef TFACTORS_H +#define TFACTORS_H + +struct tf_t { + amrex::Real T9; + amrex::Real T9i; + amrex::Real T943i; + amrex::Real T923i; + amrex::Real T913i; + amrex::Real T913; + amrex::Real T923; + amrex::Real T953; + amrex::Real lnT9; +}; + +AMREX_GPU_HOST_DEVICE AMREX_INLINE +tf_t evaluate_tfactors(const amrex::Real T) +{ + + tf_t tf; + tf.T9 = T / 1.e9_rt; + tf.T9i = 1.0_rt / tf.T9; + tf.T913 = std::cbrt(tf.T9); + tf.T913i = 1.0_rt / tf.T913; + tf.T923i = tf.T913i * tf.T913i; + tf.T943i = tf.T9i * tf.T913i; + tf.T923 = tf.T913 * tf.T913; + tf.T953 = tf.T9 * tf.T923; + tf.lnT9 = std::log(tf.T9); + + return tf; +} + +#endif diff --git a/networks/ECSN/ecsn_network_generation.py b/networks/ECSN/ecsn_network_generation.py index c9f7fd97df..2a1a7e766b 100644 --- a/networks/ECSN/ecsn_network_generation.py +++ b/networks/ECSN/ecsn_network_generation.py @@ -29,10 +29,16 @@ # Only select the rates which are >= 1.e-20 at 1.e9 K and 7.e9 g/cm3 # Do not select weak rates from "20180319default2" new_rate_list = [] -ydots = rc.evaluate_rates(rho=7.e9, T=1.e9, composition=comp) +rho = 7.e9 +T = 1.e9 +ydots = rc.evaluate_rates(rho=rho, T=T, composition=comp) for rate in rc.rates: if ydots[rate] >= 1.e-20 and rate.weak == False: new_rate_list.append(rate) wd_net = AmrexAstroCxxNetwork(rates=new_rate_list, rate_files=escn_tabular) wd_net.write_network() + +wd_net.plot(rho, T, comp, outfile="ECSN.png", + hide_xalpha=True, curved_edges=True, + node_size=500, node_font_size=11, node_color="#337dff", node_shape="s") diff --git a/sphinx_docs/source/CNO_He_burn.png b/sphinx_docs/source/CNO_He_burn.png new file mode 100644 index 0000000000..24c454e17c Binary files /dev/null and b/sphinx_docs/source/CNO_He_burn.png differ diff --git a/sphinx_docs/source/ECSN.png b/sphinx_docs/source/ECSN.png new file mode 100644 index 0000000000..094b13c063 Binary files /dev/null and b/sphinx_docs/source/ECSN.png differ diff --git a/sphinx_docs/source/cno_extras_hide_alpha.png b/sphinx_docs/source/cno_extras_hide_alpha.png new file mode 100644 index 0000000000..2df9d36a12 Binary files /dev/null and b/sphinx_docs/source/cno_extras_hide_alpha.png differ diff --git a/sphinx_docs/source/networks.rst b/sphinx_docs/source/networks.rst index afed2c0a4d..e0fd944f00 100644 --- a/sphinx_docs/source/networks.rst +++ b/sphinx_docs/source/networks.rst @@ -3,8 +3,8 @@ Available Reaction Networks *************************** -iso7, aprox13, aprox19, and aprox21 -=================================== +``iso7``, ``aprox13``, ``aprox19``, and ``aprox21`` +=================================================== These are alpha-chains (with some other nuclei) from Frank Timmes. These networks share common rates (from ``Microphysics/rates``), @@ -32,8 +32,8 @@ where :math:`N_A` is Avogadro’s number (to convert this to “per gram”) and :math:`\edotnu` is the neutrino loss term. -general_null -============ +``general_null`` +================ ``general_null`` is a bare interface for a nuclear reaction network -- no reactions are enabled. The @@ -79,9 +79,44 @@ At compile time, the "`.net`" file is parsed and a network header ``Make.package``. +``CNO_extras`` +============== + +This network replicates the popular [MESA "cno_extras" +network](https://docs.mesastar.org/en/latest/net/nets.html) which is +meant to study hot-CNO burning and the start of the breakout from CNO +burning. + +We add ${}^{56}\mathrm{Fe}$ as an inert nucleus to allow this to be +used for X-ray burst simulations. + +.. figure:: cno_extras_hide_alpha.png + :align: center -ignition_chamulak -================= + +``CNO_He_burn`` +=============== + +This network is meant to study explosive H and He burning. It combines +the ``CNO_extras`` network (with the exception of the inert ${}^{56}\mathrm{Fe}$ +with the ``subch_simple`` network. This allows it to capture hot-CNO and +He burning. + +.. figure:: CNO_He_burn.png + :align: center + +``ECSN`` +======== + +``ECSN`` is meant to model electron-capture supernovae in O-Ne white dwarfs. +It includes various weak rates that are important to this process. + +.. figure:: ECSN.png + :align: center + + +``ignition_chamulak`` +===================== This network was introduced in our paper on convection in white dwarfs as a model of Type Ia supernovae :cite:`wdconvect`. It models @@ -104,11 +139,24 @@ binding energies are negative. The energy generation rate is then: (this is positive since both :math:`q` and :math:`dY/dt` are negative) -ignition_reaclib -================ +``ignition_reaclib`` +==================== + +This contains several networks designed to model C burning in WDs. They include: + +* ``C-burn-simple`` : a version of ``ignition_simple`` built from + ReacLib rates. This just includes the C+C rates and doesn't group + the endpoints together. + +* ``URCA-simple`` : a basic network for modeling convective Urca, + containing the ${}^{23}\mathrm{Na}$-${}^{23}\mathrm{Ne}$ Urca pair. + +* ``URCA-medium`` : a more extensive Urca network than ``URCA-simple``, + containing more extensive C burning rates. -ignition_simple -=============== + +``ignition_simple`` +=================== This is the original network used in our white dwarf convection studies :cite:`lowMach4`. It includes a single-step @@ -127,11 +175,26 @@ Kepler stellar evolution code (Weaver 1978), which implements the work of (Graboske 1973) for weak screening and the work of (Alastuey 1978 and Itoh 1979) for strong screening. -kpp -=== -powerlaw -======== +nova networks +============= + +The ``nova`` and ``nova2`` networks both are intended for modeling classical novae. + + +* ``nova`` focuses just on CNO/hot-CNO: + + .. figure:: nova.png + :align: center + +* ``nova2`` expands ``nova`` by adding the pp-chain nuclei: + + .. figure:: nova2.png + :align: center + + +``powerlaw`` +============ This is a simple single-step reaction rate. We will consider only two species, fuel, :math:`f`, and ash, :math:`a`, through @@ -185,8 +248,8 @@ There are a number of parameters we use to control the constants in this network. This is one of the few networks that was designed to work with ``gamma_law`` as the EOS. -rprox -===== +``rprox`` +========= This network contains 10 species, approximating hot CNO, triple-\ :math:`\alpha`, and rp-breakout burning up through :math:`^{56}\mathrm{Ni}`, @@ -195,8 +258,8 @@ reaction rates from ReacLib :cite:`ReacLib` where available. This network was used for the X-ray burst studies in :cite:`xrb:II`, :cite:`xrb:III`, and more details are contained in those papers. -triple_alpha_plus_cago -====================== +``triple_alpha_plus_cago`` +========================== This is a 2 reaction network for helium burning, capturing the :math:`3`-:math:`\alpha` reaction and :math:`\isotm{C}{12}(\alpha,\gamma)\isotm{O}{16}`. Additionally, @@ -206,8 +269,7 @@ reaction and :math:`\isotm{C}{12}(\alpha,\gamma)\isotm{O}{16}`. Additionally, subch networks ============== -The networks subch_full (subch2), subch_approx (subch), -subch_simple, and subch_base recreate an aprox13 +The subch networks recreate an ``aprox13`` alpha-chain + including a bypass rate for :math:`\isotm{C}{12}(\alpha, \gamma)\isotm{O}{16}` discussed in :cite:`ShenBildsten`. This is appropriate for explosive He burning. @@ -242,74 +304,47 @@ forward rate to just be the first rate. We do not include reverse rates for these processes. -subch_full ----------- - -subch_full, also known as subch2, does not create an effective rate -for :math:`(\alpha, \gamma)` and :math:`(\alpha, p)(p, \gamma)` -(i.e. combine them assuming proton equilibrium). Therefore, -we need to explicitly include the intermediate nuclei produced in -the :math:`(\alpha,p)` reactions. In all, 28 nuclei and 107 rates are included. +``subch_simple`` +---------------- -This network is generated via pynucastro using the ``subch_full.py`` script. -The overall network appears as: - -.. figure:: subch_full.png - :align: center - -.. note:: - subch_full has been removed in - commit 19108a72c2dc81e251669ef0fed4edf7e6a3f9ed - -subch_approx ------------- - -subch_approx, also known as subch, approximates subch_full by +``subch_simple`` uses the ideas above but approximates some +of the rates by combining some of the :math:`A(\alpha,p)X(p,\gamma)B` links with :math:`A(\alpha,\gamma)B`, allowing us to drop the intermediate nucleus :math:`X`. We do this for :math:`\isotm{Cl}{35}`, :math:`\isotm{K}{39}`, :math:`\isotm{Sc}{43}`, :math:`\isotm{V}{47}`, :math:`\isotm{Mn}{51}`, and :math:`\isotm{Co}{55}`. -The resulting network appears as: - -.. figure:: subch_approx.png - :align: center - -The nuclei in gray are not part of the network, but the links to them -are approximated. This reduces the number of nuclei compared to subch_full -from 28 to 22. - -.. note:: - subch_approx has been removed in - commit 19108a72c2dc81e251669ef0fed4edf7e6a3f9ed -subch_simple -------------- +Further simplifications include: -subch_simple further simplifies subch_approx by the following: - -* Reverse rates of :math:`\isotm{C}{12}+\isotm{C}{12}`, +* The reverse rates of :math:`\isotm{C}{12}+\isotm{C}{12}`, :math:`\isotm{C}{12}+\isotm{O}{16}`, :math:`\isotm{O}{16}+\isotm{O}{16}` are neglected since they're not present in the original aprox13 network -* :math:`\isotm{C}{12}+\isotm{Ne}{20}` rates are removed +* The :math:`\isotm{C}{12}+\isotm{Ne}{20}` rate is removed -* :math:`(\alpha, \gamma)` links between :math:`\isotm{Na}{23}`, +* The :math:`(\alpha, \gamma)` links between :math:`\isotm{Na}{23}`, :math:`\isotm{Al}{27}` and between :math:`\isotm{Al}{27}` and :math:`\isotm{P}{31}` are removed, since they're not in the original aprox13 network. +The network appears as: + .. figure:: subch_simple.png :align: center -.. warning:: - Due to inclusion of the rate sequence, n14(a, g)f18(a, p)ne21, there is - an artificial end-point at Na22. +The nuclei in gray are those that have been approximated about, but the links +are effectively accounted for in the approximate rates. + +.. warning:: Due to inclusion of the rate sequence, + ${}^{14}\mathrm{N}(\alpha, \gamma){}^{18}\mathrm{F}(\alpha, + \mathrm{p}){}^{21}\mathrm{Ne}$, there is an artificial end-point at + ${}^{22}\mathrm{Na}$. -subch_base ------------ +``subch_base`` +-------------- -subch_base is the simplest subch network. It is created to reconcile the +``subch_base`` is the simplest subch network. It is created to reconcile the artificial end-point at :math:`\isotm{Na}{22}`. This is done by excluding :math:`\isotm{N}{14}`, :math:`\isotm{F}{18}`, :math:`\isotm{Ne}{21}`, and :math:`\isotm{Na}{22}`. These nuclei were added to include diff --git a/sphinx_docs/source/nova.png b/sphinx_docs/source/nova.png new file mode 100644 index 0000000000..a9fbc5984d Binary files /dev/null and b/sphinx_docs/source/nova.png differ diff --git a/sphinx_docs/source/nova2.png b/sphinx_docs/source/nova2.png new file mode 100644 index 0000000000..8867d19795 Binary files /dev/null and b/sphinx_docs/source/nova2.png differ diff --git a/sphinx_docs/source/subch_approx.png b/sphinx_docs/source/subch_approx.png deleted file mode 100644 index 1fa79a0ac0..0000000000 Binary files a/sphinx_docs/source/subch_approx.png and /dev/null differ diff --git a/sphinx_docs/source/subch_full.png b/sphinx_docs/source/subch_full.png deleted file mode 100644 index 9393c5880c..0000000000 Binary files a/sphinx_docs/source/subch_full.png and /dev/null differ diff --git a/sphinx_docs/source/unit_tests.rst b/sphinx_docs/source/unit_tests.rst index d9ba9c5d1e..a95a18de72 100644 --- a/sphinx_docs/source/unit_tests.rst +++ b/sphinx_docs/source/unit_tests.rst @@ -131,6 +131,13 @@ One-zone tests given a $\rho$, $T$, and $X_k$, call the equation of state and print out the thermodynamic information. +* ``jac_cell`` : + + for a single thermodynamic state, compute the analytic Jacobian + (using the functions provided by the network) and a numerical + finite-difference approximation to the Jacobian and output them, + element-by-element, to the display. + * ``nse_table_cell`` : given a $\rho$, $T$, and $Y_e$, evaluate the NSE state via table interpolation diff --git a/unit_test/jac_cell/GNUmakefile b/unit_test/jac_cell/GNUmakefile new file mode 100644 index 0000000000..8372650ebb --- /dev/null +++ b/unit_test/jac_cell/GNUmakefile @@ -0,0 +1,39 @@ +PRECISION = DOUBLE +PROFILE = FALSE + +DEBUG = FALSE + +DIM = 3 + +COMP = gnu + +USE_MPI = FALSE +USE_OMP = FALSE + +USE_REACT = TRUE + +EBASE = main + +BL_NO_FORT = TRUE + +# define the location of the Microphysics top directory +MICROPHYSICS_HOME := ../.. + +# This sets the EOS directory +EOS_DIR := helmholtz + +# This sets the network directory +NETWORK_DIR := aprox13 + +CONDUCTIVITY_DIR := stellar + +INTEGRATOR_DIR = VODE + +EXTERN_SEARCH += . .. + +Bpack := ./Make.package +Blocs := . + +include $(MICROPHYSICS_HOME)/unit_test/Make.unit_test + + diff --git a/unit_test/jac_cell/Make.package b/unit_test/jac_cell/Make.package new file mode 100644 index 0000000000..daf293f4db --- /dev/null +++ b/unit_test/jac_cell/Make.package @@ -0,0 +1,2 @@ +CEXE_sources += main.cpp +CEXE_headers += jac_cell.H diff --git a/unit_test/jac_cell/README.md b/unit_test/jac_cell/README.md new file mode 100644 index 0000000000..0d972f1f25 --- /dev/null +++ b/unit_test/jac_cell/README.md @@ -0,0 +1,5 @@ +# jac_cell + +For a single thermodynamic condition, evaluate the Jacobian using both +the analytic version from the network and the finite-difference +numerical approximation. diff --git a/unit_test/jac_cell/_parameters b/unit_test/jac_cell/_parameters new file mode 100644 index 0000000000..9047a84f8e --- /dev/null +++ b/unit_test/jac_cell/_parameters @@ -0,0 +1,21 @@ +@namespace: unit_test + +run_prefix string "" + +small_temp real 1.e5 +small_dens real 1.e5 + +# the final time to integrate to +tmax real 1.e-2 + +# first output time -- we will output in nsteps logarithmically spaced steps between [tfirst, tmax] +tfirst real 0.0 + +# number of steps (logarithmically spaced) +nsteps int 100 + +density real 1.e7 + +temperature real 3.e9 + +skip_initial_normalization bool 0 diff --git a/unit_test/jac_cell/ci-benchmarks/jac_cell_aprox13.out b/unit_test/jac_cell/ci-benchmarks/jac_cell_aprox13.out new file mode 100644 index 0000000000..b85220eaee --- /dev/null +++ b/unit_test/jac_cell/ci-benchmarks/jac_cell_aprox13.out @@ -0,0 +1,214 @@ +Initializing AMReX (24.07-16-gdcb9cc0383dc)... +AMReX (24.07-16-gdcb9cc0383dc) initialized +starting the single zone burn... +J( 1, 1) = -22.83252156 -22.76871089 +J( 1, 2) = -7074.184809 -7070.885902 +J( 1, 3) = -146332.0024 -146331.961 +J( 1, 4) = -2840218.246 -2840216.758 +J( 1, 5) = -1480087.416 -1480081.685 +J( 1, 6) = -150293.5967 -150288.8284 +J( 1, 7) = -155563.9558 -155558.7711 +J( 1, 8) = -90256.26203 -90254.79555 +J( 1, 9) = -4338.739586 -4338.971348 +J( 1, 10) = -1367.526773 -1364.641738 +J( 1, 11) = -754.4182788 -751.4739669 +J( 1, 12) = -164.8910475 -163.1314012 +J( 1, 13) = 0.177283612 8.045249939e-06 +J( 1, 14) = 2.036804679e-18 2.036804635e-18 + +J( 2, 1) = 22.83252156 22.76871089 +J( 2, 2) = -21223.06355 -21215.80687 +J( 2, 3) = -0.1431906097 0.01577663496 +J( 2, 4) = -0.1527366503 0 +J( 2, 5) = -0.1591006774 0 +J( 2, 6) = -0.1636464111 0 +J( 2, 7) = -0.1670557113 0 +J( 2, 8) = -0.1697073892 0 +J( 2, 9) = -0.1718287316 0 +J( 2, 10) = -0.1735643754 0 +J( 2, 11) = -0.1750107452 0 +J( 2, 12) = -0.1762345965 0 +J( 2, 13) = -0.177283612 0 +J( 2, 14) = -2.036804679e-18 -2.036804635e-18 + +J( 3, 1) = -5.632962675e-25 -5.570411722e-25 +J( 3, 2) = 28286.69277 28286.69277 +J( 3, 3) = -585327.8861 -585327.8861 +J( 3, 4) = 6128.217777 6128.217777 +J( 3, 5) = -1.739488553e-26 0 +J( 3, 6) = -1.789188226e-26 0 +J( 3, 7) = -1.826462981e-26 0 +J( 3, 8) = -1.855454457e-26 0 +J( 3, 9) = -1.878647638e-26 0 +J( 3, 10) = -1.897623876e-26 0 +J( 3, 11) = -1.913437409e-26 0 +J( 3, 12) = -1.92681809e-26 0 +J( 3, 13) = -1.938287245e-26 0 +J( 3, 14) = -2.226890848e-43 -2.226890927e-43 + +J( 4, 1) = -1.366807088e-23 -1.347708423e-23 +J( 4, 2) = 4.753870727e-12 1.2621475e-25 +J( 4, 3) = 731659.8313 731659.8313 +J( 4, 4) = -14216404.34 -14216404.34 +J( 4, 5) = 0.003363940593 0.003363940593 +J( 4, 6) = -1.093051048e-24 0 +J( 4, 7) = -1.115822945e-24 0 +J( 4, 8) = -1.13353442e-24 0 +J( 4, 9) = -1.1477036e-24 0 +J( 4, 10) = -1.159296566e-24 0 +J( 4, 11) = -1.168957371e-24 0 +J( 4, 12) = -1.177131898e-24 0 +J( 4, 13) = -1.184138635e-24 0 +J( 4, 14) = -1.360452377e-41 -1.360452352e-41 + +J( 5, 1) = 8.302657095e-24 8.170002764e-24 +J( 5, 2) = 3.153014201e-25 1.88760336e-28 +J( 5, 3) = 3.547140976e-25 1.88760336e-28 +J( 5, 4) = 17050492.88 17050492.88 +J( 5, 5) = -8880490.115 -8880490.115 +J( 5, 6) = 0.0001669112793 0.0001669112793 +J( 5, 7) = -5.810350496e-23 0 +J( 5, 8) = -5.809693618e-23 0 +J( 5, 9) = -5.809168116e-23 0 +J( 5, 10) = -5.808738159e-23 0 +J( 5, 11) = -5.808379862e-23 0 +J( 5, 12) = -5.808076688e-23 0 +J( 5, 13) = -5.807816824e-23 0 +J( 5, 14) = 5.045605543e-42 5.045605749e-42 + +J( 6, 1) = 9.417373366e-24 9.308549997e-24 +J( 6, 2) = 7.540626412e-25 2.20220392e-28 +J( 6, 3) = 6.930014139e-18 2.204043829e-28 +J( 6, 4) = 5.942221324e-23 0 +J( 6, 5) = 10360571.8 10360571.8 +J( 6, 6) = -1052021.799 -1052021.799 +J( 6, 7) = 2.618223472 2.618223472 +J( 6, 8) = 5.952275493e-23 0 +J( 6, 9) = 5.953532264e-23 0 +J( 6, 10) = 5.954560531e-23 0 +J( 6, 11) = 5.955417421e-23 0 +J( 6, 12) = 5.956142481e-23 0 +J( 6, 13) = 5.956763961e-23 0 +J( 6, 14) = 1.206687442e-41 1.206687398e-41 + +J( 7, 1) = -4.433213398e-26 -4.216253314e-26 +J( 7, 2) = -1.713032535e-26 0 +J( 7, 3) = 9.755839735e-19 2.590167837e-32 +J( 7, 4) = -2.055639042e-26 0 +J( 7, 5) = -2.141290668e-26 0 +J( 7, 6) = 1202310.628 1202310.628 +J( 7, 7) = -1244476.153 -1244476.153 +J( 7, 8) = 10.56270301 10.56270301 +J( 7, 9) = -2.312593922e-26 0 +J( 7, 10) = -2.335953456e-26 0 +J( 7, 11) = -2.355419735e-26 0 +J( 7, 12) = -2.371891202e-26 0 +J( 7, 13) = -2.386009602e-26 0 +J( 7, 14) = -2.741277362e-43 -2.741278343e-43 + +J( 8, 1) = 5.935462112e-25 5.877272628e-25 +J( 8, 2) = 4.909905946e-26 0 +J( 8, 3) = 5.523644189e-26 0 +J( 8, 4) = 5.891887135e-26 0 +J( 8, 5) = 6.137382433e-26 0 +J( 8, 6) = 6.312736216e-26 0 +J( 8, 7) = 1400032.306 1400032.306 +J( 8, 8) = -812316.926 -812316.926 +J( 8, 9) = 1.524756764 1.524756764 +J( 8, 10) = 6.69532629e-26 0 +J( 8, 11) = 6.751120676e-26 0 +J( 8, 12) = 6.79833131e-26 0 +J( 8, 13) = 6.838797568e-26 0 +J( 8, 14) = 7.857068531e-43 7.857069044e-43 + +J( 9, 1) = 8.75876269e-25 8.591697512e-25 +J( 9, 2) = 1.000399222e-25 0 +J( 9, 3) = 1.125449125e-25 0 +J( 9, 4) = 1.200479066e-25 0 +J( 9, 5) = 1.250499028e-25 0 +J( 9, 6) = 1.286227571e-25 0 +J( 9, 7) = 1.313023979e-25 0 +J( 9, 8) = 902561.1588 902561.1588 +J( 9, 9) = -43393.10183 -43393.10183 +J( 9, 10) = 136.1591093 136.1591093 +J( 9, 11) = 1.37554893e-25 0 +J( 9, 12) = 1.385168154e-25 0 +J( 9, 13) = 1.393413202e-25 0 +J( 9, 14) = 1.600887132e-42 1.600887039e-42 + +J( 10, 1) = 3.341465689e-26 3.256971428e-26 +J( 10, 2) = 3.653921958e-27 0 +J( 10, 3) = 4.110662202e-27 0 +J( 10, 4) = 4.384706349e-27 0 +J( 10, 5) = 4.567402447e-27 0 +J( 10, 6) = 4.69789966e-27 0 +J( 10, 7) = 4.79577257e-27 0 +J( 10, 8) = 4.871895944e-27 0 +J( 10, 9) = 47730.54842 47730.54842 +J( 10, 10) = -15310.60916 -15310.60916 +J( 10, 11) = 0.002383888334 0.002383888334 +J( 10, 12) = 5.059276557e-27 0 +J( 10, 13) = 5.089391298e-27 0 +J( 10, 14) = 5.847182318e-44 5.847181188e-44 + +J( 11, 1) = 7.727968776e-27 7.52140159e-27 +J( 11, 2) = 1.166347238e-27 0 +J( 11, 3) = 1.312140643e-27 0 +J( 11, 4) = 1.399616686e-27 0 +J( 11, 5) = 1.457934048e-27 0 +J( 11, 6) = 1.499589306e-27 0 +J( 11, 7) = 1.53083075e-27 0 +J( 11, 8) = 1.555129651e-27 0 +J( 11, 9) = 1.574568772e-27 0 +J( 11, 10) = 16539.09179 16539.09179 +J( 11, 11) = -9017.692804 -9017.692804 +J( 11, 12) = 0.000548515294 0.000548515294 +J( 11, 13) = 1.624555082e-27 0 +J( 11, 14) = 1.866445159e-44 1.866444877e-44 + +J( 12, 1) = 7.899733031e-27 7.648455578e-27 +J( 12, 2) = 1.384355059e-27 0 +J( 12, 3) = 1.557399442e-27 0 +J( 12, 4) = 1.661226071e-27 0 +J( 12, 5) = 1.730443824e-27 0 +J( 12, 6) = 1.779885076e-27 0 +J( 12, 7) = 1.816966015e-27 0 +J( 12, 8) = 1.845806746e-27 0 +J( 12, 9) = 1.86887933e-27 0 +J( 12, 10) = 1.887756899e-27 0 +J( 12, 11) = 9769.164387 9769.164387 +J( 12, 12) = -2120.709403 -2120.709403 +J( 12, 13) = 0.0001045882492 0.0001045882492 +J( 12, 14) = 2.215311799e-44 2.215311465e-44 + +J( 13, 1) = 2.36704737e-27 2.283840256e-27 +J( 13, 2) = 4.518871185e-28 0 +J( 13, 3) = 5.083730083e-28 0 +J( 13, 4) = 5.422645422e-28 0 +J( 13, 5) = 5.648588981e-28 0 +J( 13, 6) = 5.809977238e-28 0 +J( 13, 7) = 5.93101843e-28 0 +J( 13, 8) = 6.02516158e-28 0 +J( 13, 9) = 6.1004761e-28 0 +J( 13, 10) = 6.16209707e-28 0 +J( 13, 11) = 6.213447879e-28 0 +J( 13, 12) = 2283.840256 2283.840256 +J( 13, 13) = -0.0001126334991 -0.0001126334991 +J( 13, 14) = 7.231315828e-45 7.231315425e-45 + +J( 14, 1) = 1.335535433e+19 1.331810907e+19 +J( 14, 2) = 1.672678172e+22 1.221628179e+22 +J( 14, 3) = 1.764169333e+23 1.669883326e+23 +J( 14, 4) = 6.38519349e+24 6.382691446e+24 +J( 14, 5) = 3.575435081e+24 3.56443165e+24 +J( 14, 6) = 2.522960852e+23 2.518972785e+23 +J( 14, 7) = 2.567887496e+23 2.492143743e+23 +J( 14, 8) = 1.63734141e+23 1.532779936e+23 +J( 14, 9) = 1.46197563e+22 5.363178614e+21 +J( 14, 10) = 1.41303877e+22 2.541660459e+21 +J( 14, 11) = 7.680250114e+21 1.43978686e+21 +J( 14, 12) = 6.72190453e+21 3.147552442e+20 +J( 14, 13) = -1.03705583e+17 -1.56260658e+13 +J( 14, 14) = -1.191469501 -1.191474366 + +AMReX (24.07-16-gdcb9cc0383dc) finalized diff --git a/unit_test/jac_cell/inputs_aprox13 b/unit_test/jac_cell/inputs_aprox13 new file mode 100644 index 0000000000..5e138fc92d --- /dev/null +++ b/unit_test/jac_cell/inputs_aprox13 @@ -0,0 +1,38 @@ +unit_test.run_prefix = "react_aprox13_" + +unit_test.small_temp = 1.e5 +unit_test.small_dens = 1.e5 + +integrator.burner_verbose = 0 + +# Set which jacobian to use +# 1 = analytic jacobian +# 2 = numerical jacobian + +integrator.jacobian = 2 + +integrator.renormalize_abundances = 0 + +integrator.rtol_spec = 1.0e-6 +integrator.rtol_enuc = 1.0e-6 +integrator.atol_spec = 1.0e-6 +integrator.atol_enuc = 1.0e-6 + +unit_test.tmax = 1.e-2 + +unit_test.density = 1.e6 +unit_test.temperature = 3.e9 + +unit_test.X1 = 1.0 +unit_test.X2 = 0.0 +unit_test.X3 = 0.0 +unit_test.X4 = 0.0 +unit_test.X5 = 0.0 +unit_test.X6 = 0.0 +unit_test.X7 = 0.0 +unit_test.X8 = 0.0 +unit_test.X9 = 0.0 +unit_test.X10 = 0.0 +unit_test.X11 = 0.0 +unit_test.X12 = 0.0 +unit_test.X13 = 0.0 diff --git a/unit_test/jac_cell/jac_cell.H b/unit_test/jac_cell/jac_cell.H new file mode 100644 index 0000000000..fd49859883 --- /dev/null +++ b/unit_test/jac_cell/jac_cell.H @@ -0,0 +1,79 @@ +#ifndef BURN_CELL_H +#define BURN_CELL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace unit_test_rp; + +AMREX_INLINE +void jac_cell_c() +{ + + amrex::Real massfractions[NumSpec] = {-1.0}; + + // Make sure user set all the mass fractions to values in the interval [0, 1] + for (int n = 1; n <= NumSpec; ++n) { + + massfractions[n-1] = get_xn(n); + + if (massfractions[n-1] < 0 || massfractions[n-1] > 1) { + amrex::Error("mass fraction for " + short_spec_names_cxx[n-1] + " not initialized in the interval [0,1]!"); + } + + } + + burn_t burn_state; + + burn_state.rho = density; + burn_state.T = temperature; + for (int n = 0; n < NumSpec; ++n) { + burn_state.xn[n] = massfractions[n]; + } + + normalize_abundances_burn(burn_state); + + // get the energy + + eos(eos_input_rt, burn_state); + + JacNetArray2D jac_analytic; + JacNetArray2D jac_numerical; + + actual_jac(burn_state, jac_analytic); + + // we need to convert this to be in terms of X instead of Y + + for (int j = 1; j <= NumSpec; ++j) { + for (int i = 1; i <= neqs; ++i) { + jac_analytic(j, i) *= aion[j-1]; + jac_analytic(i, j) *= aion_inv[j-1]; + } + } + + jac_info_t jac_info; + jac_info.h = 1.e-5_rt; // timestep really doesn't make sense here + + numerical_jac(burn_state, jac_info, jac_numerical); + + // output + + for (int ii = 1; ii <= neqs; ++ii) { + for (int jj = 1; jj <= neqs; ++jj) { + std::cout << "J(" << std::setw(3) << ii << ", " << std::setw(3) << jj << ") = " + << std::setw(20) << jac_numerical(ii,jj) << " " + << std::setw(20) << jac_analytic(ii,jj) << std::endl; + } + std::cout << std::endl; + } + + +} +#endif diff --git a/unit_test/jac_cell/main.cpp b/unit_test/jac_cell/main.cpp new file mode 100644 index 0000000000..692a38d8f9 --- /dev/null +++ b/unit_test/jac_cell/main.cpp @@ -0,0 +1,28 @@ +#include + +#include +#include +#include +#include +#include + +using namespace unit_test_rp; + +int main(int argc, char *argv[]) { + + amrex::Initialize(argc, argv); + + std::cout << "starting the single zone burn..." << std::endl; + + init_unit_test(); + + // C++ EOS initialization (must be done after Fortran eos_init and init_extern_parameters) + eos_init(small_temp, small_dens); + + // C++ Network, RHS, screening, rates initialization + network_init(); + + jac_cell_c(); + + amrex::Finalize(); +} diff --git a/unit_test/nse_table_cell/GNUmakefile b/unit_test/nse_table_cell/GNUmakefile index 1b443926cb..e25e3df662 100644 --- a/unit_test/nse_table_cell/GNUmakefile +++ b/unit_test/nse_table_cell/GNUmakefile @@ -10,6 +10,8 @@ COMP = gnu USE_MPI = FALSE USE_OMP = FALSE +USE_SIMPLIFIED_SDC = TRUE + USE_REACT = TRUE EBASE = main