Thermal-FIST  1.3
Package for hadron resonance gas model applications
ThermalModelEVCrossterms.h
Go to the documentation of this file.
1 /*
2  * Thermal-FIST package
3  *
4  * Copyright (c) 2015-2018 Volodymyr Vovchenko
5  *
6  * GNU General Public License (GPLv3 or later)
7  */
8 #ifndef THERMALMODELEVCROSSTERMS_H
9 #define THERMALMODELEVCROSSTERMS_H
10 
12 
13 namespace thermalfist {
14 
37  {
38  public:
46 
51  virtual ~ThermalModelEVCrossterms(void);
52 
53  // Override functions begin
54 
55  virtual void FillVirial(const std::vector<double> & ri = std::vector<double>(0));
56 
57  virtual void ReadInteractionParameters(const std::string &filename);
58 
59  virtual void WriteInteractionParameters(const std::string &filename);
60 
61  void SetRadius(double rad);
62 
63  double VirialCoefficient(int i, int j) const;
64 
65  void SetVirial(int i, int j, double b);
66 
67  virtual void ChangeTPS(ThermalParticleSystem *TPS);
68 
69  virtual void CalculatePrimordialDensities();
70 
72 
73  void CalculateFluctuations();
74 
75  virtual std::vector<double> CalculateChargeFluctuations(const std::vector<double> &chgs, int order = 4);
76 
77  virtual double CalculatePressure();
78 
79  virtual double CalculateEnergyDensity();
80 
81  virtual double CalculateEntropyDensity();
82 
83  // Dummy
84  virtual double CalculateBaryonMatterEntropyDensity() { return 0.; }
85  virtual double CalculateMesonMatterEntropyDensity() { return 0.; }
86 
87  // TODO properly with excluded volume
88  virtual double ParticleScaledVariance(int /*part*/) { return 1.; }
89 
90  // TODO properly with excluded volume
91  virtual double ParticleSkewness(int part) { return m_skewprim[part]; }
92 
93  // TODO properly with excluded volume
94  virtual double ParticleKurtosis(int part) { return m_kurtprim[part]; }
95 
96  // TODO properly with excluded volume
97  virtual double ParticleScalarDensity(int /*part*/) { return 0.; }
98 
99  // Override functions end
100 
101  protected:
109  virtual void SolvePressure(bool resetPartials = true); // Using Broyden's method
110 
111  void SolvePressureIter(); // Using iteration method
112 
114 
115  virtual void CalculatePrimordialDensitiesIter();
116 
127  virtual void SolveDiagonal();
128 
137  double PartialPressureDiagonal(int i, double P);
138 
146  double PressureDiagonalTotal(double P);
147 
157  virtual double DensityId(int i, const std::vector<double>& pstars = std::vector<double>());
158 
168  virtual double Pressure(int i, const std::vector<double>& pstars = std::vector<double>());
169 
180  double ScaledVarianceId(int ind);
181 
192  virtual double MuShift(int i) const;
193 
194  std::vector<double> m_densitiesid;
195  std::vector<double> m_Ps;
196  std::vector< std::vector<double> > m_Virial;
197  double m_Pressure;
200  private:
201  class BroydenEquationsCRS : public BroydenEquations
202  {
203  public:
204  BroydenEquationsCRS(ThermalModelEVCrossterms *model) : BroydenEquations(), m_THM(model) { m_N = model->Densities().size(); }
205  std::vector<double> Equations(const std::vector<double> &x);
206  private:
208  };
209 
210  class BroydenEquationsCRSDEV : public BroydenEquations
211  {
212  public:
213  BroydenEquationsCRSDEV(ThermalModelEVCrossterms *model) : BroydenEquations(), m_THM(model) { m_N = 1; }
214  std::vector<double> Equations(const std::vector<double> &x);
215  private:
217  };
218 
219  class BroydenJacobianCRS : public BroydenJacobian
220  {
221  public:
222  BroydenJacobianCRS(ThermalModelEVCrossterms *model) : BroydenJacobian(), m_THM(model) { }
223  std::vector<double> Jacobian(const std::vector<double> &x);
224  private:
226  };
227 
228  class BroydenSolutionCriteriumCRS : public Broyden::BroydenSolutionCriterium
229  {
230  public:
231  BroydenSolutionCriteriumCRS(ThermalModelEVCrossterms *model, double relative_error = Broyden::TOL) : Broyden::BroydenSolutionCriterium(relative_error), m_THM(model) { }
232  virtual bool IsSolved(const std::vector<double>& x, const std::vector<double>& f, const std::vector<double>& xdelta = std::vector<double>()) const;
233  protected:
235  };
236  };
237 
238 } // namespace thermalfist
239 
240 #endif
241 
Abstract base class for an HRG model implementation.
virtual void ReadInteractionParameters(const std::string &filename)
Reads the QvdW interaction parameters from a file.
double ScaledVarianceId(int ind)
Calculate the ideal gas scaled variance of particle species i number fluctuations for the given value...
virtual double ParticleScalarDensity(int)
The scalar density of the particle species i.
virtual std::vector< double > CalculateChargeFluctuations(const std::vector< double > &chgs, int order=4)
Calculates fluctuations (diagonal susceptibilities) of an arbitrary "conserved" charge.
virtual double ParticleKurtosis(int part)
Kurtosis of primordial particle number fluctuations for species i.
static const double TOL
Default desired solution accuracy.
Definition: Broyden.h:183
const std::vector< double > & Densities() const
double VirialCoefficient(int i, int j) const
Excluded volume coefficient .
std::vector< double > m_skewprim
virtual double ParticleScaledVariance(int)
Scaled variance of primordial particle number fluctuations for species i.
virtual void SolveDiagonal()
Solves the transcendental equation of the corresponding diagonal EV model.
Class containing the particle list.
Structure containing all thermal parameters of the model.
Abstract class which defines the system of non-linear equations to be solved by the Broyden&#39;s method...
Definition: Broyden.h:31
virtual double CalculateBaryonMatterEntropyDensity()
The fraction of entropy carried by baryons (Ideal GCE only)
void CalculateFluctuations()
Computes the fluctuation observables.
double PressureDiagonalTotal(double P)
The total pressure for the given input pressure in the diagonal model.
virtual double ParticleSkewness(int part)
Skewness of primordial particle number fluctuations for species i.
virtual void SolvePressure(bool resetPartials=true)
Solves the system of transcdental equations for the pressure using the Broyden&#39;s method.
virtual void WriteInteractionParameters(const std::string &filename)
Write the QvdW interaction parameters to a file.
Sub-class where it is determined whether the required accuracy is achieved in the Broyden&#39;s method...
Definition: Broyden.h:144
std::vector< double > m_kurtprim
ThermalModelEVCrossterms(ThermalParticleSystem *TPS, const ThermalModelParameters &params=ThermalModelParameters())
Construct a new ThermalModelEVCrossterms object.
virtual ~ThermalModelEVCrossterms(void)
Destroy the ThermalModelEVCrossterms object.
Class implementing the crossterms excluded-volume model.
void SetVirial(int i, int j, double b)
Set the excluded volume coefficient .
Class which implements calculation of the Jacobian needed for the Broyden&#39;s method.
Definition: Broyden.h:76
virtual void ChangeTPS(ThermalParticleSystem *TPS)
Change the particle list.
virtual void FillVirial(const std::vector< double > &ri=std::vector< double >(0))
Fills the excluded volume coefficients based on the provided radii parameters for all species...
virtual double MuShift(int i) const
The shift in the chemical potential of particle species i due to the excluded volume interactions...
virtual double DensityId(int i, const std::vector< double > &pstars=std::vector< double >())
Calculate the ideal gas density of particle species i for the given values of partial pressures...
void SetRadius(double rad)
Set the same excluded volume radius parameter for all species.
double PartialPressureDiagonal(int i, double P)
The "partial pressure" of hadron species i for the given total pressure in the diagonal model...
double Pressure()
System pressure (GeV fm )
The main namespace where all classes and functions of the Thermal-FIST library reside.
virtual void CalculatePrimordialDensities()
Calculates the primordial densities of all species.
std::vector< std::vector< double > > m_Virial
ThermalParticleSystem * TPS()
virtual double CalculatePressure()
Implementation of the equation of state functions.
void CalculateTwoParticleCorrelations()
Computes the fluctuations and correlations of the primordial particle numbers.
virtual double CalculateMesonMatterEntropyDensity()
The fraction of entropy carried by mesons (Ideal GCE only)