Version: SMASH-3.3
smash::ICOutput Class Reference

#include <icoutput.h>

SMASH output in a format containing initial conditions for hydrodynamic codes ("For_vHLLE").

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

Definition at line 31 of file icoutput.h.

Inheritance diagram for smash::ICOutput:
smash::OutputInterface

Public Member Functions

 ICOutput (const std::filesystem::path &path, const std::string &name, const OutputParameters &out_par)
 Create a new IC output. More...
 
 ~ICOutput ()
 
void at_eventstart (const Particles &, const EventLabel &event_label, const EventInfo &event) override
 Write event start line. More...
 
void at_eventend (const Particles &particles, const EventLabel &event_label, const EventInfo &event) override
 Write event end line. More...
 
void at_intermediate_time (const Particles &, const std::unique_ptr< Clock > &, const DensityParameters &, const EventLabel &, 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 ()=0
 Pure virtual destructor to make class abstract and prevent its instantiation. More...
 
virtual void at_eventstart (const std::vector< Particles > &, int)
 Output launched at event start after initialization, when particles are generated but not yet propagated. More...
 
virtual void at_eventstart (const int, const ThermodynamicQuantity, const DensityType, RectangularLattice< DensityOnLattice >)
 Output launched at event start after initialization, when particles are generated but not yet propagated. More...
 
virtual void at_eventstart (const int, const ThermodynamicQuantity, const DensityType, RectangularLattice< EnergyMomentumTensor >)
 Output launched at event start after initialization, when particles are generated but not yet propagated. More...
 
virtual void at_eventend (const ThermodynamicQuantity)
 Output launched at event end. More...
 
virtual void at_eventend (const std::vector< Particles > &, const int)
 Output launched at event end. More...
 
virtual void at_intermediate_time (const std::vector< Particles > &, const std::unique_ptr< Clock > &, const DensityParameters &)
 Output launched after every N'th timestep. More...
 
virtual void thermodynamics_output (const ThermodynamicQuantity, const DensityType, RectangularLattice< DensityOnLattice > &)
 Output to write thermodynamics from the lattice. More...
 
virtual void thermodynamics_output (const ThermodynamicQuantity, const DensityType, RectangularLattice< EnergyMomentumTensor > &)
 Output to write energy-momentum tensor and related quantities from the lattice. More...
 
virtual void thermodynamics_lattice_output (RectangularLattice< DensityOnLattice > &, const double)
 Output to write thermodynamics from the lattice. More...
 
virtual void thermodynamics_lattice_output (RectangularLattice< DensityOnLattice > &, const double, const std::vector< Particles > &, const DensityParameters &)
 Output to write thermodynamics from the lattice. More...
 
virtual void thermodynamics_lattice_output (const ThermodynamicQuantity, RectangularLattice< EnergyMomentumTensor > &, const double)
 Output to write energy-momentum tensor and related quantities from the lattice. More...
 
virtual void thermodynamics_output (const GrandCanThermalizer &)
 Output to write energy-momentum tensor and related quantities from the thermalizer class. More...
 
virtual void fields_output (const std::string, const std::string, RectangularLattice< std::pair< ThreeVector, ThreeVector >> &)
 Write fields in vtk output Fields are a pair of threevectors for example electric and magnetic field. 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...
 
OutputFormatter< ToASCIIformatter_
 Formatter of the output. 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 std::filesystem::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 102 of file icoutput.cc.

104  : OutputInterface(name),
105  file_{path / "SMASH_IC_For_vHLLE.dat", "w"},
106  out_par_(out_par),
108  std::fprintf(
109  file_.get(),
110  "# %s initial conditions: hypersurface of constant proper time\n",
111  SMASH_VERSION);
112  std::fprintf(file_.get(), "# %s", formatter_.quantities_line().c_str());
113  std::fprintf(file_.get(), "# %s", formatter_.unit_line().c_str());
114 }
RenamingFilePtr file_
Pointer to output file.
Definition: icoutput.h:76
const OutputParameters out_par_
Structure that holds all the information about what to printout.
Definition: icoutput.h:78
OutputFormatter< ToASCII > formatter_
Formatter of the output.
Definition: icoutput.h:92
OutputInterface(std::string name)
Construct output interface.
FILE * get()
Get the underlying FILE* pointer.
Definition: file.cc:27
static const std::vector< std::string > ic_For_vHLLE
Quantities output in initial conditions format for vHLLE.

◆ ~ICOutput()

smash::ICOutput::~ICOutput ( )

Definition at line 116 of file icoutput.cc.

116 {}

Member Function Documentation

◆ at_eventstart()

void smash::ICOutput::at_eventstart ( const Particles ,
const EventLabel event_label,
const EventInfo event 
)
overridevirtual

Write event start line.

Parameters
[in]event_labelNumbers of the current event and ensemble.
[in]eventEvent info, see event_info

Reimplemented from smash::OutputInterface.

Definition at line 118 of file icoutput.cc.

119  {
120  if (event.n_ensembles != 1) {
121  throw std::logic_error(
122  "ICOutput shouldn't be used with multiple parallel ensembles.");
123  }
124  std::fprintf(file_.get(), "# event %i ensemble %i start\n",
125  event_label.event_number, event_label.ensemble_number);
126 }

◆ at_eventend()

void smash::ICOutput::at_eventend ( const Particles particles,
const EventLabel event_label,
const EventInfo event 
)
overridevirtual

Write event end line.

Parameters
[in]particlesParticles at end of event, expected to be empty
[in]event_labelNumbers of the current event and ensemble.
[in]eventEvent info, see event_info

Reimplemented from smash::OutputInterface.

Definition at line 128 of file icoutput.cc.

130  {
131  if (event.n_ensembles != 1) {
132  throw std::logic_error(
133  "ICOutput shouldn't be used with multiple parallel ensembles.");
134  }
135  std::fprintf(file_.get(), "# event %i ensemble %i end\n",
136  event_label.event_number, event_label.ensemble_number);
137 }

◆ at_intermediate_time()

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

Unused, but needed since virtually declared in mother class.

Reimplemented from smash::OutputInterface.

Definition at line 139 of file icoutput.cc.

142  {
143  // Dummy, but virtual function needs to be declared.
144 }

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

146  {
147  assert(action.get_type() == ProcessType::Fluidization ||
148  action.get_type() == ProcessType::FluidizationNoRemoval);
149  assert(action.incoming_particles().size() == 1);
150 
151  const ParticleData &particle = action.incoming_particles()[0];
152 
153  // Determine if particle is spectator:
154  // Fulfilled if particle is initial nucleon, aka has no prior interactions
155  bool is_spectator = particle.get_history().collisions_per_particle == 0;
156 
157  // write particle data excluding spectators
158  if (!is_spectator) {
159  std::fprintf(file_.get(), "%s",
160  formatter_.single_particle_data(particle).c_str());
161  }
162 
163  if (IC_proper_time_ < 0.0) {
164  // First particle that is removed, overwrite negative default
165  IC_proper_time_ = particle.hyperbolic_time();
166  } else {
167  // Verify that all other particles have the same proper time
168  const double next_proper_time = particle.hyperbolic_time();
169  if (!((next_proper_time - IC_proper_time_) < really_small))
170  throw std::runtime_error(
171  "Hypersurface proper time changed during evolution.");
172  }
173 }
double IC_proper_time_
Proper time of the particles removed when extracting initial conditions.
Definition: icoutput.h:89
@ FluidizationNoRemoval
See here for a short description.
@ Fluidization
See here for a short description.
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:41

Member Data Documentation

◆ file_

RenamingFilePtr smash::ICOutput::file_
private

Pointer to output file.

Definition at line 76 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 78 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. Determined 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 89 of file icoutput.h.

◆ formatter_

OutputFormatter<ToASCII> smash::ICOutput::formatter_
private

Formatter of the output.

Definition at line 92 of file icoutput.h.


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