35#include "ThermalFISTConfig.h"
39#ifdef ThermalFIST_USENAMESPACE
66 r.
P = model->Pressure();
67 r.
e = model->EnergyDensity();
68 r.
s = model->EntropyDensity();
69 r.
rhoB = model->BaryonDensity();
70 r.
rhoQ = model->ElectricChargeDensity();
72 auto safe = [](
double v) {
return std::isfinite(v) ? v : std::numeric_limits<double>::quiet_NaN(); };
73 r.
cs2_B = safe(model->cs2(
true,
false,
false,
false));
74 r.
cT2_B = safe(model->cT2(
true,
false,
false,
false));
75 r.
cs2_BQ = safe(model->cs2(
true,
true,
false,
false));
76 r.
cT2_BQ = safe(model->cT2(
true,
true,
false,
false));
78 r.
cMu = model->HeatCapacityMu();
80 r.
dsdT_mu = model->CalculateEntropyDensityDerivativeT();
89 for (
int i = 0; i < model->TPS()->ComponentsNumber(); ++i)
90 chargesB[i] = model->TPS()->Particles()[i].BaryonCharge();
104static void PrintTable(
const string& modelName,
107 const vector<double>& Tvals)
115 vector<ThermoRow> rows;
116 for (
double T : Tvals) {
118 rows.push_back(Evaluate(model));
125 cout <<
"================================================================\n";
126 cout <<
" " << modelName <<
" muB = " << muB <<
" GeV\n";
127 cout <<
"================================================================\n";
130 cout << setw(wlab) << left <<
"Quantity";
132 cout << setw(w) << right << (r.
T == 0. ?
"T=0" :
133 r.
T == 1.e-6 ?
"T=0.001MeV" :
134 r.
T == 1.e-5 ?
"T=0.01MeV" :
135 r.
T == 1.e-4 ?
"T=0.1MeV" :
136 r.
T == 1.e-3 ?
"T=1MeV" :
137 r.
T == 1.e-2 ?
"T=10MeV" :
"T=?");
139 cout << string(wlab + w * rows.size(),
'-') <<
"\n";
141 typedef std::function<double(
const ThermoRow&)> RowGetter;
142 auto line = [&](
const char* label, RowGetter getter) {
143 cout << setw(wlab) << left << label;
144 for (
size_t i = 0; i < rows.size(); ++i)
145 cout << setw(w) << right << scientific << setprecision(6) << getter(rows[i]);
149 line(
"P [GeV/fm3]", [](
const ThermoRow& r){
return r.
P; });
150 line(
"e [GeV/fm3]", [](
const ThermoRow& r){
return r.
e; });
151 line(
"s [fm-3]", [](
const ThermoRow& r){
return r.
s; });
152 line(
"rhoB [fm-3]", [](
const ThermoRow& r){
return r.
rhoB; });
153 line(
"rhoQ [fm-3]", [](
const ThermoRow& r){
return r.
rhoQ; });
155 line(
"chi3_BB [fm-3GeV-1]",[](
const ThermoRow& r){
return r.
chi3BB; });
156 line(
"chi4_BB [fm-3GeV-2]",[](
const ThermoRow& r){
return r.
chi4BB; });
161 line(
"C_mu [fm-3]", [](
const ThermoRow& r){
return r.
cMu; });
165 if (rows.size() > 1) {
166 const auto& ref = rows[0];
167 cout <<
"\n Relative deviations from T=0:\n";
168 cout << string(wlab + w * rows.size(),
'-') <<
"\n";
170 auto relline = [&](
const char* label, RowGetter getter) {
171 double refv = getter(ref);
172 cout << setw(wlab) << left << label;
173 for (
size_t i = 0; i < rows.size(); ++i) {
174 if (i == 0) { cout << setw(w) << right <<
"---";
continue; }
175 double v = getter(rows[i]);
176 if (std::isfinite(v) && std::isfinite(refv) && std::abs(refv) > 1.e-30)
177 cout << setw(w) << right << scientific << setprecision(3) << (v - refv) / refv;
179 cout << setw(w) << right <<
"n/a";
184 relline(
"dP/P", [](
const ThermoRow& r){
return r.
P; });
185 relline(
"de/e", [](
const ThermoRow& r){
return r.
e; });
186 relline(
"drhoB/rhoB", [](
const ThermoRow& r){
return r.
rhoB; });
189 relline(
"dcs2/cs2(B)", [](
const ThermoRow& r){
return r.
cs2_B; });
190 relline(
"dcT2/cT2(B)", [](
const ThermoRow& r){
return r.
cT2_B; });
200int main(
int argc,
char *argv[])
203 if (argc > 1) muB = atof(argv[1]);
205 cout <<
"Zero-temperature comparison at muB = " << muB <<
" GeV\n";
206 cout <<
"Temperatures: 0, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2 GeV\n";
208 string inputDir = string(ThermalFIST_INPUT_FOLDER);
211 const vector<double> Tvals = {0., 1.e-6, 1.e-5, 1.e-4, 1.e-3, 1.e-2};
219 PrintTable(
"Ideal HRG", &model, muB, Tvals);
233 PrintTable(
"EV-Diagonal HRG (b=1 fm3)", &model, muB, Tvals);
243 PrintTable(
"QvdW HRG (a=0.329, b=3.42)", &model, muB, Tvals);
253 double a = 0.329, b = 3.42;
263 PrintTable(
"RealGas HRG (CS+VDW, a=0.329, b=3.42)", &model, muB, Tvals);
Contains some functions to deal with excluded volumes.
Base class implementing the ideal gas.
Class implementing auxiliary functions for the Carnahan-Starling excluded volume model.
Implementation of a crossterms generalized excluded volume model.
Implementation of the van der Waals mean field model for multiple components.
Abstract base class for an HRG model implementation.
virtual void SetTemperature(double T)
Set the temperature.
virtual void CalculateFluctuations()
Computes the fluctuation observables.
virtual std::vector< double > CalculateChargeFluctuations(const std::vector< double > &chgs, int order=4, bool dimensionfull=false)
Calculates fluctuations (diagonal susceptibilities) of an arbitrary "conserved" charge.
virtual void CalculateTemperatureDerivatives()
Computes the temperature derivatives of densities, shifted chemical potentials, and primordial hadron...
void SetUseWidth(bool useWidth)
Sets whether finite resonance widths are used. Deprecated.
virtual void SetBaryonChemicalPotential(double muB)
Set the baryon chemical potential.
virtual double SusceptibilityDimensionfull(ConservedCharge::Name i, ConservedCharge::Name j) const
A 2nd order susceptibility of conserved charges.
virtual void SetElectricChemicalPotential(double muQ)
Set the electric chemical potential.
int ComponentsNumber() const
Number of different particle species in the list.
virtual void CalculatePrimordialDensities()=0
Calculates the primordial densities of all species.
virtual void SetStrangenessChemicalPotential(double muS)
Set the strangeness chemical potential.
virtual void SetCalculationType(IdealGasFunctions::QStatsCalculationType type)
Sets the CalculationType() method to evaluate quantum statistics. Calls the corresponding method in T...
const ThermalModelParameters & Parameters() const
virtual void SetCharmChemicalPotential(double muC)
Set the charm chemical potential.
virtual void SetStatistics(bool stats)
Class implementing the diagonal excluded-volume model.
void SetVirial(int i, int j, double b)
Sets the eigenvolume parameter of particle species i.
Class implementing the Ideal HRG model.
Class implementing the quantum real gas HRG model.
void SetExcludedVolumeModel(ExcludedVolumeModelMultiBase *exvolmod)
Set the excluded volume model for the real gas HRG model.
void SetMeanFieldModel(MeanFieldModelMultiBase *mfmod)
Set the mean field model for the real gas HRG model.
Class implementing the quantum van der Waals HRG model.
int BaryonCharge() const
Particle's baryon number.
Class containing the particle list.
const ThermalParticle & Particle(int id) const
ThermalParticle object corresponding to particle species with a provided 0-based index.
int ComponentsNumber() const
Number of different particle species in the list.
constexpr double GeVtoifm3()
A constant to transform GeV into fm .
The main namespace where all classes and functions of the Thermal-FIST library reside.
std::vector< std::vector< double > > GetBaryonBaryonInteractionMatrix(const ThermalParticleSystem *TPS, double param)
Returns the matrix of attraction and repulsion parameters for baryon-baryon and antibaryon-antibaryon...
void SetVDWHRGInteractionParameters(ThermalModelBase *model, double a, double b)
Sets vdW interactions for baryon-baryon and antibaryon-antibaryon pairs as in https://arxiv....
@ BaryonCharge
Baryon number.