Merge branch 'poisson_solver' of masterduck.fspanier.de:katrin/karl into poisson_solver

This commit is contained in:
2024-07-01 10:07:41 +02:00
6 changed files with 61 additions and 12 deletions
+3 -1
View File
@@ -56,7 +56,8 @@ class PoissonSolver {
double target_accuracy,
int num_cycles,
int solver_intervall,
int solver_offset);
int solver_offset,
bool do_solver);
void solvePotential(const blitz::Array<double, 3> charge_density,
int cpu_sync);
@@ -75,6 +76,7 @@ class PoissonSolver {
const int num_cycles_;
const int solver_intervall_;
const int solver_offset_;
const bool do_solver_;
// density binning defined on the cell centers, potential defined
// such that it exists on the cell edges so that the azimuthal
+7
View File
@@ -54,6 +54,13 @@
"yValuesKey": "/vz(ms)",
"prefactor": 1
}
},
"f5": {
"Exponential": {
"scale": -1,
"prefactor": 1,
"comment": "f5 = prefactor*exp(scale*x)"
}
}
},
"3dto1D examples": {
+12 -4
View File
@@ -568,6 +568,15 @@
}
}
}
},
"GradientField": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Constant3D": {
"constant": 2.5
}
}
}
}
},
"GravityField": {
@@ -616,7 +625,8 @@
"TargetAccuracy": 1e-7,
"NumCycles": 2e4,
"Intervall": 1,
"Offset": 9
"Offset": 9,
"DoSolver": "true"
},
"Simulation": {
"SimulatedEvents": 1,
@@ -639,9 +649,7 @@
"OverwriteLast": "true"
},
"DeletionLogger": {
"Species": [
"all"
],
"Species": "all",
"Intervall": "EachSync",
"OverwriteLast": "true"
},
+28 -2
View File
@@ -565,6 +565,15 @@
}
}
}
},
"GradientField": {
"VectorFieldFunctionInZ": {
"zFunction": {
"Constant3D": {
"constant": 0
}
}
}
}
},
"PoissonSolver": {
@@ -585,13 +594,30 @@
"GlobalPositionBinning"
]
},
"Boundary": {
"Top": {
"type": "neumann",
"value": 0
},
"Bottom": {
"type": "dirichlet",
"value": 0
},
"Hull": {
"type": "dirichlet",
"value": 0
}
},
"TargetAccuracy": 1e-7,
"NumCycles": 2e4
"NumCycles": 2e4,
"Intervall": 1,
"Offset": 0
},
"Simulation": {
"SimulatedEvents": 1,
"EventStride": 1,
"PoissonOffset": 0
"PoissonOffset": 0,
"DoSolver": "false"
},
"Output": {
"folder": "output",
+5 -1
View File
@@ -51,10 +51,14 @@ namespace generator {
int num_cycles = parameter.intValue(json_path_append({"PoissonSolver"},
{"NumCycles"}));
bool do_solver = parameter.boolValue(json_path_append({"PoissonSolver"},
{"DoSolver"}), true);
return std::shared_ptr<PoissonSolver>(new PoissonSolver(boundaries.at("Bottom"),
boundaries.at("Top"), boundaries.at("Hull"), geometry, position_binning,
electrodes, target_accuracy, num_cycles, solver_intervall, solver_offset));
electrodes, target_accuracy, num_cycles, solver_intervall, solver_offset,
do_solver));
}
std::map<std::string, GlobalBoundary> buildBoundaries(Parameter& parameter,
+6 -4
View File
@@ -17,7 +17,8 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary,
double target_accuracy,
int num_cycles,
int solver_intervall,
int solver_offset)
int solver_offset,
bool do_solver)
: bottom_boundary_(bottom_boundary),
top_boundary_(top_boundary),
hull_boundary_(hull_boundary),
@@ -34,7 +35,8 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary,
target_accuracy_(target_accuracy),
num_cycles_(num_cycles),
solver_intervall_(solver_intervall),
solver_offset_(solver_offset) {
solver_offset_(solver_offset),
do_solver_(do_solver) {
blitz::TinyVector<double, 3> stepsize = density_binning_.stepsize();
for (int i = potential_.lbound(0); i <= potential_.ubound(0); ++i) {
@@ -84,8 +86,8 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary,
void PoissonSolver::solvePotential(
const blitz::Array<double, 3> charge_density, int cpu_sync) {
if ((cpu_sync % solver_intervall_ != 0) || ((cpu_sync <= solver_offset_)
&& (cpu_sync > 0))) {
if ((!do_solver_) || ((cpu_sync % solver_intervall_ != 0) || ((cpu_sync <= solver_offset_)
&& (cpu_sync > 0)))) {
return;
}
DEBUG_LEVEL_3("Interpolating chargedensity.");