pynucastro.networks.nse_network module#
A collection of classes and methods for working with nuclear statistical equilibrium.
- class pynucastro.networks.nse_network.NSENetwork(*args, use_unreliable_spins=True, **kwargs)[source]#
Bases:
RateCollectionA network for solving the NSE composition and outputting tabulated NSE quantities
- generate_table(rho_values=None, T_values=None, Ye_values=None, comp_reduction_func=None, verbose=False, outfile='nse.tbl')[source]#
Generate a table of NSE properties. For every combination of density, temperature, and Ye, we solve for the NSE state and output composition properties to a file.
- Parameters:
rho_values (numpy.ndarray) – values of density to use in the tabulation
T_values (numpy.ndarray) – values of temperature to use in the tabulation
Ye_values (numpy.ndarray) – values of electron fraction to use in the tabulation
comp_reduction_func (Callable) – a function that takes the NSE
Compositionobject and returns a newCompositionrepresenting a reduced set of nuclei.verbose (bool) – output progress on creating the table as we go along
outfile (str) – filename for the NSE table output
- get_comp_nse(rho, T, ye, init_guess=(-3.5, -15), tol=1e-11, use_coulomb_corr=False, return_sol=False)[source]#
Return the NSE composition given density, temperature and prescribed electron fraction using scipy.fsolve.
- Parameters:
rho (float) – NSE state density
T (float) – NSE state Temperature
ye (float) – prescribed electron fraction
init_guess ((tuple, list)) – initial guess of chemical potential of proton and neutron, [μ^{id}_p + μ^{c}_p, μ^{id}_n]
tol (float) – tolerance of scipy.fsolve
use_coulomb_corr (bool) – whether to include coulomb correction terms
return_sol (bool) – whether to return the solution of the proton and neutron chemical potential.
- Returns:
comp (Composition) – the NSE composition
u (ndarray) – the chemical potentials found by solving the nonlinear system.
- class pynucastro.networks.nse_network.NSETableEntry(rho, T, Ye, *, comp=None, ydots=None, enu=None, comp_reduction_func=None)[source]#
Bases:
objectA simple container to hold a single entry in the NSE table.
- Parameters:
rho (float) – the density of the NSE state
T (float) – the temperature of the NSE state
Ye (float) – the electron fraction
comp (Composition) – the NSE composition
ydots (dict) – a dictionary of dY/dt keyed by Nucleus. This is meant to be the weak nuclear rates only, since those affect the NSE state.
enu (float) – the weak rate neutrino energy loss
comp_reduction_function (Callable) – a function that converts the NSE composition into a smaller set of nuclei. It takes a Composition object and returns a new Composition object representing the reduced set of nuclei and their abundances.