Version: SMASH-3.3
dynamicfluidfinder.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2023-2025
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
11 
13 #include "smash/freeforallaction.h"
14 #include "smash/logging.h"
15 
16 namespace smash {
17 static constexpr int LFluidization = LogArea::HyperSurfaceCrossing::id;
18 
20  const ParticleList &search_list, double dt,
21  [[maybe_unused]] const double gcell_vol,
22  [[maybe_unused]] const std::vector<FourVector> &beam_momentum) const {
23  ActionList actions;
24 
25  for (const ParticleData &p : search_list) {
26  const double t0 = p.position().x0();
27  const double t_creation = p.begin_formation_time();
28  const double t_end = t0 + dt;
29  if (t_end < min_time_ || t0 > max_time_) {
30  break;
31  }
32  if (p.is_core()) {
33  continue;
34  }
35  const double fluidization_time =
36  t_creation +
37  formation_time_fraction_ * (p.formation_time() - t_creation);
38  if (fluidization_time >= t_end) {
39  continue;
40  }
41  if (!is_process_fluidizable(p.get_history())) {
42  continue;
43  }
44  if (above_threshold(p)) {
45  double time_until = (1 - p.xsec_scaling_factor() <= really_small)
46  ? 0
47  : std::max(fluidization_time - t0, 0.);
48  actions.emplace_back(
49  std::make_unique<FluidizationAction>(p, p, time_until));
50  }
51  } // search_list loop
52  return actions;
53 }
54 
56  const ParticleData &pdata) const {
58  // value_at returns false if pdata is out of bounds
59  const bool inside =
60  energy_density_lattice_.value_at(pdata.position().threevec(), Tmunu);
61  if (inside) {
62  // If the particle is not in the map, the background evaluates to 0
63  const double background =
64  background_.count(pdata.id()) ? background_.at(pdata.id()) : 0;
65  const double e_den_particles =
66  Tmunu.boosted(Tmunu.landau_frame_4velocity())[0];
67  if (e_den_particles + background >=
69  logg[LFluidization].debug()
70  << "Fluidize " << pdata.id() << " with " << e_den_particles << "+"
71  << background << " GeV/fm^3 at " << pdata.position().x0()
72  << " fm, formed at " << pdata.formation_time() << " fm";
73  return true;
74  }
75  }
76  return false;
77 }
78 
80  const HistoryData &history) const {
81  const ProcessType &type = history.process_type;
82  if (is_string_soft_process(type)) {
85  }
86  switch (type) {
88  if (history.collisions_per_particle == 1 && delay_initial_elastic_) {
89  return false;
90  }
92  case ProcessType::Decay:
108  default:
109  return false;
110  }
111 }
112 
114  const Particles &search_list) const {
115  ActionList actions;
116  const bool are_there_core_particles =
117  std::any_of(search_list.begin(), search_list.end(),
118  [](const ParticleData &p) { return p.is_core(); });
119  if (are_there_core_particles) {
120  for (auto &p : search_list) {
121  if (p.is_core()) {
122  actions.emplace_back(std::make_unique<FreeforallAction>(
123  ParticleList{p}, ParticleList{}, p.position().x0()));
125  energy_in_core_ += p.momentum()[0];
126  }
127  }
128  } else {
129  for (auto &original : search_list) {
130  if (original.get_history().collisions_per_particle == 0) {
131  // Spectators are not propagated back.
132  continue;
133  }
134  const double t = original.position().x0();
135  double corona_time = original.get_history().time_last_collision;
136  if (t == corona_time) {
137  continue;
138  }
139  // This prevents particles from decays or strings from ending up at the
140  // same position
141  corona_time += 0.01;
142  const ThreeVector r = original.position().threevec() -
143  (t - corona_time) * original.velocity();
144  ParticleData backpropagated{original.type()};
145  backpropagated.set_4position(FourVector(corona_time, r));
146  backpropagated.set_4momentum(original.momentum());
147  // This is done so no further actions can be found for this particle
148  backpropagated.set_formation_time(t);
149  backpropagated.set_cross_section_scaling_factor(0.0);
150  actions.emplace_back(std::make_unique<FreeforallAction>(
151  ParticleList{original}, ParticleList{}, t));
152  actions.emplace_back(std::make_unique<FreeforallAction>(
153  ParticleList{}, ParticleList{backpropagated}, corona_time));
154  }
155  logg[LFluidization].info()
156  << particles_in_core_ << " particles were part of the core with energy "
157  << energy_in_core_ << " GeV.";
158  }
159  return actions;
160 }
161 
162 } // 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.cc:40
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.
@ StringHard
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_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