Version: SMASH-1.7
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 59 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

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

Construct hypersurfacecrossing action finder.

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

Definition at line 65 of file hypersurfacecrossingaction.h.

65 : prop_time_{tau} {};
const double prop_time_
Proper time of the hypersurface in fm.

Member Function Documentation

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 52 of file hypersurfacecrossingaction.cc.

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

Here is the call graph for this function:

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 82 of file hypersurfacecrossingaction.h.

84  {
85  return {};
86  }
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 89 of file hypersurfacecrossingaction.h.

91  {
92  return {};
93  }
ActionList smash::HyperSurfaceCrossActionsFinder::find_final_actions ( const Particles ,
bool   
) const
inlineoverridevirtual

No final actions for hypersurface crossing.

Implements smash::ActionFinderInterface.

Definition at line 96 of file hypersurfacecrossingaction.h.

96  {
97  return {};
98  }
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 120 of file hypersurfacecrossingaction.cc.

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

Here is the call graph for this function:

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 154 of file hypersurfacecrossingaction.cc.

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

Here is the call graph for this function:

Member Data Documentation

const double smash::HyperSurfaceCrossActionsFinder::prop_time_
private

Proper time of the hypersurface in fm.

Definition at line 102 of file hypersurfacecrossingaction.h.


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