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);
89 const double dt = parameters.
labclock->timestep_duration();
95 FourVector(0.0, h * data.position().threevec() * dt);
98 " expansion motion: ", expan_dist);
100 FourVector position = data.position() + expan_dist;
101 FourVector momentum = data.momentum() - delta_mom;
104 data.set_4position(position);
105 data.set_4momentum(momentum);
107 data.set_4momentum(data.pole_mass(), data.momentum().threevec());
112 std::vector<Particles> &ensembles,
double dt,
const Potentials &pot,
121 const ParticleList tmp = particles.copy_to_vector();
122 plist.insert(plist.end(), tmp.begin(), tmp.end());
125 bool possibly_use_lattice =
126 (pot.
use_skyrme() ? (FB_lat !=
nullptr) :
true) &&
127 (pot.
use_vdf() ? (FB_lat !=
nullptr) :
true) &&
129 std::pair<ThreeVector, ThreeVector> FB, FI3, EM_fields;
130 double min_time_scale = std::numeric_limits<double>::infinity();
135 if (!(data.is_baryon() || data.is_nucleus())) {
143 const bool use_lattice =
144 possibly_use_lattice &&
145 (pot.
use_skyrme() ? FB_lat->value_at(r, FB) :
true) &&
146 (pot.
use_vdf() ? FB_lat->value_at(r, FB) :
true) &&
147 (pot.
use_symmetry() ? FI3_lat->value_at(r, FI3) :
true);
159 FB = std::make_pair(std::get<0>(tmp), std::get<1>(tmp));
160 FI3 = std::make_pair(std::get<2>(tmp), std::get<3>(tmp));
164 const auto sNaN = std::numeric_limits<double>::signaling_NaN();
168 jB_lat, data.position().threevec(), data.momentum().threevec(),
169 data.effective_mass(), plist);
170 force = -energy_grad * scale.first;
172 scale.second * data.type().isospin3_rel() *
173 (FI3.first + data.momentum().velocity().cross_product(FI3.second));
175 force = scale.first *
177 data.momentum().velocity().cross_product(FB.second)) +
178 scale.second * data.type().isospin3_rel() *
180 data.momentum().velocity().cross_product(FI3.second));
183 if (pot.
use_coulomb() && EM_lat->value_at(r, EM_fields)) {
187 data.momentum().velocity().cross_product(EM_fields.second));
190 data.set_4momentum(data.effective_mass(),
191 data.momentum().threevec() + force * dt);
194 const double Force_abs = force.
abs();
198 const double time_scale = data.momentum().x0() / Force_abs;
199 if (time_scale < min_time_scale) {
200 min_time_scale = time_scale;
205 constexpr
double safety_factor = 0.1;
206 if (dt > safety_factor * min_time_scale) {
208 <<
"The time step size is too large for an accurate propagation "
209 <<
"with potentials. Maximum safe value: "
210 << safety_factor * min_time_scale <<
" fm.\n"
211 <<
"In case of Triangular or Discrete smearing you may additionally "
212 <<
"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
ThreeVector single_particle_energy_gradient(DensityLattice *jB_lattice, const ThreeVector &position, const ThreeVector &momentum, double mass, ParticleList &plist) const
Calculates the gradient of the single-particle energy (including potentials) in the calculation frame...
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.
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)