pynucastro.networks.nse_network module#
- class pynucastro.networks.nse_network.NSENetwork(rate_files=None, libraries=None, rates=None, inert_nuclei=None, symmetric_screening=False, do_screening=True)[source]#
Bases:
RateCollection
a network for solving for 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 composition and return a reduced composition
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]#
Returns 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, [mu_p, mu_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:
object
A 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 dictionary with the nucleus name (like “Ni56”) as the key and the corresponding mass fraction as the value. It should be ordered in the way you want the nuclei output into the NSE table file.