Version: SMASH-1.7
smash::ICOutput Class Reference

#include <icoutput.h>

SMASH output in ASCII format containing initial conditions for hydrodynamic codes.

Formatted such that it can be directly processed by vHLLE Karpenko:2015xea.

Definition at line 31 of file icoutput.h.

Inheritance diagram for smash::ICOutput:
[legend]
Collaboration diagram for smash::ICOutput:
[legend]

Public Member Functions

 ICOutput (const bf::path &path, const std::string &name, const OutputParameters &out_par)
 Create a new IC output. More...
 
 ~ICOutput ()
 
void at_eventstart (const Particles &, const int event_number) override
 Write event start line. More...
 
void at_eventend (const Particles &particles, const int event_number, double, bool) override
 Write event end line. More...
 
void at_intermediate_time (const Particles &, const std::unique_ptr< Clock > &, const DensityParameters &) override
 Unused, but needed since virtually declared in mother class. More...
 
void at_interaction (const Action &action, const double) override
 Write particle data at the hypersurface crossing point to the IC output. More...
 
- Public Member Functions inherited from smash::OutputInterface
 OutputInterface (std::string name)
 Construct output interface. More...
 
virtual ~OutputInterface ()=default
 
virtual void thermodynamics_output (const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< DensityOnLattice > &lattice)
 Output to write thermodynamics from the lattice. More...
 
virtual void thermodynamics_output (const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< EnergyMomentumTensor > &lattice)
 Output to write energy-momentum tensor and related quantities from the lattice. More...
 
virtual void thermodynamics_output (const GrandCanThermalizer &gct)
 Output to write energy-momentum tensor and related quantities from the thermalizer class. More...
 
bool is_dilepton_output () const
 Get, whether this is the dilepton output? More...
 
bool is_photon_output () const
 Get, whether this is the photon output? More...
 
bool is_IC_output () const
 Get, whether this is the IC output? More...
 
const char * to_string (const ThermodynamicQuantity tq)
 Convert thermodynamic quantities to strings. More...
 
const char * to_string (const DensityType dens_type)
 Convert density types to strings. More...
 

Private Attributes

RenamingFilePtr file_
 Pointer to output file. More...
 
const OutputParameters out_par_
 Structure that holds all the information about what to printout. More...
 
double IC_proper_time_ = -1.0
 Proper time of the particles removed when extracting initial conditions. More...
 

Additional Inherited Members

- Protected Attributes inherited from smash::OutputInterface
const bool is_dilepton_output_
 Is this the dilepton output? More...
 
const bool is_photon_output_
 Is this the photon output? More...
 
const bool is_IC_output_
 Is this the IC output? More...
 

Constructor & Destructor Documentation

smash::ICOutput::ICOutput ( const bf::path &  path,
const std::string &  name,
const OutputParameters out_par 
)

Create a new IC output.

Parameters
[in]pathPath to the output file.
[in]nameName of the output.
[in]out_parAdditional information on the configured output.

Definition at line 94 of file icoutput.cc.

96  : OutputInterface(name),
97  file_{path / "SMASH_IC.dat", "w"},
98  out_par_(out_par) {
99  std::fprintf(
100  file_.get(),
101  "# %s initial conditions: hypersurface of constant proper time\n",
102  VERSION_MAJOR);
103  std::fprintf(file_.get(), "# tau x y eta mt px py Rap ID charge\n");
104  std::fprintf(file_.get(), "# fm fm fm none GeV GeV GeV none none e\n");
105 }
FILE * get()
Get the underlying FILE* pointer.
Definition: file.cc:27
const OutputParameters out_par_
Structure that holds all the information about what to printout.
Definition: icoutput.h:74
RenamingFilePtr file_
Pointer to output file.
Definition: icoutput.h:72
OutputInterface(std::string name)
Construct output interface.

Here is the call graph for this function:

smash::ICOutput::~ICOutput ( )

Definition at line 107 of file icoutput.cc.

107 {}

Member Function Documentation

void smash::ICOutput::at_eventstart ( const Particles ,
const int  event_number 
)
overridevirtual

Write event start line.

Parameters
[in]event_numberNumber of the current event.

Implements smash::OutputInterface.

Definition at line 109 of file icoutput.cc.

109  {
110  std::fprintf(file_.get(), "# event %i start\n", event_number + 1);
111 }
FILE * get()
Get the underlying FILE* pointer.
Definition: file.cc:27
RenamingFilePtr file_
Pointer to output file.
Definition: icoutput.h:72

Here is the call graph for this function:

void smash::ICOutput::at_eventend ( const Particles particles,
const int  event_number,
double  ,
bool   
)
overridevirtual

Write event end line.

Parameters
[in]particlesParticles at end of event, expected to be empty
[in]event_numberNumber of the current event.

Implements smash::OutputInterface.

Definition at line 113 of file icoutput.cc.

114  {
115  const auto &log = logger<LogArea::HyperSurfaceCrossing>();
116  std::fprintf(file_.get(), "# event %i end\n", event_number + 1);
117 
118  // If the runtime is too short some particles might not yet have
119  // reached the hypersurface. Warning is printed.
120  if (particles.size() != 0) {
121  log.warn(
122  "End time might be too small for initial conditions output. "
123  "Hypersurface has not yet been crossed by ",
124  particles.size(), " particle(s).");
125  }
126 }
FILE * get()
Get the underlying FILE* pointer.
Definition: file.cc:27
RenamingFilePtr file_
Pointer to output file.
Definition: icoutput.h:72

Here is the call graph for this function:

void smash::ICOutput::at_intermediate_time ( const Particles ,
const std::unique_ptr< Clock > &  ,
const DensityParameters  
)
overridevirtual

Unused, but needed since virtually declared in mother class.

Reimplemented from smash::OutputInterface.

Definition at line 128 of file icoutput.cc.

130  {
131  // Dummy, but virtual function needs to be declared.
132 }
void smash::ICOutput::at_interaction ( const Action action,
const double   
)
overridevirtual

Write particle data at the hypersurface crossing point to the IC output.

Parameters
[in]actionDetails about the action

Reimplemented from smash::OutputInterface.

Definition at line 134 of file icoutput.cc.

134  {
135  assert(action.get_type() == ProcessType::HyperSurfaceCrossing);
136  assert(action.incoming_particles().size() == 1);
137 
138  ParticleData particle = action.incoming_particles()[0];
139 
140  // transverse mass
141  const double m_trans = sqrt(particle.type().mass() * particle.type().mass() +
142  particle.momentum()[1] * particle.momentum()[1] +
143  particle.momentum()[2] * particle.momentum()[2]);
144  // momentum space rapidity
145  const double rapidity =
146  0.5 * log((particle.momentum()[0] + particle.momentum()[3]) /
147  (particle.momentum()[0] - particle.momentum()[3]));
148 
149  // write particle data
150  std::fprintf(file_.get(), "%g %g %g %g %g %g %g %g %i %i \n",
151  particle.position().tau(), particle.position()[1],
152  particle.position()[2], particle.position().eta(), m_trans,
153  particle.momentum()[1], particle.momentum()[2], rapidity,
154  particle.id(), particle.type().charge());
155 
156  if (IC_proper_time_ < 0.0) {
157  // First particle that is removed, overwrite negative default
158  IC_proper_time_ = particle.position().tau();
159  } else {
160  // Verify that all other particles have the same proper time
161  const double next_proper_time = particle.position().tau();
162  if (!((next_proper_time - IC_proper_time_) < really_small))
163  throw std::runtime_error(
164  "Hypersurface proper time changed during evolution.");
165  }
166 }
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:37
FILE * get()
Get the underlying FILE* pointer.
Definition: file.cc:27
Hypersurface crossing Particles are removed from the evolution and printed to a separate output to se...
double IC_proper_time_
Proper time of the particles removed when extracting initial conditions.
Definition: icoutput.h:85
RenamingFilePtr file_
Pointer to output file.
Definition: icoutput.h:72

Here is the call graph for this function:

Member Data Documentation

RenamingFilePtr smash::ICOutput::file_
private

Pointer to output file.

Definition at line 72 of file icoutput.h.

const OutputParameters smash::ICOutput::out_par_
private

Structure that holds all the information about what to printout.

Definition at line 74 of file icoutput.h.

double smash::ICOutput::IC_proper_time_ = -1.0
private

Proper time of the particles removed when extracting initial conditions.

Parameter used for testing purposes only. Used to verify that the initial proper time remains unchanged during the evolution. Dewtermined from the actually removed particles. By construction, tau > 0. Nevertheless it is initialized with a negative number to easily find the first particle that is removed from the evolution in at_interaction().

Definition at line 85 of file icoutput.h.


The documentation for this class was generated from the following files: