Class eos_nse_full (o2scl)¶
-
class eos_nse_full¶
EOS for nuclear statistical equilibrium with interactions.
This class is experimental.
For the verbose parameter, generally 0 means no output, 1 means the function will output the composition and thermodynamics for the first 10 or so nuclei in the distribution, and 2 means the function will output the entire distribution.
This class retains the usual mechanism using err_nonconv to handle what to do if one of the functions does not converge. In addition, calc_density_fixnp() and calc_density_noneq() return invalid_config for invalid configurations, which sometimes occur during normal execution. Since these invalid configurations are ‘normal’, they do not cause the error handler to be called, independent of the value of err_nonconv . Practically, this means the end-user must check the return value of these two functions every time they are called.
This class presumes that electrons include their rest mass, but nucleons and nuclei do not. The error handler is called by some functions if this is not the case (determined by the values in
o2scl::part::inc_rest_mass
).Todo
In class eos_nse_full: I don’t think inc_lept_phot=false works because then all WS cells have infinite size because of no electrons. For the moment, this variable is protected to discourage the user from changing it.
- Idea for Future:
There is a bit of duplication between calc_density_noneq() and calc_density_fixnp() which could be streamlined.
Add fermion and boson statistics to the nuclei in the distribution.
Various settings
-
int verbose¶
Verbose parameter.
-
bool err_nonconv¶
If true, call the error handler if calc_density() does not converge (default true)
-
bool inc_prot_coul¶
If true, include dripped protons and neutrons in the nuclear mass (default true)
-
bool include_muons¶
If true, include muons (default false)
-
o2scl::fermion_rel relf¶
Relativistic fermions.
-
virtual int solve_fixnp(size_t n, const ubvector &x, ubvector &y, dense_matter &dm, bool from_densities = true)¶
Function which is solved by calc_density_saha()
This function takes two inputs, the neutron and proton densities, and solves to ensure that dense_matter::baryon_density() matches o2scl::dense_matter::nB and o2scl::dense_matter::electron_fraction() matches dense_matter::Ye.
This function calls calc_density_fixnp() .
-
virtual int bracket_mu_solve(double &mun_low, double &mun_high, double &mup_low, double &mup_high, dense_matter &dm)¶
Solve matter at fixed chemical potential by bracketing.
-
double mup_for_Ye(double mup, double &mun_low, double &mun_high, dense_matter &dm)¶
Fix electron fraction by varying proton chemical potential.
At some fixed values of
dm.Ye
anddm.nB
, given a value of \( \mu_p \), and given an initial bracket for \( \mu_n \) (stored inmun_low
andmun_high
), this function attempts to find the value of \( \mu_n \) which ensures that the baryon density in nuclei matches that indm.nB
using a bracketing solver. It then returns the difference between the value of the proton fraction in nuclei and the value indm.Ye
.If
mun_low
andmun_high
do not bracket the correct value of \( \mu_n \), this function attempts to modify them to give a proper bracket for the root. The finaly value of \( \mu_n \) is stored indm.n.mu
.Currently, the values of
dm.n.n
anddm.p.n
are ignored and set to zero.
-
virtual double solve_mun(double mun, dense_matter &dm)¶
Fix the baryon density by varying the neutron chemical potential.
Given a value of \( \mu_n \) (the value in
dm.n.mu
is ignored), this function computes the baryon density in nuclei and returns the difference between this value and that stored indm.nB
.Currently, the values of
dm.n.n
anddm.p.n
are ignored and set to zero.
-
virtual int calc_density_noneq(dense_matter &dm)¶
Compute the properties of matter from the densities, not presuming equilibrium.
The values of
dm.nB
anddm.Ye
are ignored and unchanged by this function. The electron and muon density are determined by charged neutrality and assuming their chemical potentials are equal. Photons are always included.If the nuclear densities are all zero, then this just returns nuclear matter with leptons and photons as determined by charge neutrality.
This function is designed to return non-zero values for invalid configurations and can return the value invalid_config without calling the error handler, independent of the value of err_nonconv .
Possible invalid configurations are:
negative nucleon or nucleus densities, or
proton radii larger than WS cell radii, i.e. \( (0.08 - n_p) / (n_e+n_{\mu}-n_p) < 1 \) or \( n_p > 0.08 \) .
-
virtual int calc_density_fixnp(dense_matter &dm, bool from_densities = true)¶
Compute the properties of matter from neutron and proton densities, using the Saha equation.
If the parameter
from_densities
is true, then this computes nucleonic matter using the neutron and proton densities stored indm.n.n
anddm.p.n
. Otherwise, nucleonic matter is computed using the chemical potential stored indm.n.mu
anddm.p.mu
. Either way, electrons are computed assuming their density is given from o2scl::dense_matter::nB and o2scl::dense_matter::Ye. Muons are added assuming their chemical potential is equal to the electron chemical potential. Finally, the Saha equation is used to determine the nuclear chemical potentials and this gives the nuclear densities.This function only works when inc_prot_coul is
false
.The values in o2scl::dense_matter::nB and o2scl::dense_matter::Ye are unchanged by this function. Note that, after this function completes, the value returned by o2scl::dense_matter::baryon_density() will not necessarily be the same as that stored in o2scl::dense_matter::nB (and similarly for the electron fraction).
This function is designed to return non-zero values for invalid configurations and can return the value invalid_config without calling the error handler, independent of the value of err_nonconv .
Possible invalid configurations are:
negative nucleon densities, or
proton radii larger than WS cell radii, i.e. \( (0.08 - n_p) / (n_e+n_{\mu}-n_p) < 1 \) or \( n_p > 0.08 \) .
-
virtual int calc_density_by_min(dense_matter &dm)¶
Compute the free energy for a fixed composition by minimization.
Given a fixed baryon density (dm.nB), electron fraction (dm.Ye), temperature (dm.T), this minimizes the free energy over the densities of the nuclei currently present in the distribution. The neutron and proton drip densities are determined by ensuring that the baryon density and electron fraction are correctly reproduced. The function which is minimized is free_energy() .
Note
This function currently only performs a very simple minimization and currently works in only limited circumstances.
-
virtual int calc_density_saha(dense_matter &dm)¶
Compute properties of matter for baryon density and electron fraction using the Saha equation.
This function solves the function specified by solve_fixnp() using the current values of
dm.n.n
anddm.p.n
as initial guesses.
-
virtual void output(dense_matter &dm, int output_level)¶
Output properties of a o2scl::dense_matter object to std::cout.
This function was particularly designed for comparing results with o2scl::eos_sn_base derived classes.
If output level is 0, then just the basic quantities are output without any information about the distribution. If output_level is 1, then only about 10 nuclei in the distribution are output, and if output_level is 2, then all nuclei in the distribution are output.
-
virtual int density_match(dense_matter &dm)¶
Adjust the particle densities to match specified density and electron fraction.
This function attempts to match the nuclear and nucleon densities so that the baryon density and electron fraction are equal to those specified in o2scl::dense_matter::nB and o2scl::dense_matter::Ye .
Nuclei and nuclear masses
-
o2scl::nucmass_densmat nuc_dens¶
Compute nuclei in dense matter.
-
inline void set_mass(o2scl::nucmass_densmat &m)¶
Set nuclear mass formula.
Numerical methods
-
o2scl::mmin_simp2 def_mmin¶
The default minimizer.
-
mroot_hybrids def_mroot¶
Default solver.
Nucleonic matter EOS
-
inline void set_eos(o2scl::eos_had_temp_base &e)¶
Set homogeneous matter EOS.
-
inline o2scl::eos_had_temp_base &get_eos()¶
Get homogeneous matter EOS.
This function calls the error handler if no EOS has been set
-
inline bool is_eos_set()¶
Return true if an EOS was specified.
Public Types
-
typedef boost::numeric::ublas::vector<double> ubvector¶
-
typedef boost::numeric::ublas::matrix<double> ubmatrix¶
Public Functions
-
eos_nse_full()¶
Public Static Attributes
-
static const int invalid_config = -10¶
The integer return value which indicates an invalid configuration.
Protected Functions
-
virtual void check_dm(o2scl::dense_matter &dm)¶
Check the o2scl::dense_matter object to see if the rest masses are correctly included or not, etc.
-
virtual void verb_output(o2scl::dense_matter &dm, std::string func_name)¶
Output a o2scl::dense_matter object according to the setting of verbose for function specified in
func_name
.
-
virtual double charge_neutrality(double mu_e, double np_tot, dense_matter &dm)¶
Solve for charge neutrality assuming the specified electron chemical potential and proton number density.
This function returns
\[ \left[n_p-n_e(\mu_e)-n_{\mu}(\mu_{\mu}=\mu_e)\right]/n_p \]using relf.
-
virtual double free_energy(const ubvector &n_nuc, dense_matter &dm)¶
Compute the free energy from a vector of densities of the nuclei.
This calls calc_density_noneq() and then returns the free energy. The vector
n_nuc
and the distributiondm.dist
must both have the same size. The nuclear densities are taken fromn_nuc
and the proton and neutron densities are determined automatically from subtracting the density contributions of nuclei from the total neutron and proton densities as determined in o2scl::dense_matter::nB and o2scl::dense_matter::Ye .If the call to calc_density_noneq() returns a non-zero value, e.g. because of an invalid configuration, then the value \( 10^{4} \) is returned.
Protected Attributes
-
bool inc_lept_phot¶
If true, include electrons and photons (default true)
-
o2scl::classical_thermo cla¶
Compute particle properties assuming classical thermodynamics.
-
o2scl::fermion_deriv_rel snf¶
Relativistic fermions with derivatives.
-
o2scl::nucmass_densmat *massp¶
Mass formula (points to nuc_dens by default)
-
std::vector<o2scl::nucleus> *ad¶
The full distribution of all nuclei to consider.
Note
Currently, the
ad
variable doesn’t do much, but it’s important to leave this in as future functions may want to automatically adjust the distribution
-
o2scl::eos_had_temp_base *ehtp¶
Nucleonic EOS (0 by default)