Bugfixes;

Restarts now reproduce longer Sims
This commit is contained in:
2024-09-11 14:56:14 +02:00
parent 75bb2e4d85
commit b4cbd8c44c
9 changed files with 53 additions and 14 deletions
+14 -1
View File
@@ -260,11 +260,21 @@ void Simulation::processEvents(int events, int density_events, int cpu_syncs) {
} else {
DEBUG_LEVEL_2("Current density event: " +
std::to_string(current_density_event));
std::to_string(current_density_event));
//maybe use a different event name?
SimulationTimer::eventStartPoint(std::string("DensityParticleInjection"));
new_particles = determineInjectedDensityParticles(random_.get(), density_events, current_density_event);
SimulationTimer::eventStopPoint(std::string("DensityParticleInjection"));
#if defined debug_level3
for(auto& particle : new_particles) {
std::stringstream output_ss;
output_ss << particle.specie()->name() << " with velocity (cart): ";
output_ss << particle.velocity().cartesianEntries();
output_ss << " and position (cart)";
output_ss << particle.position().cartesianEntries();
DEBUG_LEVEL_3(output_ss.str());
}
#endif
current_density_event += 1;
}
if(new_particles.empty())
@@ -442,6 +452,9 @@ std::vector<particle::Particle> Simulation::determineInjectedDensityParticles(
}
const double injection_time = timer_->time() - timer_->getDeltaT();
for(auto& pair: tracked_species_) {
// not ideal, gets recalculated each time a new particle is drawn from the density,
// which does not change except after a timestep, but think the rejection method is
// much more time consuming anyways... might optimize in the future
// particle number of the denstiy, i.e. the integral over the density
const double particleNumberDensity =
pair.second->densityForDrawing()->particleNumber();