pynucastro.rates.approximate_rates module#
Classes and methods for describing approximations to rates. Often this involves using a group of existing rates to enforce an equilibrium through a nucleus.
- class pynucastro.rates.approximate_rates.ApproximateRate(rates, *, is_reverse=False, approx_type='ap_pg', use_identical_particle_factor=True)[source]#
Bases:
RateAn approximation to a rate sequence A <–> B. The following approximations are currently supported:
“ap_pg” : combine the A(α,γ)B and A(α,p)X(p,γ)B sequences into a single, effective A(α,γ)B rate.
An example of this is combining S32(α,γ)Ar36 and S32(α,p)Cl35(p,γ)Ar36.
“nn_g” : replace the sequence A(n,γ)X(n,γ)B with an effective A(nn,γ)B rate.
An example of this is combining Fe52(n,γ)Fe53(n,γ)Fe54
“Yp_pg” : combine A(Y,γ)B and A(Y,p)X(p,γ)B sequences into a single, effective A(Y,γ)B rate. Note: the original A(Y,γ)B does not need to be included, in which case just A(Y,p)X(p,γ)B is approximated. We also include another pathway from X connecting to a different nucleus C, X(p,α)C. This affects the branching from X that serves as the normalization.
Here Y is another nucleus, and we assume that mass_number(A) >= mass_number(Y)
An example of this is combining O16(O16,p)P31(p,γ)S32 and optionally (a modified rate version of) O16(O16,γ)S32.
“Yp_pa” : combine the A(Y,α)B and A(Y,p)X(p,α)B sequences into a single, effective A(Y,α)B rate. We also include another pathway from X connecting to a different nucleus C, X(p,γ)C. This affects the branching from X that serves as the normalization.
This class stores all of the rates needed to implement these approximations.
- Parameters:
rates (dict(str)) – A dictionary keyed by the generic form of the rate, e.g., “A(a,p)X”, that provides the
Rateobject for that rate. Each approximation has a different set of keys that is expected.is_reverse (bool) – Are we creating the effective A(x,y)B or B(y,x)A?
approx_type (str) – The type of approximation to do. Currently supported are “ap_pg”, “nn_g”, “Yp_pg”, and “Yp_pa”
use_identical_particle_factor (bool) – Usually if a rate has 2 reactants of the same type, we divide by 2, since the order doesn’t matter. However, for some approximations, like A(n,g)X(n,g)B -> A(nn,g), we don’t want this factor, since the neutron captures are sequential. This option allows the double counting factor to be disabled.
- eval(T, *, rho=None, comp=None, screen_func=None)[source]#
Evaluate the approximate rate.
- Parameters:
T (float) – the temperature to evaluate the rate at
rho (float) – the density to evaluate screening effects at.
comp (float) – the composition (of type
Composition) to evaluate screening effects with.screen_func (Callable) – one of the screening functions from
pynucastro.screening– if provided, then the rate will include screening correction.
- Return type:
- function_string_cxx(dtype='double', specifiers='inline', leave_open=False, extra_args=None)[source]#
Return a string containing the C++ function that computes the approximate rate
- Parameters:
dtype (str) – The C++ datatype to use for all declarations
specifiers (str) – C++ specifiers to add before each function declaration (i.e. “inline”)
leave_open (bool) – If
true, then we leave the function unclosed (no “}” at the end). This can allow additional functions to add to this output.extra_args (list(str)) – A list of strings representing additional arguments that should be appended to the argument list when defining the function interface.
- Return type:
- function_string_py()[source]#
Return a string containing the python function that computes the approximate rate.
- Return type:
- log_eval(T, *, rho=None, comp=None, screen_func=None)[source]#
Evaluate the natural log of reaction rate for approximate rate.
- Parameters:
T (float) – the temperature to evaluate the rate at
rho (float) – the density to evaluate screening effects at.
comp (float) – the composition (of type
Composition) to evaluate screening effects with.screen_func (Callable) – one of the screening functions from
pynucastro.screening– if provided, then the rate will include screening correction.
- Return type:
- pynucastro.rates.approximate_rates.create_double_neutron_capture(lib, reactant, product)[source]#
Return a pair of
ApproximateRateobjects for the A(n,g)X(n,g)B -> A(nn,g)B approximation- Parameters:
- Return type: