15 #include <boost/filesystem.hpp> 18 #include "smash/config.h" 110 const std::string &name,
113 file_{path /
"thermodynamics.dat",
"w"},
115 std::fprintf(file_.get(),
"# %s thermodynamics output\n", VERSION_MAJOR);
117 if (out_par_.td_smearing) {
118 std::fprintf(file_.get(),
"# @ point (%6.2f, %6.2f, %6.2f) [fm]\n", r.x1(),
121 std::fprintf(file_.get(),
"# averaged over the entire volume\n");
123 std::fprintf(file_.get(),
"# %s\n", to_string(out_par.td_dens_type));
124 std::fprintf(file_.get(),
"# time [fm/c], ");
125 if (out_par_.td_rho_eckart) {
126 std::fprintf(file_.get(),
"%s [fm^-3], ",
129 if (out_par_.td_tmn) {
130 if (out_par_.td_smearing) {
131 std::fprintf(file_.get(),
"%s [GeV/fm^3] 00 01 02 03 11 12 13 22 23 33, ",
134 std::fprintf(file_.get(),
"%s [GeV] 00 01 02 03 11 12 13 22 23 33, ",
138 if (out_par_.td_tmn_landau) {
139 if (out_par_.td_smearing) {
140 std::fprintf(file_.get(),
"%s [GeV/fm^3] 00 01 02 03 11 12 13 22 23 33, ",
143 std::fprintf(file_.get(),
"%s [GeV] 00 01 02 03 11 12 13 22 23 33, ",
147 if (out_par_.td_v_landau) {
148 std::fprintf(file_.get(),
"%s x y z ",
151 std::fprintf(file_.get(),
"\n");
157 const int event_number) {
158 std::fprintf(
file_.
get(),
"# event %i\n", event_number);
171 constexpr
bool compute_gradient =
false;
176 std::fprintf(
file_.
get(),
"%7.4f ", rho);
180 for (
const auto &
p : particles) {
181 const double dens_factor =
190 1.0 /
p.momentum().abs(), dens_param, compute_gradient)
197 Tmn.add_particle(
p, dens_factor);
203 for (
int i = 0; i < 10; i++) {
208 for (
int i = 0; i < 10; i++) {
209 std::fprintf(
file_.
get(),
"%7.4f ", Tmn_L[i]);
213 std::fprintf(
file_.
get(),
"%7.4f %7.4f %7.4f", -u[1] / u[0], -u[2] / u[0],
221 const char *file_name,
const ParticleList &plist,
225 std::ofstream a_file;
226 a_file.open(file_name, std::ios::out);
227 const bool compute_gradient =
false;
229 for (
int i = 0; i <= n_points; i++) {
230 r = line_start + (line_end - line_start) * (1.0 * i / n_points);
232 std::get<0>(
rho_eckart(r, plist, param, dens_type, compute_gradient));
233 a_file << r.
x1() <<
" " << r.
x2() <<
" " << r.
x3() <<
" " << rho_eck
void at_eventend(const Particles &particles, const int event_number, double impact_parameter) override
only flushes the output the file
A class to pre-calculate and store parameters relevant for density calculation.
The ThreeVector class represents a physical three-vector with the components .
constexpr double really_small
Numerical error tolerance.
double norm_factor_sf() const
DensityType td_dens_type
Type (e.g., baryon/pion/hadron) of thermodynamic quantity.
FILE * get()
Get the underlying FILE* pointer.
ThreeVector td_position
Point, where thermodynamic quantities are calculated.
std::tuple< double, ThreeVector, ThreeVector, ThreeVector > rho_eckart(const ThreeVector &r, const ParticleList &plist, const DensityParameters &par, DensityType dens_type, bool compute_gradient)
Calculates Eckart rest frame density and optionally the gradient of the density in an arbitary frame...
const OutputParameters out_par_
Structure that holds all the information about what to printout.
bool td_tmn_landau
Print out energy-momentum tensor in Landau rest frame (of type td_dens_type) or not?
bool td_smearing
Whether smearing is on or off; WARNING : if smearing is off, then final result is in GeV instead of G...
void at_intermediate_time(const Particles &particles, const Clock &clock, const DensityParameters &dens_param) override
Writes thermodynamics every fixed time interval.
~ThermodynamicOutput()
Default destructor.
ThermodynamicOutput(const bf::path &path, const std::string &name, const OutputParameters &out_par)
Construct Output param[in] path Path to output param[in] name Filename param[in] out_par Parameters o...
void at_eventstart(const Particles &particles, const int event_number) override
writes the event header
bool td_rho_eckart
Print out Eckart rest frame density of type td_dens_type or not?
Helper structure for Experiment to hold output options and parameters.
The EnergyMomentumTensor class represents a symmetric positive semi-definite energy-momentum tensor ...
Clock tracks the time in the simulation.
double density_factor(const ParticleType &type, DensityType dens_type)
Get the factor that determines how much a particle contributes to the density type that is computed...
std::pair< double, ThreeVector > unnormalized_smearing_factor(const ThreeVector &r, const FourVector &p, const double m_inv, const DensityParameters &dens_par, const bool compute_gradient=false)
Implements gaussian smearing for any quantity.
bool td_tmn
Print out energy-momentum tensor of type td_dens_type or not?
The Particles class abstracts the storage and manipulation of particles.
bool td_v_landau
Print out Landau velocity of type td_dens_type or not?
double current_time() const
DensityType
Allows to choose which kind of density to calculate.
void density_along_line(const char *file_name, const ParticleList &plist, const DensityParameters ¶m, DensityType dens_type, const ThreeVector &line_start, const ThreeVector &line_end, int n_points)
Prints density along the specified line.
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
RenamingFilePtr file_
Pointer to output file.
Abstraction of generic output.