All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
eos_nse.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2014, Andrew W. Steiner
5 
6  This file is part of O2scl.
7 
8  O2scl is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  O2scl is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with O2scl. If not, see <http://www.gnu.org/licenses/>.
20 
21  -------------------------------------------------------------------
22 */
23 /** \file eos_nse.h
24  \brief File defining \ref o2scl::eos_nse
25 */
26 #ifndef O2SCL_NSE_EOS_H
27 #define O2SCL_NSE_EOS_H
28 
29 #include <o2scl/classical.h>
30 #include <o2scl/constants.h>
31 #include <o2scl/nucdist.h>
32 #include <o2scl/mm_funct.h>
33 #include <o2scl/mroot_hybrids.h>
34 
35 #ifndef DOXYGEN_NO_O2NS
36 namespace o2scl {
37 #endif
38 
39  /** \brief Equation of state for nuclei in statistical equilibrium
40 
41  This class computes the composition of matter in nuclear statistical
42  equilibrium. The chemical potential of a nucleus X with proton number
43  \f$ Z_X \f$ and neutron number \f$ N_X \f$ is given by
44  \f[
45  \mu_X = N \mu_n + Z \mu_p - E_{\mathrm{bind},X}
46  \f]
47  where \f$ \mu_n \f$ and \f$ \mu_p \f$ are the neutron and proton
48  chemical potentials and \f$ E_{\mathrm{bind},X} \f$ is the binding
49  energy of the nucleus.
50 
51  The baryon number density and electron fraction are then given
52  by
53  \f[
54  n_B = n_{X} (N_X + Z_X) \qquad Y_e n_B = n_X Z_X
55  \f]
56  where \f$ n_X \f$ is the number density which is determined from
57  the chemical potential above.
58 
59  This implicitly assumes that the nuclei are non-interacting.
60 
61  \future Right now calc_density() needs a very good guess. This
62  could be fixed, probably by solving for the log(mu/T) instead
63  of mu.
64  */
65  class eos_nse {
66 
67  public:
68 
71 
72 #ifndef DOXYGEN_INTERNAL
73 
74  protected:
75 
76  /// Parameter structure
77  typedef struct {
78  double nb, Ye, T;
79  std::vector<nucleus> *ndp;
80  } solve_parms;
81 
82  /// Function to solve for baryon and charge conservation
83  int solve_fun(size_t nv, const ubvector &x, ubvector &y,
84  solve_parms &pa);
85 
86  /// Solver
88 
89  /// Compute particle properties assuming classical thermodynamics
91 
92 #endif
93 
94  public:
95 
96  eos_nse();
97 
98  /** \brief If true, call the error handler if calc_density() does
99  not converge (default true)
100  */
102 
103  /** \brief Calculate the equation of state as a function of the
104  chemical potentials
105 
106  Given \c mun, \c mup and \c T, this computes the composition
107  (the individual densities are stored in the distribution \c
108  nd) the baryon number density \c nb, and the electron fraction
109  \c Ye.
110 
111  This function does not use the solver.
112  */
113  void calc_mu(double mun, double mup, double T,
114  double &nb, double &Ye, thermo &th, std::vector<nucleus> &nd);
115 
116  /** \brief Calculate the equation of state as a function of the densities
117 
118  Given the baryon number density \c nb, and the electron
119  fraction \c Ye and the temperature \c T, this computes the
120  composition (the individual densities are stored in the
121  distribution \c nd) and the chemical potentials are given in
122  \c mun and \c mup .
123 
124  This function uses the solver to self-consistently compute
125  the chemical potentials.
126  */
127  int calc_density(double nb, double Ye, double T, double &mun,
128  double &mup, thermo &th, std::vector<nucleus> &nd);
129 
130  /// Default solver
132 
133  /** \brief Set the solver for use in computing the chemical potentials
134  */
136  root=&rp;
137  return;
138  }
139 
140  };
141 
142 #ifndef DOXYGEN_NO_O2NS
143 }
144 #endif
145 
146 #endif
void calc_mu(double mun, double mup, double T, double &nb, double &Ye, thermo &th, std::vector< nucleus > &nd)
Calculate the equation of state as a function of the chemical potentials.
bool err_nonconv
If true, call the error handler if calc_density() does not converge (default true) ...
Definition: eos_nse.h:101
Parameter structure.
Definition: eos_nse.h:77
mroot< mm_funct11, ubvector, jac_funct11 > * root
Solver.
Definition: eos_nse.h:87
mroot_hybrids< mm_funct11, ubvector, ubmatrix, jac_funct11 > def_root
Default solver.
Definition: eos_nse.h:131
void set_mroot(mroot< mm_funct11, ubvector, jac_funct11 > &rp)
Set the solver for use in computing the chemical potentials.
Definition: eos_nse.h:135
int solve_fun(size_t nv, const ubvector &x, ubvector &y, solve_parms &pa)
Function to solve for baryon and charge conservation.
classical cla
Compute particle properties assuming classical thermodynamics.
Definition: eos_nse.h:90
int calc_density(double nb, double Ye, double T, double &mun, double &mup, thermo &th, std::vector< nucleus > &nd)
Calculate the equation of state as a function of the densities.
Equation of state for nuclei in statistical equilibrium.
Definition: eos_nse.h:65

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).
Hosted at Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads..