Added gradB as input, adjusted drift mover
to include gradB (not yet tested for correctness)
This commit is contained in:
@@ -208,10 +208,12 @@ void DriftMover::move(particle::Particle* particle,
|
||||
|
||||
old_kinetic_energy = particle->kineticEnergy_eV();
|
||||
|
||||
const blitz::TinyVector<double, 3> force_over_charge =
|
||||
electric_field->value(old_position).cartesianEntries(old_position) +
|
||||
gravity_field->value(old_position).cartesianEntries(old_position) *
|
||||
particle->mass_kg() / particle->charge_C();
|
||||
blitz::TinyVector<double, 3> force_over_charge =
|
||||
electric_field->value(old_position).cartesianEntries(old_position);
|
||||
|
||||
// gravity force / q
|
||||
force_over_charge += gravity_field->value(old_position).cartesianEntries(old_position)
|
||||
* particle->mass_kg() / particle->charge_C();
|
||||
|
||||
const blitz::TinyVector<double, 3> B =
|
||||
magnetic_field->value(old_position).cartesianEntries(old_position);
|
||||
@@ -227,12 +229,20 @@ void DriftMover::move(particle::Particle* particle,
|
||||
kinematic::perpendicularVector(old_velocity.cartesianEntries(), B);
|
||||
const double v_perp_norm = kinematic::norm(v_perp);
|
||||
|
||||
// centrifugal and magnetic moment force / q
|
||||
// not sure if correct. It might be that the centrifugal force includes only the
|
||||
// perpendicular part of grad(B)
|
||||
force_over_charge += -(particle->mass_kg()/particle->charge_C() *
|
||||
(v_parallel_norm*v_parallel_norm + v_perp_norm*v_perp_norm/2) *
|
||||
magnetic_field->gradientValue(old_position).cartesianEntries(old_position) /
|
||||
B_norm);
|
||||
|
||||
const blitz::TinyVector<double, 3> v_drift = driftVelocity(force_over_charge, B);
|
||||
const double v_drift_norm = kinematic::norm(v_drift);
|
||||
|
||||
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 (but has happend)
|
||||
// should be a very rare case
|
||||
const double timestep = std::min(
|
||||
stepsize / (v_parallel_norm + v_perp_norm + v_drift_norm),
|
||||
max_time_alive);
|
||||
|
||||
Reference in New Issue
Block a user