Changed initializtion of potential-grid, included
a variable for minimum cycles before first poisson solution
This commit is contained in:
@@ -33,22 +33,29 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary,
|
||||
num_cycles_(num_cycles) {
|
||||
// set inner values
|
||||
blitz::TinyVector<double, 3> stepsize = density_binning_.stepsize();
|
||||
for (int i = potential_.lbound(0); i <= potential_.ubound(0) - 1; ++i) {
|
||||
for (int i = potential_.lbound(0); i <= potential_.ubound(0); ++i) {
|
||||
for (int j = potential_.lbound(1); j <= potential_.ubound(1); ++j) {
|
||||
for (int k = potential_.lbound(2) + 1; k <= potential_.ubound(2) - 1;
|
||||
for (int k = potential_.lbound(2); k <= potential_.ubound(2);
|
||||
++k) {
|
||||
potential_(i,j,k).type = BoundaryType::no_boundary;
|
||||
potential_(i,j,k).value = 0.;
|
||||
|
||||
CylinderCoordinate position(blitz::TinyVector<double, 3>(
|
||||
i * stepsize(0), j * stepsize(1), k * stepsize(2)));
|
||||
// does not make sense, either resize the potential array or include
|
||||
// check which boundary it is and use the global boundary condition
|
||||
// or throw an error, because otherwise there should be an error with the density binning
|
||||
if (!geometry_->isInside(position)) {
|
||||
//DEBUG_LEVEL_0("Binning is larger than the Geometry.");
|
||||
potential_(i,j,k).type = BoundaryType::no_boundary;
|
||||
potential_(i,j,k).value = 0.;
|
||||
|
||||
switch(geometry_->isWhere(position)) {
|
||||
case GeometryPositioning::bottom:
|
||||
potential_(i,j,k) = {bottom_boundary_.type, bottom_boundary_.boundary_value};
|
||||
break;
|
||||
case GeometryPositioning::top:
|
||||
potential_(i,j,k) = {top_boundary_.type, top_boundary_.boundary_value};
|
||||
break;
|
||||
case GeometryPositioning::hull:
|
||||
potential_(i,j,k) = {hull_boundary_.type, hull_boundary_.boundary_value};
|
||||
break;
|
||||
case GeometryPositioning::inside:
|
||||
potential_(i,j,k) = {BoundaryType::no_boundary, 0.};
|
||||
break;
|
||||
default:
|
||||
ERROR("Something went terribly wrong. Position is nowhere.");
|
||||
break;
|
||||
}
|
||||
for (auto& electrode : electrodes_) {
|
||||
if (electrode->isOnElectrode(position)) {
|
||||
@@ -59,25 +66,6 @@ PoissonSolver::PoissonSolver(GlobalBoundary bottom_boundary,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//does not yet make sense. Should be the boundaries for the boundary
|
||||
// of the geometry, right now it's the boundary of the potential array
|
||||
// set global boundary
|
||||
PotentialGridPoint tempGridPoint{};
|
||||
tempGridPoint.type = bottom_boundary_.type;
|
||||
tempGridPoint.value = bottom_boundary_.boundary_value;
|
||||
potential_(blitz::Range::all(), blitz::Range::all(), potential_.lbound(2)) =
|
||||
tempGridPoint; //hopefully by value and not by reference...
|
||||
|
||||
tempGridPoint.type = top_boundary_.type;
|
||||
tempGridPoint.value = top_boundary_.boundary_value;
|
||||
potential_(blitz::Range::all(), blitz::Range::all(), potential_.ubound(2)) =
|
||||
tempGridPoint;
|
||||
|
||||
tempGridPoint.type = hull_boundary_.type;
|
||||
tempGridPoint.value = hull_boundary_.boundary_value;
|
||||
potential_(potential_.ubound(0), blitz::Range::all(), blitz::Range::all()) =
|
||||
tempGridPoint;
|
||||
}
|
||||
|
||||
void PoissonSolver::solverIteration(
|
||||
@@ -158,6 +146,9 @@ bool PoissonSolver::converged(
|
||||
for (int j = potential_.lbound(1); j <= potential_.ubound(1); ++j) {
|
||||
for (int k = potential_.lbound(2) + 1; k <= potential_.ubound(2) - 1;
|
||||
++k) {
|
||||
if(potential_(i,j,k).type != BoundaryType::no_boundary) {
|
||||
continue;
|
||||
}
|
||||
if (i == 0) {
|
||||
// special calculation for r=0
|
||||
//Note: the value \phi_{i,j+Nj/2,k} as the replacement of
|
||||
|
||||
Reference in New Issue
Block a user