All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
eos_crust_virial.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2013-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_crust_virial.h
24  \brief File defining \ref o2scl::eos_crust_virial
25 */
26 #ifndef O2SCL_VIRIAL_EOS_H
27 #define O2SCL_VIRIAL_EOS_H
28 
29 #include <cmath>
30 #include <o2scl/constants.h>
31 #include <o2scl/lib_settings.h>
32 #include <o2scl/interp.h>
33 #include <o2scl/boson.h>
34 #include <o2scl/eos_had_base.h>
35 
36 #ifndef DOXYGEN_NO_O2NS
37 namespace o2scl {
38 #endif
39 
40  /** \brief Virial EOS for neutrons, protons, deuterons, and alpha
41  particles
42 
43  Virial EOS from \ref Horowitz05.
44 
45  \warning This class is implemented as a eos_had_base object
46  because it might be helpful to be able to use \ref
47  o2scl::eos_had_temp_base::calc_temp_e(), but because of the
48  alpha particles and deuterons, some of the other \ref
49  o2scl::eos_had_base methods don't have the correct
50  interpretation.
51  */
53 
54  protected:
55 
56  /// \name Interpolation for virial coefficients
57  //@{
58  std::vector<double> Tv, bnv, Tbnpv, bpnv, Tbpnpv;
59  std::vector<double> banv, Tbanpv, bav, Tbapv;
60  interp_vec<std::vector<double> > ibn, iTbnp, ibpn, iTbpnp,
61  iban, iTbanp, iba, iTbap;
62  //@}
63 
64  public:
65 
67 
69  ("kg","1/fm",o2scl_mks::mass_alpha),1.0);
71  ("kg","1/fm",o2scl_mks::mass_deuteron),1.0);
72 
73  // Data from the tables in Horowitz05. The rows for T<=10 MeV
74  // are from Table 1 and Table 2 and the rows for T>10 MeV are
75  // from Table 3.
76  double arr[16][9]={
77  {0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},
78  {1,0.288,0.032,19.4,-43.8,1.51,1.21,2.55,1.59},
79  {2,0.303,0.012,6.10,-7.39,2.26,0.90,4.12,2.95},
80  {3,0.306,0.005,4.01,-3.54,2.57,0.63,5.64,4.81},
81  {4,0.307,0.002,3.19,-2.30,2.73,0.44,7.44,7.90},
82  {5,0.308,0.002,2.74,-1.73,2.81,0.32,9.57,11.3},
83  {6,0.308,0.003,2.46,-1.40,2.86,0.23,11.9,14.3},
84  {7,0.308,0.004,2.26,-1.18,2.89,0.18,14.3,16.3},
85  {8,0.309,0.006,2.11,-1.04,2.92,0.15,16.5,17.3},
86  {9,0.310,0.008,2.00,-0.93,2.93,0.14,18.6,17.5},
87  {10,0.311,0.010,1.91,-0.85,2.95,0.13,20.4,17.0},
88  {12,0.313,0.013,1.76,-0.73,2.97,0.12,23.3,14.7},
89  {14,0.315,0.014,1.66,-0.65,2.98,0.10,25.4,11.7},
90  {16,0.317,0.014,1.57,-0.59,3.00,0.07,26.7,8.48},
91  {18,0.319,0.013,1.51,-0.55,3.00,0.02,27.5,5.44},
92  {20,0.320,0.011,1.45,-0.52,3.00,-0.04,28.0,2.69}};
93  for(size_t i=0;i<16;i++) {
94  Tv.push_back(arr[i][0]);
95  bnv.push_back(arr[i][1]);
96  Tbnpv.push_back(arr[i][2]);
97  bpnv.push_back(arr[i][3]);
98  Tbpnpv.push_back(arr[i][4]);
99  banv.push_back(arr[i][5]);
100  Tbanpv.push_back(arr[i][6]);
101  bav.push_back(arr[i][7]);
102  Tbapv.push_back(arr[i][8]);
103  }
104  ibn.set(16,Tv,bnv,itp_linear);
105  iTbnp.set(16,Tv,Tbnpv,itp_linear);
106  ibpn.set(16,Tv,bpnv,itp_linear);
107  iTbpnp.set(16,Tv,Tbpnpv,itp_linear);
108  iban.set(16,Tv,banv,itp_linear);
109  iTbanp.set(16,Tv,Tbanpv,itp_linear);
110  iba.set(16,Tv,bav,itp_linear);
111  iTbap.set(16,Tv,Tbapv,itp_linear);
112  }
113 
114  virtual ~eos_crust_virial() {
115  }
116 
117  /// Internal alpha particle
119 
120  /// Internal deuteron
122 
123  /** \brief Equation of state as a function of the chemical potentials
124  */
125  virtual int calc_p(fermion &ne, fermion &pr, thermo &th) {
126  O2SCL_ERR("Virial EOS does not work at T=0",exc_efailed);
127  return 0;
128  }
129 
130  /** \name The virial coefficients and their temperature derivatives
131 
132  These functions assume that the temperature is specified in MeV
133  */
134  //@{
135  virtual double bn(double T) {
136  return ibn.eval(T);
137  }
138 
139  virtual double ban(double T) {
140  return iban.eval(T);
141  }
142 
143  virtual double ba(double T) {
144  return iba.eval(T);
145  }
146 
147  virtual double bpn(double T) {
148  return ibpn.eval(T);
149  }
150 
151  virtual double Tbn_prime(double T) {
152  return iTbnp.eval(T);
153  }
154 
155  virtual double Tban_prime(double T) {
156  return iTbanp.eval(T);
157  }
158 
159  virtual double Tba_prime(double T) {
160  return iTbap.eval(T);
161  }
162 
163  virtual double Tbpn_prime(double T) {
164  return iTbpnp.eval(T);
165  }
166  //@}
167 
168  /** \brief Equation of state as a function of the chemical potentials
169  at finite temperature
170  */
171  virtual int calc_temp_p(fermion &n, fermion &p, double T,
172  thermo &th) {
173 
174  return calc_temp_p_alpha(n,p,deuteron,alpha,T,th);
175  }
176 
177  /** \brief Equation of state as a function of the chemical
178  potentials at finite temperature with alpha particles and
179  deuterons
180  */
181  virtual int calc_temp_p_alpha(fermion &n, fermion &p, boson &d, boson &a,
182  double T, thermo &th) {
183 
184  double TMeV=T*o2scl_const::hc_mev_fm;
185 
186  a.mu=2.0*p.mu+2.0*n.mu;
187  d.mu=p.mu+n.mu;
188 
189  double zn, zp, za, zd;
190  if (n.inc_rest_mass) {
191  zn=exp((n.mu-n.m)/T);
192  } else {
193  zn=exp(n.mu/T);
194  }
195  if (p.inc_rest_mass) {
196  zp=exp((p.mu-p.m)/T);
197  } else {
198  zp=exp(p.mu/T);
199  }
200  za=zp*zp*zn*zn*exp(-(a.m-2.0*n.m-2.0*p.m)/T);
201  zd=zp*zn*exp(-(d.m-n.m-p.m)/T);
202 
203  double lambda=sqrt(4.0*o2scl_const::pi/(n.m+p.m)/T);
204  double lambdaa=sqrt(2.0*o2scl_const::pi/a.m/T);
205  double lambda3=pow(lambda,3.0);
206  double lambdaa3=pow(lambdaa,3.0);
207  double lambdad=sqrt(2.0*o2scl_const::pi/d.m/T);
208  double lambdad3=pow(lambdad,3.0);
209 
210  th.pr=T*(2.0/lambda3*(zn+zp+(zn*zn+zp*zp)*bn(TMeV)+2.0*zp*zn*bpn(TMeV))
211  +1.0/lambdaa3*(za+za*za*ba(TMeV)+2.0*za*(zn+zp)*ban(TMeV)));
212 
213  n.n=2.0/lambda3*(zn+2.0*zn*zn*bn(TMeV)+2.0*zp*zn*bpn(TMeV)+
214  8.0*za*zn*ban(TMeV));
215  p.n=2.0/lambda3*(zp+2.0*zp*zp*bn(TMeV)+2.0*zp*zn*bpn(TMeV)+
216  8.0*za*zp*ban(TMeV));
217  a.n=1.0/lambdaa3*(za+2.0*za*za*ba(TMeV)+2.0*za*(zn+zp)*ban(TMeV));
218  d.n=1.0/lambdad3*zd;
219 
220  th.en=5.0*th.pr/2.0/T-n.n*log(zn)-p.n*log(zp)-a.n*log(za)+
221  2.0/lambda3*((zn*zn+zp*zp)*Tbn_prime(TMeV)+
222  2.0*zp*zn*Tbpn_prime(TMeV))+
223  1.0/lambdaa3*(za*za*Tba_prime(TMeV)+2.0*za*(zn+zp)*Tban_prime(TMeV));
224 
225  th.ed=-th.pr+T*th.en;
226  if (n.inc_rest_mass) {
227  th.ed+=n.n*n.mu;
228  } else {
229  th.ed+=n.n*n.mu+n.n*n.m;
230  }
231  if (p.inc_rest_mass) {
232  th.ed+=p.n*p.mu;
233  } else {
234  th.ed+=p.n*p.mu+p.n*p.m;
235  }
236  if (a.inc_rest_mass) {
237  th.ed+=a.n*a.mu;
238  } else {
239  th.ed+=a.n*a.mu+a.n*a.m;
240  }
241  /*
242  Alternate expression for the energy density
243 
244  double ed2=th.pr*1.5-a.n*Ealpha+2.0*T/lambda3*
245  ((zn*zn+zp*zp)*Tbn_prime(TMeV)+2.0*zn*zp*Tbpn_prime(TMeV))+
246  T/lambdaa3*(za*za*Tba_prime(TMeV)+2.0*za*(zn+zp)*Tban_prime(TMeV));
247  */
248 
249  return 0;
250  }
251 
252  };
253 
254 #ifndef DOXYGEN_NO_O2NS
255 }
256 #endif
257 
258 #endif
const double pi
virtual int calc_temp_p(fermion &n, fermion &p, double T, thermo &th)
Equation of state as a function of the chemical potentials at finite temperature. ...
virtual double convert(std::string from, std::string to, double val)
lib_settings_class o2scl_settings
const double mass_deuteron
const double hc_mev_fm
const double mass_alpha
Virial EOS for neutrons, protons, deuterons, and alpha particles.
virtual int calc_temp_p_alpha(fermion &n, fermion &p, boson &d, boson &a, double T, thermo &th)
Equation of state as a function of the chemical potentials at finite temperature with alpha particles...
A hadronic EOS at finite temperature based on a function of the chemical potentials [abstract base]...
boson deuteron
Internal deuteron.
boson alpha
Internal alpha particle.
convert_units & get_convert_units()
#define O2SCL_ERR(d, n)
virtual void init(double mass, double dof)
virtual double eval(const double x0) const
bool inc_rest_mass
virtual int calc_p(fermion &ne, fermion &pr, thermo &th)
Equation of state as a function of the chemical potentials.
void set(size_t n, const vec_t &x, const vec2_t &y)

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