fermion_deriv_nr.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_FERMION_DERIV_NR_H
24 #define O2SCL_FERMION_DERIV_NR_H
25 
26 /** \file fermion_deriv_nr.h
27  \brief File defining \ref o2scl::fermion_deriv_nr
28 */
29 
30 #include <string>
31 #include <iostream>
32 #include <fstream>
33 #include <cmath>
34 #include <o2scl/constants.h>
35 #include <o2scl/root_cern.h>
36 
37 #include <o2scl/part_deriv.h>
38 
39 #ifndef DOXYGEN_NO_O2NS
40 namespace o2scl {
41 #endif
42 
43  /** \brief Equation of state for a nonrelativistic fermion
44 
45  This does not include the rest mass energy in the chemical
46  potential or the rest mass energy density in the energy density
47  to alleviate numerical precision problems at low densities
48 
49  This implements an equation of state for a nonrelativistic fermion
50  using direct integration. After subtracting the rest mass from
51  the chemical potentials, the distribution function is
52  \f[
53  \left\{1+\exp\left[\left(\frac{k^2}
54  {2 m^{*}}-\nu\right)/T\right]\right\}^{-1}
55  \f]
56  where \f$ \nu \f$ is the effective chemical potential, \f$ m \f$ is
57  the rest mass, and \f$ m^{*} \f$ is the effective mass.
58  For later use, we define \f$ E^{*} = k^2/2/m^{*} \f$ .
59 
60  Uncertainties are given in \ref unc.
61 
62  \b Evaluation \b of \b the \b derivatives
63 
64  The relevant derivatives of the distribution function are
65  \f[
66  \frac{\partial f}{\partial T}=
67  f(1-f)\frac{E^{*}-\nu}{T^2}
68  \f]
69  \f[
70  \frac{\partial f}{\partial \nu}=
71  f(1-f)\frac{1}{T}
72  \f]
73  \f[
74  \frac{\partial f}{\partial k}=
75  -f(1-f)\frac{k}{m^{*} T}
76  \f]
77  \f[
78  \frac{\partial f}{\partial m^{*}}=
79  f(1-f)\frac{k^2}{2 m^{*2} T}
80  \f]
81 
82  We also need the derivative of the entropy integrand w.r.t. the
83  distribution function, which is quite simple
84  \f[
85  {\cal S}\equiv f \ln f +(1-f) \ln (1-f) \qquad
86  \frac{\partial {\cal S}}{\partial f} = \ln
87  \left(\frac{f}{1-f}\right) =
88  \left(\frac{\nu-E^{*}}{T}\right)
89  \f]
90  where the entropy density is
91  \f[
92  s = - \frac{g}{2 \pi^2} \int_0^{\infty} {\cal S} k^2 d k
93  \f]
94 
95  The derivatives can be integrated directly
96  or they may be converted to integrals
97  over the distribution function through an integration by parts
98  \f[
99  \int_a^b f(k) \frac{d g(k)}{dk} dk = \left.f(k) g(k)\right|_{k=a}^{k=b}
100  - \int_a^b g(k) \frac{d f(k)}{dk} dk
101  \f]
102  using the distribution function for \f$ f(k) \f$ and 0 and \f$
103  \infty \f$ as the limits, we have
104  \f[
105  \frac{g}{2 \pi^2} \int_0^{\infty} \frac{d g(k)}{dk} f dk =
106  \frac{g}{2 \pi^2} \int_0^{\infty} g(k) f (1-f) \frac{k}{E^{*} T} dk
107  \f]
108  as long as \f$ g(k) \f$ vanishes at \f$ k=0 \f$ .
109  Rewriting,
110  \f[
111  \frac{g}{2 \pi^2} \int_0^{\infty} h(k) f (1-f) dk =
112  \frac{g}{2 \pi^2} \int_0^{\infty} f \frac{T m^{*}}{k}
113  \left[ h^{\prime} - \frac{h}{k}\right] d k
114  \f]
115  as long as \f$ h(k)/k \f$ vanishes at \f$ k=0 \f$ .
116 
117  \b Explicit \b forms
118 
119  1) The derivative of the density wrt the chemical potential
120  \f[
121  \left(\frac{d n}{d \mu}\right)_T =
122  \frac{g}{2 \pi^2} \int_0^{\infty} \frac{k^2}{T} f (1-f) dk
123  \f]
124  Using \f$ h(k)=k^2/T \f$ we get
125  \f[
126  \left(\frac{d n}{d \mu}\right)_T =
127  \frac{g}{2 \pi^2} \int_0^{\infty}
128  m^{*} f dk
129  \f]
130 
131  2) The derivative of the density wrt the temperature
132  \f[
133  \left(\frac{d n}{d T}\right)_{\mu} =
134  \frac{g}{2 \pi^2} \int_0^{\infty} \frac{k^2(E^{*}-\nu)}{T^2}
135  f (1-f) dk
136  \f]
137  Using \f$ h(k)=k^2(E^{*}-\nu)/T^2 \f$ we get
138  \f[
139  \left(\frac{d n}{d T}\right)_{\mu} =
140  \frac{g}{2 \pi^2} \int_0^{\infty} \frac{f}{T}
141  \left[m^{*} \left(E^{*}-\nu\right) -k^2\right] d k
142  \f]
143 
144  3) The derivative of the entropy wrt the chemical potential
145  \f[
146  \left(\frac{d s}{d \mu}\right)_T =
147  \frac{g}{2 \pi^2} \int_0^{\infty} k^2 f (1-f)
148  \frac{(E^{*}-\nu)}{T^2} dk
149  \f]
150  This verifies the Maxwell relation
151  \f[
152  \left(\frac{d s}{d \mu}\right)_T =
153  \left(\frac{d n}{d T}\right)_{\mu}
154  \f]
155 
156  4) The derivative of the entropy wrt the temperature
157  \f[
158  \left(\frac{d s}{d T}\right)_{\mu} =
159  \frac{g}{2 \pi^2} \int_0^{\infty} k^2 f (1-f)
160  \frac{(E^{*}-\nu)^2}{T^3} dk
161  \f]
162  Using \f$ h(k)=k^2 (E^{*}-\nu)^2/T^3 \f$
163  \f[
164  \left(\frac{d s}{d T}\right)_{\mu} =
165  \frac{g}{2 \pi^2} \int_0^{\infty}
166  f \frac{m^{*}}{T^2} \left[\left( E^{*}-\nu \right)^2
167  +\frac{2 k^2}{m^{*}} \left(E^{*}-\nu\right)\right] d k
168  \f]
169 
170  5) The derivative of the density wrt the effective mass
171  \f[
172  \left(\frac{d n}{d m^{*}}\right)_{T,\mu} =
173  \frac{g}{2 \pi^2} \int_0^{\infty}
174  \frac{k^2}{2 m^{* 2} T} f (1-f) k^2 dk
175  \f]
176  Using \f$ h(k)=k^4/(2 m^{* 2} T) \f$ we get
177  \f[
178  \left(\frac{d n}{d m^{*}}\right)_{T,\mu} =
179  \frac{g}{2 \pi^2} \int_0^{\infty} f
180  \frac{3 k^2}{2 m^{*}} d k
181  \f]
182 
183  <b>Conversion to unitless variables:</b>
184 
185  After integrating by parts
186  \f$ u = k^2/2/m^{*}/T \f$ and \f$ y=\mu/T \f$, so
187  \f[
188  k d k = m^{*} T d u
189  \f]
190  or
191  \f[
192  d k = \frac{m^{*} T}{\sqrt{2 m^{*} T u}} d u =
193  \sqrt{\frac{m^{*} T}{2 u}} d u
194  \f]
195 
196  1) The derivative of the density wrt the chemical potential
197  \f[
198  \left(\frac{d n}{d \mu}\right)_T =
199  \frac{g m^{* 3/2} \sqrt{T}}{2^{3/2} \pi^2} \int_0^{\infty}
200  u^{-1/2} f d u
201  \f]
202 
203  2) The derivative of the density wrt the temperature
204  \f[
205  \left(\frac{d n}{d T}\right)_{\mu} =
206  \frac{g m^{* 3/2} \sqrt{T}}
207  {2^{3/2} \pi^2} \int_0^{\infty} f d u
208  \left[ 3 u^{1/2} - y u^{-1/2}\right]
209  \f]
210 
211  4) The derivative of the entropy wrt the temperature
212  \f[
213  \left(\frac{d s}{d T}\right)_{\mu} =
214  \frac{g m^{* 3/2} T^{1/2}}{2^{3/2} \pi^2} \int_0^{\infty}
215  f \left[ 5 u^{3/2} - 6 y u^{1/2} + y^2 u^{-1/2}\right] d u
216  \f]
217 
218  5) The derivative of the density wrt the effective mass
219  \f[
220  \left(\frac{d n}{d m^{*}}\right)_{T,\mu} =
221  \frac{3 g m{* 1/2} T^{3/2}}{2^{3/2} \pi^2}
222  \int_0^{\infty} u^{1/2} f d u
223  \f]
224 
225  */
227 
228  public:
229 
230  /// Create a fermion with mass \c m and degeneracy \c g
232 
233  virtual ~fermion_deriv_nr();
234 
235  /** \brief The limit for the Fermi functions (default 20.0)
236 
237  fermion_deriv_nr will ignore corrections smaller than about
238  \f$ \exp(-\mathrm{f{l}imit}) \f$ .
239  */
240  double flimit;
241 
242  /// Storage for the most recently calculated uncertainties
244 
245  /** \brief If true, use the present value of the chemical potential as
246  a guess for the new chemical potential
247  */
249 
250  /** \brief Calculate properties as function of chemical potential
251  */
252  virtual int calc_mu(fermion_deriv &f, double temper);
253 
254  /** \brief Calculate properties as function of density
255  */
256  virtual int calc_density(fermion_deriv &f, double temper);
257 
258  /** \brief Calculate properties with antiparticles as function of
259  chemical potential
260  */
261  virtual int pair_mu(fermion_deriv &f, double temper);
262 
263  /** \brief Calculate properties with antiparticles as function of
264  density
265  */
266  virtual int pair_density(fermion_deriv &f, double temper);
267 
268  /// Calculate effective chemical potential from density
269  virtual int nu_from_n(fermion_deriv &f, double temper);
270 
271  /** \brief Set the solver for use in calculating the chemical
272  potential from the density */
274  density_root=&rp;
275  return;
276  }
277 
278  /// The default solver for npen_density() and pair_density()
280 
281  /// Return string denoting type ("fermion_deriv_nr")
282  virtual const char *type() { return "fermion_deriv_nr"; };
283 
284  protected:
285 
286 #ifndef DOXYGEN_INTERNAL
287 
288  /// Solver to compute chemical potential from density
290 
291  /// Function to compute chemical potential from density
292  double solve_fun(double x, fermion_deriv &f, double T);
293 
294  /** \brief Function to compute chemical potential from density
295  when antiparticles are included
296  */
297  double pair_fun(double x, fermion_deriv &f, double T);
298 
299 #endif
300 
301  };
302 
303 #ifndef DOXYGEN_NO_O2NS
304 }
305 #endif
306 
307 #endif
virtual int nu_from_n(fermion_deriv &f, double temper)
Calculate effective chemical potential from density.
virtual int calc_density(fermion_deriv &f, double temper)
Calculate properties as function of density.
A fermion with derivative information.
Definition: part_deriv.h:134
double flimit
The limit for the Fermi functions (default 20.0)
Compute properties of a fermion including derivatives [abstract base].
Definition: part_deriv.h:199
bool guess_from_nu
If true, use the present value of the chemical potential as a guess for the new chemical potential...
virtual const char * type()
Return string denoting type ("fermion_deriv_nr")
fermion_deriv unc
Storage for the most recently calculated uncertainties.
Equation of state for a nonrelativistic fermion.
root_cern def_density_root
The default solver for npen_density() and pair_density()
root * density_root
Solver to compute chemical potential from density.
double pair_fun(double x, fermion_deriv &f, double T)
Function to compute chemical potential from density when antiparticles are included.
virtual int calc_mu(fermion_deriv &f, double temper)
Calculate properties as function of chemical potential.
double solve_fun(double x, fermion_deriv &f, double T)
Function to compute chemical potential from density.
virtual int pair_mu(fermion_deriv &f, double temper)
Calculate properties with antiparticles as function of chemical potential.
virtual int pair_density(fermion_deriv &f, double temper)
Calculate properties with antiparticles as function of density.
fermion_deriv_nr()
Create a fermion with mass m and degeneracy g.
void set_density_root(root<> &rp)
Set the solver for use in calculating the chemical potential from the density.

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