Added new restart info

This commit is contained in:
2025-08-21 14:00:24 +02:00
parent 285d165615
commit bea8751f1d
10 changed files with 73 additions and 22 deletions
+13 -12
View File
@@ -99,7 +99,7 @@ void Simulation::init(Parameter& parameter) {
Restart restarter = generator::buildRestart(parameter);
restarter.restart(tracked_species_, poisson_solver_.get(), random_.get(),
storage_queue_[active_storage]);
storage_queue_[active_storage], injectionGroupOffset);
// poisson solver is restarted -> set the electric field from the potential
electric_field_->updateDynamicField(poisson_solver_->staticElectricField());
@@ -151,14 +151,14 @@ void Simulation::start() {
// beta decay
const int injection_stride =
parameter_.intValue(json_path({"Simulation", "InjectionStride"}), 1);
int check = MpiCommunication::mpiSize() - injection_stride;
int check = MpiCommunication::mpi_size - injection_stride;
ASSERT_NOTNEGATIVE(&check, "The injection stride has to be smaller or equal"
" to the number of processes!");
const int group = MpiCommunication::mpiRank() % injection_stride;
const int group = MpiCommunication::mpi_rank % injection_stride;
// determine the number of processes that inject at the same timestep
int group_size = MpiCommunication::mpiSize() / injection_stride;
group_size = group < (MpiCommunication::mpiSize() - group_size * injection_stride) ?
int group_size = MpiCommunication::mpi_size / injection_stride;
group_size = group < (MpiCommunication::mpi_size - group_size * injection_stride) ?
group_size + 1 : group_size;
// number of timesteps to be simulated
@@ -169,7 +169,7 @@ void Simulation::start() {
// time_resolution_events/Activity
const double time_resolution_events =
parameter_.doubleValue(json_path({"Simulation", "TimeResolutionEvents"}),
MpiCommunication::mpiSize());
MpiCommunication::mpi_size);
// number of beta decay events per timestep and CPU (will get normalized s.t.
// the physical number of particles is correct)
@@ -182,7 +182,7 @@ void Simulation::start() {
#ifdef debug
std::stringstream out;
out << "Rank " << MpiCommunication::mpiRank() << ": is part of group ";
out << "Rank " << MpiCommunication::mpi_rank << ": is part of group ";
out << group << " with size " << group_size;
out << " (injection stride: " << injection_stride << ")";
out << "\n\tweight of beta particle: " << beta_particle_weight;
@@ -204,7 +204,7 @@ void Simulation::start() {
// calculate the scaling factor for the particle weight for particles
// drawn from the density
const double density_weight_factor =
1./(MpiCommunication::mpiSize()*particles_per_bin);
1./(MpiCommunication::mpi_size*particles_per_bin);
#ifdef debug
DEBUG_LEVEL_0("Number of particles per bin per CPU: " + std::to_string(particles_per_bin));
@@ -270,9 +270,9 @@ void Simulation::start() {
// process both density and beta events before a cpu synchronization
processDensityEvents(particles_per_bin, density_weight_factor);
if(group == (timestep % injection_stride)) {
if(group == ((timestep + injectionGroupOffset) % injection_stride)) {
#ifdef debug
DEBUG_LEVEL_0(std::to_string(MpiCommunication::mpiRank()) + ": injection at "
DEBUG_LEVEL_0(std::to_string(MpiCommunication::mpi_rank) + ": injection at "
"timestep " + std::to_string(timestep));
#endif
processEvents(events_of_cycle, beta_particle_weight);
@@ -312,8 +312,9 @@ void Simulation::start() {
SimulationTimer::eventStartPoint(std::string("Output"));
// only write inactive queue, obvi not correct if written between timesteps
output_->writeSimulationData(num_cpu_syncs, tracked_species_, poisson_solver_.get(),
random_->engine(), storage_queue_[inactive_storage]);
SimulationTimer::eventStopPoint(std::string("Output"));
random_->engine(), storage_queue_[inactive_storage],
(timestep + injectionGroupOffset + 1) % injection_stride);
SimulationTimer::eventStopPoint(std::string("Output"));
SimulationTimer::eventStartPoint("Reset");
if(reset) {