Version: SMASH-2.0
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 [25].

Definition at line 32 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, const EventInfo &) override
 Write event start line. More...
 
void at_eventend (const Particles &particles, const int event_number, const EventInfo &) override
 Write event end line. More...
 
void at_intermediate_time (const Particles &, const std::unique_ptr< Clock > &, const DensityParameters &, const EventInfo &) 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

◆ ICOutput()

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 99 of file icoutput.cc.

101  : OutputInterface(name),
102  file_{path / "SMASH_IC.dat", "w"},
103  out_par_(out_par) {
104  std::fprintf(
105  file_.get(),
106  "# %s initial conditions: hypersurface of constant proper time\n",
107  VERSION_MAJOR);
108  std::fprintf(file_.get(), "# tau x y eta mt px py Rap pdg charge\n");
109  std::fprintf(file_.get(), "# fm fm fm none GeV GeV GeV none none e\n");
110 }

◆ ~ICOutput()

smash::ICOutput::~ICOutput ( )

Definition at line 112 of file icoutput.cc.

112 {}

Member Function Documentation

◆ at_eventstart()

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

Write event start line.

Parameters
[in]event_numberNumber of the current event.

Implements smash::OutputInterface.

Definition at line 114 of file icoutput.cc.

115  {
116  std::fprintf(file_.get(), "# event %i start\n", event_number);
117 }
Here is the call graph for this function:

◆ at_eventend()

void smash::ICOutput::at_eventend ( const Particles particles,
const int  event_number,
const EventInfo  
)
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 119 of file icoutput.cc.

120  {
121  std::fprintf(file_.get(), "# event %i end\n", event_number);
122 
123  // If the runtime is too short some particles might not yet have
124  // reached the hypersurface. Warning is printed.
125  if (particles.size() != 0) {
127  "End time might be too small for initial conditions output. "
128  "Hypersurface has not yet been crossed by ",
129  particles.size(), " particle(s).");
130  }
131 }
Here is the call graph for this function:

◆ at_intermediate_time()

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

Unused, but needed since virtually declared in mother class.

Reimplemented from smash::OutputInterface.

Definition at line 133 of file icoutput.cc.

136  {
137  // Dummy, but virtual function needs to be declared.
138 }

◆ at_interaction()

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 140 of file icoutput.cc.

140  {
141  assert(action.get_type() == ProcessType::HyperSurfaceCrossing);
142  assert(action.incoming_particles().size() == 1);
143 
144  ParticleData particle = action.incoming_particles()[0];
145 
146  // transverse mass
147  const double m_trans =
148  std::sqrt(particle.type().mass() * particle.type().mass() +
149  particle.momentum()[1] * particle.momentum()[1] +
150  particle.momentum()[2] * particle.momentum()[2]);
151  // momentum space rapidity
152  const double rapidity =
153  0.5 * std::log((particle.momentum()[0] + particle.momentum()[3]) /
154  (particle.momentum()[0] - particle.momentum()[3]));
155 
156  // Determine if particle is spectator:
157  // Fulfilled if particle is initial nucleon, aka has no prior interactions
158  bool is_spectator = particle.get_history().collisions_per_particle == 0;
159 
160  // write particle data excluding spectators
161  if (!is_spectator) {
162  std::fprintf(file_.get(), "%g %g %g %g %g %g %g %g %s %i \n",
163  particle.position().tau(), particle.position()[1],
164  particle.position()[2], particle.position().eta(), m_trans,
165  particle.momentum()[1], particle.momentum()[2], rapidity,
166  particle.pdgcode().string().c_str(), particle.type().charge());
167  }
168 
169  if (IC_proper_time_ < 0.0) {
170  // First particle that is removed, overwrite negative default
171  IC_proper_time_ = particle.position().tau();
172  } else {
173  // Verify that all other particles have the same proper time
174  const double next_proper_time = particle.position().tau();
175  if (!((next_proper_time - IC_proper_time_) < really_small))
176  throw std::runtime_error(
177  "Hypersurface proper time changed during evolution.");
178  }
179 }
Here is the call graph for this function:

Member Data Documentation

◆ file_

RenamingFilePtr smash::ICOutput::file_
private

Pointer to output file.

Definition at line 75 of file icoutput.h.

◆ out_par_

const OutputParameters smash::ICOutput::out_par_
private

Structure that holds all the information about what to printout.

Definition at line 77 of file icoutput.h.

◆ IC_proper_time_

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 88 of file icoutput.h.


The documentation for this class was generated from the following files:
smash::OutputInterface::OutputInterface
OutputInterface(std::string name)
Construct output interface.
Definition: outputinterface.h:71
smash::logg
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
Definition: logging.cc:39
smash::really_small
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:37
smash::RenamingFilePtr::get
FILE * get()
Get the underlying FILE* pointer.
Definition: file.cc:27
smash::LHyperSurfaceCrossing
static constexpr int LHyperSurfaceCrossing
Definition: hypersurfacecrossingaction.cc:16
smash::ICOutput::IC_proper_time_
double IC_proper_time_
Proper time of the particles removed when extracting initial conditions.
Definition: icoutput.h:88
smash::ICOutput::out_par_
const OutputParameters out_par_
Structure that holds all the information about what to printout.
Definition: icoutput.h:77
smash::ICOutput::file_
RenamingFilePtr file_
Pointer to output file.
Definition: icoutput.h:75
smash::ProcessType::HyperSurfaceCrossing
Hypersurface crossing Particles are removed from the evolution and printed to a separate output to se...