Version: SMASH-3.4
chemicalpotential.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2020,2022
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_SMASH_CHEMICALPOTENTIAL_H_
11 #define SRC_INCLUDE_SMASH_CHEMICALPOTENTIAL_H_
12 
13 #include "gsl/gsl_multiroots.h"
14 #include "gsl/gsl_vector.h"
15 
16 #include "smash/integrate.h"
17 
18 namespace smash {
19 
20 /**
21  * A class which encapsulates a GSL algorithm for finding the effective
22  * chemical potential and supporting functions.
23  */
25  public:
26  /**
27  * Vector number density of one particle species, obtained through integrating
28  * the Juttner distribution function over the momentum space.
29  * \param[in] degeneracy degeneracy g of the particle species
30  * \param[in] mass (pole) mass m of the particle species [GeV]
31  * \param[in] temperature temperature T of the system [GeV]
32  * \param[in] effective_chemical_potential effective chemical potential of the
33  * system [GeV]
34  * \param[in] statistics quantum statistics of the particles species
35  * (+1 for Fermi, -1 for Bose, 0 for Boltzmann)
36  * \param[in] integrator wrapper for gsl numerical integration
37  * \return the vector number density for a given species of particles [GeV^3]
38  */
39  static double density_one_species(double degeneracy, double mass,
40  double temperature,
42  double statistics, Integrator* integrator);
43 
44  /**
45  * Struct, root equations, and procedure for finding the effective chemical
46  * potential for a given particle species. This chemical potential is NOT the
47  * equilibrium chemical potential of a system with multiple particle species.
48  * Rather, it is the effective chemical potential of a particle species
49  * calculated as if only that species is present. (In particular, this applies
50  * also to particles and antiparticles of the same species.)
51  * Note that the procedure is exact for a system composed of protons and
52  * neutrons only, as their mass is degenerate.
53  */
54 
55  /**
56  * Struct object that holds the parameters relevant to finding the effective
57  * chemical potential of one particle species.
58  */
60  /// degeneracy g of the particle species
61  double degeneracy;
62 
63  /// (pole) mass m of the particle species
64  double mass;
65 
66  /// number density n of the particle species [GeV^3]
68 
69  /// temperature T of the system [GeV]
70  double temperature;
71 
72  /**
73  * statistics quantum statistics of the particles species
74  * (+1 for Fermi, -1 for Bose, 0 for Boltzmann)
75  */
76  double statistics;
77 
78  /// wrapper for gsl numerical integration
80  };
81 
82  /**
83  * Root equation for finding the value of the effective chemical potential
84  * for one particle species.
85  * \param[in] degeneracy degeneracy g of the particle species
86  * \param[in] mass (pole) mass m of the particle species
87  * \param[in] number_density number density n of the particle species [GeV^3]
88  * \param[in] temperature temperature T of the system [GeV]
89  * \param[in] effective_chemical_potential effective chemical potential of the
90  * system [GeV]
91  * \param[in] statistics quantum statistics of the particles species
92  * (+1 for Fermi, -1 for Bose, 0 for Boltzmann)
93  * \param[in] integrator wrapper for gsl numerical integration
94  * \return the root equation
95  */
97  double degeneracy, double mass, double number_density, double temperature,
98  double effective_chemical_potential, double statistics,
99  Integrator* integrator);
100 
101  /**
102  * Root equation for finding the value of the effective chemical potential
103  * for one particle species, suited for the GSL root finding procedure.
104  * \param[in] roots_array an array holding the current best estimate of the
105  * roots of the solved equation
106  * \param[in] parameters refers to the parameters as provided in the GSL
107  * root solving procedure
108  * \param[in] function refers to the root equation(s) as provided in the GSL
109  * root solving procedure (where it's called "function")
110  * \return the root equation suited for GSL root finding procedure
111  */
113  const gsl_vector* roots_array, void* parameters, gsl_vector* function);
114 
115  /**
116  * A GSL utility which allows for printing out the status of the solver
117  * during the root finding procedure.
118  * \param[in] iter variable keeping track of how many steps in the root
119  * solving procedure have been taken
120  * \param[in] solver GSL solver object, which has access to the current best
121  * estimate of the roots and the corresponding function values
122  * \return message about the current state of the solver
123  */
125  unsigned int iter, gsl_multiroot_fsolver* solver);
126 
127  /**
128  * A GSL root solver for finding the effective chemical potential. In practice
129  * one should use the convenience wrapper effective_chemical_potential(),
130  * which also performs sanity checks on the obtained solution.
131  *
132  * Solver of the equation for chemical potential \f$ \mu \f$
133  * \f[ n = \frac{g}{2 \pi^2} \int
134  * \frac{p^2 dp}{ e^{(\sqrt{p^2 + m^2} - \mu)/T} \pm 1}
135  * \f] given the density \f$ n \f$, and temperature \f$ T \f$.
136  * \param[in] degeneracy degeneracy g of the particle species
137  * \param[in] mass m (pole) mass m of the particle species [GeV]
138  * \param[in] number_density number density n of the particle species n
139  * [GeV^3]
140  * \param[in] temperature temperature T of the system in GeV
141  * \param[in] statistics quantum statistics of the particles species
142  * (+1 for Fermi, -1 for Bose, 0 for Boltzmann)
143  * \param[in] mu_initial_guess the initial guess for the value of the
144  * effective chemical potential [GeV]
145  * \param[in] solution_precision precision with which the solution is found;
146  * note that this precision also goes into the precision of
147  * integrals calculated in the process
148  * \param[in] integrator wrapper for gsl numerical integration
149  * \param[out] effective_chemical_potential the solution stored in an array
150  * object (we use an array in anticipation of generalizing to
151  * multidimensional root finding, needed for example when scalar
152  * interactions are present and effective mass is calculated at
153  * the same time as the effective chemical potential)
154  */
156  double degeneracy, double mass, double number_density, double temperature,
157  double statistics, double mu_initial_guess, double solution_precision,
158  Integrator* integrator, double* effective_chemical_potential);
159 
160  /**
161  * Convenience wrapper for finding the effective chemical potential for a
162  * given particle species and performing sanity checks on the result.
163  *
164  * \param[in] degeneracy degeneracy g of the particle species
165  * \param[in] mass (pole) mass m of the particle species [GeV]
166  * \param[in] number_density number density n of the particle species [GeV^3]
167  * \param[in] temperature temperature T of the system [GeV]
168  * \param[in] statistics quantum statistics of the particles species
169  * (+1 for Fermi, -1 for Bose, 0 for Boltzmann)
170  * \param[in] solution_precision precision with which the solution is found;
171  * note that this precision also goes into the precision of
172  * integrals calculated in the process
173  * \return effective chemical potential mu, the solution [GeV]
174  */
175  double effective_chemical_potential(double degeneracy, double mass,
176  double number_density, double temperature,
177  double statistics,
178  double solution_precision);
179 
180  private:
181  /**
182  * A wrapper for gsl numerical integration
183  */
185 };
186 
187 } // namespace smash
188 
189 #endif // SRC_INCLUDE_SMASH_CHEMICALPOTENTIAL_H_
A class which encapsulates a GSL algorithm for finding the effective chemical potential and supportin...
static double root_equation_effective_chemical_potential(double degeneracy, double mass, double number_density, double temperature, double effective_chemical_potential, double statistics, Integrator *integrator)
Root equation for finding the value of the effective chemical potential for one particle species.
Integrator integrator_
A wrapper for gsl numerical integration.
double effective_chemical_potential(double degeneracy, double mass, double number_density, double temperature, double statistics, double solution_precision)
Convenience wrapper for finding the effective chemical potential for a given particle species and per...
static void print_state_effective_chemical_potential(unsigned int iter, gsl_multiroot_fsolver *solver)
A GSL utility which allows for printing out the status of the solver during the root finding procedur...
static double density_one_species(double degeneracy, double mass, double temperature, double effective_chemical_potential, double statistics, Integrator *integrator)
Vector number density of one particle species, obtained through integrating the Juttner distribution ...
static int root_equation_effective_chemical_potential_for_GSL(const gsl_vector *roots_array, void *parameters, gsl_vector *function)
Root equation for finding the value of the effective chemical potential for one particle species,...
static int find_effective_chemical_potential(double degeneracy, double mass, double number_density, double temperature, double statistics, double mu_initial_guess, double solution_precision, Integrator *integrator, double *effective_chemical_potential)
A GSL root solver for finding the effective chemical potential.
A C++ interface for numerical integration in one dimension with the GSL CQUAD integration functions.
Definition: integrate.h:106
Definition: action.h:24
Struct, root equations, and procedure for finding the effective chemical potential for a given partic...
double temperature
temperature T of the system [GeV]
double degeneracy
degeneracy g of the particle species
double number_density
number density n of the particle species [GeV^3]
double statistics
statistics quantum statistics of the particles species (+1 for Fermi, -1 for Bose,...
Integrator * integrator
wrapper for gsl numerical integration
double mass
(pole) mass m of the particle species