Skip to content

Commit f0c0d2a

Browse files
authored
move CNO_He_burn and clean-up (#1710)
this is now under he-burn and uses the he_burn_core.py script
1 parent 5b58803 commit f0c0d2a

20 files changed

+68
-152
lines changed

networks/CNO_He_burn

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
he-burn/cno-he-burn-33a

networks/CNO_He_burn/CNO_He_burn.png

-112 KB
Binary file not shown.

networks/CNO_He_burn/CNO_He_burn.py

-123
This file was deleted.

networks/CNO_He_burn/_parameters

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@namespace: network
2+

networks/CNO_He_burn/actual_rhs.H networks/he-burn/cno-he-burn-33a/actual_rhs.H

+1-23
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,6 @@ void evaluate_rates(const burn_t& state, T& rate_eval) {
7171

7272
fill_reaclib_rates<do_T_derivatives, T>(tfactors, rate_eval);
7373

74-
if (disable_p_C12_to_N13) {
75-
rate_eval.screened_rates(k_p_C12_to_N13) = 0.0;
76-
if constexpr (std::is_same_v<T, rate_derivs_t>) {
77-
rate_eval.dscreened_rates_dT(k_p_C12_to_N13) = 0.0;
78-
}
79-
rate_eval.screened_rates(k_N13_to_p_C12) = 0.0;
80-
if constexpr (std::is_same_v<T, rate_derivs_t>) {
81-
rate_eval.dscreened_rates_dT(k_N13_to_p_C12) = 0.0;
82-
}
83-
}
84-
85-
if (disable_He4_N13_to_p_O16) {
86-
rate_eval.screened_rates(k_He4_N13_to_p_O16) = 0.0;
87-
if constexpr (std::is_same_v<T, rate_derivs_t>) {
88-
rate_eval.dscreened_rates_dT(k_He4_N13_to_p_O16) = 0.0;
89-
}
90-
rate_eval.screened_rates(k_p_O16_to_He4_N13) = 0.0;
91-
if constexpr (std::is_same_v<T, rate_derivs_t>) {
92-
rate_eval.dscreened_rates_dT(k_p_O16_to_He4_N13) = 0.0;
93-
}
94-
}
95-
9674

9775

9876
// Evaluate screening factors
@@ -1584,7 +1562,7 @@ void evaluate_rates(const burn_t& state, T& rate_eval) {
15841562

15851563
// Fill approximate rates
15861564

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

15891567
// Calculate tabular rates
15901568

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# a blend of CNO_extras and subch_simple
2+
3+
import pynucastro as pyna
4+
from pynucastro.networks import AmrexAstroCxxNetwork
5+
6+
import he_burn_core
7+
8+
9+
DO_DERIVED_RATES = False
10+
11+
12+
def doit():
13+
14+
extra_reactants = ["c13", "n15",
15+
"o14", "o15", "o17", "o18",
16+
"f17", "f19",
17+
"ne18", "ne19",
18+
"na22", "na23",
19+
"mg22"]
20+
21+
subch = he_burn_core.get_core_library(include_n14_sequence=True,
22+
include_zn=False,
23+
extra_nuclei=extra_reactants,
24+
do_detailed_balance=DO_DERIVED_RATES)
25+
26+
net = AmrexAstroCxxNetwork(libraries=[subch], symmetric_screening=True)
27+
28+
net.make_ap_pg_approx(intermediate_nuclei=["cl35", "k39", "sc43", "v47", "mn51", "co55"])
29+
net.remove_nuclei(["cl35", "k39", "sc43", "v47", "mn51", "co55"])
30+
31+
print(f"number of nuclei: {len(net.unique_nuclei)}")
32+
print(f"number of rates: {len(net.rates)}")
33+
34+
comp = pyna.Composition(net.get_nuclei())
35+
comp.set_all(0.1)
36+
comp.set_nuc("he4", 0.95)
37+
comp.normalize()
38+
39+
rho = 1.e6
40+
T = 1.e9
41+
42+
net.plot(rho, T, comp, outfile="cno-he-burn-33a.png",
43+
rotated=True, hide_xalpha=True, curved_edges=True,
44+
size=(1500, 450),
45+
node_size=500, node_font_size=11, node_color="#337dff", node_shape="s",
46+
Z_range=(1, 29))
47+
48+
net.write_network()
49+
50+
51+
if __name__ == "__main__":
52+
doit()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../he_burn_core.py

networks/CNO_He_burn/reaclib_rates.H networks/he-burn/cno-he-burn-33a/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{};
File renamed without changes.

networks/he-burn/he_burn_core.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ def get_core_library(*,
99
include_zn=False,
1010
include_iron_peak=False,
1111
include_low_ye=False,
12-
do_detailed_balance=False):
12+
do_detailed_balance=False,
13+
extra_nuclei=None):
1314

1415
reaclib_lib = pyna.ReacLibLibrary()
1516

17+
if extra_nuclei is None:
18+
extra_nuclei = []
19+
1620
nuclei = ["p",
1721
"he4", "c12", "n13", "o16",
1822
"ne20", "na23", "mg24", "si28", "s32",
@@ -21,6 +25,8 @@ def get_core_library(*,
2125
"al27", "p31", "cl35", "k39", "sc43", "v47",
2226
"mn51", "co55"]
2327

28+
nuclei += extra_nuclei
29+
2430
if include_n14_sequence:
2531
nuclei += ["n14", "f18", "ne21", "na22"]
2632

0 commit comments

Comments
 (0)