24 switch (metric.
mode_) {
29 h = metric.
b_ / (2 * (metric.
b_ * time + 1));
32 h = 2 * metric.
b_ / (3 * (metric.
b_ * time + 1));
45 const std::vector<FourVector> &beam_momentum) {
46 bool negative_dt_error =
false;
49 const double t0 = data.position().x0();
51 if (dt < 0.0 && !negative_dt_error) {
53 negative_dt_error =
true;
65 assert(data.id() >= 0);
66 const bool avoid_fermi_motion =
67 (
static_cast<uint64_t
>(data.id()) <
68 static_cast<uint64_t
>(beam_momentum.size())) &&
69 (data.get_history().collisions_per_particle == 0);
71 if (avoid_fermi_motion) {
72 const FourVector vbeam = beam_momentum[data.id()];
79 FourVector position = data.position() + distance;
81 data.set_4position(position);
87 bool positive_dt_error =
false;
89 const double t = data.position().x0();
90 if (t < to_time && !positive_dt_error) {
92 positive_dt_error =
true;
95 " in backpropagate_straight_line is after the earliest particle.");
98 const double dt = to_time - t;
99 const ThreeVector r = data.position().threevec() + dt * data.velocity();
101 data.set_formation_time(t);
102 data.set_cross_section_scaling_factor(0.0);
109 const double dt = parameters.
labclock->timestep_duration();
115 FourVector(0.0, h * data.position().threevec() * dt);
118 " expansion motion: ", expan_dist);
120 FourVector position = data.position() + expan_dist;
121 FourVector momentum = data.momentum() - delta_mom;
124 data.set_4position(position);
125 data.set_4momentum(momentum);
127 data.set_4momentum(data.pole_mass(), data.momentum().threevec());
132 std::vector<Particles> &ensembles,
double dt,
const Potentials &pot,
141 const ParticleList tmp = particles.copy_to_vector();
142 plist.insert(plist.end(), tmp.begin(), tmp.end());
145 bool possibly_use_lattice =
146 (pot.
use_skyrme() ? (FB_lat !=
nullptr) :
true) &&
147 (pot.
use_vdf() ? (FB_lat !=
nullptr) :
true) &&
149 std::pair<ThreeVector, ThreeVector> FB, FI3, EM_fields;
150 double min_time_scale = std::numeric_limits<double>::infinity();
155 if (!(data.is_baryon() || data.is_nucleus())) {
163 const bool use_lattice =
164 possibly_use_lattice &&
165 (pot.
use_skyrme() ? FB_lat->value_at(r, FB) :
true) &&
166 (pot.
use_vdf() ? FB_lat->value_at(r, FB) :
true) &&
167 (pot.
use_symmetry() ? FI3_lat->value_at(r, FI3) :
true);
179 FB = std::make_pair(std::get<0>(tmp), std::get<1>(tmp));
180 FI3 = std::make_pair(std::get<2>(tmp), std::get<3>(tmp));
184 const ThreeVector energy_grad = pot.single_particle_energy_gradient(
185 jB_lat, data.position().threevec(), data.momentum().threevec(),
186 data.effective_mass(), plist);
187 return -energy_grad * scale.first +
188 scale.second * data.type().isospin3_rel() *
190 data.momentum().velocity().cross_product(FI3.second));
194 data.momentum().velocity().cross_product(FB.second)) +
195 scale.second * data.type().isospin3_rel() *
197 data.momentum().velocity().cross_product(FI3.second));
201 if (pot.
use_coulomb() && EM_lat->value_at(r, EM_fields)) {
205 data.momentum().velocity().cross_product(EM_fields.second));
208 data.set_4momentum(data.effective_mass(),
209 data.momentum().threevec() + force * dt);
212 const double Force_abs = force.
abs();
216 const double time_scale = data.momentum().x0() / Force_abs;
217 if (time_scale < min_time_scale) {
218 min_time_scale = time_scale;
223 constexpr
double safety_factor = 0.1;
224 if (dt > safety_factor * min_time_scale) {
226 <<
"The time step size is too large for an accurate propagation "
227 <<
"with potentials. Maximum safe value: "
228 << safety_factor * min_time_scale <<
" fm.\n"
229 <<
"In case of Triangular or Discrete smearing you may additionally "
230 <<
"need to increase the number of ensembles or testparticles.";
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
ThreeVector velocity() const
Get the velocity (3-vector divided by zero component).
ParticleData contains the dynamic information of a certain particle.
The Particles class abstracts the storage and manipulation of particles.
A class that stores parameters of potentials, calculates potentials and their gradients.
virtual bool use_symmetry() const
virtual bool use_skyrme() const
bool use_potentials_outside_lattice() const
virtual bool use_coulomb() const
static std::pair< double, int > force_scale(const ParticleType &data)
Evaluates the scaling factor of the forces acting on the particles.
virtual std::tuple< ThreeVector, ThreeVector, ThreeVector, ThreeVector > all_forces(const ThreeVector &r, const ParticleList &plist) const
Evaluates the electric and magnetic components of the forces at point r.
virtual bool use_vdf() const
virtual bool use_momentum_dependence() const
A container class to hold all the arrays on the lattice and access them.
The ThreeVector class represents a physical three-vector with the components .
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
void update_momenta(std::vector< Particles > &particles, double dt, const Potentials &pot, RectangularLattice< std::pair< ThreeVector, ThreeVector >> *FB_lat, RectangularLattice< std::pair< ThreeVector, ThreeVector >> *FI3_lat, RectangularLattice< std::pair< ThreeVector, ThreeVector >> *EM_lat, DensityLattice *jB_lat)
Updates the momenta of all particles at the current time step according to the equations of motion:
void expand_space_time(Particles *particles, const ExperimentParameters ¶meters, const ExpansionProperties &metric)
Modifies positions and momentum of all particles to account for space-time deformation.
double propagate_straight_line(Particles *particles, double to_time, const std::vector< FourVector > &beam_momentum)
Propagates the positions of all particles on a straight line to a given moment.
constexpr double hbarc
GeV <-> fm conversion factor.
constexpr double really_small
Numerical error tolerance.
void backpropagate_straight_line(Particles *particles, double to_time)
double calc_hubble(double time, const ExpansionProperties &metric)
Calculate the Hubble parameter , which describes how large the expansion flow is.
static constexpr int LPropagation
const double elementary_charge
Elementary electric charge in natural units, approximately 0.3.
Struct containing the type of the metric and the expansion parameter of the metric.
double b_
Expansion parameter in the metric (faster expansion for larger values)
ExpansionMode mode_
Type of metric used.
Helper structure for Experiment.
std::unique_ptr< Clock > labclock
System clock (for simulation time keeping in the computational frame)