fixed errors, included missing memberfunctions

This commit is contained in:
2024-01-19 15:07:02 +01:00
parent 00eb561e92
commit 5f7f44b337
2 changed files with 228 additions and 86 deletions
+31 -19
View File
@@ -2,6 +2,11 @@
#define POISSON_SOLVER_H
#include "blitz/array.h"
#include "simulation/vector_field.h"
#include <memory>
// for now put the electric field calculation into
// the poisson solver
class Geometry;
class CylinderBinning;
@@ -15,13 +20,30 @@ enum class BoundaryType {
};
struct PotentialGridPoint {
//PotentialGridPoint(BoundaryType _type, double _value);
BoundaryType type;
double value;
};
struct GlobalBoundary {
double boundary_value;
BoundaryType type
BoundaryType type;
};
class Electrode {
public:
Electrode(double potential);
virtual bool isOnElectrode(const Coordinate& position) = 0;
double electrodePotential();
protected:
const double potential_;
};
class RearWall : public Electrode {
public:
RearWall(double potential);
bool isOnElectrode(const Coordinate& position);
};
class PoissonSolver {
@@ -37,17 +59,21 @@ class PoissonSolver {
void solvePotential(const blitz::Array<double, 3> charge_density);
blitz::Array<double, 3> potential();
// std::shared_ptr<VectorField> staticElectricField();
private:
Boundary bottom_boundary_;
Boundary top_boundary_;
Boundary hull_boundary_;
GlobalBoundary bottom_boundary_;
GlobalBoundary top_boundary_;
GlobalBoundary hull_boundary_;
std::shared_ptr<Geometry> geometry_;
std::vector<std::shared_ptr<Electrode>> electrodes_;
std::shared_ptr<CylinderBinning> density_binning_;
double target_accuracy_;
int num_cycles_;
// the potential is located on the grid corners (such that
// it is defined on r=0) (note that the density_binning is taken
// to be defined in the cell centers)
blitz::Array<PotentialGridPoint, 3> potential_;
blitz::Array<double, 3> interpolateDensityToPotentialGrid(
@@ -57,20 +83,6 @@ class PoissonSolver {
bool converged(const blitz::Array<double, 3>& interpolated_density);
};
class Electrode {
public:
Electrode(double potential);
virtual bool isOnElectrode(Coordinate* position) = 0;
double electrodePotential();
private:
const double potential_;
};
class RearWall : public Electrode {
public:
RearWall(double potential);
bool isOnElectrode(Coordinate* position);
};
// Electrodes can only be dirichlet boundary conditions
#endif /* POISSON_SOLVER_H */