part_deriv.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2018, 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 #ifndef O2SCL_PART_DERIV_H
24 #define O2SCL_PART_DERIV_H
25 
26 /** \file part_deriv.h
27  \brief File defining \ref o2scl::part_deriv
28 */
29 
30 #include <string>
31 #include <iostream>
32 #include <fstream>
33 #include <cmath>
34 #include <o2scl/part.h>
35 #include <o2scl/fermion.h>
36 
37 #ifndef DOXYGEN_NO_O2NS
38 namespace o2scl {
39 #endif
40 
41  /** \brief A particle data class with derivatives
42 
43  This class adds the derivatives \ref dndmu, \ref dndT, and
44  \ref dsdT, which correspond to
45  \f[
46  \left(\frac{d n}{d \mu}\right)_{T,V}, \quad
47  \left(\frac{d n}{d T}\right)_{\mu,V}, \quad \mathrm{and} \quad
48  \left(\frac{d s}{d T}\right)_{\mu,V}
49  \f]
50  respectively. All other first-order thermodynamic derivatives
51  can be expressed in terms of the first three derivatives.
52 
53  \comment
54 
55  (This is no longer required)
56 
57  In the
58  case that the particle is interacting (i.e. \ref
59  part::non_interacting is \c false), then the derivatives which
60  are computed are
61  \f[
62  \left(\frac{d n}{d \nu}\right)_{T,V}, \quad
63  \left(\frac{d n}{d T}\right)_{\nu,V}, \quad
64  \left(\frac{d s}{d T}\right)_{\nu,V}, \quad \mathrm{and} \quad
65  \left(\frac{d n}{d m^{*}}\right)_{T,\nu,V},
66  \f]
67  If the particles are interacting, no derivative with respect to
68  the bare mass is given, since classes cannot know how to relate
69  the effective mass to the bare mass.
70 
71  \endcomment
72 
73  */
74  class part_deriv : public part {
75 
76  public:
77 
78  /// Make a particle of mass \c mass and degeneracy \c dof.
79  part_deriv(double mass=0.0, double dof=0.0) : part(mass,dof) {
80  }
81 
82  /// Derivative of number density with respect to chemical potential
83  double dndmu;
84 
85  /// Derivative of number density with respect to temperature
86  double dndT;
87 
88  /// Derivative of entropy density with respect to temperature
89  double dsdT;
90 
91  /// Copy constructor
92  part_deriv(const part_deriv &p) {
93  g=p.g;
94  m=p.m;
95  ms=p.ms;
96  n=p.n;
97  ed=p.ed;
98  pr=p.pr;
99  mu=p.mu;
100  en=p.en;
101  nu=p.nu;
102  dndmu=p.dndmu;
103  dndT=p.dndT;
104  dsdT=p.dsdT;
107  }
108 
109  /// Copy construction with operator=()
111  if (this!=&p) {
112  g=p.g;
113  m=p.m;
114  ms=p.ms;
115  n=p.n;
116  ed=p.ed;
117  pr=p.pr;
118  mu=p.mu;
119  en=p.en;
120  nu=p.nu;
121  dndmu=p.dndmu;
122  dndT=p.dndT;
123  dsdT=p.dsdT;
126  }
127  return *this;
128  }
129 
130  };
131 
132  /** \brief A fermion with derivative information
133  */
134  class fermion_deriv : public part_deriv {
135 
136  public:
137 
138  /// Make a particle of mass \c mass and degeneracy \c dof.
139  fermion_deriv(double mass=0.0, double dof=0.0) : part_deriv(mass,dof) {
140  }
141 
142  /// Fermi momentum
143  double kf;
144 
145  /// Copy constructor
147  g=p.g;
148  m=p.m;
149  ms=p.ms;
150  n=p.n;
151  ed=p.ed;
152  pr=p.pr;
153  mu=p.mu;
154  en=p.en;
155  nu=p.nu;
156  dndmu=p.dndmu;
157  dndT=p.dndT;
158  dsdT=p.dsdT;
161  }
162 
163  /// Copy construction with operator=()
165  if (this!=&p) {
166  g=p.g;
167  m=p.m;
168  ms=p.ms;
169  n=p.n;
170  ed=p.ed;
171  pr=p.pr;
172  mu=p.mu;
173  en=p.en;
174  nu=p.nu;
175  dndmu=p.dndmu;
176  dndT=p.dndT;
177  dsdT=p.dsdT;
180  }
181  return *this;
182  }
183 
184  };
185 
186  /** \brief Compute properties of a fermion including derivatives
187  [abstract base]
188 
189  \future Include explicit zero-temperature calculation, maybe
190  by making this a child of fermion_zerot or by making a
191  new fermion_deriv_zerot?
192  \comment
193  dn/dmu is just g*mu*kf/2/pi^2
194  \endcomment
195  \future There is also a closed form for the derivatives
196  of massless fermions with pairs at finite temperature
197  in Constantinou et al. 2014 which could be implemented here.
198  */
200 
201  public:
202 
203  virtual ~fermion_deriv_thermo() {
204  }
205 
206  /** \brief Calculate properties as function of chemical potential
207  */
208  virtual int calc_mu(fermion_deriv &f, double temper)=0;
209 
210  /** \brief Calculate properties as function of density
211  */
212  virtual int calc_density(fermion_deriv &f, double temper)=0;
213 
214  /** \brief Calculate properties with antiparticles as function of
215  chemical potential
216  */
217  virtual int pair_mu(fermion_deriv &f, double temper)=0;
218 
219  /** \brief Calculate properties with antiparticles as function of
220  density
221  */
222  virtual int pair_density(fermion_deriv &f, double temper)=0;
223 
224  /// Calculate effective chemical potential from density
225  virtual int nu_from_n(fermion_deriv &f, double temper)=0;
226 
227  /** \brief Calculate properties as a function of chemical
228  potential using a degenerate expansion
229 
230  \future There is some repetition of the code
231  for this function and the function
232  \ref o2scl::fermion_eval_thermo::calc_mu_deg() .
233  which could be avoided.
234  */
235  virtual bool calc_mu_deg(fermion_deriv &f, double temper,
236  double prec);
237 
238  /** \brief Calculate properties as a function of chemical
239  potential using a nondegenerate expansion
240 
241  \future There is some repetition of the code
242  for this function and the function
243  \ref o2scl::fermion_eval_thermo::calc_mu_ndeg() .
244  which could be avoided.
245  */
246  virtual bool calc_mu_ndeg(fermion_deriv &f, double temper,
247  double prec, bool inc_antip=false);
248 
249 #ifdef O2SCL_NEVER_DEFINED
250 
251  /** \brief The heat capacity per particle at
252  constant volume (unitless)
253 
254  This function returns
255  \f[
256  \frac{T}{N} \frac{\partial S}{\partial T}_{V,N} =
257  \frac{T}{n} \frac{\partial S}{\partial T}_{V,n} =
258  \frac{T}{N} \frac{\partial E}{\partial T}_{V,N}
259  \f]
260  */
261  double heat_cap_ppart_const_vol(part_deriv &p, double temper) {
262  return (p.dsdT-p.dndT*p.dndT/p.dndmu)*temper/p.n;
263  }
264 
265  /** \brief The heat capacity per particle
266  at constant pressure (unitless)
267  */
268  double heat_cap_ppart_const_press(part_deriv &p, double temper) {
269  return temper/p.n*p.dsdT+p.en*p.en*temper/p.n/p.n/p.n*p.dndmu-
270  2.0*p.en*temper/p.n/p.n*p.dndT;
271  }
272 
273  /** \brief The adiabatic compressibility
274  */
275  double compress_adiabatic(part_deriv &p, double temper) {
276  }
277 
278  /** \brief The isothermal compressibility
279  */
280  double compress_const_tptr(part_deriv &p, double temper) {
281  }
282 
283  /** \brief The coefficient of thermal expansion
284  */
285  double coeff_thermal_exp(part_deriv &p, double temper) {
286  }
287 
288 #endif
289 
290  };
291 
292 
293 #ifndef DOXYGEN_NO_O2NS
294 }
295 #endif
296 
297 #endif
double dsdT
Derivative of entropy density with respect to temperature.
Definition: part_deriv.h:89
double nu
Effective chemical potential.
Definition: part.h:113
double dndT
Derivative of number density with respect to temperature.
Definition: part_deriv.h:86
double n
Number density.
Definition: part.h:101
A particle data class with derivatives.
Definition: part_deriv.h:74
double dndmu
Derivative of number density with respect to chemical potential.
Definition: part_deriv.h:83
part_deriv & operator=(const part_deriv &p)
Copy construction with operator=()
Definition: part_deriv.h:110
A fermion with derivative information.
Definition: part_deriv.h:134
double en
Entropy density.
Definition: part.h:109
Compute properties of a fermion including derivatives [abstract base].
Definition: part_deriv.h:199
fermion_deriv(double mass=0.0, double dof=0.0)
Make a particle of mass mass and degeneracy dof.
Definition: part_deriv.h:139
double kf
Fermi momentum.
Definition: part_deriv.h:143
double m
Mass.
Definition: part.h:99
Particle base class.
Definition: part.h:92
double mu
Chemical potential.
Definition: part.h:107
double pr
Pressure.
Definition: part.h:105
part_deriv(const part_deriv &p)
Copy constructor.
Definition: part_deriv.h:92
double ms
Effective mass (Dirac unless otherwise specified)
Definition: part.h:111
fermion_deriv & operator=(const fermion_deriv &p)
Copy construction with operator=()
Definition: part_deriv.h:164
double ed
Energy density.
Definition: part.h:103
bool non_interacting
True if the particle is non-interacting (default true)
Definition: part.h:119
fermion_deriv(const fermion_deriv &p)
Copy constructor.
Definition: part_deriv.h:146
part_deriv(double mass=0.0, double dof=0.0)
Make a particle of mass mass and degeneracy dof.
Definition: part_deriv.h:79
bool inc_rest_mass
If true, include the mass in the energy density and chemical potential (default true) ...
Definition: part.h:117
double g
Degeneracy (e.g. spin and color if applicable)
Definition: part.h:97

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