Poisson step and resets only after time resolution
This commit is contained in:
@@ -110,18 +110,24 @@ void Simulation::start() {
|
||||
const int time_resolution_this_cpu = eventsThisCpu(time_resolution_events);
|
||||
SIM_INFO("Events per cpu (approx.): " + std::to_string(events_this_cpu));
|
||||
int leftover_events = events_this_cpu;
|
||||
int leftover_events_time_resolution = time_resolution_this_cpu;
|
||||
const double delta_t = time_resolution_events*injector_->timePassed();
|
||||
|
||||
int num_cpu_syncs = 0;
|
||||
bool reset = false;
|
||||
bool reset = true;
|
||||
std::vector<particle::Particle> backup_queue;
|
||||
backup_queue.reserve(100); // probably should be a more sensible value
|
||||
// bring some order into the reset checks
|
||||
while (leftover_events > 0) {
|
||||
timer_->increaseTimestep(time_resolution_events*injector_->timePassed());
|
||||
if(reset)
|
||||
timer_->increaseTimestep(delta_t);
|
||||
|
||||
std::stringstream out;
|
||||
out << "Timeinterval: " << timer_->time() << "s.";
|
||||
out << "\n size of particle: " << sizeof(particle::Particle);
|
||||
DEBUG_LEVEL_3(out.str());
|
||||
int events_of_cylcle = eventsOfCycle(event_stride, time_resolution_this_cpu);
|
||||
|
||||
int events_of_cylcle = eventsOfCycle(event_stride, leftover_events_time_resolution);
|
||||
SIM_INFO("Leftover events on first cpu: " +
|
||||
std::to_string(leftover_events));
|
||||
processEvents(events_of_cylcle, backup_queue, time_resolution_events);
|
||||
@@ -129,6 +135,9 @@ void Simulation::start() {
|
||||
|
||||
DEBUG_LEVEL_1("Leftover events: " + std::to_string(leftover_events));
|
||||
leftover_events -= events_of_cylcle;
|
||||
leftover_events_time_resolution -= events_of_cylcle;
|
||||
|
||||
reset = !(leftover_events_time_resolution > 0);
|
||||
|
||||
SIM_INFO("Cpu sync.");
|
||||
SimulationTimer::eventStartPoint(std::string("CpuSync"));
|
||||
@@ -138,7 +147,7 @@ void Simulation::start() {
|
||||
|
||||
SIM_INFO("Poisson step.");
|
||||
SimulationTimer::eventStartPoint(std::string("PoissonStep"));
|
||||
poisson_solver_->solvePotential(chargedensity(), num_cpu_syncs, reset);
|
||||
poisson_solver_->solvePotential(chargedensity(), reset);
|
||||
electric_field_->updateDynamicField(poisson_solver_->staticElectricField());
|
||||
|
||||
SimulationTimer::eventStopPoint(std::string("PoissonStep"));
|
||||
@@ -161,6 +170,10 @@ void Simulation::start() {
|
||||
pair.second->lastSyncDeletionLogger()->resetDeletionLogger();
|
||||
}
|
||||
}
|
||||
|
||||
if ((leftover_events > 0) && reset) {
|
||||
leftover_events_time_resolution = time_resolution_this_cpu;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +188,7 @@ void Simulation::processEvents(int events,
|
||||
std::vector<particle::Particle> particle_queue;
|
||||
particle_queue.reserve(100);
|
||||
DEBUG_LEVEL_3("Move backup to processing queue.");
|
||||
// highly inefficient in case that #cpu_syncs/time_res >> 1
|
||||
// highly inefficient in case that #cpu_syncs/time_res >> 1, i.e. backup queue is large
|
||||
particle_queue.insert(particle_queue.end(), backup_queue.begin(),
|
||||
backup_queue.end());
|
||||
// clean backup_queue after moving the elements to the particle queue
|
||||
|
||||
Reference in New Issue
Block a user