Version: SMASH-3.4
dynamicfluidfinder.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2023-2026
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
11 
14 #include "smash/freeforallaction.h"
15 #include "smash/logging.h"
16 
17 namespace smash {
18 static constexpr int LFluidization = LogArea::HyperSurfaceCrossing::id;
19 
21  const ParticleList &search_list, double dt,
22  [[maybe_unused]] const double gcell_vol,
23  [[maybe_unused]] const std::vector<FourVector> &beam_momentum) const {
24  ActionList actions;
25 
26  for (const ParticleData &p : search_list) {
27  const double t0 = p.position().x0();
28  const double t_creation = p.begin_formation_time();
29  const double t_end = t0 + dt;
30  if (t_end < min_time_ || t0 > max_time_) {
31  break;
32  }
33  if (p.is_core()) {
34  continue;
35  }
36  const double fluidization_time =
37  t_creation +
38  formation_time_fraction_ * (p.formation_time() - t_creation);
39  if (fluidization_time >= t_end) {
40  continue;
41  }
42  if (!is_process_fluidizable(p.get_history())) {
43  continue;
44  }
45  if (above_threshold(p)) {
46  double time_until = (1 - p.xsec_scaling_factor() <= really_small)
47  ? 0
48  : std::max(fluidization_time - t0, 0.);
49  actions.emplace_back(
50  std::make_unique<FluidizationAction>(p, p, time_until));
51  }
52  } // search_list loop
53  return actions;
54 }
55 
57  const ParticleData &pdata) const {
59  // value_at returns false if pdata is out of bounds
60  const bool inside =
61  energy_density_lattice_.value_at(pdata.position().threevec(), Tmunu);
62  if (inside) {
63  // If the particle is not in the map, the background evaluates to 0
64  const double background =
65  background_.count(pdata.id()) ? background_.at(pdata.id()) : 0;
66  const double e_den_particles =
67  Tmunu.boosted(Tmunu.landau_frame_4velocity())[0];
68  if (e_den_particles + background >=
70  logg[LFluidization].debug()
71  << "Fluidize " << pdata.id() << " with " << e_den_particles << "+"
72  << background << " GeV/fm^3 at " << pdata.position().x0()
73  << " fm, formed at " << pdata.formation_time() << " fm";
74  return true;
75  }
76  }
77  return false;
78 }
79 
81  const HistoryData &history) const {
82  const ProcessType &type = history.process_type;
83  if (is_string_soft_process(type)) {
86  }
87  if (is_string_hard_process(type)) {
90  }
91  switch (type) {
93  if (history.collisions_per_particle == 1 && delay_initial_elastic_) {
94  return false;
95  }
97  case ProcessType::Decay:
110  default:
111  return false;
112  }
113 }
114 
116  const Particles &search_list) const {
117  ActionList actions;
118  const bool are_there_core_particles =
119  std::any_of(search_list.begin(), search_list.end(),
120  [](const ParticleData &p) { return p.is_core(); });
121  if (are_there_core_particles) {
122  for (auto &p : search_list) {
123  if (p.is_core()) {
124  actions.emplace_back(std::make_unique<FreeforallAction>(
125  ParticleList{p}, ParticleList{}, p.position().x0()));
127  energy_in_core_ += p.momentum()[0];
128  }
129  }
130  } else {
131  for (auto &original : search_list) {
132  if (original.get_history().collisions_per_particle == 0) {
133  // Spectators are not propagated back.
134  continue;
135  }
136  const double t = original.position().x0();
137  double corona_time = original.get_history().time_last_collision;
138  if (t == corona_time) {
139  continue;
140  }
141  // This prevents particles from decays or strings from ending up at the
142  // same position
143  corona_time += 0.01;
144  const ThreeVector r = original.position().threevec() -
145  (t - corona_time) * original.velocity();
146  ParticleData backpropagated{original.type()};
147  backpropagated.set_4position(FourVector(corona_time, r));
148  backpropagated.set_4momentum(original.momentum());
149  // This is done so no further actions can be found for this particle
150  backpropagated.set_formation_time(t);
151  backpropagated.set_cross_section_scaling_factor(0.0);
152  actions.emplace_back(std::make_unique<FreeforallAction>(
153  ParticleList{original}, ParticleList{}, t));
154  actions.emplace_back(std::make_unique<FreeforallAction>(
155  ParticleList{}, ParticleList{backpropagated}, corona_time));
156  }
157  logg[LFluidization].info()
158  << particles_in_core_ << " particles were part of the core with energy "
159  << energy_in_core_ << " GeV.";
160  }
161  return actions;
162 }
163 
164 } // namespace smash
const RectangularLattice< EnergyMomentumTensor > & energy_density_lattice_
Lattice where energy momentum tensor is computed.
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.
bool is_process_fluidizable(const HistoryData &history) const
Checks if a given process type is in fluidizable_processes_.
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 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.
The EnergyMomentumTensor class represents a symmetric positive semi-definite energy-momentum tensor .
EnergyMomentumTensor boosted(const FourVector &u) const
Boost to a given 4-velocity.
FourVector landau_frame_4velocity() const
Find the Landau frame 4-velocity from energy-momentum tensor.
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
Definition: fourvector.h:33
ThreeVector threevec() const
Definition: fourvector.h:329
double x0() const
Definition: fourvector.h:313
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:59
const ParticleType & type() const
Get the type of the particle.
Definition: particledata.h:132
double formation_time() const
Get the absolute formation time of the particle.
Definition: particledata.h:249
int32_t id() const
Get the id of the particle.
Definition: particledata.h:77
double pole_mass() const
Get the particle's pole mass ("on-shell").
Definition: particledata.h:119
const FourVector & position() const
Get the particle's position in Minkowski space.
Definition: particledata.h:217
The Particles class abstracts the storage and manipulation of particles.
Definition: particles.h:33
iterator begin()
Definition: particles.h:395
iterator end()
Definition: particles.h:419
The ThreeVector class represents a physical three-vector with the components .
Definition: threevector.h:31
@ From_HardString
@ From_Inelastic
@ From_Elastic
@ From_SoftString
@ From_Decay
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > & logg
An array that stores all pre-configured Logger objects.
Definition: logging.h:245
constexpr int p
Proton.
Definition: action.h:24
static constexpr int LFluidization
ProcessType
ProcessTypes are used to identify the type of the process.
Definition: processbranch.h:39
@ TwoToOne
See here for a short description.
@ MultiParticleThreeToTwo
See here for a short description.
@ Decay
See here for a short description.
@ TwoToFive
See here for a short description.
@ TwoToTwo
See here for a short description.
@ Elastic
See here for a short description.
@ TwoToFour
See here for a short description.
@ MultiParticleThreeMesonsToOne
See here for a short description.
@ MultiParticleFourToTwo
See here for a short description.
@ TwoToThree
See here for a short description.
@ MultiParticleFiveToTwo
See here for a short description.
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:41
bool is_string_hard_process(ProcessType p)
Check if a given process type is a hard string excitation.
bool is_string_soft_process(ProcessType p)
Check if a given process type is a soft string excitation.
A structure to hold information about the history of the particle, e.g.
Definition: particledata.h:31
int32_t collisions_per_particle
Collision counter per particle, zero only for initially present particles.
Definition: particledata.h:33
ProcessType process_type
type of the last action
Definition: particledata.h:37