Skip to content

Commit 2d61ba0

Browse files
committed
regenerate the networks with the latest pynucastro
this updates binding energies with more precision, fixes partition functions with ROCm/HIP, and adds the ability to compile out neutrino losses.
1 parent ab820ce commit 2d61ba0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+764
-1104
lines changed

networks/CNO_He_burn/CNO_He_burn.png

0 Bytes
Loading

networks/CNO_He_burn/actual_rhs.H

+7-3
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ void evaluate_rates(const burn_t& state, T& rate_eval) {
15841584

15851585
// Fill approximate rates
15861586

1587-
fill_approx_rates<do_T_derivatives, T>(tfactors, rate_eval);
1587+
fill_approx_rates<do_T_derivatives, T>(tfactors, state.rho, Y, rate_eval);
15881588

15891589
// Calculate tabular rates
15901590

@@ -2005,9 +2005,12 @@ void actual_rhs (burn_t& state, amrex::Array1D<amrex::Real, 1, neqs>& ydot)
20052005

20062006
// Get the thermal neutrino losses
20072007

2008-
amrex::Real sneut, dsneutdt, dsneutdd, dsnuda, dsnudz;
2008+
amrex::Real sneut{};
2009+
#ifdef NEUTRINOS
20092010
constexpr int do_derivatives{0};
2011+
amrex::Real dsneutdt{}, dsneutdd{}, dsnuda{}, dsnudz{};
20102012
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);
2013+
#endif
20112014

20122015
// Append the energy equation (this is erg/g/s)
20132016

@@ -2829,6 +2832,7 @@ void actual_jac(const burn_t& state, MatrixType& jac)
28292832

28302833
// Account for the thermal neutrino losses
28312834

2835+
#ifdef NEUTRINOS
28322836
amrex::Real sneut, dsneutdt, dsneutdd, dsnuda, dsnudz;
28332837
constexpr int do_derivatives{1};
28342838
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);
@@ -2837,7 +2841,7 @@ void actual_jac(const burn_t& state, MatrixType& jac)
28372841
amrex::Real b1 = (-state.abar * state.abar * dsnuda + (zion[j-1] - state.zbar) * state.abar * dsnudz);
28382842
jac.add(net_ienuc, j, -b1);
28392843
}
2840-
2844+
#endif
28412845

28422846
// Evaluate the Jacobian elements with respect to energy by
28432847
// calling the RHS using d(rate) / dT and then transform them

networks/CNO_He_burn/reaclib_rates.H

+4-1
Original file line numberDiff line numberDiff line change
@@ -8342,7 +8342,10 @@ fill_reaclib_rates(const tf_t& tfactors, T& rate_eval)
83428342
template <int do_T_derivatives, typename T>
83438343
AMREX_GPU_HOST_DEVICE AMREX_INLINE
83448344
void
8345-
fill_approx_rates([[maybe_unused]] const tf_t& tfactors, [[maybe_unused]] T& rate_eval)
8345+
fill_approx_rates([[maybe_unused]] const tf_t& tfactors,
8346+
[[maybe_unused]] const amrex::Real rho,
8347+
[[maybe_unused]] const amrex::Array1D<amrex::Real, 1, NumSpec>& Y,
8348+
[[maybe_unused]] T& rate_eval)
83468349
{
83478350

83488351
[[maybe_unused]] amrex::Real rate{};

networks/CNO_extras/Make.package

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ifeq ($(USE_REACT),TRUE)
55
CEXE_headers += actual_network.H
66
CEXE_headers += tfactors.H
77
CEXE_headers += partition_functions.H
8+
CEXE_sources += partition_functions_data.cpp
89
CEXE_headers += actual_rhs.H
910
CEXE_headers += reaclib_rates.H
1011
CEXE_headers += table_rates.H

networks/CNO_extras/actual_network.H

+20-20
Original file line numberDiff line numberDiff line change
@@ -30,64 +30,64 @@ namespace network
3030
return 0.0_rt;
3131
}
3232
else if constexpr (spec == He4) {
33-
return 28.29566_rt;
33+
return 28.295662457999697_rt;
3434
}
3535
else if constexpr (spec == C12) {
36-
return 92.16172800000001_rt;
36+
return 92.16173498399803_rt;
3737
}
3838
else if constexpr (spec == C13) {
39-
return 97.108037_rt;
39+
return 97.10804378399916_rt;
4040
}
4141
else if constexpr (spec == N13) {
42-
return 94.105219_rt;
42+
return 94.10522604799917_rt;
4343
}
4444
else if constexpr (spec == N14) {
45-
return 104.65859599999999_rt;
45+
return 104.65860734799753_rt;
4646
}
4747
else if constexpr (spec == N15) {
48-
return 115.4919_rt;
48+
return 115.49190414799887_rt;
4949
}
5050
else if constexpr (spec == O14) {
51-
return 98.731892_rt;
51+
return 98.73189611199996_rt;
5252
}
5353
else if constexpr (spec == O15) {
54-
return 111.95538_rt;
54+
return 111.95539521199862_rt;
5555
}
5656
else if constexpr (spec == O16) {
57-
return 127.619296_rt;
57+
return 127.6193154119992_rt;
5858
}
5959
else if constexpr (spec == O17) {
60-
return 131.76237600000002_rt;
60+
return 131.76239561199873_rt;
6161
}
6262
else if constexpr (spec == O18) {
63-
return 139.807746_rt;
63+
return 139.8077658120019_rt;
6464
}
6565
else if constexpr (spec == F17) {
66-
return 128.21957600000002_rt;
66+
return 128.21958437599824_rt;
6767
}
6868
else if constexpr (spec == F18) {
69-
return 137.369484_rt;
69+
return 137.36950247599816_rt;
7070
}
7171
else if constexpr (spec == F19) {
72-
return 147.801342_rt;
72+
return 147.80136567599766_rt;
7373
}
7474
else if constexpr (spec == Ne18) {
75-
return 132.142626_rt;
75+
return 132.14265544000227_rt;
7676
}
7777
else if constexpr (spec == Ne19) {
78-
return 143.779517_rt;
78+
return 143.7795235400008_rt;
7979
}
8080
else if constexpr (spec == Ne20) {
81-
return 160.6448_rt;
81+
return 160.64482384000075_rt;
8282
}
8383
else if constexpr (spec == Mg22) {
84-
return 168.58074200000001_rt;
84+
return 168.58082376800303_rt;
8585
}
8686
else if constexpr (spec == Mg24) {
87-
return 198.25701600000002_rt;
87+
return 198.2570479679962_rt;
8888
}
8989
else if constexpr (spec == Fe56) {
90-
return 492.2598239999999_rt;
90+
return 492.2599506639962_rt;
9191
}
9292

9393

networks/CNO_extras/actual_rhs.H

+7-3
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ void evaluate_rates(const burn_t& state, T& rate_eval) {
687687

688688
// Fill approximate rates
689689

690-
fill_approx_rates<do_T_derivatives, T>(tfactors, rate_eval);
690+
fill_approx_rates<do_T_derivatives, T>(tfactors, state.rho, Y, rate_eval);
691691

692692
// Calculate tabular rates
693693

@@ -973,9 +973,12 @@ void actual_rhs (burn_t& state, amrex::Array1D<amrex::Real, 1, neqs>& ydot)
973973

974974
// Get the thermal neutrino losses
975975

976-
amrex::Real sneut, dsneutdt, dsneutdd, dsnuda, dsnudz;
976+
amrex::Real sneut{};
977+
#ifdef NEUTRINOS
977978
constexpr int do_derivatives{0};
979+
amrex::Real dsneutdt{}, dsneutdd{}, dsnuda{}, dsnudz{};
978980
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);
981+
#endif
979982

980983
// Append the energy equation (this is erg/g/s)
981984

@@ -1497,6 +1500,7 @@ void actual_jac(const burn_t& state, MatrixType& jac)
14971500

14981501
// Account for the thermal neutrino losses
14991502

1503+
#ifdef NEUTRINOS
15001504
amrex::Real sneut, dsneutdt, dsneutdd, dsnuda, dsnudz;
15011505
constexpr int do_derivatives{1};
15021506
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);
@@ -1505,7 +1509,7 @@ void actual_jac(const burn_t& state, MatrixType& jac)
15051509
amrex::Real b1 = (-state.abar * state.abar * dsnuda + (zion[j-1] - state.zbar) * state.abar * dsnudz);
15061510
jac.add(net_ienuc, j, -b1);
15071511
}
1508-
1512+
#endif
15091513

15101514
// Evaluate the Jacobian elements with respect to energy by
15111515
// calling the RHS using d(rate) / dT and then transform them

networks/CNO_extras/cno_extras.png

-1.01 KB
Loading
2.1 KB
Loading

networks/CNO_extras/partition_functions.H

+9-8
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ namespace part_fun {
1717

1818
// interpolation routine
1919

20-
template <int npts>
20+
template <typename T>
2121
AMREX_GPU_HOST_DEVICE AMREX_INLINE
22-
void interpolate_pf(const amrex::Real t9, const amrex::Real (&temp_array)[npts], const amrex::Real (&pf_array)[npts],
22+
void interpolate_pf(const amrex::Real t9, const T& temp_array, const T& pf_array,
2323
amrex::Real& pf, amrex::Real& dpf_dT) {
2424

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

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

29-
int left = 0;
30-
int right = npts;
29+
int left = temp_array.lo();
30+
int right = temp_array.hi();
3131

3232
while (left < right) {
3333
int mid = (left + right) / 2;
34-
if (temp_array[mid] > t9) {
34+
if (temp_array(mid) > t9) {
3535
right = mid;
3636
} else {
3737
left = mid + 1;
@@ -44,11 +44,12 @@ namespace part_fun {
4444

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

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

4950
// find the PF
5051

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

5455
// find the derivative (with respect to T, not T9)

networks/CNO_extras/reaclib_rates.H

+4-1
Original file line numberDiff line numberDiff line change
@@ -4483,7 +4483,10 @@ fill_reaclib_rates(const tf_t& tfactors, T& rate_eval)
44834483
template <int do_T_derivatives, typename T>
44844484
AMREX_GPU_HOST_DEVICE AMREX_INLINE
44854485
void
4486-
fill_approx_rates([[maybe_unused]] const tf_t& tfactors, [[maybe_unused]] T& rate_eval)
4486+
fill_approx_rates([[maybe_unused]] const tf_t& tfactors,
4487+
[[maybe_unused]] const amrex::Real rho,
4488+
[[maybe_unused]] const amrex::Array1D<amrex::Real, 1, NumSpec>& Y,
4489+
[[maybe_unused]] T& rate_eval)
44874490
{
44884491

44894492
[[maybe_unused]] amrex::Real rate{};

networks/ECSN/Make.package

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ifeq ($(USE_REACT),TRUE)
55
CEXE_headers += actual_network.H
66
CEXE_headers += tfactors.H
77
CEXE_headers += partition_functions.H
8+
CEXE_sources += partition_functions_data.cpp
89
CEXE_headers += actual_rhs.H
910
CEXE_headers += reaclib_rates.H
1011
CEXE_headers += table_rates.H

networks/ECSN/actual_network.H

+10-10
Original file line numberDiff line numberDiff line change
@@ -30,34 +30,34 @@ namespace network
3030
return 0.0_rt;
3131
}
3232
else if constexpr (spec == He4) {
33-
return 28.29566_rt;
33+
return 28.295662457999697_rt;
3434
}
3535
else if constexpr (spec == O16) {
36-
return 127.619296_rt;
36+
return 127.6193154119992_rt;
3737
}
3838
else if constexpr (spec == O20) {
39-
return 151.3714_rt;
39+
return 151.37138571200194_rt;
4040
}
4141
else if constexpr (spec == F20) {
42-
return 154.40268_rt;
42+
return 154.40270167600102_rt;
4343
}
4444
else if constexpr (spec == Ne20) {
45-
return 160.6448_rt;
45+
return 160.64482384000075_rt;
4646
}
4747
else if constexpr (spec == Mg24) {
48-
return 198.25701600000002_rt;
48+
return 198.2570479679962_rt;
4949
}
5050
else if constexpr (spec == Al27) {
51-
return 224.951931_rt;
51+
return 224.95193723199915_rt;
5252
}
5353
else if constexpr (spec == Si28) {
54-
return 236.536832_rt;
54+
return 236.53684539599638_rt;
5555
}
5656
else if constexpr (spec == P31) {
57-
return 262.91617699999995_rt;
57+
return 262.9161999600037_rt;
5858
}
5959
else if constexpr (spec == S32) {
60-
return 271.78012800000005_rt;
60+
return 271.78016372399725_rt;
6161
}
6262

6363

networks/ECSN/actual_rhs.H

+7-3
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ void evaluate_rates(const burn_t& state, T& rate_eval) {
269269

270270
// Fill approximate rates
271271

272-
fill_approx_rates<do_T_derivatives, T>(tfactors, rate_eval);
272+
fill_approx_rates<do_T_derivatives, T>(tfactors, state.rho, Y, rate_eval);
273273

274274
// Calculate tabular rates
275275

@@ -499,9 +499,12 @@ void actual_rhs (burn_t& state, amrex::Array1D<amrex::Real, 1, neqs>& ydot)
499499

500500
// Get the thermal neutrino losses
501501

502-
amrex::Real sneut, dsneutdt, dsneutdd, dsnuda, dsnudz;
502+
amrex::Real sneut{};
503+
#ifdef NEUTRINOS
503504
constexpr int do_derivatives{0};
505+
amrex::Real dsneutdt{}, dsneutdd{}, dsnuda{}, dsnudz{};
504506
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);
507+
#endif
505508

506509
// Append the energy equation (this is erg/g/s)
507510

@@ -717,6 +720,7 @@ void actual_jac(const burn_t& state, MatrixType& jac)
717720

718721
// Account for the thermal neutrino losses
719722

723+
#ifdef NEUTRINOS
720724
amrex::Real sneut, dsneutdt, dsneutdd, dsnuda, dsnudz;
721725
constexpr int do_derivatives{1};
722726
sneut5<do_derivatives>(state.T, state.rho, state.abar, state.zbar, sneut, dsneutdt, dsneutdd, dsnuda, dsnudz);
@@ -725,7 +729,7 @@ void actual_jac(const burn_t& state, MatrixType& jac)
725729
amrex::Real b1 = (-state.abar * state.abar * dsnuda + (zion[j-1] - state.zbar) * state.abar * dsnudz);
726730
jac.add(net_ienuc, j, -b1);
727731
}
728-
732+
#endif
729733

730734
// Evaluate the Jacobian elements with respect to energy by
731735
// calling the RHS using d(rate) / dT and then transform them

networks/ECSN/partition_functions.H

+9-8
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ namespace part_fun {
1717

1818
// interpolation routine
1919

20-
template <int npts>
20+
template <typename T>
2121
AMREX_GPU_HOST_DEVICE AMREX_INLINE
22-
void interpolate_pf(const amrex::Real t9, const amrex::Real (&temp_array)[npts], const amrex::Real (&pf_array)[npts],
22+
void interpolate_pf(const amrex::Real t9, const T& temp_array, const T& pf_array,
2323
amrex::Real& pf, amrex::Real& dpf_dT) {
2424

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

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

29-
int left = 0;
30-
int right = npts;
29+
int left = temp_array.lo();
30+
int right = temp_array.hi();
3131

3232
while (left < right) {
3333
int mid = (left + right) / 2;
34-
if (temp_array[mid] > t9) {
34+
if (temp_array(mid) > t9) {
3535
right = mid;
3636
} else {
3737
left = mid + 1;
@@ -44,11 +44,12 @@ namespace part_fun {
4444

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

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

4950
// find the PF
5051

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

5455
// find the derivative (with respect to T, not T9)

networks/ECSN/reaclib_rates.H

+4-1
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,10 @@ fill_reaclib_rates(const tf_t& tfactors, T& rate_eval)
910910
template <int do_T_derivatives, typename T>
911911
AMREX_GPU_HOST_DEVICE AMREX_INLINE
912912
void
913-
fill_approx_rates([[maybe_unused]] const tf_t& tfactors, [[maybe_unused]] T& rate_eval)
913+
fill_approx_rates([[maybe_unused]] const tf_t& tfactors,
914+
[[maybe_unused]] const amrex::Real rho,
915+
[[maybe_unused]] const amrex::Array1D<amrex::Real, 1, NumSpec>& Y,
916+
[[maybe_unused]] T& rate_eval)
914917
{
915918

916919
[[maybe_unused]] amrex::Real rate{};
0 Bytes
Loading

0 commit comments

Comments
 (0)