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
+11 -4
View File
@@ -10,21 +10,28 @@ namespace generator {
#ifdef debug
DEBUG_LEVEL_0("No Restart desired.");
#endif
return Restart(false, "", "");
return Restart(false, "", "", 0);
}
std::string filepath = readAbsoluteFilename(json_object_by_path(object, {"PathToH5"}))
+ ".h5";
// no file extensions!!! Those get added in the constructor of the hdf5 and mpi
// reader classes
std::string filepath =
readAbsoluteFilename(json_object_by_path(object, {"PathToH5"}));
#ifdef debug_level3
DEBUG_LEVEL_3("Restart: file path:" + filepath);
#endif
std::string identifier;
int sync_period = json_int(json_object_by_path(object, {"SyncPeriod"}));
int part_restart_at = sync_period;
if(sync_period == 0 && json_string(json_object_by_path(object, {"SyncPeriod"}))
== "LastSyncPeriod") {
identifier = "LastSyncPeriod";
part_restart_at = json_int(json_object_by_path(object, {"ParticleSyncPeriod"}));
ASSERT_POSITIVE(&part_restart_at, "The ParticleSyncPeriod has to be positive!");
} else {
ASSERT_POSITIVE(&sync_period, "The SyncPeriod for the restart has to be either"
" positive or \"LastSyncPeriod\".");
@@ -35,7 +42,7 @@ namespace generator {
DEBUG_LEVEL_3("Restart: SyncPeriod to be started from: " + identifier);
#endif
return Restart(do_restart, filepath, identifier);
return Restart(do_restart, filepath, identifier, part_restart_at);
}
Restart buildRestart(Parameter& parameter) {
@@ -178,6 +178,31 @@ std::shared_ptr<SimulationOutput> buildSimulationOutput(
output->setRestartInfoOutput(task);
}
// Particles
{
int intervall =
json_int(json_object_by_path(object, {"Particles", "Intervall"}), -1);
// DEBUG_LEVEL_2("Try value of Intervall as string");
if (intervall == -1 && json_string(json_object_by_path(
object, {"Particles", "Intervall"})) == "EachSync") {
intervall = 1;
} else if (intervall == -1) {
intervall = 0;
}
ASSERT_NOTNEGATIVE(&intervall, "The intervall for Particles output has to be either 0"
",if no output is required or positive otherwise");
#ifdef debug_level3
DEBUG_LEVEL_3("Particles output interval: " + std::to_string(intervall));
#endif
// could be done, but then the naming of the mpi file would need to be adjusted
bool overwrite_last = false;
OutputTask task = {"Particles", overwrite_last, intervall};
output->setParticleOutput(task);
}
return output;
}
+5
View File
@@ -137,6 +137,11 @@ void SpeciesBuilder::initTrackedSpecies(Parameter& parameter) {
json_t* value;
json_object_foreach(parameter.jsonObjectFromBase({"Species", "Tracked"}), key,
value) {
if(std::string(key).size() >= 16) {
std::stringstream out;
out << std::string(key) << ": name is to long, has to be 15 chars or less!";
ERROR(out.str());
}
tracked_species_info[std::string(key)] = TrackedSpeciesBuilderInfo();
tracked_species_info[std::string(key)].name = std::string(key);
tracked_species_info[std::string(key)].path_in_json = {"Species", "Tracked",