Added option to reset relevant fields for
output after a poisson solution step
This commit is contained in:
@@ -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 reset_after_solving)
|
||||
: 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),
|
||||
reset_after_solving_(reset_after_solving) {
|
||||
|
||||
blitz::TinyVector<double, 3> stepsize = density_binning_.stepsize();
|
||||
for (int i = potential_.lbound(0); i <= potential_.ubound(0); ++i) {
|
||||
@@ -79,13 +81,16 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary,
|
||||
blitz::Range(density_binning.binIndexMin()(2),
|
||||
density_binning.binIndexMax()(2)));
|
||||
zero_chargedensity = 0.;
|
||||
solvePotential(zero_chargedensity, 0);
|
||||
bool reset;
|
||||
solvePotential(zero_chargedensity, 0, reset);
|
||||
}
|
||||
|
||||
void PoissonSolver::solvePotential(
|
||||
const blitz::Array<double, 3> charge_density, int cpu_sync) {
|
||||
const blitz::Array<double, 3> charge_density, int cpu_sync,
|
||||
bool& reset) {
|
||||
if ((cpu_sync % solver_intervall_ != 0) || ((cpu_sync <= solver_offset_)
|
||||
&& (cpu_sync > 0))) {
|
||||
reset = false;
|
||||
return;
|
||||
}
|
||||
DEBUG_LEVEL_3("Interpolating chargedensity.");
|
||||
@@ -102,6 +107,7 @@ void PoissonSolver::solvePotential(
|
||||
}
|
||||
++it;
|
||||
} while (it < num_cycles_);
|
||||
reset = reset_after_solving_;
|
||||
}
|
||||
|
||||
void PoissonSolver::solverIteration(
|
||||
@@ -243,7 +249,7 @@ bool PoissonSolver::converged(
|
||||
double normalized_maximum =
|
||||
maximum_difference*SI::eps0/(fabs(blitz::max(interpolated_density)) + 1e-12);
|
||||
std::ostringstream message;
|
||||
message << "Maximum Differenece normalized by order of magnitude: "
|
||||
message << "Maximum Difference normalized by order of magnitude: "
|
||||
<< normalized_difference;
|
||||
DEBUG_LEVEL_0(message.str());
|
||||
return normalized_difference < target_accuracy_;
|
||||
|
||||
Reference in New Issue
Block a user