#include <hadgas_eos.h>
Class to handle the equation of state (EoS) of the hadron gas, consisting of all hadrons included in SMASH.
This implementation deals with an ideal Boltzmann gas and allows to compute:
Definition at line 125 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, 4 > | solve_eos (double e, double nb, double ns, double nq, std::array< double, 4 > initial_approximation) |
Compute temperature and chemical potentials given energy-, net baryon-, net strangeness- and net charge density and an inital approximation. More... | |
std::array< double, 4 > | solve_eos (double e, double nb, double ns, double nq) |
Compute temperature and chemical potentials given energy-, net baryon-, net strangeness- and net charge density without an inital approximation. More... | |
std::array< double, 4 > | solve_eos_initial_approximation (double e, double nb, double nq) |
Compute a reasonable initial approximation for solve_eos. More... | |
void | from_table (EosTable::table_element &res, double e, double nb, double nq) 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, double muq) |
Compute energy density. More... | |
static double | density (double T, double mub, double mus, double muq, bool account_for_resonance_widths=false) |
Compute particle number density. More... | |
static double | pressure (double T, double mub, double mus, double muq, bool account_for_resonance_widths=false) |
Compute pressure \( p = n T \). More... | |
static double | net_baryon_density (double T, double mub, double mus, double muq, bool account_for_resonance_widths=false) |
Compute net baryon density. More... | |
static double | net_strange_density (double T, double mub, double mus, double muq, bool account_for_resonance_widths=false) |
Compute net strangeness density. More... | |
static double | net_charge_density (double T, double mub, double mus, double muq, bool account_for_resonance_widths=false) |
Compute net charge density. More... | |
static double | partial_density (const ParticleType &ptype, double T, double mub, double mus, double muq, 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, double muq) |
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, double muq, 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-1, 1.e-1, 1.e-1, 90, 90, 90) |
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_ = 4 |
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 197 of file hadgas_eos.cc.
smash::HadronGasEos::~HadronGasEos | ( | ) |
Definition at line 218 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 + \mu_Q Q_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] |
[in] | muq | charge chemical potential [GeV] |
Definition at line 281 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 + \mu_Q Q_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] | muq | charge 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 310 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] | muq | charge 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 195 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 + \mu_Q Q_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] | muq | charge 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 328 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 + \mu_Q Q_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] | muq | charge 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 347 of file hadgas_eos.cc.
|
static |
Compute net charge density.
Grand-canonical Boltzmann ideal gas, consisting of all hadrons in SMASH:
\[ n_Q = \sum Q_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 + \mu_Q Q_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] | muq | charge 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 366 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 + \mu_Q Q_i}{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] | muq | charge 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 270 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 385 of file hadgas_eos.cc.
std::array< double, 4 > smash::HadronGasEos::solve_eos | ( | double | e, |
double | nb, | ||
double | ns, | ||
double | nq, | ||
std::array< double, 4 > | initial_approximation | ||
) |
Compute temperature and chemical potentials given energy-, net baryon-, net strangeness- and net charge 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] | nq | net charge density [fm \(^{-3}\)] |
[in] | initial_approximation | (T [GeV], mub [GeV], mus [GeV]) to use as starting point |
Definition at line 586 of file hadgas_eos.cc.
|
inline |
Compute temperature and chemical potentials given energy-, net baryon-, net strangeness- and net charge 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}\)] |
[in] | nq | net charge density [fm \(^{-3}\)] |
Definition at line 322 of file hadgas_eos.h.
std::array< double, 4 > smash::HadronGasEos::solve_eos_initial_approximation | ( | double | e, |
double | nb, | ||
double | nq | ||
) |
Compute a reasonable initial approximation for solve_eos.
[in] | e | energy density [GeV/fm \(^3\)] |
[in] | nb | net baryon density [fm \(^{-3}\)] |
[in] | nq | net charge density [fm \(^{-3}\)] |
Definition at line 506 of file hadgas_eos.cc.
|
static |
Compute strangeness chemical potential, requiring that net strangeness = 0.
[in] | T | temperature [GeV] |
[in] | mub | baryon chemical potential [GeV] |
[in] | muq | charge chemical potential [GeV] |
Definition at line 456 of file hadgas_eos.cc.
|
inline |
Get the element of eos table.
Definition at line 349 of file hadgas_eos.h.
|
inlinestatic |
Check if a particle belongs to the EoS.
Definition at line 355 of file hadgas_eos.h.
|
inline |
|
inline |
If resonance spectral functions are taken into account.
Definition at line 363 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 223 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] | muq | charge 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 237 of file hadgas_eos.cc.
|
staticprivate |
Interface EoS equations to be solved to gnu library.
Definition at line 480 of file hadgas_eos.cc.
|
staticprivate |
|
private |
Helpful printout, useful for debugging if gnu equation solving goes crazy.
[in] | iter | current value of iterator |
Definition at line 636 of file hadgas_eos.cc.
|
staticconstexprprivate |
Constant factor, that appears in front of many thermodyn. expressions.
Definition at line 431 of file hadgas_eos.h.
|
staticconstexprprivate |
Precision of equation solving.
Definition at line 435 of file hadgas_eos.h.
|
staticconstexprprivate |
Number of equations in the system of equations to be solved.
Definition at line 438 of file hadgas_eos.h.
EOS Table to be used.
Definition at line 441 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 449 of file hadgas_eos.h.
|
private |
Definition at line 452 of file hadgas_eos.h.
|
private |
Create an EoS table or not?
Definition at line 455 of file hadgas_eos.h.
|
private |
Use pole masses of resonances or integrate over spectral functions.
Definition at line 458 of file hadgas_eos.h.