 |
Version: SMASH-1.8
|
|
Go to the documentation of this file.
15 #include <boost/filesystem.hpp>
18 #include "smash/config.h"
117 const std::string &name,
120 file_{path /
"thermodynamics.dat",
"w"},
122 std::fprintf(file_.get(),
"# %s thermodynamics output\n", VERSION_MAJOR);
124 if (out_par_.td_smearing) {
125 std::fprintf(file_.get(),
"# @ point (%6.2f, %6.2f, %6.2f) [fm]\n", r.x1(),
128 std::fprintf(file_.get(),
"# averaged over the entire volume\n");
130 std::fprintf(file_.get(),
"# %s\n", to_string(out_par.td_dens_type));
131 std::fprintf(file_.get(),
"# time [fm/c], ");
132 if (out_par_.td_rho_eckart) {
133 std::fprintf(file_.get(),
"%s [fm^-3], ",
136 if (out_par_.td_tmn) {
137 if (out_par_.td_smearing) {
138 std::fprintf(file_.get(),
"%s [GeV/fm^3] 00 01 02 03 11 12 13 22 23 33, ",
141 std::fprintf(file_.get(),
"%s [GeV] 00 01 02 03 11 12 13 22 23 33, ",
145 if (out_par_.td_tmn_landau) {
146 if (out_par_.td_smearing) {
147 std::fprintf(file_.get(),
"%s [GeV/fm^3] 00 01 02 03 11 12 13 22 23 33, ",
150 std::fprintf(file_.get(),
"%s [GeV] 00 01 02 03 11 12 13 22 23 33, ",
154 if (out_par_.td_v_landau) {
155 std::fprintf(file_.get(),
"%s x y z, ",
158 if (out_par_.td_jQBS) {
159 if (out_par_.td_smearing) {
160 std::fprintf(file_.get(),
"j_QBS [(Q,B,S)/fm^3] (0 1 2 3)x3");
162 std::fprintf(file_.get(),
"j_QBS [(Q,B,S)] (0 1 2 3)x3");
165 std::fprintf(file_.get(),
"\n");
171 const int event_number) {
172 std::fprintf(
file_.
get(),
"# event %i\n", event_number);
183 const Particles &particles,
const std::unique_ptr<Clock> &clock,
185 std::fprintf(
file_.
get(),
"%6.2f ", clock->current_time());
186 constexpr
bool compute_gradient =
false;
191 std::fprintf(
file_.
get(),
"%7.4f ", rho);
195 for (
const auto &
p : particles) {
196 const double dens_factor =
205 1.0 /
p.momentum().abs(), dens_param, compute_gradient)
212 Tmn.add_particle(
p, dens_factor);
218 for (
int i = 0; i < 10; i++) {
223 for (
int i = 0; i < 10; i++) {
224 std::fprintf(
file_.
get(),
"%7.4f ", Tmn_L[i]);
228 std::fprintf(
file_.
get(),
"%7.4f %7.4f %7.4f ", -u[1] / u[0],
229 -u[2] / u[0], -u[3] / u[0]);
242 std::fprintf(
file_.
get(),
"%15.12f %15.12f %15.12f %15.12f ", jQ[0], jQ[1],
244 std::fprintf(
file_.
get(),
"%15.12f %15.12f %15.12f %15.12f ", jB[0], jB[1],
246 std::fprintf(
file_.
get(),
"%15.12f %15.12f %15.12f %15.12f ", jS[0], jS[1],
253 const char *file_name,
const ParticleList &plist,
257 std::ofstream a_file;
258 a_file.open(file_name, std::ios::out);
259 const bool compute_gradient =
false;
260 const bool smearing =
true;
262 for (
int i = 0; i <= n_points; i++) {
263 r = line_start + (line_end - line_start) * (1.0 * i / n_points);
264 double rho_eck = std::get<0>(
265 current_eckart(r, plist, param, dens_type, compute_gradient, smearing));
266 a_file << r.
x1() <<
" " << r.
x2() <<
" " << r.
x3() <<
" " << rho_eck
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.
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...
RenamingFilePtr file_
Pointer to output file.
A class to pre-calculate and store parameters relevant for density calculation.
bool td_jQBS
Print out QBS 4-currents or not?
bool td_v_landau
Print out Landau velocity of type td_dens_type or not?
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.
const OutputParameters out_par_
Structure that holds all the information about what to printout.
constexpr double really_small
Numerical error tolerance.
FILE * get()
Get the underlying FILE* pointer.
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.
ThreeVector td_position
Point, where thermodynamic quantities are calculated.
Helper structure for Experiment to hold output options and parameters.
void at_eventend(const Particles &particles, const int event_number, double impact_parameter, bool empty_event) override
only flushes the output the file
bool td_rho_eckart
Print out Eckart rest frame density of type td_dens_type or not?
Abstraction of generic output.
void at_intermediate_time(const Particles &particles, const std::unique_ptr< Clock > &clock, const DensityParameters &dens_param) override
Writes thermodynamics every fixed time interval.
bool td_tmn
Print out energy-momentum tensor of type td_dens_type or not?
std::tuple< double, FourVector, ThreeVector, ThreeVector, ThreeVector > current_eckart(const ThreeVector &r, const ParticleList &plist, const DensityParameters &par, DensityType dens_type, bool compute_gradient, bool smearing)
Calculates Eckart rest frame density and 4-current of a given density type and optionally the gradien...
DensityType
Allows to choose which kind of density to calculate.
double norm_factor_sf() const
~ThermodynamicOutput()
Default destructor.
DensityType td_dens_type
Type (e.g., baryon/pion/hadron) of thermodynamic quantity.
void at_eventstart(const Particles &particles, const int event_number) override
writes the event header
bool td_smearing
Whether smearing is on or off; WARNING : if smearing is off, then final result is in GeV instead of G...
bool td_tmn_landau
Print out energy-momentum tensor in Landau rest frame (of type td_dens_type) or not?