Added gravity array to boris push,
minor cosmetic changes
This commit is contained in:
@@ -29,19 +29,22 @@ void BorisMover::move(particle::Particle* particle,
|
||||
auto old_position = particle->position();
|
||||
double old_kinetic_energy = particle->kineticEnergy_eV();
|
||||
|
||||
if (old_kinetic_energy < 1E-9) {
|
||||
// Guard against small enegies taking up much time without contributing to
|
||||
// density
|
||||
return;
|
||||
}
|
||||
// if (old_kinetic_energy < 1E-9) {
|
||||
// DEBUG_LEVEL_2("Particle has too low an energy.");
|
||||
// // Guard against small enegies taking up much time without contributing to
|
||||
// // density
|
||||
// //return;
|
||||
// }
|
||||
|
||||
bool changed_position_bin = false;
|
||||
bool changed_energy_bin = false;
|
||||
bool left_simulation_domain = false;
|
||||
bool died_in_bin = false;
|
||||
|
||||
while (
|
||||
!(changed_position_bin || changed_energy_bin || left_simulation_domain) &&
|
||||
(leftover_distance > 0.)) {
|
||||
!(changed_position_bin || changed_energy_bin
|
||||
|| left_simulation_domain || died_in_bin) &&
|
||||
(leftover_distance > 0.)) {
|
||||
old_position = particle->position();
|
||||
old_kinetic_energy = particle->kineticEnergy_eV();
|
||||
|
||||
@@ -51,8 +54,13 @@ void BorisMover::move(particle::Particle* particle,
|
||||
electric_field->value(old_position).cartesianEntries(old_position);
|
||||
const blitz::TinyVector<double, 3> B =
|
||||
magnetic_field->value(old_position).cartesianEntries(old_position);
|
||||
const blitz::TinyVector<double, 3> g =
|
||||
gravity_field->value(old_position).cartesianEntries(old_position);
|
||||
|
||||
const blitz::TinyVector<double, 3> force_over_q =
|
||||
E + particle->mass_kg()/particle->charge_C()*g;
|
||||
|
||||
movementStep(particle, E, B, moved_distance);
|
||||
movementStep(particle, force_over_q, B, moved_distance);
|
||||
particle->increaseTimeAlive(maximal_time_step_s_);
|
||||
particle->increaseTimeInBin(maximal_time_step_s_);
|
||||
|
||||
@@ -69,6 +77,9 @@ void BorisMover::move(particle::Particle* particle,
|
||||
left_simulation_domain =
|
||||
particle->specie()->terminator()->leftSimulationDomain(particle);
|
||||
|
||||
died_in_bin =
|
||||
particle->specie()->terminator()->reachedMaxTimeAlive(particle);
|
||||
|
||||
leftover_distance -= moved_distance;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user