Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
o2scl::eos_nse_full Class Reference

EOS for nuclear statistical equilibrium with interactions. More...

#include <eos_nse_full.h>

Public Types

typedef boost::numeric::ublas::vector< double > ubvector
typedef boost::numeric::ublas::matrix< double > ubmatrix

Public Member Functions

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() More...
virtual int bracket_mu_solve (double &mun_low, double &mun_high, double &mup_low, double &mup_high, dense_matter &dm)
double mup_for_Ye (double mup, double &mun_low, double &mun_high, dense_matter &dm)
 Fix electron fraction by varying proton chemical potential. More...
virtual double solve_mun (double mun, dense_matter &dm)
 Fix the baryon density by varying the neutron chemical potential. More...
virtual int calc_density_noneq (dense_matter &dm)
 Compute the properties of matter from the densities, not presuming equilibrium. More...
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. More...
virtual int calc_density_by_min (dense_matter &dm)
 Compute the free energy for a fixed composition by minimization. More...
virtual int calc_density_saha (dense_matter &dm)
 Compute properties of matter for baryon density and electron fraction using the Saha equation. More...
virtual void output (dense_matter &dm, int output_level)
 Output properties of a o2scl::dense_matter object to std::cout. More...
virtual int density_match (dense_matter &dm)
 Adjust the particle densities to match specified density and electron fraction. More...
Nucleonic matter EOS
void set_eos (o2scl::eos_had_temp_base &e)
 Set homogeneous matter EOS.
o2scl::eos_had_temp_baseget_eos ()
 Get homogeneous matter EOS. More...
bool is_eos_set ()
 Return true if an EOS was specified.

Public Attributes

o2scl::fermion_rel relf
 Relativistic fermions. More...
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)
Numerical methods
o2scl::mmin_simp2 def_mmin
 The default minimizer.
mroot_hybrids def_mroot
 Default solver.
root_cern def_root
 Lepton solver.

Static Public Attributes

static const int invalid_config =-10
 The integer return value which indicates an invalid configuration.

Protected Member 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. More...
virtual double free_energy (const ubvector &n_nuc, dense_matter &dm)
 Compute the free energy from a vector of densities of the nuclei. More...

Protected Attributes

bool inc_lept_phot
 If true, include electrons and photons (default true)
o2scl::classical cla
 Compute particle properties assuming classical thermodynamics.
o2scl::fermion_deriv_rel snf
 Relativistic fermions with derivatives.
 Mass formula (points to nuc_dens by default)
std::vector< o2scl::nucleus > * ad
 The full distribution of all nuclei to consider. More...
 Nucleonic EOS (0 by default)

Nuclei and nuclear masses

o2scl::nucmass_densmat nuc_dens
 Compute nuclei in dense matter.
void set_mass (o2scl::nucmass_densmat &m)
 Set nuclear mass formula.
void set_dist (std::vector< o2scl::nucleus > &dist)
 Set distribution of nuclei.

Detailed Description

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).

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.

Definition at line 84 of file eos_nse_full.h.

Member Function Documentation

◆ calc_density_by_min()

virtual int o2scl::eos_nse_full::calc_density_by_min ( dense_matter dm)

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() .

This function currently only performs a very simple minimization and currently works in only limited circumstances.

◆ calc_density_fixnp()

virtual int o2scl::eos_nse_full::calc_density_fixnp ( dense_matter dm,
bool  from_densities = true 

If the parameter from_densities is true, then this computes nucleonic matter using the neutron and proton densities stored in dm.n.n and dm.p.n. Otherwise, nucleonic matter is computed using the chemical potential stored in and 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 $ .

◆ calc_density_noneq()

virtual int o2scl::eos_nse_full::calc_density_noneq ( dense_matter dm)

The values of dm.nB and dm.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 $ .

◆ calc_density_saha()

virtual int o2scl::eos_nse_full::calc_density_saha ( dense_matter dm)

This function solves the function specified by solve_fixnp() using the current values of dm.n.n and dm.p.n as initial guesses.

◆ charge_neutrality()

virtual double o2scl::eos_nse_full::charge_neutrality ( double  mu_e,
double  np_tot,
dense_matter dm 

This function returns

\[ \left[n_p-n_e(\mu_e)-n_{\mu}(\mu_{\mu}=\mu_e)\right]/n_p \]

using relf.

◆ density_match()

virtual int o2scl::eos_nse_full::density_match ( dense_matter dm)

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 .

◆ free_energy()

virtual double o2scl::eos_nse_full::free_energy ( const ubvector n_nuc,
dense_matter dm 

This calls calc_density_noneq() and then returns the free energy. The vector n_nuc and the distribution dm.dist must both have the same size. The nuclear densities are taken from n_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.

◆ get_eos()

o2scl::eos_had_temp_base& o2scl::eos_nse_full::get_eos ( )

This function calls the error handler if no EOS has been set

Definition at line 400 of file eos_nse_full.h.

◆ mup_for_Ye()

double o2scl::eos_nse_full::mup_for_Ye ( double  mup,
double &  mun_low,
double &  mun_high,
dense_matter dm 

At some fixed values of dm.Ye and dm.nB, given a value of $ \mu_p $, and given an initial bracket for $ \mu_n $ (stored in mun_low and mun_high), this function attempts to find the value of $ \mu_n $ which ensures that the baryon density in nuclei matches that in dm.nB using a bracketing solver. It then returns the difference between the value of the proton fraction in nuclei and the value in dm.Ye.

If mun_low and mun_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 in

Currently, the values of dm.n.n and dm.p.n are ignored and set to zero.

◆ output()

virtual void o2scl::eos_nse_full::output ( dense_matter dm,
int  output_level 

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.

◆ solve_fixnp()

virtual int o2scl::eos_nse_full::solve_fixnp ( size_t  n,
const ubvector x,
ubvector y,
dense_matter dm,
bool  from_densities = true 

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() .

◆ solve_mun()

virtual double o2scl::eos_nse_full::solve_mun ( double  mun,
dense_matter dm 

Given a value of $ \mu_n $ (the value in is ignored), this function computes the baryon density in nuclei and returns the difference between this value and that stored in dm.nB.

Currently, the values of dm.n.n and dm.p.n are ignored and set to zero.

Member Data Documentation

◆ ad

std::vector<o2scl::nucleus>* o2scl::eos_nse_full::ad
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

Definition at line 125 of file eos_nse_full.h.

◆ relf

o2scl::fermion_rel o2scl::eos_nse_full::relf

Definition at line 365 of file eos_nse_full.h.

The documentation for this class was generated from the following file:

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).