fermion_deriv_nr.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_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> New section</b>
184 
185  \f$ u = k^2/2/m^{*}/T \f$ and \f$ y=\mu/T \f$, so
186  \f[
187  k d k = m^{*} T d u
188  \f]
189  or
190  \f[
191  d k = \frac{m^{*} T}{\sqrt{2 m^{*} T u}} d u =
192  \sqrt{\frac{m^{*} T}{2 u}} d u
193  \f]
194 
195  1) The derivative of the density wrt the chemical potential
196  \f[
197  \left(\frac{d n}{d \mu}\right)_T =
198  \frac{g m^{* 3/2} \sqrt{T}}{2^{3/2} \pi^2} \int_0^{\infty}
199  u^{-1/2} f d u
200  \f]
201 
202  2) The derivative of the density wrt the temperature
203  \f[
204  \left(\frac{d n}{d T}\right)_{\mu} =
205  \frac{g m^{* 3/2} \sqrt{T}}
206  {2^{3/2} \pi^2} \int_0^{\infty} f d u
207  \left[ 3 u^{1/2} - y u^{-1/2}\right]
208  \f]
209 
210  4) The derivative of the entropy wrt the temperature
211  \f[
212  \left(\frac{d s}{d T}\right)_{\mu} =
213  \frac{g m^{* 3/2} T^{1/2}}{2^{3/2} \pi^2} \int_0^{\infty}
214  f \left[ 5 u^{3/2} - 6 y u^{1/2} + y^2 u^{-1/2}\right] d u
215  \f]
216 
217  5) The derivative of the density wrt the effective mass
218  \f[
219  \left(\frac{d n}{d m^{*}}\right)_{T,\mu} =
220  \frac{3 g m{* 1/2} T^{3/2}}{2^{3/2} \pi^2}
221  \int_0^{\infty} u^{1/2} f d u
222  \f]
223 
224  */
226 
227  public:
228 
229  /// Create a fermion with mass \c m and degeneracy \c g
231 
232  virtual ~fermion_deriv_nr();
233 
234  /** \brief The limit for the Fermi functions (default 20.0)
235 
236  fermion_deriv_nr will ignore corrections smaller than about
237  \f$ \exp(-\mathrm{f{l}imit}) \f$ .
238  */
239  double flimit;
240 
241  /// Storage for the most recently calculated uncertainties
243 
244  /** \brief If true, use the present value of the chemical potential as
245  a guess for the new chemical potential
246  */
248 
249  /** \brief Calculate properties as function of chemical potential
250  */
251  virtual int calc_mu(fermion_deriv &f, double temper);
252 
253  /** \brief Calculate properties as function of density
254  */
255  virtual int calc_density(fermion_deriv &f, double temper);
256 
257  /** \brief Calculate properties with antiparticles as function of
258  chemical potential
259  */
260  virtual int pair_mu(fermion_deriv &f, double temper);
261 
262  /** \brief Calculate properties with antiparticles as function of
263  density
264  */
265  virtual int pair_density(fermion_deriv &f, double temper);
266 
267  /// Calculate effective chemical potential from density
268  virtual int nu_from_n(fermion_deriv &f, double temper);
269 
270  /** \brief Set the solver for use in calculating the chemical
271  potential from the density */
273  density_root=&rp;
274  return;
275  }
276 
277  /// The default solver for npen_density() and pair_density()
279 
280  /// Return string denoting type ("fermion_deriv_nr")
281  virtual const char *type() { return "fermion_deriv_nr"; };
282 
283  protected:
284 
285 #ifndef DOXYGEN_INTERNAL
286 
287  /// Solver to compute chemical potential from density
289 
290  /// Function to compute chemical potential from density
291  double solve_fun(double x, fermion_deriv &f, double T);
292 
293  /** \brief Function to compute chemical potential from density
294  when antiparticles are included
295  */
296  double pair_fun(double x, fermion_deriv &f, double T);
297 
298 #endif
299 
300  };
301 
302 #ifndef DOXYGEN_NO_O2NS
303 }
304 #endif
305 
306 #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:345
double flimit
The limit for the Fermi functions (default 20.0)
Compute properties of a fermion including derivatives [abstract base].
Definition: part_deriv.h:410
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).