Fix in timestep calculation in Drift Mover
This commit is contained in:
@@ -209,8 +209,11 @@ void DriftMover::move(particle::Particle* particle,
|
|||||||
const double stepsize = std::min(leftover_distance, maximal_distance_m_);
|
const double stepsize = std::min(leftover_distance, maximal_distance_m_);
|
||||||
// guard against very large timesteps i.e. v ~ 0 -> timestep = Inf
|
// guard against very large timesteps i.e. v ~ 0 -> timestep = Inf
|
||||||
// should be a very rare case
|
// should be a very rare case
|
||||||
|
// only works if |v| >> |v_drift|
|
||||||
const double timestep = std::min(
|
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);
|
max_time_alive);
|
||||||
|
|
||||||
const blitz::TinyVector<double, 3> movement_parallel =
|
const blitz::TinyVector<double, 3> movement_parallel =
|
||||||
|
|||||||
Reference in New Issue
Block a user