Thermal-FIST 1.6.1
Package for hadron resonance gas model applications
Loading...
Searching...
No Matches
ThermalModelCanonical.h
Go to the documentation of this file.
1/*
2 * Thermal-FIST package
3 *
4 * Copyright (c) 2015-2019 Volodymyr Vovchenko
5 *
6 * GNU General Public License (GPLv3 or later)
7 */
8#ifndef THERMALMODELCANONICAL_H
9#define THERMALMODELCANONICAL_H
10
11#include <map>
12
13
15
16namespace thermalfist {
17
24 {
25 int B;
26 int Q;
27 int S;
28 int C;
29
38 QuantumNumbers(int iB = 0, int iQ = 0, int iS = 0, int iC = 0) :
39 B(iB), Q(iQ), S(iS), C(iC) { }
40 const bool operator < (const QuantumNumbers &r) const {
41 if (B != r.B)
42 return (B < r.B);
43 else if (Q != r.Q)
44 return (Q < r.Q);
45 else if (S != r.S)
46 return (S < r.S);
47 else
48 return (C < r.C);
49 }
50 };
51
94
148 public ThermalModelBase
149 {
150 public:
158
163 virtual ~ThermalModelCanonical(void);
164
174 virtual void CalculateQuantumNumbersRange(bool computeFluctuations = false);
175
190 virtual void CalculatePartitionFunctions(double Vc = -1.);
191
204 virtual bool IsParticleCanonical(const ThermalParticle &part);
205
213 virtual void ConserveBaryonCharge(bool conserve = true) { m_BCE = static_cast<int>(conserve); m_PartialZCalculated = false; }
214
222 virtual void ConserveElectricCharge(bool conserve = true) { m_QCE = static_cast<int>(conserve); m_PartialZCalculated = false; }
223
231 virtual void ConserveStrangeness(bool conserve = true) { m_SCE = static_cast<int>(conserve); m_PartialZCalculated = false; }
232
240 virtual void ConserveCharm(bool conserve = true) { m_CCE = static_cast<int>(conserve); m_PartialZCalculated = false; }
241
242 virtual bool IsConservedChargeCanonical(ConservedCharge::Name charge) const;
243
250 virtual double GetGCEDensity(int i) const;
251
258
267
271 CanonicalMethod Method() const { return m_Method; }
272
278 void SetMethod(CanonicalMethod method) { m_Method = method; m_PartialZCalculated = false; }
279
296 void SetModelGCE(ThermalModelBase* model);
297
298 /*
299 * \brief Reset all flags which correspond to a calculation status
300 */
301 virtual void ResetCalculatedFlags() {
302 ThermalModelBase::ResetCalculatedFlags();
304 }
305 /*
306 * \brief Reset the flags indicating whether the partial partition functions are calculated
307 */
309
310 /*
311 * \brief Whether the partial partition functions are calculated
312 */
314
315 /*
316 * \brief Whether the partial partition functions are calculated with fluctuations
317 */
319
320 // Override functions begin
321
323
324 virtual void SetStatistics(bool stats);
325
326 virtual void FixParameters();
327
328 virtual void FixParametersNoReset();
329
332 void SolveChemicalPotentialsGCE(bool resetInitialValues);
333
334 virtual void CalculatePrimordialDensities();
335
336 virtual void ValidateCalculation();
337
338 virtual double ParticleScaledVariance(int part);
339
341
348 virtual void CalculateFluctuations();
349
350 virtual double CalculateEnergyDensity();
351
352 virtual double CalculatePressure();
353
354 virtual double CalculateEntropyDensity();
355
356 virtual double CalculateEnergyDensityDerivativeT() { throw std::runtime_error("CalculateEnergyDensityDerivativeT not implemented"); return 0.; } // Not implemented
357
358 virtual double CalculateEntropyDensityDerivativeT() { throw std::runtime_error("CalculateEntropyDensityDerivativeT not implemented"); return 0.; } // Not implemented
359
368 virtual double ParticleScalarDensity(int /*part*/) { return 0.; }
369
370 // Override functions end
371
372 private:
374
387 virtual void PrepareModelGCE();
388 void CleanModelGCE();
389
393 void EnforceSaddlePointLOForNonIdeal();
395
397
400 void ComputeSaddlePointPartitionFunctions();
401 void SolveSaddlePointEquations();
402 void SetupSaddlePointChargeIndices();
403
406 double ComputeSigmaLogDetFromModel();
407
434 void ComputeAnalyticCumulants(bool computeCovariance = false);
435
437
438 protected:
439
446 std::vector<QuantumNumbers> m_QNvec;
447
453 std::map<QuantumNumbers, int> m_QNMap;
454
462 std::vector<double> m_Corr;
463
473 std::vector<double> m_PartialZ;
474
482
484
485 int m_BMAX;
486 int m_QMAX;
487 int m_SMAX;
488 int m_CMAX;
490
491 double m_MultExp;
493
499
500 int m_BCE;
501 int m_QCE;
502 int m_SCE;
503 int m_CCE;
504
509
512
514
516 std::vector<int> m_SaddlePointChargeIndices;
517 std::vector<double> m_SaddlePointMu;
518 std::vector<double> m_SaddlePointMuStar;
520 std::vector<double> m_W2;
521
528 };
529
530} // namespace thermalfist
531
532#endif
map< string, double > params
Abstract base class for an HRG model implementation.
ThermalModelBase(ThermalParticleSystem *TPS, const ThermalModelParameters &params=ThermalModelParameters())
Construct a new ThermalModelBase object.
virtual void ConserveCharm(bool conserve=true)
Specifies whether the charm charge is treated canonically.
std::map< QuantumNumbers, int > m_QNMap
Maps QuantumNumbers combinations to a 1-dimensional index.
double m_MultExpBanalyt
Exponential multiplier for analytical baryon fugacity calculations.
int m_IntegrationIterationsMultiplier
A multiplier to increase the number of iterations during the numerical integration used to calculate ...
virtual double ParticleScalarDensity(int)
Returns the scalar density of a particle species.
int m_SaddlePointDim
Saddle-point approximation data (for SaddlePoint quadrature method)
int IntegrationIterationsMultiplier() const
The multiplier of the number of iterations in the numerical integration.
std::vector< double > m_PartialZ
The computed canonical partition function.
int m_QCE
Flag indicating if electric charge is conserved canonically.
ThermalModelBase * m_modelgce_ext
External GCE model (not owned), set via SetModelGCE()
void SolveChemicalPotentialsGCE(bool resetInitialValues)
CanonicalMethod Method() const
Returns the method used for computing the canonical partition functions.
virtual void ConserveStrangeness(bool conserve=true)
Specifies whether the strangeness charge is treated canonically.
void ChangeTPS(ThermalParticleSystem *TPS)
Change the particle list.
virtual void CalculateTwoParticleCorrelations()
Computes the fluctuations and correlations of the primordial particle numbers.
double m_NLOEnergyDensity
ε = ε^GCE(μ*) - (1/2) Σ_j E_j G_jj (LO: ε^GCE(μ*))
int m_CCE
Flag indicating if charm is conserved canonically.
virtual void CalculateFluctuations()
Computes the fluctuation observables.
double m_NLOPressure
P = p^GCE(μ*) - d·T/(2·Vc) (LO: p^GCE(μ*))
double m_MultExp
Exponential multiplier for canonical partition function calculations.
virtual double ParticleScaledVariance(int part)
void SetModelGCE(ThermalModelBase *model)
Sets an external GCE model to use in the saddle-point approach.
std::vector< QuantumNumbers > m_QNvec
A set of QuantumNumbers combinations for which it is necessary to compute the canonical partition fun...
std::vector< double > m_Corr
A vector of chemical factors.
virtual double GetGCEDensity(int i) const
Density of particle species i in the grand-canonical ensemble.
virtual bool IsParticleCanonical(const ThermalParticle &part)
Determines whether the specified ThermalParticle is treat canonically or grand-canonically in the pre...
virtual void CalculatePartitionFunctions(double Vc=-1.)
Calculates all necessary canonical partition functions.
double m_NLOEntropyDensity
LO entropy: s^GCE(μ*) (used only by SaddlePointLO; NLO uses lnZ_SP)
virtual ~ThermalModelCanonical(void)
Destroy the ThermalModelCanonical object.
void SetIntegrationIterationsMultiplier(int multiplier)
Assigns the multiplier of the number of iterations in the numerical integration.
virtual void CalculateQuantumNumbersRange(bool computeFluctuations=false)
Calculates the range of quantum numbers values for which it is necessary to compute the canonical par...
virtual void FixParametersNoReset()
Method which actually implements ConstrainChemicalPotentialsNoReset() (for backward compatibility).
std::vector< int > m_SaddlePointChargeIndices
Which of {B=0,Q=1,S=2,C=3} are canonical.
void SetMethod(CanonicalMethod method)
Sets the method for computing the canonical partition functions.
int m_BCE
Flag indicating if baryon charge is conserved canonically.
virtual void ValidateCalculation()
Checks whether issues have occured during the calculation of particle densities in the CalculateDensi...
virtual bool IsConservedChargeCanonical(ConservedCharge::Name charge) const
bool m_Banalyt
Flag indicating whether the analytical calculation of baryon fugacity is used.
ThermalModelBase * m_modelgce_default
Default ideal-gas GCE model (owned, created once)
int m_SCE
Flag indicating if strangeness is conserved canonically.
std::vector< double > m_SaddlePointMu
Saddle-point mu*_a/T for each conserved charge (size 4)
std::vector< double > m_W2
Per-particle W^(2) = Vc * chi2 (for SaddlePointNLO)
CanonicalMethod m_Method
Method for computing the canonical partition functions.
virtual void FixParameters()
Method which actually implements ConstrainChemicalPotentials() (for backward compatibility).
virtual void ConserveElectricCharge(bool conserve=true)
Specifies whether the electric charge is treated canonically.
virtual void CalculatePrimordialDensities()
Calculates the primordial densities of all species.
ThermalModelCanonical(ThermalParticleSystem *TPS, const ThermalModelParameters &params=ThermalModelParameters())
Construct a new ThermalModelCanonical object.
virtual void ConserveBaryonCharge(bool conserve=true)
Specifies whether the baryon number is treated canonically.
std::vector< double > m_SaddlePointMuStar
Per-particle full chemical potential at saddle point.
Class containing all information about a particle specie.
Class containing the particle list.
The main namespace where all classes and functions of the Thermal-FIST library reside.
Definition CosmicEoS.h:9
CanonicalMethod
Method used for computing the canonical partition functions.
@ SaddlePointLO
Saddle-point LO only (GCE densities/thermo, canonical LO fluctuations)
@ SaddlePoint
Saddle-point approximation (per-QN solve)
@ SaddlePointNLO
Saddle-point with systematic NLO expansion (preserves exact conservation laws)
@ GaussLegendre
Composite 10-point Gauss-Legendre on subintervals (default)
Name
Set of all conserved charges considered.
QuantumNumbers(int iB=0, int iQ=0, int iS=0, int iC=0)
Construct a new QuantumNumbers object.
const bool operator<(const QuantumNumbers &r) const
Structure containing all thermal parameters of the model.