Thermal-FIST  1.3
Package for hadron resonance gas model applications
ThermalModelCanonicalStrangeness.cpp
Go to the documentation of this file.
1 /*
2  * Thermal-FIST package
3  *
4  * Copyright (c) 2014-2019 Volodymyr Vovchenko
5  *
6  * GNU General Public License (GPLv3 or later)
7  */
9 
10 #include "HRGBase/xMath.h"
11 
12 using namespace std;
13 
14 namespace thermalfist {
15 
16  ThermalModelCanonicalStrangeness::ThermalModelCanonicalStrangeness(ThermalParticleSystem *TPS_, const ThermalModelParameters& params) :
17  ThermalModelBase(TPS_, params)
18  {
19  m_densitiesGCE.resize(m_TPS->Particles().size());
20 
21  m_StrVals.resize(0);
22  m_StrVals.push_back(0);
23  m_StrVals.push_back(1);
24  m_StrVals.push_back(2);
25  m_StrVals.push_back(3);
26  m_StrVals.push_back(-1);
27  m_StrVals.push_back(-2);
28  m_StrVals.push_back(-3);
29 
30  m_StrMap.clear();
31  for (unsigned int i = 0; i < m_StrVals.size(); ++i) m_StrMap[m_StrVals[i]] = i;
32 
33  m_Parameters.muS = 0.;
34 
35  m_TAG = "ThermalModelCanonicalStrangeness";
36 
37  m_Ensemble = SCE;
39  }
40 
42  {
43  }
44 
45 
48  m_Parameters.muS = 0.;
49  }
50 
52  {
53  m_Parameters.muS = 0.0;
54  }
55 
58  m_densitiesGCE.resize(m_TPS->Particles().size());
59  }
61  m_ConstrainMuS = false;
62  m_ConstrainMuC = false; // No sense doing strangeness CE but charm GCE
63 
65  }
66 
67 
69  m_QuantumStats = stats;
70  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i)
71  if (m_TPS->Particles()[i].Strangeness() == 0) m_TPS->Particle(i).UseStatistics(stats);
72  else m_TPS->Particle(i).UseStatistics(false);
73  }
74 
76  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) {
78  }
79  m_GCECalculated = true;
80  }
81 
83  m_energydensitiesGCE.resize(m_densitiesGCE.size());
84  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) {
86  }
87  }
88 
90  {
91  m_pressuresGCE.resize(m_densitiesGCE.size());
92  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) {
94  }
95  }
96 
98  {
99  if (!m_GCECalculated)
101 
102  m_Zsum.resize(m_StrVals.size());
103 
104  m_partialS.resize(m_StrVals.size());
105  vector<double> xi(3, 0.), yi(3, 0.);
106 
107  for (size_t i = 0; i < m_StrVals.size(); ++i) {
108  m_partialS[i] = 0.;
109  for (int j = 0; j < m_TPS->ComponentsNumber(); ++j)
110  if (m_StrVals[i] == m_TPS->Particles()[j].Strangeness())
111  m_partialS[i] += m_densitiesGCE[j] * Vc;
112  }
113 
114  for (int i = 0; i < 3; ++i) {
115  xi[i] = 2. * sqrt(m_partialS[m_StrMap[i + 1]] * m_partialS[m_StrMap[-(i + 1)]]);
116  yi[i] = sqrt(m_partialS[m_StrMap[i + 1]] / m_partialS[m_StrMap[-(i + 1)]]);
117  }
118 
119  // TODO: Choose iters dynamically based on total strangeness
120  int iters = 20;
121 
122  for (unsigned int i = 0; i < m_StrVals.size(); ++i) {
123  double res = 0.;
124 
125  for (int m = -iters; m <= iters; ++m)
126  for (int n = -iters; n <= iters; ++n) {
127  double tmp = xMath::BesselI(abs(3 * m + 2 * n - m_StrVals[i]), xi[0]) *
128  xMath::BesselI(abs(n), xi[1]) *
129  xMath::BesselI(abs(m), xi[2]) *
130  pow(yi[0], m_StrVals[i] - 3 * m - 2 * n) *
131  pow(yi[1], n) *
132  pow(yi[2], m);
133  if (tmp != tmp) continue;
134  res += tmp;
135  }
136  m_Zsum[i] = res;
137  }
138  }
139 
142  printf("**ERROR** ThermalModelCanonicalStrangeness::CalculatePrimordialDensities(): PCE not supported!\n");
143  exit(1);
144  }
145 
146  m_FluctuationsCalculated = false;
147 
148  m_energydensitiesGCE.resize(0);
149  m_pressuresGCE.resize(0);
150 
152 
154 
155  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) {
156  if (m_StrMap.count(-m_TPS->Particles()[i].Strangeness()))
157  m_densities[i] = (m_Zsum[m_StrMap[-m_TPS->Particles()[i].Strangeness()]] / m_Zsum[m_StrMap[0]]) * m_densitiesGCE[i];
158  }
159 
160  m_Calculated = true;
162  }
163 
164 
166  m_wprim.resize(m_densities.size());
167  m_wtot.resize(m_densities.size());
168  for (size_t i = 0; i < m_wprim.size(); ++i) {
169  m_wprim[i] = 1.;
170  m_wtot[i] = 1.;
171  m_skewprim[i] = 1.;
172  m_skewtot[i] = 1.;
173  }
174  }
175 
176 
178  if (!m_Calculated)
180  if (m_energydensitiesGCE.size() == 0)
182  double ret = 0.;
183  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i)
184  if (m_StrMap.count(-m_TPS->Particles()[i].Strangeness()))
185  ret += (m_Zsum[m_StrMap[-m_TPS->Particles()[i].Strangeness()]] / m_Zsum[m_StrMap[0]]) * m_energydensitiesGCE[i];
186  return ret;
187  }
188 
189 
191  double ret = log(m_Zsum[m_StrMap[0]]) / m_Parameters.SVc;
192  if (m_energydensitiesGCE.size() == 0)
194  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i)
195  if (m_TPS->Particles()[i].Strangeness() != 0) {
196  if (m_StrMap.count(-m_TPS->Particles()[i].Strangeness()))
197  ret += (m_Zsum[m_StrMap[-m_TPS->Particles()[i].Strangeness()]] / m_Zsum[m_StrMap[0]]) * ((m_energydensitiesGCE[i] - m_Chem[i] * m_densitiesGCE[i]) / m_Parameters.T);
198  }
199  else {
201  }
202  return ret;
203  }
204 
205 
207  double ret = 0.;
208  if (m_pressuresGCE.size() == 0)
210  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i)
211  if (m_StrMap.count(-m_TPS->Particles()[i].Strangeness()))
212  ret += (m_Zsum[m_StrMap[-m_TPS->Particles()[i].Strangeness()]] / m_Zsum[m_StrMap[0]]) * m_pressuresGCE[i];
213  return ret;
214  }
215 
217  return (charge == ConservedCharge::StrangenessCharge);
218  }
219 
220 } // namespace thermalfist
virtual void CalculateDensitiesGCE()
Calculates the particle densities in a grand-canonical ensemble.
Abstract base class for an HRG model implementation.
virtual void CalculatePrimordialDensities()
Calculates the primordial densities of all species.
std::vector< double > m_Chem
virtual void FixParameters()
Method which actually implements ConstrainChemicalPotentials() (for backward compatibility).
virtual bool IsConservedChargeCanonical(ConservedCharge::Name charge) const
Whether the given conserved charge is treated canonically.
virtual void ChangeTPS(ThermalParticleSystem *TPS)
Change the particle list.
std::vector< double > m_wprim
const ThermalParticle & Particle(int id) const
ThermalParticle object corresponding to particle species with a provided 0-based index.
std::vector< double > m_skewprim
virtual void FixParameters()
Method which actually implements ConstrainChemicalPotentials() (for backward compatibility).
void CalculateFluctuations()
Dummy function. Fluctuations not yet supported.
virtual void CalculatePressuresGCE()
Calculates the grand-canonical pressures.
Class containing the particle list.
virtual void SetParameters(const ThermalModelParameters &params)
The thermal parameters.
ThermalModelParameters m_Parameters
Structure containing all thermal parameters of the model.
int ComponentsNumber() const
Number of different particle species in the list.
Contains some extra mathematical functions used in the code.
ThermalParticleSystem * m_TPS
std::vector< double > m_wtot
double BesselI(int n, double x)
integer order modified Bessel function I_n(x)
Definition: xMath.cpp:191
const std::vector< ThermalParticle > & Particles() const
Returns the vector of all particle species.
ThermalModelInteraction m_InteractionModel
virtual void ValidateCalculation()
Checks whether issues have occured during the calculation of particle densities in the CalculateDensi...
virtual void CalculateSums(double Vc)
Calculates the strangeness-canonical partition functions.
void UseStatistics(bool enable)
Use quantum statistics.
Name
Set of all conserved charges considered.
virtual void CalculateDensities()
Calculates the primordial and total (after decays) densities of all species.
virtual void SetStrangenessChemicalPotential(double muS)
Override the base class method to always set to zero.
std::vector< double > m_densities
virtual ~ThermalModelCanonicalStrangeness(void)
Destroy the ThermalModelCanonicalStrangeness object.
virtual void SetParameters(const ThermalModelParameters &params)
The thermal parameters.
virtual void ChangeTPS(ThermalParticleSystem *TPS)
Change the particle list.
bool UsePartialChemicalEquilibrium()
Whether partial chemical equilibrium with additional chemical potentials is used. ...
Strangeness-canonical ensemble.
ThermalModelEnsemble m_Ensemble
std::vector< double > m_skewtot
virtual void CalculateEnergyDensitiesGCE()
Calculates the grand-canonical energy densities.
virtual double CalculatePressure()
Implementation of the equation of state functions.
The main namespace where all classes and functions of the Thermal-FIST library reside.