Version: SMASH-2.0
smash::HyperSurfaceCrossActionsFinder Class Reference

#include <hypersurfacecrossingaction.h>

Finder for hypersurface crossing actions. Loops through all particles and checks if they cross the hypersurface during the next timestep.

Definition at line 61 of file hypersurfacecrossingaction.h.

Inheritance diagram for smash::HyperSurfaceCrossActionsFinder:
[legend]
Collaboration diagram for smash::HyperSurfaceCrossActionsFinder:
[legend]

Public Member Functions

 HyperSurfaceCrossActionsFinder (double tau)
 Construct hypersurfacecrossing action finder. More...
 
ActionList find_actions_in_cell (const ParticleList &plist, double dt, const double, const std::vector< FourVector > &beam_momentum) const override
 Find the next hypersurface crossings for each particle that occur within the timestepless propagation. More...
 
ActionList find_actions_with_neighbors (const ParticleList &, const ParticleList &, double, const std::vector< FourVector > &) const override
 Ignore the neighbor searches for hypersurface crossing. More...
 
ActionList find_actions_with_surrounding_particles (const ParticleList &, const Particles &, double, const std::vector< FourVector > &) const override
 Ignore the surrounding searches for hypersurface crossing. More...
 
ActionList find_final_actions (const Particles &, bool) const override
 No final actions for hypersurface crossing. More...
 
- Public Member Functions inherited from smash::ActionFinderInterface
virtual ~ActionFinderInterface ()=default
 

Private Member Functions

bool crosses_hypersurface (ParticleData &pdata_before_propagation, ParticleData &pdata_after_propagation, const double tau) const
 Determine whether particle crosses hypersurface within next timestep during propagation. More...
 
FourVector coordinates_on_hypersurface (ParticleData &pdata_before_propagation, ParticleData &pdata_after_propagation, const double tau) const
 Find the coordinates where particle crosses hypersurface. More...
 

Private Attributes

const double prop_time_
 Proper time of the hypersurface in fm. More...
 

Constructor & Destructor Documentation

◆ HyperSurfaceCrossActionsFinder()

smash::HyperSurfaceCrossActionsFinder::HyperSurfaceCrossActionsFinder ( double  tau)
inlineexplicit

Construct hypersurfacecrossing action finder.

Parameters
[in]tauProper time of the hypersurface. [fm]

Definition at line 67 of file hypersurfacecrossingaction.h.

67 : prop_time_{tau} {};

Member Function Documentation

◆ find_actions_in_cell()

ActionList smash::HyperSurfaceCrossActionsFinder::find_actions_in_cell ( const ParticleList &  plist,
double  dt,
const double  ,
const std::vector< FourVector > &  beam_momentum 
) const
overridevirtual

Find the next hypersurface crossings for each particle that occur within the timestepless propagation.

Parameters
[in]plistList of all particles.
[in]dtTime until crossing can appear (until end of timestep). [fm]
[in]beam_momentum[GeV] List of beam momenta for each particle; only necessary for frozen Fermi motion necessary if frozen Fermi Motion is activated
Returns
List of all found wall crossings.

Implements smash::ActionFinderInterface.

Definition at line 50 of file hypersurfacecrossingaction.cc.

52  {
53  std::vector<ActionPtr> actions;
54 
55  for (const ParticleData &p : plist) {
56  ParticleData pdata_before_propagation = p;
57  ParticleData pdata_after_propagation = p; // Will receive updated position
58  double t0 = p.position().x0();
59  double t_end = t0 + dt; // Time at the end of timestep
60 
61  // We don't want to remove particles before the nuclei have interacted
62  // because those would not yet be part of the newly-created medium.
63  if (t_end < 0.0) {
64  continue;
65  }
66 
67  // For frozen Fermi motion:
68  // Fermi momenta are only applied if particles interact. The particle
69  // properties p.velocity() and p.momentum() already contain the values
70  // corrected by Fermi motion, but those particles that have not yet
71  // interacted are propagated along the beam-axis with v = (0, 0, beam_v)
72  // (and not with p.velocity()).
73  // To identify the corresponding hypersurface crossings the finding for
74  // those paricles without prior interactions has to be performed with
75  // v = vbeam instead of p.velcocity().
76  // Note: The beam_momentum vector is empty in case frozen Fermi motion is
77  // not applied.
78  const bool no_prior_interactions =
79  (static_cast<uint64_t>(p.id()) < // particle from
80  static_cast<uint64_t>(beam_momentum.size())) && // initial nucleus
81  (p.get_history().collisions_per_particle == 0);
82  ThreeVector v;
83  if (no_prior_interactions) {
84  const FourVector vbeam = beam_momentum[p.id()];
85  v = vbeam.velocity();
86  } else {
87  v = p.velocity();
88  }
89 
90  // propagate particles to position where they would be at the end of the
91  // time step (after dt)
92  const FourVector distance = FourVector(0.0, v * dt);
93  FourVector position = p.position() + distance;
94  position.set_x0(t_end);
95  // update coordinates to the position corresponding to t_end
96  pdata_after_propagation.set_4position(position);
97 
98  bool hypersurface_is_crossed = crosses_hypersurface(
99  pdata_before_propagation, pdata_after_propagation, prop_time_);
100 
101  if (hypersurface_is_crossed) {
102  // Get exact coordinates where hypersurface is crossed
103  FourVector crossing_position = coordinates_on_hypersurface(
104  pdata_before_propagation, pdata_after_propagation, prop_time_);
105 
106  double time_until_crossing = crossing_position[0] - t0;
107 
108  ParticleData outgoing_particle(p);
109  outgoing_particle.set_4position(crossing_position);
110  ActionPtr action = make_unique<HypersurfacecrossingAction>(
111  p, outgoing_particle, time_until_crossing);
112  actions.emplace_back(std::move(action));
113  }
114  }
115  return actions;
116 }
Here is the call graph for this function:

◆ find_actions_with_neighbors()

ActionList smash::HyperSurfaceCrossActionsFinder::find_actions_with_neighbors ( const ParticleList &  ,
const ParticleList &  ,
double  ,
const std::vector< FourVector > &   
) const
inlineoverridevirtual

Ignore the neighbor searches for hypersurface crossing.

Implements smash::ActionFinderInterface.

Definition at line 84 of file hypersurfacecrossingaction.h.

86  {
87  return {};
88  }

◆ find_actions_with_surrounding_particles()

ActionList smash::HyperSurfaceCrossActionsFinder::find_actions_with_surrounding_particles ( const ParticleList &  ,
const Particles ,
double  ,
const std::vector< FourVector > &   
) const
inlineoverridevirtual

Ignore the surrounding searches for hypersurface crossing.

Implements smash::ActionFinderInterface.

Definition at line 91 of file hypersurfacecrossingaction.h.

93  {
94  return {};
95  }

◆ find_final_actions()

ActionList smash::HyperSurfaceCrossActionsFinder::find_final_actions ( const Particles ,
bool   
) const
inlineoverridevirtual

No final actions for hypersurface crossing.

Implements smash::ActionFinderInterface.

Definition at line 98 of file hypersurfacecrossingaction.h.

98  {
99  return {};
100  }

◆ crosses_hypersurface()

bool smash::HyperSurfaceCrossActionsFinder::crosses_hypersurface ( ParticleData pdata_before_propagation,
ParticleData pdata_after_propagation,
const double  tau 
) const
private

Determine whether particle crosses hypersurface within next timestep during propagation.

Parameters
[in]pdata_before_propagationParticle data at the beginning of time step in question
[in]pdata_after_propagationParticle data at the end of time step in question
[in]tauProper time of the hypersurface that is tested
Returns
Does particle cross the hypersurface?

Definition at line 118 of file hypersurfacecrossingaction.cc.

120  {
121  bool hypersurface_is_crossed = false;
122  const bool t_greater_z_before_prop =
123  (std::fabs(pdata_before_propagation.position().x0()) >
124  std::fabs(pdata_before_propagation.position().x3())
125  ? 1
126  : 0);
127  const bool t_greater_z_after_prop =
128  (std::fabs(pdata_after_propagation.position().x0()) >
129  std::fabs(pdata_after_propagation.position().x3())
130  ? 1
131  : 0);
132 
133  if (t_greater_z_before_prop && t_greater_z_after_prop) {
134  // proper time before and after propagation
135  const double tau_before = pdata_before_propagation.position().tau();
136  const double tau_after = pdata_after_propagation.position().tau();
137 
138  if (tau_before <= tau && tau <= tau_after) {
139  hypersurface_is_crossed = true;
140  }
141  } else if (!t_greater_z_before_prop && t_greater_z_after_prop) {
142  // proper time after propagation
143  const double tau_after = pdata_after_propagation.position().tau();
144  if (tau_after >= tau) {
145  hypersurface_is_crossed = true;
146  }
147  }
148 
149  return hypersurface_is_crossed;
150 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ coordinates_on_hypersurface()

FourVector smash::HyperSurfaceCrossActionsFinder::coordinates_on_hypersurface ( ParticleData pdata_before_propagation,
ParticleData pdata_after_propagation,
const double  tau 
) const
private

Find the coordinates where particle crosses hypersurface.

Parameters
[in]pdata_before_propagationParticle data at the beginning of time in question
[in]pdata_after_propagationParticle data at the end of time step in question
[in]tauProper time of the hypersurface that is crossed
Returns
Fourvector of the crossing position

Definition at line 152 of file hypersurfacecrossingaction.cc.

154  {
155  // find t and z at start of propagation
156  const double t1 = pdata_before_propagation.position().x0();
157  const double z1 = pdata_before_propagation.position().x3();
158 
159  // find t and z after propagation
160  const double t2 = pdata_after_propagation.position().x0();
161  const double z2 = pdata_after_propagation.position().x3();
162 
163  // find slope and intercept of linear function that describes propagation on
164  // straight line
165  const double m = (z2 - z1) / (t2 - t1);
166  const double n = z1 - m * t1;
167 
168  // The equation to solve is a quadratic equation which provides two solutions,
169  // the latter is usually out of the t-interval we are looking at.
170  const double sol1 = n * m / (1 - m * m) +
171  std::sqrt((1 - m * m) * tau * tau + n * n) / (1 - m * m);
172  const double sol2 = n * m / (1 - m * m) -
173  std::sqrt((1 - m * m) * tau * tau + n * n) / (1 - m * m);
174 
175  SMASH_UNUSED(sol2); // only used in DEBUG output
176  assert((sol1 >= t1 && sol1 <= t2));
177  assert(!(sol2 >= t1 && sol2 <= t2));
178 
179  // Propagate to point where hypersurface is crossed
180  const ThreeVector v = pdata_before_propagation.velocity();
181  const FourVector distance = FourVector(0.0, v * (sol1 - t1));
182  FourVector crossing_position = pdata_before_propagation.position() + distance;
183  crossing_position.set_x0(sol1);
184 
185  return crossing_position;
186 }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ prop_time_

const double smash::HyperSurfaceCrossActionsFinder::prop_time_
private

Proper time of the hypersurface in fm.

Definition at line 104 of file hypersurfacecrossingaction.h.


The documentation for this class was generated from the following files:
smash::HyperSurfaceCrossActionsFinder::prop_time_
const double prop_time_
Proper time of the hypersurface in fm.
Definition: hypersurfacecrossingaction.h:104
smash::HyperSurfaceCrossActionsFinder::crosses_hypersurface
bool crosses_hypersurface(ParticleData &pdata_before_propagation, ParticleData &pdata_after_propagation, const double tau) const
Determine whether particle crosses hypersurface within next timestep during propagation.
Definition: hypersurfacecrossingaction.cc:118
smash::HyperSurfaceCrossActionsFinder::coordinates_on_hypersurface
FourVector coordinates_on_hypersurface(ParticleData &pdata_before_propagation, ParticleData &pdata_after_propagation, const double tau) const
Find the coordinates where particle crosses hypersurface.
Definition: hypersurfacecrossingaction.cc:152
SMASH_UNUSED
#define SMASH_UNUSED(x)
Mark as unused, silencing compiler warnings.
Definition: macros.h:24
smash::pdg::p
constexpr int p
Proton.
Definition: pdgcode_constants.h:28
smash::pdg::n
constexpr int n
Neutron.
Definition: pdgcode_constants.h:30