eos_had_gogny.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2013-2017, 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_had_gogny.h
24  \brief File defining \ref o2scl::eos_had_gogny
25 */
26 #ifndef O2SCL_GOGNY_EOS_H
27 #define O2SCL_GOGNY_EOS_H
28 
29 #include <cmath>
30 #include <o2scl/constants.h>
31 #include <o2scl/eos_had_base.h>
32 #include <o2scl/table3d.h>
33 
34 #ifndef DOXYGEN_NO_O2NS
35 namespace o2scl {
36 #endif
37 
38  /** \brief Gogny EOS
39 
40  Gogny EOS from \ref Chappert08 with data kindly supplied
41  by Michel Girod.
42 
43  \warning The table might not have a sufficiently dense grid to
44  accurately compute derivatives, including compressibility and
45  symmetry energy.
46  */
48 
49  public:
50 
51  /// The original EOS data
53 
54  eos_had_gogny() {
55  }
56 
57  virtual ~eos_had_gogny() {
58  }
59 
60  /** \brief Equation of state as a function of density
61  */
62  virtual int calc_e(fermion &ne, fermion &pr, thermo &th) {
63 
64  if (t3d.get_nx()==0) {
65  O2SCL_ERR("No data loaded in eos_had_gogny::calc_e().",
66  exc_einval);
67  }
68 
69  double rho=ne.n+pr.n;
70  double asym=(ne.n-pr.n)/(ne.n+pr.n);
71  double hc=o2scl_const::hc_mev_fm;
72 
73  // Arbitrarily set effective masses to bare masses
74  ne.ms=ne.m;
75  pr.ms=pr.m;
76 
77  // The energy density
78  double E=t3d.interp(rho,asym,"enneut")/hc;
79  th.ed=E*rho+ne.n*ne.m+pr.n*pr.m;
80 
81  // The derivatives of the energy densities wrt the baryon density
82  double dEdrho=t3d.deriv_x(rho,asym,"enneut")/hc;
83  double dEda=t3d.deriv_y(rho,asym,"enneut")/hc;
84  ne.mu=ne.m+E+ne.n*(dEdrho+dEda*2.0*pr.n/rho/rho);
85  pr.mu=pr.m+E+pr.n*(dEdrho-dEda*2.0*ne.n/rho/rho);
86 
87  // The pressure
88  th.pr=-th.ed+ne.n*ne.mu+pr.n*pr.mu;
89 
90  return 0;
91  }
92 
93  };
94 
95 #ifndef DOXYGEN_NO_O2NS
96 }
97 #endif
98 
99 #endif
double deriv_x(double x, double y, std::string name)
table3d t3d
The original EOS data.
Definition: eos_had_gogny.h:52
size_t get_nx() const
exc_einval
const double hc_mev_fm
A hadronic EOS based on a function of the densities [abstract base].
Definition: eos_had_base.h:932
#define O2SCL_ERR(d, n)
double deriv_y(double x, double y, std::string name)
virtual int calc_e(fermion &ne, fermion &pr, thermo &th)
Equation of state as a function of density.
Definition: eos_had_gogny.h:62
double interp(double x, double y, std::string name)

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