Class eos_nse (o2scl)¶
-
class eos_nse¶
Equation of state for nuclei in statistical equilibrium.
This class computes the composition of matter in nuclear statistical equilibrium. The chemical potential of a nucleus X with proton number \( Z_X \) and neutron number \( N_X \) is given by
\[ \mu_X = N \mu_n + Z \mu_p - E_{\mathrm{bind},X} \]where \( \mu_n \) and \( \mu_p \) are the neutron and proton chemical potentials and \( E_{\mathrm{bind},X} \) is the binding energy of the nucleus. The chemical potentials are assumed to be in units of \( \mathrm{fm}^{-1} \).The baryon number density and electron fraction are then given by
\[ n_B = \sum_X n_{X} (N_X + Z_X) \qquad Y_e n_B = \sum_X n_X Z_X \]where \( n_X \) is the number density which is determined from the chemical potential above.The nuclei in specified in the parameter named
nd
, must have their proton number, neutron number, mass number, binding energy, and spin degeracy already specified. This class implicitly assumes that the nuclei are non-interacting and that the values ofpart::inc_rest_mass
are false. The chemical potential arguments also do not include the rest mass. The nuclear rest mass is presumed to be \( Z_X m_p + N_X m_n \).The function calc_density() attempts to solve for the neutron and proton chemical potentials given the neutron and proton densities. However, this is relatively difficult. At low enough temperatures, \( n(\mu) \) is a staircase-like function with alernating regions which are very flat and or nearly vertical. For this reason, derivative-based methods often fail without extremely good guesses. The current method of solution combines make_guess(), density_min() and direct_solve() in order to obtain the solution.
Note also that calc_density() will fail if there are no nuclei in the distribution which equal, or surround the requested value of \( Y_e=n_p/(n_n+n_p) \) determined from
nn
andnp
.Basic usage
-
int verbose¶
Verbosity parameter (default 1)
-
bool err_nonconv¶
If true, call the error handler if calc_density() does not converge (default true)
-
void calc_mu(double mun, double mup, double T, double &nn, double &np, thermo &th, std::vector<nucleus> &nd)¶
Calculate the equation of state as a function of the chemical potentials.
Given
mun
,mup
andT
, this computes the composition (the individual densities are stored in the distributionnd
), the neutron number densitynn
, and the proton number densitynp
. Note that the densities can be infinite if the chemical potentials are sufficiently large.This function does not use the solver or the minimizer.
-
int calc_density(double nn, double np, double T, double &mun, double &mup, thermo &th, std::vector<nucleus> &nd)¶
Calculate the equation of state as a function of the densities.
Given the neutron number density
nn
in \( \mathrm{fm}^{-3} \), the proton number densitynp
and the temperatureT
in \( \mathrm{fm}^{-1} \), this computes the composition (the individual densities are stored in the distributionnd
) and the chemical potentials are given inmun
andmup
. The nuclei innd
must have their proton number, neutron number, atomic number, binding energy, and spin degeracy already specified.This function uses make_guess(), direct_solve(), and density_min(), to self-consistently compute the chemical potentials.
Tools for fixing chemical potentials from the densities
-
size_t make_guess_iters¶
The maximum number of iterations for make_guess() (default 60)
-
double make_guess_init_step¶
The initial stepsize for the chemical potentials relative to the temperature (default \( 10^5 \) )
-
int make_guess(double &mun, double &mup, double T, thermo &th, std::vector<nucleus> &nd, double nn_min = 1.0e-20, double nn_max = 1.0e8, double np_min = 1.0e-20, double np_max = 1.0e8, bool err_on_fail = true)¶
Find values for the chemical potentials which ensure that the densities are within a fixed range.
This function improves initial guesses for the chemical potentials in order to ensure the densities are within a specified range. It can sometimes even succeed when the chemical potentials are so far off as to make the densities infinite or zero. This function is used by calc_density() to improve the initial guesses for the chemical potentials if necessary.
The algorithm can fail in several different ways. This is particularly likely if the density range specified by
nn_min
,nn_max
,np_min
, andnp_max
is small. This function ignores the value of err_nonconv, and throws an exception on failure only iferr_on_fail
is true (which is the default).
-
int direct_solve(double nn, double np, double T, double &mun, double &mup, thermo &th, std::vector<nucleus> &nd)¶
Obtain chemical potentials from densities directly using a solver.
This function often requires extremely good guesses for the chemical potentials, especially at low temperatures.
-
int density_min(double nn, double np, double T, double &mun, double &mup, thermo &th, std::vector<nucleus> &nd)¶
Obtain chemical potentials from densities using a minimizer.
This function often requires extremely good guesses for the chemical potentials, especially at low temperatures. By default, this calls the minimizer five times, as this seems to improve convergence using the default minimizer. By default, the value of o2scl::mmin_base::err_nonconv is set to false for def_mmin .
Numerical methods
-
mroot_hybrids def_mroot¶
Default solver.
-
mmin_simp2 def_mmin¶
Default minimizer.
-
inline void set_mroot(mroot<> &rp)¶
Set the solver for use in direct_solve()
-
inline void set_mmin(mmin_base<> &mp)¶
Set the minimizer for use in density_min()
Public Types
-
typedef boost::numeric::ublas::vector<double> ubvector¶
Public Functions
-
eos_nse()¶
-
int verbose¶