Electrons are explicitly stored between timesteps

and can be dumped using MPI-IO.
Restarts read particles from earlier output.
This commit is contained in:
2025-08-11 09:18:51 +02:00
parent 0dd65d38f3
commit 76a93f5aa4
16 changed files with 781 additions and 81 deletions
+29 -7
View File
@@ -15,14 +15,25 @@
// called reset function (e.g. in the density field) and sometimes it's
// handled here
Restart::Restart(bool do_restart, std::string absolute_filename,
std::string restart_identifier):
do_restart_(do_restart),
restart_identifier_(restart_identifier),
reader_(Hdf5Reader(absolute_filename)) {}
// Restart::Restart(bool do_restart, std::string absolute_filename,
// std::string restart_identifier):
// do_restart_(do_restart),
// restart_identifier_(restart_identifier),
// reader_(Hdf5Reader(absolute_filename)) {}
void Restart::restart(std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species,
PoissonSolver* poisson_solver, RandomNumbers* random_numbers) {
Restart::Restart(bool do_restart, std::string absolute_filename_without_extension,
std::string restart_idenitfier, int particle_restart_at):
do_restart_(do_restart),
restart_identifier_(restart_idenitfier),
reader_(absolute_filename_without_extension + ".h5"),
particle_reader_(absolute_filename_without_extension,
particle_restart_at) {}
void Restart::restart(
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species,
PoissonSolver* poisson_solver,
RandomNumbers* random_numbers,
std::vector<particle::SerializedParticle>& storage_queue) {
if(!do_restart_) {
return;
@@ -31,6 +42,7 @@ void Restart::restart(std::map<std::string, std::shared_ptr<species::TrackedSpec
DEBUG_LEVEL_1("Restarting rng");
#endif
restartRandomNumbers(random_numbers);
#ifdef debug_level1
DEBUG_LEVEL_1("Restarting poisson solver.");
#endif
@@ -47,6 +59,11 @@ void Restart::restart(std::map<std::string, std::shared_ptr<species::TrackedSpec
restartDrawingDensityField(pair.second->densityForDrawing(), path);
pair.second->positionDistributionFromDensity()->setMaximumDensity();
}
#if defined(debug_level1) || defined(debug_level2) || defined(debug_level3)
DEBUG_LEVEL_1("Reloading particles.");
#endif
particle_reader_.readParticles(storage_queue);
}
void Restart::restartRandomNumbers(RandomNumbers* random) {
@@ -141,4 +158,9 @@ void Restart::restartPoissonSolver(PoissonSolver* solver) {
#endif
blitz::Array<double, 3> potential = reader_.readD3Double(path);
solver->setPotential(potential);
}
void Restart::restartParticles(
std::vector<particle::SerializedParticle>& storage_queue) {
particle_reader_.readParticles(storage_queue);
}