Added option to reset relevant fields for

output after a poisson solution step
This commit is contained in:
2024-04-13 11:10:18 +02:00
parent 30b0178e5f
commit 93a51acbda
12 changed files with 71 additions and 9 deletions
+16 -1
View File
@@ -106,6 +106,7 @@ void Simulation::start() {
int leftover_events = events_this_cpu;
int num_cpu_syncs = 0;
bool reset = false;
while (leftover_events > 0) {
int events_of_cylcle = eventsOfCycle(event_stride, leftover_events);
SIM_INFO("Leftover events on first cpu: " +
@@ -123,7 +124,7 @@ void Simulation::start() {
SIM_INFO("Poisson step.");
SimulationTimer::eventStartPoint(std::string("PoissonStep"));
poisson_solver_->solvePotential(chargedensity(), num_cpu_syncs);
poisson_solver_->solvePotential(chargedensity(), num_cpu_syncs, reset);
electric_field_->updateDynamicField(poisson_solver_->staticElectricField());
SimulationTimer::eventStopPoint(std::string("PoissonStep"));
@@ -132,6 +133,20 @@ void Simulation::start() {
SimulationTimer::eventStartPoint(std::string("Output"));
output_->writeSimulationData(num_cpu_syncs, tracked_species_, poisson_solver_.get());
SimulationTimer::eventStopPoint(std::string("Output"));
if(reset) {
SIM_INFO("Reset density, current fields and deletions.");
for(auto& pair : tracked_species_) {
pair.second->dynamicDensityField()->resetDynamicDensityField();
pair.second->lastSyncDensityField()->resetDynamicDensityField();
pair.second->currentCollector()->resetCurrentCollector();
pair.second->lastSyncCurrentCollector()->resetCurrentCollector();
pair.second->deletionLogger()->resetDeletionLogger();
pair.second->lastSyncDeletionLogger()->resetDeletionLogger();
}
}
}
}