Skip to content

Commit

Permalink
adjust propagation vor v < c
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienDoerner committed Nov 17, 2023
1 parent fe49d07 commit 3fcae94
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/module/PropagationCK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ void PropagationCK::tryStep(const Y &y, Y &out, Y &error, double h,

PropagationCK::Y PropagationCK::dYdt(const Y &y, ParticleState &p, double z) const {
// normalize direction vector to prevent numerical losses
Vector3d velocity = y.u.getUnitVector() * c_light;
double v = p.getAbsolutVelocity();
Vector3d velocity = y.u.getUnitVector() * v; //real velocity 0<v<c

// get B field at particle position
Vector3d B = getFieldAtPosition(y.x, z);

// Lorentz force: du/dt = q*c/E * (v x B)
Vector3d dudt = p.getCharge() * c_light / p.getEnergy() * velocity.cross(B);
// Lorentz force: du/dt = q / mv * (v x B)
Vector3d dudt = p.getCharge() / (p.getLorentzFactor() * p.getMass() * v) * velocity.cross(B);
return Y(velocity, dudt);
}

Expand Down

0 comments on commit 3fcae94

Please sign in to comment.