Added gravity array to boris push,
minor cosmetic changes
This commit is contained in:
@@ -49,7 +49,7 @@ class SimulationOutput {
|
|||||||
std::vector<OutputTask> tasks_density_fields_;
|
std::vector<OutputTask> tasks_density_fields_;
|
||||||
std::vector<OutputTask> tasks_current_collector_;
|
std::vector<OutputTask> tasks_current_collector_;
|
||||||
std::vector<OutputTask> tasks_deletion_logger_;
|
std::vector<OutputTask> tasks_deletion_logger_;
|
||||||
OutputTask task_potential_; // no meta data written for now
|
OutputTask task_potential_;
|
||||||
|
|
||||||
Hdf5Writer writer;
|
Hdf5Writer writer;
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ double buildMass(json_t* object) {
|
|||||||
} else if (json_object_by_path(object, {"value"})) {
|
} else if (json_object_by_path(object, {"value"})) {
|
||||||
return json_double(json_object_by_path(object, {"value"}));
|
return json_double(json_object_by_path(object, {"value"}));
|
||||||
} else {
|
} else {
|
||||||
ERROR("The mass is not given correcty.");
|
ERROR("The mass is not given correctly.");
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ std::shared_ptr<SimulationOutput> buildSimulationOutput(
|
|||||||
intervall = 1;
|
intervall = 1;
|
||||||
}
|
}
|
||||||
ASSERT_POSITIVE(&intervall,
|
ASSERT_POSITIVE(&intervall,
|
||||||
"The intervall for the poisson solver output must be positive");
|
"The output intervall for the poisson solver output must be positive.");
|
||||||
|
|
||||||
bool overwrite_last = json_bool(
|
bool overwrite_last = json_bool(
|
||||||
json_object_by_path(object, {"PoissonSolver", "OverwriteLast"}));
|
json_object_by_path(object, {"PoissonSolver", "OverwriteLast"}));
|
||||||
|
|||||||
@@ -29,19 +29,22 @@ void BorisMover::move(particle::Particle* particle,
|
|||||||
auto old_position = particle->position();
|
auto old_position = particle->position();
|
||||||
double old_kinetic_energy = particle->kineticEnergy_eV();
|
double old_kinetic_energy = particle->kineticEnergy_eV();
|
||||||
|
|
||||||
if (old_kinetic_energy < 1E-9) {
|
// if (old_kinetic_energy < 1E-9) {
|
||||||
// Guard against small enegies taking up much time without contributing to
|
// DEBUG_LEVEL_2("Particle has too low an energy.");
|
||||||
// density
|
// // Guard against small enegies taking up much time without contributing to
|
||||||
return;
|
// // density
|
||||||
}
|
// //return;
|
||||||
|
// }
|
||||||
|
|
||||||
bool changed_position_bin = false;
|
bool changed_position_bin = false;
|
||||||
bool changed_energy_bin = false;
|
bool changed_energy_bin = false;
|
||||||
bool left_simulation_domain = false;
|
bool left_simulation_domain = false;
|
||||||
|
bool died_in_bin = false;
|
||||||
|
|
||||||
while (
|
while (
|
||||||
!(changed_position_bin || changed_energy_bin || left_simulation_domain) &&
|
!(changed_position_bin || changed_energy_bin
|
||||||
(leftover_distance > 0.)) {
|
|| left_simulation_domain || died_in_bin) &&
|
||||||
|
(leftover_distance > 0.)) {
|
||||||
old_position = particle->position();
|
old_position = particle->position();
|
||||||
old_kinetic_energy = particle->kineticEnergy_eV();
|
old_kinetic_energy = particle->kineticEnergy_eV();
|
||||||
|
|
||||||
@@ -51,8 +54,13 @@ void BorisMover::move(particle::Particle* particle,
|
|||||||
electric_field->value(old_position).cartesianEntries(old_position);
|
electric_field->value(old_position).cartesianEntries(old_position);
|
||||||
const blitz::TinyVector<double, 3> B =
|
const blitz::TinyVector<double, 3> B =
|
||||||
magnetic_field->value(old_position).cartesianEntries(old_position);
|
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->increaseTimeAlive(maximal_time_step_s_);
|
||||||
particle->increaseTimeInBin(maximal_time_step_s_);
|
particle->increaseTimeInBin(maximal_time_step_s_);
|
||||||
|
|
||||||
@@ -69,6 +77,9 @@ void BorisMover::move(particle::Particle* particle,
|
|||||||
left_simulation_domain =
|
left_simulation_domain =
|
||||||
particle->specie()->terminator()->leftSimulationDomain(particle);
|
particle->specie()->terminator()->leftSimulationDomain(particle);
|
||||||
|
|
||||||
|
died_in_bin =
|
||||||
|
particle->specie()->terminator()->reachedMaxTimeAlive(particle);
|
||||||
|
|
||||||
leftover_distance -= moved_distance;
|
leftover_distance -= moved_distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user