fermion_nonrel.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_NONREL_FERMION_H
24 #define O2SCL_NONREL_FERMION_H
25 
26 /** \file fermion_nonrel.h
27  \brief File defining \ref o2scl::fermion_nonrel
28 */
29 
30 #include <string>
31 #include <iostream>
32 #include <fstream>
33 #include <cmath>
34 #include <o2scl/constants.h>
35 #include <o2scl/mroot.h>
36 #include <o2scl/inte.h>
37 #include <o2scl/root_cern.h>
38 #include <o2scl/inte_qagiu_gsl.h>
39 
40 #include <o2scl/fermion.h>
41 
42 #ifndef DOXYGEN_NO_O2NS
43 namespace o2scl {
44 #endif
45 
46  /** \brief Nonrelativistic fermion class
47 
48  The rest mass energy density is given by <tt>n*m</tt> not
49  <tt>n*ms</tt>. Note that the effective mass here is the Landau
50  mass, not the Dirac mass.
51 
52  Pressure is computed with
53  \f[
54  P = 2 \varepsilon/3
55  \f]
56  and entropy density with
57  \f[
58  s = \frac{5 \varepsilon}{3 T} - \frac{n \mu}{T}
59  \f]
60  These relations can be verified with an integration by
61  parts. See, e.g. \ref Callen85 pg. 403 or \ref Landau80 pg. 164.
62 
63  The functions \ref pair_density() and \ref pair_mu() have not
64  been implemented and just call the error handler.
65 
66  \note The function \ref calc_density() calls the error handler
67  at zero density and finite temperature, because the correct
68  answer implies \f$ \mu = - \infty \f$ . At zero density and zero
69  temperature the function \ref calc_density() calls \ref
70  calc_density_zerot() which gives the proper chemical potential
71  of \f$ mu = m \f$ without calling the error handler.
72 
73  \todo Implement \ref o2scl::fermion_nonrel::pair_density() and
74  \ref o2scl::fermion_nonrel::pair_mu().
75 
76  \todo Make sure to test with non-interacting equal to
77  true or false, and document whether or not it works
78  with both inc_rest_mass equal to true or false
79 
80  \future This could be improved by performing a Chebyshev
81  approximation (for example) to invert the density integral so
82  that we don't need to use a solver.
83  */
85 
86  public:
87 
88  /// Create a nonrelativistic fermion with mass 'm' and degeneracy 'g'
90 
91  virtual ~fermion_nonrel();
92 
93  /** \brief Zero temperature fermions
94  */
95  virtual void calc_mu_zerot(fermion &f);
96 
97  /** \brief Zero temperature fermions
98  */
99  virtual void calc_density_zerot(fermion &f);
100 
101  /** \brief Calculate properties as function of chemical potential
102  */
103  virtual void calc_mu(fermion &f, double temper);
104 
105  /** \brief Calculate properties as function of density
106 
107  If the density is zero, this function just sets part::mu,
108  part::nu, part::ed, part::pr, and part::en to zero and returns
109  without calling the error handler (even though at
110  zero density and finite temperature, the chemical potentials
111  formally are equal to \f$ -\infty \f$).
112  */
113  virtual int calc_density(fermion &f, double temper);
114 
115  virtual void pair_mu(fermion &f, double temper) {
116  O2SCL_ERR2("Function fermion_nonrel::pair_mu() not ",
117  "implemented.",exc_eunimpl);
118  return;
119  }
120 
121  virtual int pair_density(fermion &f, double temper) {
122  O2SCL_ERR2("Function fermion_nonrel::pair_density() not ",
123  "implemented.",exc_eunimpl);
124  return 0;
125  }
126 
127  /// Calculate effective chemical potential from density
128  virtual void nu_from_n(fermion &f, double temper);
129 
130  /** \brief Set the solver for use in calculating the chemical
131  potential from the density
132  */
134  density_root=&rp;
135  return;
136  }
137 
138  /// The default solver for calc_density().
140 
141  /// Return string denoting type ("fermion_nonrel")
142  virtual const char *type() { return "fermion_nonrel"; }
143 
144  protected:
145 
146 #ifndef DOXYGEN_NO_O2NS
147 
148  /// Solver to compute chemical potential from density
150 
151  /** \brief Function to compute chemical potential from density
152 
153  Variable \c nog is the target baryon density divided by
154  the spin degeneracy, and \c msT is the effective mass
155  times the temperature.
156  */
157  double solve_fun(double x, double nog, double msT);
158 
159  private:
160 
162  fermion_nonrel& operator=(const fermion_nonrel&);
163 
164 #endif
165 
166  };
167 
168 #ifndef DOXYGEN_NO_O2NS
169 }
170 #endif
171 
172 #endif
virtual void calc_mu_zerot(fermion &f)
Zero temperature fermions.
virtual int calc_density(fermion &f, double temper)
Calculate properties as function of density.
root * density_root
Solver to compute chemical potential from density.
virtual void pair_mu(fermion &f, double temper)
Calculate properties with antiparticles as function of chemical potential.
Fermion class.
Definition: fermion.h:52
double solve_fun(double x, double nog, double msT)
Function to compute chemical potential from density.
Fermion with finite-temperature thermodynamics [abstract base].
Definition: fermion.h:199
exc_eunimpl
virtual void calc_density_zerot(fermion &f)
Zero temperature fermions.
root_cern def_density_root
The default solver for calc_density().
virtual int pair_density(fermion &f, double temper)
Calculate properties with antiparticles as function of density.
virtual void nu_from_n(fermion &f, double temper)
Calculate effective chemical potential from density.
#define O2SCL_ERR2(d, d2, n)
virtual void calc_mu(fermion &f, double temper)
Calculate properties as function of chemical potential.
fermion_nonrel()
Create a nonrelativistic fermion with mass &#39;m&#39; and degeneracy &#39;g&#39;.
virtual const char * type()
Return string denoting type ("fermion_nonrel")
void set_density_root(root<> &rp)
Set the solver for use in calculating the chemical potential from the density.
Nonrelativistic fermion class.

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