Added Electrodes to Poisson Solver
This commit is contained in:
@@ -17,6 +17,7 @@ namespace generator {
|
||||
|
||||
json_t* object = json_object_by_path(
|
||||
parameter.jsonFile(), {"PoissonSolver"});
|
||||
|
||||
//create geometry
|
||||
if (json_object_by_path(object, {"BoundaryGeometry"})) {
|
||||
geometry = buildGeometryIncludingRedirection(parameter,
|
||||
@@ -24,6 +25,7 @@ namespace generator {
|
||||
} else {
|
||||
ERROR("Cannot find boundary geometry for poisson solver.");
|
||||
}
|
||||
|
||||
//create binning
|
||||
json_path path_binning = json_path_append({"PoissonSolver"},
|
||||
{"PositionBinning"});
|
||||
@@ -32,7 +34,37 @@ namespace generator {
|
||||
|
||||
auto boundaries = buildBoundaries(parameter, {"PoissonSolver", "Boundary"});
|
||||
|
||||
// build electrodes, might be good to put into own function
|
||||
std::vector<std::shared_ptr<Electrode>> electrodes{};
|
||||
const char* key;
|
||||
json_t* value;
|
||||
json_t* array = parameter.jsonObjectFromBase({"PoissonSolver", "Electrodes"});
|
||||
json_object_foreach(array, key, value) {
|
||||
std::string type = json_string(json_object_by_path(value, {"Type"}));
|
||||
if(type == "RingElectrode") {
|
||||
double zpos = json_read_length(json_object_by_path(value, {"zPosition"}));
|
||||
double rInner = json_read_length(json_object_by_path(value, {"InnerRadius"}));
|
||||
double rOuter = json_read_length(json_object_by_path(value, {"OuterRadius"}));
|
||||
double potentialValue = json_double(json_object_by_path(value, {"Potential", "value"}));
|
||||
|
||||
#ifdef debug
|
||||
std::stringstream out;
|
||||
out << "Electrode " << std::string(key) << ":\n\t";
|
||||
out << "z position: " << zpos << " m\n\t";
|
||||
out << "inner radius: " << rInner << " m\n\t";
|
||||
out << "outer radius: " << rOuter << " m\n\t";
|
||||
out << "potential: " << potentialValue << " V";
|
||||
DEBUG(out.str());
|
||||
#endif
|
||||
|
||||
electrodes.push_back(
|
||||
std::shared_ptr<RingElectrode>(
|
||||
new RingElectrode(potentialValue, zpos, rInner, rOuter,
|
||||
position_binning.stepsize())));
|
||||
} else {
|
||||
ERROR("Unknown or not implemented electrode type: " + type + ". Available options: \"RingElectrode\"");
|
||||
}
|
||||
}
|
||||
|
||||
double target_accuracy = parameter.doubleValue(
|
||||
json_path_append({"PoissonSolver"}, {"TargetAccuracy"}));
|
||||
|
||||
Reference in New Issue
Block a user