Modifying Rates#
Sometimes we want to change the nuclei involved in rates to simplify our network. Currently, pynucastro supports changing the products. Here’s an example.
import pynucastro as pyna
reaclib_library = pyna.ReacLibLibrary()
We want to model \({}^{12}\mathrm{C} + {}^{12}\mathrm{C}\) reactions. There are 3 rates involved.
filter = pyna.RateFilter(reactants=["c12", "c12"])
mylib = reaclib_library.filter(filter)
mylib
C12 + C12 ⟶ He4 + Ne20 [Q = 4.62 MeV] (C12 + C12 --> He4 + Ne20 <cf88_reaclib__>)
C12 + C12 ⟶ p + Na23 [Q = 2.24 MeV] (C12 + C12 --> p + Na23 <cf88_reaclib__>)
C12 + C12 ⟶ n + Mg23 [Q = -2.60 MeV] (C12 + C12 --> n + Mg23 <cf88_reaclib__reverse>)
The rate \({}^{12}\mathrm{C}({}^{12}\mathrm{C},n){}^{23}\mathrm{Mg}\) is quickly followed by \({}^{23}\mathrm{Mg}(n,\gamma){}^{24}\mathrm{Mg}\), so we want to modify that rate sequence to just be \({}^{12}\mathrm{C}({}^{12}\mathrm{C},\gamma){}^{24}\mathrm{Mg}\)
r = mylib.get_rate_by_name("c12(c12,n)mg23")
r
C12 + C12 ⟶ n + Mg23
This has the Q value:
r.Q
-2.598
Now we modify it
r.modify_products("mg24")
r
C12 + C12 ⟶ Mg24 + 𝛾
and we see that the Q value has been updated to reflect the new endpoint
r.Q
13.933578000000125
Now let’s build a network that includes the nuclei involved in our carbon burning. We’ll start by leaving off the \({}^{23}\mathrm{Mg}\)
Caution
We we get the rate object from the library via get_rate_by_name()
(or any similar function), we are getting
a reference to the rate in the library, not a copy. This means that our modification is reflected back in the
original library in memory. Care needs to be taken (e.g. by making a copy or rereading the library) if you want
to access the original rate.
Using our modified rate#
mylib2 = reaclib_library.linking_nuclei(["p", "he4", "c12", "o16", "ne20", "na23", "mg24"])
Now we add in our modified rate
mylib2 += pyna.Library(rates=[r])
mylib2
He4 + He4 + He4 ⟶ C12 + 𝛾 [Q = 7.28 MeV] (He4 + He4 + He4 --> C12 <fy05_reaclib__>)
C12 + He4 ⟶ O16 + 𝛾 [Q = 7.16 MeV] (C12 + He4 --> O16 <nac2_reaclib__>)
C12 + C12 ⟶ He4 + Ne20 [Q = 4.62 MeV] (C12 + C12 --> He4 + Ne20 <cf88_reaclib__>)
C12 + C12 ⟶ p + Na23 [Q = 2.24 MeV] (C12 + C12 --> p + Na23 <cf88_reaclib__>)
C12 + C12 ⟶ Mg24 + 𝛾 [Q = 13.93 MeV] (C12 + C12 --> Mg24 <cf88_reaclib__reverse>)
O16 + He4 ⟶ Ne20 + 𝛾 [Q = 4.73 MeV] (O16 + He4 --> Ne20 <co10_reaclib__>)
O16 + C12 ⟶ He4 + Mg24 [Q = 6.77 MeV] (O16 + C12 --> He4 + Mg24 <cf88_reaclib__>)
Ne20 + He4 ⟶ Mg24 + 𝛾 [Q = 9.32 MeV] (Ne20 + He4 --> Mg24 <il10_reaclib__>)
Na23 + p ⟶ He4 + Ne20 [Q = 2.38 MeV] (Na23 + p --> He4 + Ne20 <il10_reaclib__>)
Na23 + p ⟶ Mg24 + 𝛾 [Q = 11.69 MeV] (Na23 + p --> Mg24 <il10_reaclib__>)
C12 ⟶ He4 + He4 + He4 [Q = -7.28 MeV] (C12 --> He4 + He4 + He4 <fy05_reaclib__reverse>)
O16 ⟶ He4 + C12 [Q = -7.16 MeV] (O16 --> He4 + C12 <nac2_reaclib__reverse>)
Ne20 + He4 ⟶ C12 + C12 [Q = -4.62 MeV] (Ne20 + He4 --> C12 + C12 <cf88_reaclib__reverse>)
Ne20 + He4 ⟶ p + Na23 [Q = -2.38 MeV] (Ne20 + He4 --> p + Na23 <il10_reaclib__reverse>)
Ne20 ⟶ He4 + O16 [Q = -4.73 MeV] (Ne20 --> He4 + O16 <co10_reaclib__reverse>)
Na23 + p ⟶ C12 + C12 [Q = -2.24 MeV] (Na23 + p --> C12 + C12 <cf88_reaclib__reverse>)
Mg24 + He4 ⟶ C12 + O16 [Q = -6.77 MeV] (Mg24 + He4 --> C12 + O16 <cf88_reaclib__reverse>)
Mg24 ⟶ He4 + Ne20 [Q = -9.32 MeV] (Mg24 --> He4 + Ne20 <il10_reaclib__reverse>)
Mg24 ⟶ p + Na23 [Q = -11.69 MeV] (Mg24 --> p + Na23 <il10_reaclib__reverse>)
rc = pyna.RateCollection(libraries=[mylib2])
fig = rc.plot(rotated=True, curved_edges=True, hide_xalpha=True)