List of all members
o2scl::fermion_rel_tl< fp_t > Class Template Reference

Equation of state for a relativistic fermion. More...

#include <fermion_rel.h>

Inheritance diagram for o2scl::fermion_rel_tl< fp_t >:
o2scl::fermion_thermo_tl< double > o2scl::fermion_zerot_tl< double >

Detailed Description

template<class fp_t = double>
class o2scl::fermion_rel_tl< fp_t >

This class computes the thermodynamics of a relativistic fermion either as a function of the density or the chemical potential. It employs direct integration, using two different integrators for the degenerate and non-degenerate regimes. The default integrators are inte_qag_gsl (for degenerate fermions) and inte_qagiu_gsl (for non-degenerate fermions). For the functions calc_mu() and calc_density(), if the temperature argument is less than or equal to zero, the functions fermion_zerot::calc_mu_zerot() and fermion_zerot::calc_density_zerot() will be used to compute the result.


Degeneracy parameter:

Define the degeneracy parameter

\[ \psi=(\nu-m^{*})/T \]

where $ \nu $ is the effective chemical potential (including the rest mass) and $ m^{*} $ is the effective mass. For $ \psi $ smaller than min_psi, the non-degenerate expansion in fermion_thermo::calc_mu_ndeg() is attempted first. If that fails, then integration is used. For $ \psi $ greater than deg_limit (degenerate regime), a finite interval integrator is used and for $ \psi $ less than deg_limit (non-degenerate regime), an integrator over the interval from $ [0,\infty) $ is used. In the case where part::inc_rest_mass is false, the degeneracy parameter is

\[ \psi=(\nu+m-m^{*})/T \]

Integration limits:

The upper limit on the degenerate integration is given by

\[ \mathrm{upper~limit} = \sqrt{{\cal L}^2-m^{*,2}} \]

where $ {\cal L}\equiv u T+\nu $ and $ u $ is fermion_rel::upper_limit_fac . In the case where part::inc_rest_mass is false, the result is

\[ \mathrm{upper~limit} = \sqrt{(m+{\cal L})^2-m^{*2}} \]

The entropy is only significant at the Fermi surface, thus in the degenerate case, the lower limit of the entropy integral can be given be determined by the value of $ k $ which solves

\[ - u = \frac{\sqrt{k^2+m^{* 2}}-\nu}{T} \]

The solution is

\[ \mathrm{lower~limit} = \sqrt{(-u T+{\nu})^2-m^{*,2}} \]

but this solution is only valid if $ (m^{*}-\nu)/T < -u $. In the case where part::inc_rest_mass is false, the result is

\[ \mathrm{lower~limit} = \sqrt{(-u T + m +\nu)^2-m^{*,2}} \]

which is valid if $ (m^{*}-\nu - m)/T < -u $.

Entropy integrand:

In the degenerate regime, the entropy integrand

\[ - k^2 \left[ f \log f + \left(1-f\right) \log \left(1-f \right) \right] \]

where $ f $ is the fermionic distribution function can lose precision when $ (E^{*} - \nu)/T $ is negative and sufficiently large in absolute magnitude. Thus when $ (E^{*} - \nu)/T < S $ where $ S $ is stored in deg_entropy_fac (default is -30), the integrand is written as

\[ -k^2 \left( E/T-\nu/T \right) e^{E/T-\nu/T} \, . \]

If $ (E - \nu)/T < S $ is less than -1 times exp_limit (e.g. less than -200), then the entropy integrand is assumed to be zero.

Non-degenerate integrands:

The integrands in the non-degenerate regime are written in a dimensionless form, by defining $ u $ with the relation $ p = \sqrt{\left(T u + m^{*}\right)^2-m^{* 2}} $, $ y \equiv \nu/ T $, and $ \mathrm{mx} \equiv m^{*}/T $. The density integrand is

\[ \left(\mathrm{mx}+u\right) \sqrt{u^2+2 (\mathrm{mx}) u} \left(\frac{e^{y}}{e^{\mathrm{mx}+u}+e^{y}}\right) \, , \]

the energy integrand is

\[ \left(\mathrm{mx}+u\right)^2 \sqrt{u^2+2 (\mathrm{mx}) u} \left(\frac{e^{y}}{e^{\mathrm{mx}+u}+e^{y}}\right) \, , \]

and the entropy integrand is

\[ \left(\mathrm{mx}+u\right) \sqrt{u^2+2 (\mathrm{mx}) u} \left(t_1+t_2\right) \, , \]

where

\begin{eqnarray*} t_1 &=& \log \left(1+e^{y-\mathrm{mx}-u}\right)/ \left(1+e^{y-\mathrm{mx}-u}\right) \nonumber \\ t_2 &=& \log \left(1+e^{\mathrm{mx}+u-y}\right)/ \left(1+e^{\mathrm{mx}+u-y}\right) \, . \end{eqnarray*}


Accuracy:

The default settings for for this class give an accuracy of at least 1 part in $ 10^6 $ (and frequently better than this).

When the integrators provide numerical uncertainties, these uncertainties are stored in unc. In the case of calc_density() and pair_density(), the uncertainty from the numerical accuracy of the solver is not included. (There is also a relatively small inaccuracy due to the mathematical evaluation of the integrands which is not included in unc.)

One can improve the accuracy to within 1 part in $ 10^{10} $ using

fermion_rel rf(1.0,2.0);
rf.upper_limit_fac=40.0;
rf.dit->tol_abs=1.0e-13;
rf.dit->tol_rel=1.0e-13;
rf.nit->tol_abs=1.0e-13;
rf.nit->tol_rel=1.0e-13;
rf.density_root->tol_rel=1.0e-10;

which decreases the both the relative and absolute tolerances for both the degenerate and non-degenerate integrators and improves the accuracy of the solver which determines the chemical potential from the density. Of course if these tolerances are too small, the calculation may fail.


Todos:

Idea for Future:
The expressions which appear in in the integrand functions density_fun(), etc. could likely be improved, especially in the case where o2scl::part::inc_rest_mass is false. There should not be a need to check if ret is finite.
Idea for Future:
It appears this class doesn't compute the uncertainty in the chemical potential or density with calc_density(). This could be fixed.
Idea for Future:
I'd like to change the lower limit on the entropy integration, but the value in the code at the moment (stored in ll) makes bm_part2.cpp worse.
Idea for Future:
The function pair_mu() should set the antiparticle integrators as done in fermion_deriv_rel.

Definition at line 219 of file fermion_rel.h.

Numerical parameters

bool err_nonconv
 If true, call the error handler when convergence fails (default true)
 
fp_t min_psi
 The smallest value of $ (\mu-m)/T $ for which integration is used.
 
fp_t deg_limit
 The critical degeneracy at which to switch integration techniques (default 2)
 
fp_t exp_limit
 The limit for exponentials to ensure integrals are finite (default 200)
 
fp_t upper_limit_fac
 The factor for the degenerate upper limits (default 20)
 
fp_t deg_entropy_fac
 A factor for the degenerate entropy integration (default 30)
 
int verbose
 Verbosity parameter (default 0)
 
fermion unc
 Storage for the uncertainty.
 
bool use_expansions
 If true, use expansions for extreme conditions (default true)
 
std::shared_ptr< inte<> > nit
 The non-degenerate integrator.
 
std::shared_ptr< inte<> > dit
 The degenerate integrator.
 
std::shared_ptr< root<> > density_root
 The solver for calc_density()
 
int last_method
 An integer indicating the last numerical method used. More...
 
 fermion_rel_tl ()
 Create a fermion with mass m and degeneracy g.
 
virtual ~fermion_rel_tl ()
 
virtual void calc_mu (fermion &f, fp_t temper)
 Calculate properties as function of chemical potential.
 
virtual int calc_density (fermion &f, fp_t temper)
 Calculate properties as function of density. More...
 
virtual void pair_mu (fermion &f, fp_t temper)
 Calculate properties with antiparticles as function of chemical potential.
 
virtual int pair_density (fermion &f, fp_t temper)
 Calculate properties with antiparticles as function of density.
 
virtual int nu_from_n (fermion &f, fp_t temper)
 Calculate effective chemical potential from density.
 
virtual const char * type ()
 Return string denoting type ("fermion_rel")
 

Template versions of base functions

template<class fermion_t >
int nu_from_n_tlate (fermion_t &f, fp_t temper)
 Calculate the chemical potential from the density (template version)
 
template<class fermion_t >
void calc_mu_tlate (fermion_t &f, fp_t temper)
 Calculate properties as function of chemical potential (template version)
 
template<class fermion_t >
int calc_density_tlate (fermion_t &f, fp_t temper)
 Calculate properties as function of density (template version) More...
 
template<class fermion_t >
void pair_mu_tlate (fermion_t &f, fp_t temper)
 Calculate properties with antiparticles as function of chemical potential (template version)
 
template<class fermion_t >
int pair_density_tlate (fermion_t &f, fp_t temper)
 Calculate thermodynamic properties with antiparticles from the density (template version)
 
fp_t density_fun (fp_t u, fermion &f, fp_t T)
 The integrand for the density for non-degenerate fermions.
 
fp_t energy_fun (fp_t u, fermion &f, fp_t T)
 The integrand for the energy density for non-degenerate fermions.
 
fp_t entropy_fun (fp_t u, fermion &f, fp_t T)
 The integrand for the entropy density for non-degenerate fermions.
 
fp_t deg_density_fun (fp_t k, fermion &f, fp_t T)
 The integrand for the density for degenerate fermions.
 
fp_t deg_energy_fun (fp_t k, fermion &f, fp_t T)
 The integrand for the energy density for degenerate fermions.
 
fp_t deg_entropy_fun (fp_t k, fermion &f, fp_t T)
 The integrand for the entropy density for degenerate fermions.
 
fp_t solve_fun (fp_t x, fermion &f, fp_t T)
 Solve for the chemical potential given the density.
 
fp_t pair_fun (fp_t x, fermion &f, fp_t T, bool log_mode)
 Solve for the chemical potential given the density with antiparticles. More...
 

Additional Inherited Members

- Public Member Functions inherited from o2scl::fermion_thermo_tl< double >
bool calc_mu_ndeg_tlate (fermion_t &f, double temper, double prec, bool inc_antip)
 Calculate thermodynamic properties from the chemical potential using a nondegenerate expansion.
 
bool calc_mu_deg_tlate (fermion_t &f, double temper, double prec)
 Calculate thermodynamic properties from the chemical potential using a degenerate expansion.
 
virtual bool calc_mu_ndeg (fermion &f, double temper, double prec=1.0e-18, bool inc_antip=false)
 Non-degenerate expansion for fermions. More...
 
virtual bool calc_mu_deg (fermion &f, double temper, double prec=1.0e-18)
 Degenerate expansion for fermions. More...
 
virtual void calc_mu (fermion &f, double temper)=0
 Calculate properties as function of chemical potential.
 
virtual int calc_density (fermion &f, double temper)=0
 Calculate properties as function of density. More...
 
virtual void pair_mu (fermion &f, double temper)=0
 Calculate properties with antiparticles as function of chemical potential.
 
virtual int pair_density (fermion &f, double temper)=0
 Calculate properties with antiparticles as function of density. More...
 
virtual void massless_calc_mu (fermion &f, double temper)
 Finite temperature massless fermions.
 
virtual void massless_calc_density (fermion &f, double temper)
 Finite temperature massless fermions.
 
virtual void massless_pair_mu (fermion &f, double temper)
 Finite temperature massless fermions and antifermions.
 
virtual void massless_pair_density (fermion &f, double temper)
 Finite temperature massless fermions and antifermions. More...
 
void set_massless_root (root<> &rp)
 Set the solver for use in massless_calc_density()
 
void ndeg_terms (size_t j, double tt, double xx, double m, bool inc_rest_mass, bool inc_antip, double &pterm, double &nterm, double &enterm)
 Compute a term in the nondegenerate expansion.
 
- Public Member Functions inherited from o2scl::fermion_zerot_tl< double >
void kf_from_density (fermion_tl< double > &f)
 Calculate the Fermi momentum from the density. More...
 
void energy_density_zerot (fermion_tl< double > &f)
 Energy density at T=0 from o2scl::fermion_tl::kf and o2scl::part_tl::ms. More...
 
void pressure_zerot (fermion_tl< double > &f)
 Pressure at T=0 from o2scl::fermion_tl::kf and o2scl::part_tl::ms. More...
 
virtual void calc_mu_zerot (fermion_tl< double > &f)
 Zero temperature fermions from o2scl::part_tl::mu or o2scl::part_tl::nu and o2scl::part_tl::ms.
 
virtual void calc_density_zerot (fermion_tl< double > &f)
 Zero temperature fermions from o2scl::part_tl::n and o2scl::part_tl::ms. More...
 
- Public Attributes inherited from o2scl::fermion_thermo_tl< double >
root_cern def_massless_root
 The default solver for massless_calc_density() More...
 
- Protected Member Functions inherited from o2scl::fermion_thermo_tl< double >
double massless_solve_fun (double x, fermion &f, double temper)
 Solve for the chemical potential for massless fermions.
 
- Protected Attributes inherited from o2scl::fermion_thermo_tl< double >
rootmassless_root
 A pointer to the solver for massless fermions.
 
- Protected Attributes inherited from o2scl::fermion_zerot_tl< double >
double pi
 Desc.
 
double pi2
 Desc.
 

Member Function Documentation

◆ calc_density()

template<class fp_t = double>
virtual int o2scl::fermion_rel_tl< fp_t >::calc_density ( fermion f,
fp_t  temper 
)
inlinevirtual

This function uses the current value of nu (or mu if the particle is non interacting) for an initial guess to solve for the chemical potential. If this guess is too small, then this function may fail.

Definition at line 295 of file fermion_rel.h.

◆ calc_density_tlate()

template<class fp_t = double>
template<class fermion_t >
int o2scl::fermion_rel_tl< fp_t >::calc_density_tlate ( fermion_t &  f,
fp_t  temper 
)
inline
Idea for Future:
There is still quite a bit of code duplication between this function and calc_mu_tlate() .

Definition at line 738 of file fermion_rel.h.

◆ pair_fun()

template<class fp_t = double>
fp_t o2scl::fermion_rel_tl< fp_t >::pair_fun ( fp_t  x,
fermion f,
fp_t  T,
bool  log_mode 
)
inlineprotected
Idea for Future:
Particles and antiparticles have different degeneracy factors, so we separately use the expansions one at a time. It is probably better to separately generate a new expansion function which automatically handles the sum of particles and antiparticles.

Definition at line 1359 of file fermion_rel.h.

Member Data Documentation

◆ last_method

template<class fp_t = double>
int o2scl::fermion_rel_tl< fp_t >::last_method

In all functions

  • 0: no previous calculation or last calculation failed

In nu_from_n_tlate():

  • 1: default solver
  • 2: default solver with smaller tolerances
  • 3: bracketing solver

In calc_mu_tlate():

  • 4: non-degenerate expansion
  • 5: degenerate expansion
  • 6: exact integration, non-degenerate integrands
  • 7: exact integration, degenerate integrands, lower limit on entropy integration
  • 8: exact integration, degenerate integrands, full entropy integration
  • 9: T=0 result

In calc_density_tlate(), the integer is a two-digit number. The first digit (1 to 3) is the method used by nu_from_n_tlate() and the second digit is one of

  • 1: nondegenerate expansion
  • 2: degenerate expansion
  • 3: exact integration, non-degenerate integrands
  • 4: exact integration, degenerate integrands, lower limit on entropy integration
  • 5: exact integration, degenerate integrands, full entropy integration If calc_density_tlate() uses the T=0 code, then last_method is 40.

In pair_mu_tlate(), the integer is a three-digit number. The third digit is always 0 (to ensure a value of last_method which is unique from the other values reported from other functions as described above). The first digit is the method used for particles from calc_mu_tlate() above and the second digit is the method used for antiparticles.

In pair_density_tlate(), the integer is a four-digit number. The first digit is from the list below and the remaining three digits, if nonzero, are from pair_mu_tlate().

  • 1: T=0 result
  • 2: default solver
  • 3: bracketing solver
  • 4: default solver with smaller tolerances
  • 5: default solver with smaller tolerances in log units
  • 6: bracketing in log units

Definition at line 383 of file fermion_rel.h.


The documentation for this class was generated from the following file:
o2scl::fermion_rel
fermion_rel_tl< double > fermion_rel
Double-precision version of o2scl::fermion_rel_tl.
Definition: fermion_rel.h:1624

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