part_deriv.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-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 #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. In the
52  case that the particle is interacting (i.e. \ref
53  part::non_interacting is \c false), then the derivatives which
54  are computed are
55  \f[
56  \left(\frac{d n}{d \nu}\right)_{T,V}, \quad
57  \left(\frac{d n}{d T}\right)_{\nu,V}, \quad
58  \left(\frac{d s}{d T}\right)_{\nu,V}, \quad \mathrm{and} \quad
59  \left(\frac{d n}{d m^{*}}\right)_{T,\nu,V},
60  \f]
61  If the particles are interacting, no derivative with respect to
62  the bare mass is given, since classes cannot know how to relate
63  the effective mass to the bare mass.
64 
65  \hline
66 
67  <b>Other derivatives with respect
68  to chemical potential and temperature:</b>
69 
70  There is a Maxwell relation
71  \f[
72  \left(\frac{d s}{d \mu}\right)_{T,V} =
73  \left(\frac{d n}{d T}\right)_{\mu,V}
74  \f]
75  The pressure derivatives are trivial
76  \f[
77  \left(\frac{d P}{d \mu}\right)_{T,V}=n, \quad
78  \left(\frac{d P}{d T}\right)_{\mu,V}=s
79  \f]
80  The energy density derivatives are related through the
81  thermodynamic identity:
82  \f[
83  \left(\frac{d \varepsilon}{d \mu}\right)_{T,V}=
84  \mu \left(\frac{d n}{d \mu}\right)_{T,V}+
85  T \left(\frac{d s}{d \mu}\right)_{T,V}
86  \f]
87  \f[
88  \left(\frac{d \varepsilon}{d T}\right)_{\mu,V}=
89  \mu \left(\frac{d n}{d T}\right)_{\mu,V}+
90  T \left(\frac{d s}{d T}\right)_{\mu,V}
91  \f]
92 
93  \hline
94 
95  <b>Other derivatives:</b>
96 
97  Note that the derivative of the entropy with respect to the
98  temperature above is not the specific heat per particle, \f$ c_V \f$.
99  The specific heat per particle is
100  \f[
101  c_V = \frac{T}{N} \left( \frac{\partial S}{\partial T} \right)_{V,N}
102  = \frac{T}{n} \left( \frac{\partial s}{\partial T} \right)_{V,n}
103  \f]
104  As noted in \ref part_section in the User's Guide for \o2p, we
105  work in units so that \f$ \hbar = c = k_B = 1 \f$. In this case,
106  \f$ c_V \f$ is unitless as defined here. To compute \f$ c_V \f$
107  in terms of the derivatives above, note that the
108  descendants of part_deriv provide all of the thermodynamic
109  functions in terms of \f$ \mu, V \f$ and \f$ T \f$, so we have
110  \f[
111  s=s(\mu,T,V) \quad \mathrm{and} \quad n=n(\mu,T,V) \, .
112  \f]
113  We can then construct a function
114  \f[
115  s=s[\mu(n,T,V),T,V]
116  \f]
117  and then write the required derivative directly
118  \f[
119  \left(\frac{\partial s}{\partial T}\right)_{n,V} =
120  \left(\frac{\partial s}{\partial \mu}\right)_{T,V}
121  \left(\frac{\partial \mu}{\partial T}\right)_{n,V} +
122  \left(\frac{\partial s}{\partial T}\right)_{\mu,V} \, .
123  \f]
124  Now we use the identity
125  \f[
126  \left(\frac{\partial \mu}{\partial T}\right)_{n,V} = -
127  \left(\frac{\partial n}{\partial T}\right)_{\mu,V}
128  \left(\frac{\partial n}{\partial \mu}\right)_{T,V}^{-1} \, ,
129  \f]
130  and the Maxwell relation above to give
131  \f[
132  C_V = \frac{T}{n}
133  \left[
134  \left(\frac{\partial s}{\partial T}\right)_{\mu,V}
135  -\left(\frac{\partial n}{\partial T}\right)_{\mu,V}^2
136  \left(\frac{\partial n}{\partial \mu}\right)_{T,V}^{-1}
137  \right]
138  \f]
139  which expresses the specific heat in terms of the three
140  derivatives which are given.
141 
142  For, \f$ c_P \f$, defined as
143  \f[
144  c_P = \frac{T}{N} \left( \frac{\partial S}{\partial T}
145  \right)_{N,P}
146  \f]
147  (which is also unitless) we can write functions
148  \f[
149  S=S(N,T,V) \qquad \mathrm{and} \qquad V=V(N,P,T)
150  \f]
151  which imply
152  \f[
153  \left( \frac{\partial S}{\partial T} \right)_{N,P} =
154  \left( \frac{\partial S}{\partial T} \right)_{N,V} +
155  \left( \frac{\partial S}{\partial V} \right)_{N,T}
156  \left( \frac{\partial V}{\partial T} \right)_{N,P} \, .
157  \f]
158  Thus we require the derivatives
159  \f[
160  \left( \frac{\partial S}{\partial T} \right)_{N,V} ,
161  \left( \frac{\partial S}{\partial V} \right)_{N,T} ,
162  \qquad\mathrm{and}\qquad
163  \left( \frac{\partial V}{\partial T} \right)_{N,P}
164  \, .
165  \f]
166 
167  To compute the new entropy derivatives, we can write
168  \f[
169  S=S(\mu(N,T,V),T,V)
170  \f]
171  to get
172  \f[
173  \left( \frac{\partial S}{\partial T} \right)_{N,V} =
174  \left( \frac{\partial S}{\partial \mu} \right)_{T,V}
175  \left( \frac{\partial \mu}{\partial T} \right)_{N,V} +
176  \left( \frac{\partial S}{\partial T} \right)_{\mu,V} \, ,
177  \f]
178  and
179  \f[
180  \left( \frac{\partial S}{\partial V} \right)_{N,T} =
181  \left( \frac{\partial S}{\partial \mu} \right)_{T,V}
182  \left( \frac{\partial \mu}{\partial V} \right)_{N,T} +
183  \left( \frac{\partial S}{\partial V} \right)_{\mu,T} \, .
184  \f]
185  These require the chemical potential derivatives which have
186  associated Maxwell relations
187  \f[
188  \left( \frac{\partial \mu}{\partial T} \right)_{N,V} =
189  -\left( \frac{\partial S}{\partial N} \right)_{T,V}
190  \qquad\mathrm{and}\qquad
191  \left( \frac{\partial \mu}{\partial V} \right)_{N,T} =
192  -\left( \frac{\partial P}{\partial N} \right)_{T,V} \, .
193  \f]
194  Finally, we can rewrite the derivatives on the right hand sides
195  in terms of derivatives of functions of \f$ \mu, V \f$ and
196  \f$ T \f$,
197  \f[
198  \left( \frac{\partial S}{\partial N} \right)_{T,V} =
199  \left( \frac{\partial S}{\partial \mu} \right)_{T,V}
200  \left( \frac{\partial N}{\partial \mu} \right)_{T,V}^{-1} \, ,
201  \f]
202  and
203  \f[
204  \left( \frac{\partial P}{\partial N} \right)_{T,V} =
205  \left( \frac{\partial P}{\partial \mu} \right)_{T,V}
206  \left( \frac{\partial N}{\partial \mu} \right)_{T,V}^{-1} \, .
207  \f]
208 
209  The volume derivative,
210  \f[
211  \left( \frac{\partial V}{\partial T} \right)_{N,P} \, ,
212  \f]
213  is related to the coefficient of thermal expansion, sometimes
214  called \f$ \alpha \f$,
215  \f[
216  \alpha \equiv \frac{1}{V}
217  \left( \frac{\partial V}{\partial T} \right)_{N,P} \, .
218  \f]
219  We can rewrite the derivative
220  \f[
221  \left( \frac{\partial V}{\partial T} \right)_{N,P} =
222  -\left( \frac{\partial P}{\partial T} \right)_{N,V}
223  \left( \frac{\partial P}{\partial V} \right)_{N,T}^{-1} \, .
224  \f]
225  The first term can be computed from the Maxwell relation
226  \f[
227  \left( \frac{\partial P}{\partial T} \right)_{N,V} =
228  \left( \frac{\partial S}{\partial V} \right)_{N,T} \, ,
229  \f]
230  where the entropy derivative was computed above. The second term
231  (related to the inverse of the isothermal compressibility, \f$
232  \kappa_T \equiv (-1/V) (\partial V/\partial P)_{T,N} \f$ can be
233  computed from the function \f$ P = P[\mu(N,V,T),V,T] \f$
234  \f[
235  \left( \frac{\partial P}{\partial V} \right)_{N,T} =
236  \left( \frac{\partial P}{\partial \mu} \right)_{T,V}
237  \left( \frac{\partial \mu}{\partial V} \right)_{N,T} +
238  \left( \frac{\partial P}{\partial V} \right)_{\mu,T}
239  \f]
240  where the chemical potential derivative was computed above.
241 
242  The results above can be collected to give
243  \f[
244  \left( \frac{\partial S}{\partial T} \right)_{N,P} =
245  \left( \frac{\partial S}{\partial T} \right)_{\mu,V} +
246  \frac{S^2}{N^2}
247  \left( \frac{\partial N}{\partial \mu} \right)_{T,V} -
248  \frac{2 S}{N}
249  \left( \frac{\partial N}{\partial T} \right)_{\mu,V} \, ,
250  \f]
251  which implies
252  \f[
253  c_P =
254  \frac{T}{n}
255  \left( \frac{\partial s}{\partial T} \right)_{\mu,V} +
256  \frac{s^2 T}{n^3}
257  \left( \frac{\partial n}{\partial \mu} \right)_{T,V} -
258  \frac{2 s T}{n^2}
259  \left( \frac{\partial n}{\partial T} \right)_{\mu,V} \, ,
260  \f]
261 
262  This derivation also gives the well-known relationship between
263  the specific heats at constant volume and constant pressure,
264  \f[
265  c_P = c_V + \frac{T \alpha^2}{n \kappa_T} \, .
266  \f]
267 
268  In the case where the particle is interacting, the
269  derivative of the density with respect to the effective mass is
270  \f[
271  \left(\frac{dn}{dm^{*}}\right)_{\mu,T} =
272  \left(\frac{3 n}{m^{*}}\right) -
273  \frac{T}{m^{*}} \left(\frac{dn}{dT}\right)_{m^{*},\mu} -
274  \frac{\nu}{m^{*}} \left(\frac{dn}{d\mu}\right)_{m^{*},T}
275  \f]
276  This relation holds whether or not the mass is included in the
277  chemical potential \f$ \nu \f$, as the rest mass is held
278  constant even though the effective mass is varying. This
279  relation also holds in the case where the particle is
280  non-interacting, so long as one does not allow the rest mass in
281  the chemical potential to vary. This derivative is useful, for
282  example, in models of quark matter where the quark mass is
283  dynamically generated.
284  */
285  class part_deriv : public part {
286 
287  public:
288 
289  /// Make a particle of mass \c mass and degeneracy \c dof.
290  part_deriv(double mass=0.0, double dof=0.0) : part(mass,dof) {
291  }
292 
293  /// Derivative of number density with respect to chemical potential
294  double dndmu;
295 
296  /// Derivative of number density with respect to temperature
297  double dndT;
298 
299  /// Derivative of entropy density with respect to temperature
300  double dsdT;
301 
302  /// Copy constructor
303  part_deriv(const part_deriv &p) {
304  g=p.g;
305  m=p.m;
306  ms=p.ms;
307  n=p.n;
308  ed=p.ed;
309  pr=p.pr;
310  mu=p.mu;
311  en=p.en;
312  nu=p.nu;
313  dndmu=p.dndmu;
314  dndT=p.dndT;
315  dsdT=p.dsdT;
318  }
319 
320  /// Copy construction with operator=()
322  if (this!=&p) {
323  g=p.g;
324  m=p.m;
325  ms=p.ms;
326  n=p.n;
327  ed=p.ed;
328  pr=p.pr;
329  mu=p.mu;
330  en=p.en;
331  nu=p.nu;
332  dndmu=p.dndmu;
333  dndT=p.dndT;
334  dsdT=p.dsdT;
337  }
338  return *this;
339  }
340 
341  };
342 
343  /** \brief A fermion with derivative information
344  */
345  class fermion_deriv : public part_deriv {
346 
347  public:
348 
349  /// Make a particle of mass \c mass and degeneracy \c dof.
350  fermion_deriv(double mass=0.0, double dof=0.0) : part_deriv(mass,dof) {
351  }
352 
353  /// Fermi momentum
354  double kf;
355 
356  /// Copy constructor
358  g=p.g;
359  m=p.m;
360  ms=p.ms;
361  n=p.n;
362  ed=p.ed;
363  pr=p.pr;
364  mu=p.mu;
365  en=p.en;
366  nu=p.nu;
367  dndmu=p.dndmu;
368  dndT=p.dndT;
369  dsdT=p.dsdT;
372  }
373 
374  /// Copy construction with operator=()
376  if (this!=&p) {
377  g=p.g;
378  m=p.m;
379  ms=p.ms;
380  n=p.n;
381  ed=p.ed;
382  pr=p.pr;
383  mu=p.mu;
384  en=p.en;
385  nu=p.nu;
386  dndmu=p.dndmu;
387  dndT=p.dndT;
388  dsdT=p.dsdT;
391  }
392  return *this;
393  }
394 
395  };
396 
397  /** \brief Compute properties of a fermion including derivatives
398  [abstract base]
399 
400  \future Include explicit zero-temperature calculation, maybe
401  by making this a child of fermion_zerot or by making a
402  new fermion_deriv_zerot?
403  \comment
404  dn/dmu is just g*mu*kf/2/pi^2
405  \endcomment
406  \future There is also a closed form for the derivatives
407  of massless fermions with pairs at finite temperature
408  in Constantiou et al. 2014 which could be implemented here.
409  */
411 
412  public:
413 
414  virtual ~fermion_deriv_thermo() {
415  }
416 
417  /** \brief Calculate properties as function of chemical potential
418  */
419  virtual int calc_mu(fermion_deriv &f, double temper)=0;
420 
421  /** \brief Calculate properties as function of density
422  */
423  virtual int calc_density(fermion_deriv &f, double temper)=0;
424 
425  /** \brief Calculate properties with antiparticles as function of
426  chemical potential
427  */
428  virtual int pair_mu(fermion_deriv &f, double temper)=0;
429 
430  /** \brief Calculate properties with antiparticles as function of
431  density
432  */
433  virtual int pair_density(fermion_deriv &f, double temper)=0;
434 
435  /// Calculate effective chemical potential from density
436  virtual int nu_from_n(fermion_deriv &f, double temper)=0;
437 
438  /** \brief Calculate properties as a function of chemical
439  potential using a degenerate expansion
440  */
441  virtual bool calc_mu_deg(fermion_deriv &f, double temper,
442  double prec);
443 
444  };
445 
446 
447 #ifndef DOXYGEN_NO_O2NS
448 }
449 #endif
450 
451 #endif
double dsdT
Derivative of entropy density with respect to temperature.
Definition: part_deriv.h:300
double nu
Effective chemical potential.
Definition: part.h:113
double dndT
Derivative of number density with respect to temperature.
Definition: part_deriv.h:297
double n
Number density.
Definition: part.h:101
A particle data class with derivatives.
Definition: part_deriv.h:285
double dndmu
Derivative of number density with respect to chemical potential.
Definition: part_deriv.h:294
part_deriv & operator=(const part_deriv &p)
Copy construction with operator=()
Definition: part_deriv.h:321
A fermion with derivative information.
Definition: part_deriv.h:345
double en
Entropy density.
Definition: part.h:109
Compute properties of a fermion including derivatives [abstract base].
Definition: part_deriv.h:410
fermion_deriv(double mass=0.0, double dof=0.0)
Make a particle of mass mass and degeneracy dof.
Definition: part_deriv.h:350
double kf
Fermi momentum.
Definition: part_deriv.h:354
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:303
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:375
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:357
part_deriv(double mass=0.0, double dof=0.0)
Make a particle of mass mass and degeneracy dof.
Definition: part_deriv.h:290
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).