Fix in timestep calculation in Drift Mover

This commit is contained in:
2025-02-05 14:27:22 +01:00
parent 6c1dd8887b
commit 90d19b0cb7
+4 -1
View File
@@ -209,8 +209,11 @@ void DriftMover::move(particle::Particle* particle,
const double stepsize = std::min(leftover_distance, maximal_distance_m_);
// guard against very large timesteps i.e. v ~ 0 -> timestep = Inf
// should be a very rare case
// only works if |v| >> |v_drift|
const double timestep = std::min(
stepsize / (v_parallel_norm + v_perp_norm + v_drift_norm),
stepsize / std::sqrt(v_parallel_norm * v_parallel_norm +
v_perp_norm * v_perp_norm +
v_drift_norm * v_drift_norm),
max_time_alive);
const blitz::TinyVector<double, 3> movement_parallel =