Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move CNO_He_burn and clean-up #1710

Merged
merged 2 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions networks/CNO_He_burn
Binary file removed networks/CNO_He_burn/CNO_He_burn.png
Binary file not shown.
123 changes: 0 additions & 123 deletions networks/CNO_He_burn/CNO_He_burn.py

This file was deleted.

4 changes: 0 additions & 4 deletions networks/CNO_He_burn/_parameters

This file was deleted.

2 changes: 2 additions & 0 deletions networks/he-burn/cno-he-burn-33a/_parameters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@namespace: network

Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,6 @@ void evaluate_rates(const burn_t& state, T& rate_eval) {

fill_reaclib_rates<do_T_derivatives, T>(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<T, rate_derivs_t>) {
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<T, rate_derivs_t>) {
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<T, rate_derivs_t>) {
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<T, rate_derivs_t>) {
rate_eval.dscreened_rates_dT(k_p_O16_to_He4_N13) = 0.0;
}
}



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

// Fill approximate rates

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

// Calculate tabular rates

Expand Down
52 changes: 52 additions & 0 deletions networks/he-burn/cno-he-burn-33a/cno_he_burn_33a.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# a blend of CNO_extras and subch_simple

import pynucastro as pyna
from pynucastro.networks import AmrexAstroCxxNetwork

import he_burn_core


DO_DERIVED_RATES = False


def doit():

extra_reactants = ["c13", "n15",
"o14", "o15", "o17", "o18",
"f17", "f19",
"ne18", "ne19",
"na22", "na23",
"mg22"]

subch = he_burn_core.get_core_library(include_n14_sequence=True,
include_zn=False,
extra_nuclei=extra_reactants,
do_detailed_balance=DO_DERIVED_RATES)

net = AmrexAstroCxxNetwork(libraries=[subch], symmetric_screening=True)

net.make_ap_pg_approx(intermediate_nuclei=["cl35", "k39", "sc43", "v47", "mn51", "co55"])
net.remove_nuclei(["cl35", "k39", "sc43", "v47", "mn51", "co55"])

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-33a.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()
1 change: 1 addition & 0 deletions networks/he-burn/cno-he-burn-33a/he_burn_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8342,7 +8342,10 @@ fill_reaclib_rates(const tf_t& tfactors, T& rate_eval)
template <int do_T_derivatives, typename T>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
void
fill_approx_rates([[maybe_unused]] const tf_t& tfactors, [[maybe_unused]] T& rate_eval)
fill_approx_rates([[maybe_unused]] const tf_t& tfactors,
[[maybe_unused]] const amrex::Real rho,
[[maybe_unused]] const amrex::Array1D<amrex::Real, 1, NumSpec>& Y,
[[maybe_unused]] T& rate_eval)
{

[[maybe_unused]] amrex::Real rate{};
Expand Down
8 changes: 7 additions & 1 deletion networks/he-burn/he_burn_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ def get_core_library(*,
include_zn=False,
include_iron_peak=False,
include_low_ye=False,
do_detailed_balance=False):
do_detailed_balance=False,
extra_nuclei=None):

reaclib_lib = pyna.ReacLibLibrary()

if extra_nuclei is None:
extra_nuclei = []

nuclei = ["p",
"he4", "c12", "n13", "o16",
"ne20", "na23", "mg24", "si28", "s32",
Expand All @@ -21,6 +25,8 @@ def get_core_library(*,
"al27", "p31", "cl35", "k39", "sc43", "v47",
"mn51", "co55"]

nuclei += extra_nuclei

if include_n14_sequence:
nuclei += ["n14", "f18", "ne21", "na22"]

Expand Down
Loading