#include <hadgas_eos.h>
Class to handle the equation of state (EoS) of the hadron gas, consisting of all hadrons included into SMASH.
This implementation deals with ideal Boltzmann gas and allows to compute:
Definition at line 112 of file hadgas_eos.h.
Classes | |
struct | eparams |
Another structure for passing energy density to the gnu library. More... | |
struct | rparams |
A structure for passing equation parameters to the gnu library. More... | |
Public Member Functions | |
HadronGasEos (bool tabulate, bool account_for_widths) | |
Constructor of HadronGasEos. More... | |
~HadronGasEos () | |
std::array< double, 3 > | solve_eos (double e, double nb, double ns, std::array< double, 3 > initial_approximation) |
Compute temperature and chemical potentials given energy-, net baryon-, net strangeness density and an inital approximation. More... | |
std::array< double, 3 > | solve_eos (double e, double nb, double ns) |
Compute temperature and chemical potentials given energy-, net baryon- and net strangeness density without an inital approximation. More... | |
std::array< double, 3 > | solve_eos_initial_approximation (double e, double nb) |
Compute a reasonable initial approximation for solve_eos. More... | |
void | from_table (EosTable::table_element &res, double e, double nb) const |
Get the element of eos table. More... | |
bool | is_tabulated () const |
Create an EoS table or not? More... | |
bool | account_for_resonance_widths () const |
If resonance spectral functions are taken into account. More... | |
Static Public Member Functions | |
static double | energy_density (double T, double mub, double mus) |
Compute energy density. More... | |
static double | density (double T, double mub, double mus, bool account_for_resonance_widths=false) |
Compute particle number density. More... | |
static double | pressure (double T, double mub, double mus, bool account_for_resonance_widths=false) |
Compute pressure \( p = n T \). More... | |
static double | net_baryon_density (double T, double mub, double mus, bool account_for_resonance_widths=false) |
Compute net baryon density. More... | |
static double | net_strange_density (double T, double mub, double mus, bool account_for_resonance_widths=false) |
Compute net strangeness density. More... | |
static double | partial_density (const ParticleType &ptype, double T, double mub, double mus, bool account_for_resonance_widths=false) |
Compute partial density of one hadron sort. More... | |
static double | sample_mass_thermal (const ParticleType &ptype, double beta) |
Sample resonance mass in a thermal medium. More... | |
static double | mus_net_strangeness0 (double T, double mub) |
Compute strangeness chemical potential, requiring that net strangeness = 0. More... | |
static bool | is_eos_particle (const ParticleType &ptype) |
Check if a particle belongs to the EoS. More... | |
Private Member Functions | |
std::string | print_solver_state (size_t iter) const |
Helpful printout, useful for debugging if gnu equation solving goes crazy. More... | |
Static Private Member Functions | |
static double | scaled_partial_density_auxiliary (double m_over_T, double mu_over_T) |
Function used to avoid duplications in density calculations. More... | |
static double | scaled_partial_density (const ParticleType &ptype, double beta, double mub, double mus, bool account_for_width=false) |
Compute (unnormalized) density of one hadron sort - helper functions used to reduce code duplication. More... | |
static int | set_eos_solver_equations (const gsl_vector *x, void *params, gsl_vector *f) |
Interface EoS equations to be solved to gnu library. More... | |
static double | e_equation (double T, void *params) |
Private Attributes | |
EosTable | eos_table_ = EosTable(1.e-2, 1.e-2, 900, 900) |
EOS Table to be used. More... | |
gsl_vector * | x_ |
Variables used by gnu equation solver. More... | |
gsl_multiroot_fsolver * | solver_ |
const bool | tabulate_ |
Create an EoS table or not? More... | |
const bool | account_for_resonance_widths_ |
Use pole masses of resonances or integrate over spectral functions. More... | |
Static Private Attributes | |
static constexpr double | prefactor_ |
Constant factor, that appears in front of many thermodyn. expressions. More... | |
static constexpr double | tolerance_ = 1.e-8 |
Precision of equation solving. More... | |
static constexpr size_t | n_equations_ = 3 |
Number of equations in the system of equations to be solved. More... | |
smash::HadronGasEos::HadronGasEos | ( | bool | tabulate, |
bool | account_for_widths | ||
) |
Constructor of HadronGasEos.
[in] | tabulate | Whether the equation of state should be tabulated Tabulation takes time once (typically around 5 minutes), but makes the further usage of the class much faster. Tabulated values are saved in a file and loaded at the next run. |
[in] | account_for_widths | Whether equation of state should account for resonance spectral functions. Normally one wants to do it, if HadronGasEos is used for density calculations, for example in the box initialization. However, it is not recommended to account for spectral functions if EoS is tabulated (tabulate = true), because this makes tabulation incredibly slow. Therefore, for HadronGasEos to be used in thermalizer, this option has to be false. Also note that presently width account is not implemented for energy density calculation. |
Definition at line 161 of file hadgas_eos.cc.
smash::HadronGasEos::~HadronGasEos | ( | ) |
Definition at line 183 of file hadgas_eos.cc.
|
static |
Compute energy density.
Grand-canonical Boltzmann ideal gas, consisting of all hadrons in SMASH:
\[ \epsilon = \sum \frac{g_i m_i^2 T^2}{2\pi^2(\hbar c)^3} exp \left(\frac{\mu_B B_i + \mu_S S_i}{T} \right) \times \left[ 3 K_2\left( \frac{m_i}{T}\right) + \frac{m_i}{T} K_1\left( \frac{m_i}{T}\right)\right] \]
[in] | T | temperature [GeV] |
[in] | mub | baryon chemical potential [GeV] |
[in] | mus | strangeness chemical potential [GeV] |
Definition at line 244 of file hadgas_eos.cc.
|
static |
Compute particle number density.
Grand-canonical Boltzmann ideal gas, consisting of all hadrons in SMASH:
\[ n = \sum \frac{g_i m_i^2 T}{2\pi^2(\hbar c)^3} exp \left(\frac{\mu_B B_i + \mu_S S_i}{T} \right) K_2\left( \frac{m_i}{T}\right) \]
[in] | T | temperature [GeV] |
[in] | mub | baryon chemical potential [GeV] |
[in] | mus | strangeness chemical potential [GeV] |
[in] | account_for_resonance_widths | if false, pole masses are used; if true, then integration over spectral function is included |
Definition at line 272 of file hadgas_eos.cc.
|
inlinestatic |
Compute pressure \( p = n T \).
[in] | T | temperature [GeV] |
[in] | mub | baryon chemical potential [GeV] |
[in] | mus | strangeness chemical potential [GeV] |
[in] | account_for_resonance_widths | if false, pole masses are used; if true, then integration over spectral function is included |
Definition at line 180 of file hadgas_eos.h.
|
static |
Compute net baryon density.
Grand-canonical Boltzmann ideal gas, consisting of all hadrons in SMASH:
\[ n_B = \sum B_i \frac{g_i m_i^2 T}{2\pi^2(\hbar c)^3} exp \left(\frac{\mu_B B_i + \mu_S S_i}{T} \right) K_2\left( \frac{m_i}{T}\right) \]
[in] | T | temperature [GeV] |
[in] | mub | baryon chemical potential [GeV] |
[in] | mus | strangeness chemical potential [GeV] |
[in] | account_for_resonance_widths | if false, pole masses are used; if true, then integration over spectral function is included |
Definition at line 289 of file hadgas_eos.cc.
|
static |
Compute net strangeness density.
Grand-canonical Boltzmann ideal gas, consisting of all hadrons in SMASH:
\[ n_S = \sum S_i \frac{g_i m_i^2 T}{2\pi^2(\hbar c)^3} exp \left(\frac{\mu_B B_i + \mu_S S_i}{T} \right) K_2\left( \frac{m_i}{T}\right) \]
[in] | T | temperature [GeV] |
[in] | mub | baryon chemical potential [GeV] |
[in] | mus | strangeness chemical potential [GeV] |
[in] | account_for_resonance_widths | if false, pole masses are used; if true, then integration over spectral function is included |
Definition at line 307 of file hadgas_eos.cc.
|
static |
Compute partial density of one hadron sort.
Grand-canonical Boltzmann ideal gas:
\[ n = \frac{g m^2 T}{2\pi^2(\hbar c)^3} exp \left(\frac{\mu_B B + \mu_S S}{T} \right) K_2\left( \frac{m}{T}\right) \]
[in] | ptype | the hadron sort, for which partial density is computed |
[in] | T | temperature [GeV] |
[in] | mub | baryon chemical potential [GeV] |
[in] | mus | strangeness chemical potential [GeV] |
[in] | account_for_resonance_widths | if false, pole masses are used; if true, then integration over spectral function is included |
Definition at line 234 of file hadgas_eos.cc.
|
static |
Sample resonance mass in a thermal medium.
Samples mass from the distribution
\[ dN/dm \sim A(m) m^2 K_2\left( \frac{m}{T}\right) \]
For stable particles always returns pole mass.
[in] | ptype | the hadron sort, for which mass is sampled |
[in] | beta | inverse temperature 1/T [1/GeV] |
Definition at line 325 of file hadgas_eos.cc.
std::array< double, 3 > smash::HadronGasEos::solve_eos | ( | double | e, |
double | nb, | ||
double | ns, | ||
std::array< double, 3 > | initial_approximation | ||
) |
Compute temperature and chemical potentials given energy-, net baryon-, net strangeness density and an inital approximation.
[in] | e | energy density [GeV/fm \(^3\)] |
[in] | nb | net baryon density [fm \(^{-3}\)] |
[in] | ns | net strangeness density [fm \(^{-3}\)] |
[in] | initial_approximation | (T [GeV], mub [GeV], mus [GeV]) to use as starting point |
Definition at line 507 of file hadgas_eos.cc.
|
inline |
Compute temperature and chemical potentials given energy-, net baryon- and net strangeness density without an inital approximation.
[in] | e | energy density [GeV/fm \(^3\)] |
[in] | nb | net baryon density [fm \(^{-3}\)] |
[in] | ns | net strangeness density [fm \(^{-3}\)] |
Definition at line 279 of file hadgas_eos.h.
std::array< double, 3 > smash::HadronGasEos::solve_eos_initial_approximation | ( | double | e, |
double | nb | ||
) |
Compute a reasonable initial approximation for solve_eos.
[in] | e | energy density [GeV/fm \(^3\)] |
[in] | nb | net baryon density [fm \(^{-3}\)] |
Definition at line 444 of file hadgas_eos.cc.
|
static |
Compute strangeness chemical potential, requiring that net strangeness = 0.
[in] | mub | baryon chemical potential [GeV] |
[in] | T | temperature [GeV] |
Definition at line 397 of file hadgas_eos.cc.
|
inline |
Get the element of eos table.
Definition at line 303 of file hadgas_eos.h.
|
inlinestatic |
Check if a particle belongs to the EoS.
Definition at line 308 of file hadgas_eos.h.
|
inline |
Create an EoS table or not?
Definition at line 313 of file hadgas_eos.h.
|
inline |
If resonance spectral functions are taken into account.
Definition at line 316 of file hadgas_eos.h.
|
staticprivate |
Function used to avoid duplications in density calculations.
[in] | m_over_T | mass to temperature ratio \( m/T \) |
[in] | mu_over_T | chemical potential to temperature ratio \( \mu/T \) |
Definition at line 188 of file hadgas_eos.cc.
|
staticprivate |
Compute (unnormalized) density of one hadron sort - helper functions used to reduce code duplication.
[in] | ptype | the hadron sort, for which partial density is computed |
[in] | beta | inverse temperature [1/GeV] |
[in] | mub | baryon chemical potential [GeV] |
[in] | mus | strangeness chemical potential [GeV] |
[in] | account_for_width | Take hadron spectral functions into account or not. When taken into account, they result in a considerable slow down. |
Definition at line 202 of file hadgas_eos.cc.
|
staticprivate |
Interface EoS equations to be solved to gnu library.
Definition at line 421 of file hadgas_eos.cc.
|
staticprivate |
Definition at line 439 of file hadgas_eos.cc.
|
private |
Helpful printout, useful for debugging if gnu equation solving goes crazy.
[in] | iter | current value of iterator |
Definition at line 555 of file hadgas_eos.cc.
|
staticprivate |
Constant factor, that appears in front of many thermodyn. expressions.
Definition at line 381 of file hadgas_eos.h.
|
staticprivate |
Precision of equation solving.
Definition at line 385 of file hadgas_eos.h.
|
staticprivate |
Number of equations in the system of equations to be solved.
Definition at line 388 of file hadgas_eos.h.
EOS Table to be used.
Definition at line 391 of file hadgas_eos.h.
|
private |
Variables used by gnu equation solver.
They are stored here to allocate and deallocate memory for them only once. It is expected that this class will be used for solving the EoS many times, so multiple allocations and frees are unwanted.
Definition at line 399 of file hadgas_eos.h.
|
private |
Definition at line 402 of file hadgas_eos.h.
|
private |
Create an EoS table or not?
Definition at line 405 of file hadgas_eos.h.
|
private |
Use pole masses of resonances or integrate over spectral functions.
Definition at line 408 of file hadgas_eos.h.