Detailed Running
Code Structure
The HRG EoS Module is designed to calculate thermodynamic quantities and conserved charge susceptibilities for a Hadron Resonance Gas (HRG) Equation of State, with optional van der Waals (VdW) interactions between hadrons. The module is implemented within a Docker container to ensure portability and consistency. The workflow involves parsing input parameters, performing core computations, and generating output files for further analysis. Below is a detailed explanation of the code structure and its components.
- Input File:
- config.yaml is used to specify the ranges for \(T\), \(\mu_B\), \(\mu_Q\), and \(\mu_S\) (in MeV), as well as user-defined options for:
HRG parameters: Van der Waals interaction parameters \(a\) (attractive, in GeV·fm3), \(b\) (baryon excluding-volume, in fm3), and \(b_m\) (meson excluding-volume, in fm3). Setting all to zero reduces the model to the Ideal HRG.
Switchers: Boolean flags selecting which thermodynamic quantities are stored in the output (e.g., pressure \(P\), entropy density \(s\), baryon/charge/strangeness densities, second-order susceptibilities)
Configuration Validation: the OpenAPI_Specifications_validator.py script validates the config.yaml file against the OpenAPI specifications. This ensures that all required parameters are provided and conform to the expected structure.
Core Computation: the main script, MUSES_Wrapper.py, orchestrates the execution of the module. It validates inputs, processes the input configuration, and calls the executable to compute the thermodynamic quantities on the \((T, \mu_B, \mu_S, \mu_Q)\) grid.
Output Files: the results of the computation are saved in the output/ directory. The following files are generated:
HRG_output_thermodynamics.csv: Contains the calculated thermodynamic quantities and susceptibilities for each grid point, with only the columns corresponding to the enabled switchers.
HRG_metadata_thermodynamics.yaml: Describes the structure, types and units of the output data.
status.yaml: Provides the status of the module’s execution, including success or error messages.
Core functions
The src/HRG_EoS.cpp script contains the core functions for reading input parameters, setting up the thermal model, and computing thermodynamic quantities. Below is an overview of the key functions:
read_param(const char *param_file):Reads the grid parameters from the intermediate input file User_Input_Parameters.dat.
Parses the ranges and step sizes for \(T\), \(\mu_B\), \(\mu_Q\), and \(\mu_S\) (in GeV) and stores them in the global
Parametersstruct.
SetVDWInteractionParameters(ThermalModelRealGas* model, double a, double b, double bm): sets the van der Waals interaction parameters for the QvdW-HRG model, following the interaction scheme:Baryon-baryon and antibaryon-antibaryon pairs: attraction \(a\) and repulsion \(b\)
Meson-meson pairs: repulsion \(b_m\) only
Baryon-antibaryon and baryon-meson pairs: no interaction
PrintHeader(FILE *f, bool HessianMatrix):Writes the header line of the output file, listing the column names for all computed quantities.
The columns included depend on whether the Hessian matrix calculation is enabled.
PrintOutput(FILE *f, bool HessianMatrix, int T_pts, double MuB, ...):Writes the computed thermodynamic quantities to the output file for a given \((\mu_B, \mu_Q, \mu_S)\) point and all \(T\) values.
Handles unit conversions (e.g., GeV to MeV) and formats the output as a whitespace-separated table.
main(int argc, char* argv[]): the main function orchestrating the full computation:Parses command-line arguments (input/output file names, VdW parameters, switcher flags) using
getopt_long.Reads the grid parameters from the input file via
read_param().Instantiates either a Ideal HRG (
ThermalModelIdeal) or a QvdW-HRG (ThermalModelRealGas) model depending on whether the VdW parameters are non-zero.Iterates over all \((\mu_B, \mu_Q, \mu_S)\) grid points. At each point, loops over all \(T\) values and:
Solves the self-consistent equations for hadron densities via
CalculateDensities().Skips points in the condensation region (where \(|\mu_Q| \geq m_\pi\), \(|\mu_S| \geq m_{K^0}\), or \(|\mu_S + \mu_Q| \geq m_{K^\pm}\)), unless meson excluded-volume interactions are enabled.
Computes thermodynamic quantities: \(p\), \(\varepsilon\), \(s\), \(n_B\), \(n_Q\), \(n_S\), and optionally the pressure Hessian matrix elements \(\chi_2^{B,Q,S}\), \(\chi_{11}^{BQ,BS,QS}\), \(c_V\), and \(c_s^2\).
Writes the results to the intermediate output file Thermo_Output_HRG.dat via
PrintOutput().
Code Organization
The module’s code is organized into the following directories:
api/: contains the OpenAPI specifications, the input adapter, the output adapter, and the input validation script.
build/: contains the build files generated by CMake and the compiled executable hrg-eos-thermodynamics.
src/: contains the core computation script for calculating thermodynamic quantities.
input/: contains the config.yaml file and the intermediate User_Input_Parameters.dat file generated by the input adapter.
output/: stores the generated output files, including results (HRG_output_thermodynamics.csv), metadata (HRG_metadata_thermodynamics.yaml), and status (status.yaml).
test/: contains reference files and test cases for validating the module’s functionality.