Added Electrodes to Poisson Solver
This commit is contained in:
@@ -196,16 +196,18 @@ bool PoissonSolver::converged(
|
||||
normalized_difference =
|
||||
std::sqrt(cumulated_quadradic_difference / (nr * nz));
|
||||
#ifdef debug
|
||||
DEBUG_LEVEL_0("Poisson solver reached a normalized difference of: " +
|
||||
std::to_string(normalized_difference));
|
||||
std::stringstream out;
|
||||
out << "Poisson solver reached a normalized difference of: ";
|
||||
out << normalized_difference;
|
||||
DEBUG_LEVEL_0(out.str());
|
||||
#endif
|
||||
double normalized_maximum =
|
||||
maximum_difference*SI::eps0/(fabs(blitz::max(interpolated_density)) + 1e-12);
|
||||
#ifdef debug_level1
|
||||
#ifdef debug
|
||||
std::ostringstream message;
|
||||
message << "Maximum Difference normalized by order of magnitude: "
|
||||
<< normalized_difference;
|
||||
DEBUG_LEVEL_1(message.str());
|
||||
<< normalized_maximum;
|
||||
DEBUG(message.str());
|
||||
#endif
|
||||
return normalized_difference < target_accuracy_;
|
||||
}
|
||||
@@ -331,4 +333,34 @@ RearWall::RearWall(double potential): Electrode(potential) {};
|
||||
bool RearWall::isOnElectrode(const Coordinate& position) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RingElectrode::RingElectrode(double potential, const double zPosition,
|
||||
const double innerRadius,
|
||||
const double outerRadius,
|
||||
const blitz::TinyVector<double, 2> stepsize):
|
||||
Electrode(potential),
|
||||
specs_(blitz::TinyVector<double, 3>(innerRadius, outerRadius, zPosition)),
|
||||
stepsize_(stepsize) {}
|
||||
|
||||
bool RingElectrode::isOnElectrode(const Coordinate& pos) {
|
||||
blitz::TinyVector<double, 3> pos_cyl = pos.cylinderEntries();
|
||||
|
||||
bool zdir = std::abs(pos_cyl(2) - specs_(2)) <= stepsize_(1)/2;
|
||||
zdir = (specs_(2) - pos_cyl(2) == stepsize_(1)/2) ? false : zdir;
|
||||
|
||||
bool rInner = (pos_cyl(0) >= specs_(0));
|
||||
bool rOuter = (pos_cyl(0) < specs_(1));
|
||||
|
||||
#ifdef debug
|
||||
std::stringstream out;
|
||||
out << "Position " << pos_cyl << ": \n\t";
|
||||
out << "z-dir: " << ((zdir) ? "true" : "false") << "\n\t";
|
||||
out << "rinner-dir: " << ((rInner) ? "true" : "false") << "\n\t";
|
||||
out << "router-dir: " << ((rOuter) ? "true" : "false") << "\n\t";
|
||||
out << "total: " << ((zdir && rInner && rOuter) ? "true" : "false") << "\n\t";
|
||||
DEBUG(out.str());
|
||||
#endif
|
||||
|
||||
return zdir && rInner && rOuter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user