Version: SMASH-3.4
dynamicfluidfinder.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2022-2025
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_SMASH_DYNAMICFLUIDFINDER_H_
11 #define SRC_INCLUDE_SMASH_DYNAMICFLUIDFINDER_H_
12 
13 #include <limits>
14 #include <map>
15 #include <vector>
16 
17 #include "actionfinderfactory.h"
18 #include "icparameters.h"
19 #include "input_keys.h"
20 
21 namespace smash {
22 
23 /**
24  * \ingroup action
25  * Finder for dynamic fluidizations.
26  * Loops through all particles and checks if they reach the energy density
27  * threshold. This happens at the end of every time step for all hadrons that
28  * participated in a fluidizable process. For string fragmentation products,
29  * fluidization happens only after the fraction of formation time of the
30  * particle, controlled by \key Formation_Time_Fraction.
31  */
33  public:
34  /**
35  * Construct finder for fluidization action.
36  * \param[in] lattice Lattice used for the energy density interpolation
37  * \param[in] background Background map between particle indices and the
38  * corresponding background energy density
39  * \param[in] ic_params Parameters for dynamic fluidization
40  *
41  * \note \c energy_density_lattice and \c energy_density_background are both
42  * "in" parameters because the class stores references, but the values are non
43  * constant.
44  */
47  const std::map<int32_t, double> &background,
48  const InitialConditionParameters &ic_params)
50  background_{background},
51  energy_density_threshold_{ic_params.energy_density_threshold.value()},
52  min_time_{ic_params.min_time.value()},
53  max_time_{ic_params.max_time.value()},
54  formation_time_fraction_{ic_params.formation_time_fraction.value()},
55  smearing_kernel_at_0_{ic_params.smearing_kernel_at_0.value()},
56  fluid_cells_{ic_params.num_fluid_cells.value()},
57  fluidizable_processes_{ic_params.fluidizable_processes.value()},
58  delay_initial_elastic_{ic_params.delay_initial_elastic.value()} {};
59 
60  /**
61  * Find particles to fluidize, depending on the energy density around them.
62  * \param[in] search_list List of candidate particles to fluidize.
63  * \param[in] dt Time step duration \unit{in fm}.
64  * \param[in] gcell_vol Volume of the grid cell \unit{in fm³},
65  * \param[in] beam_momentum Unused.
66  * \return List of fluidization actions that will happen at the corresponding
67  * formation time.
68  */
69  ActionList find_actions_in_cell(
70  const ParticleList &search_list, double dt, double gcell_vol,
71  const std::vector<FourVector> &beam_momentum) const override;
72 
73  /// Ignore the neighbor search for fluidization
75  const ParticleList &, const ParticleList &, const double,
76  const std::vector<FourVector> &) const override {
77  return {};
78  }
79 
80  /// Ignore the surrounding searches for fluidization
82  const ParticleList &, const Particles &, double,
83  const std::vector<FourVector> &) const override {
84  return {};
85  }
86 
87  /**
88  * Prepare corona particles left in the IC for the afterburner.
89  *
90  * - Remove core particles.
91  * - Move corona particles back to their last interaction point so they start
92  * at the correct spacetime position for afterburner rescattering with
93  * hadrons sampled from the fluid.
94  * - Do not modify spectators.
95  *
96  * \param[in] search_list All particles at the end of the simulation.
97  * \return ActionList with removals and backpropagation steps.
98  *
99  * \note The backpropagation is encoded as two FreeForAll actions:
100  * remove the corona particle, then add it at the target spacetime
101  * point. This will appear in the Collisions output.
102  */
103  ActionList find_final_actions(const Particles &search_list) const override;
104 
105  /**
106  * Determine if fluidization condition is satisfied.
107  *
108  * \param[in] pdata Particle to be checked for fluidization.
109  * \return Whether energy density around pdata is high enough.
110  */
111  bool above_threshold(const ParticleData &pdata) const;
112 
113  /**
114  * Checks if a given process type is in \ref fluidizable_processes_. In
115  * particular, initially sampled hadrons are not fluidizable and have
116  * ProcessType::None, which falls in the default case for the switch.
117  *
118  * \return whether the process is fluidizable
119  */
120  bool is_process_fluidizable(const HistoryData &history) const;
121 
122  private:
123  /**
124  * Lattice where energy momentum tensor is computed
125  *
126  * \note It must be a reference so that it can be updated outside the class,
127  * without creating a new Finder object.
128  */
130  /**
131  * Background energy density at positions of particles, using the id as key
132  *
133  * \note It is a reference so that it can be updated outside the class, e.g.
134  * by an external manager using SMASH as a library.
135  */
136  const std::map<int32_t, double> &background_;
137  /// Minimum energy density surrounding the particle to fluidize it
138  const double energy_density_threshold_ = smash_NaN<double>;
139  /// Minimum time (in lab frame) in fm to allow fluidization
140  const double min_time_ = smash_NaN<double>;
141  /// Maximum time (in lab frame) in fm to allow fluidization
142  const double max_time_ = smash_NaN<double>;
143  /// Fraction of formation time after which a particles can fluidize
144  const double formation_time_fraction_ = smash_NaN<double>;
145  /// Smearing kernel at the position of the particle of interest
146  const double smearing_kernel_at_0_ = smash_NaN<double>;
147  /// Number of cells to interpolate the energy density
148  const int fluid_cells_ = smash_NaN<int>;
149  /// Processes that create a fluidizable particle
151  /// Whether the first elastic interaction of an initial nucleon is fluidizable
152  const bool delay_initial_elastic_ = true;
153 
154  /// Accumulated number of core particles
155  mutable int particles_in_core_ = 0;
156  /// Accumulated energy of core particles
157  mutable double energy_in_core_ = 0.;
158 };
159 
160 } // namespace smash
161 
162 #endif // SRC_INCLUDE_SMASH_DYNAMICFLUIDFINDER_H_
ActionFinderInterface is the abstract base class for all action finders, i.e.
Finder for dynamic fluidizations.
const RectangularLattice< EnergyMomentumTensor > & energy_density_lattice_
Lattice where energy momentum tensor is computed.
ActionList find_actions_with_surrounding_particles(const ParticleList &, const Particles &, double, const std::vector< FourVector > &) const override
Ignore the surrounding searches for fluidization.
const double min_time_
Minimum time (in lab frame) in fm to allow fluidization.
const double formation_time_fraction_
Fraction of formation time after which a particles can fluidize.
ActionList find_final_actions(const Particles &search_list) const override
Prepare corona particles left in the IC for the afterburner.
ActionList find_actions_with_neighbors(const ParticleList &, const ParticleList &, const double, const std::vector< FourVector > &) const override
Ignore the neighbor search for fluidization.
bool is_process_fluidizable(const HistoryData &history) const
Checks if a given process type is in fluidizable_processes_.
DynamicFluidizationFinder(const RectangularLattice< EnergyMomentumTensor > &lattice, const std::map< int32_t, double > &background, const InitialConditionParameters &ic_params)
Construct finder for fluidization action.
int particles_in_core_
Accumulated number of core particles.
const bool delay_initial_elastic_
Whether the first elastic interaction of an initial nucleon is fluidizable.
bool above_threshold(const ParticleData &pdata) const
Determine if fluidization condition is satisfied.
ActionList find_actions_in_cell(const ParticleList &search_list, double dt, double gcell_vol, const std::vector< FourVector > &beam_momentum) const override
Find particles to fluidize, depending on the energy density around them.
const std::map< int32_t, double > & background_
Background energy density at positions of particles, using the id as key.
const double max_time_
Maximum time (in lab frame) in fm to allow fluidization.
double energy_in_core_
Accumulated energy of core particles.
const FluidizableProcessesBitSet fluidizable_processes_
Processes that create a fluidizable particle.
const int fluid_cells_
Number of cells to interpolate the energy density.
const double energy_density_threshold_
Minimum energy density surrounding the particle to fluidize it.
const double smearing_kernel_at_0_
Smearing kernel at the position of the particle of interest.
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:59
The Particles class abstracts the storage and manipulation of particles.
Definition: particles.h:33
A container class to hold all the arrays on the lattice and access them.
Definition: lattice.h:49
std::bitset< 5 > FluidizableProcessesBitSet
constexpr Section lattice
Section for the lattice.
Definition: input_keys.h:149
Definition: action.h:24
A structure to hold information about the history of the particle, e.g.
Definition: particledata.h:31
The variables in this POD struct are of type std::optional<double> so that only the relevant paramete...
Definition: icparameters.h:19