Fixed errors s.t. code runs (on 1 proc)

This commit is contained in:
2024-01-25 11:34:46 +01:00
parent 9d0c7646b3
commit ffc65f8ef9
3 changed files with 15 additions and 12 deletions
+2 -2
View File
@@ -144,9 +144,9 @@ void SimulationOutput::writeSimulationData(PoissonSolver* poisson_solver,
std::string poisson_path,
int cpu_sync,
bool overwrite_last) {
std::string sync_path = "SyncPeriod_" + std::to_string(cpu_sync);
std::string sync_path = "/SyncPeriod_" + std::to_string(cpu_sync);
if (overwrite_last) {
sync_path = "LastSyncPeriod";
sync_path = "/LastSyncPeriod";
}
std::string path = poisson_path + sync_path;
DEBUG_LEVEL_3("Write potential.");
@@ -129,21 +129,21 @@ std::shared_ptr<SimulationOutput> buildSimulationOutput(
}
}
// Potential
// PoissonSolver
{
int intervall =
json_int(json_object_by_path(object, {"Potential", "Intervall"}));
json_int(json_object_by_path(object, {"PoissonSolver", "Intervall"}));
if (intervall == 0 &&
json_string(json_object_by_path(
object, {"Potential", "Intervall"})) == "EachSync") {
object, {"PoissonSolver", "Intervall"})) == "EachSync") {
intervall = 1;
}
ASSERT_POSITIVE(&intervall,
"The intervall for the potential must be positive");
bool overwrite_last = json_bool(
json_object_by_path(object, {"Potential", "OverwriteLast"}));
json_object_by_path(object, {"PoissonSolver", "OverwriteLast"}));
OutputTask task = {"potential", overwrite_last, intervall};
+9 -6
View File
@@ -310,17 +310,20 @@ std::vector<particle::Particle> Simulation::determineInjectedParticles(
}
blitz::Array<double,3> Simulation::chargedensity() {
DEBUG_LEVEL_3("Initialize chargedensity Array");
//not great but the size and bounds of the density arrays are needed...
blitz::Array<double, 3> chargeden(tracked_species_["electron"]->
dynamicDensityField()->densityArray().lbound(),
tracked_species_["electron"]->dynamicDensityField()->
densityArray().extent());
std::shared_ptr<species::TrackedSpecie> firstTracked = tracked_species_.begin()->second;
DEBUG_LEVEL_3("shared pointer extracted, key: " + tracked_species_.begin()->first);
if(!firstTracked)
ERROR("extracted pointer is null");
blitz::Array<double,3> init = firstTracked->dynamicDensityField()->densityArray();
blitz::Array<double, 3> chargeden(init.lbound(), init.extent());
chargeden = 0.;
DEBUG_LEVEL_3("Collect chargedensity");
for (auto& pair : tracked_species_) {
chargeden += pair.second->charge_C() * pair.second->dynamicDensityField()->
densityArray();
}
return chargeden;
}