Scale Factor for Electric Field

This commit is contained in:
Jonas Kellerer
2021-07-06 09:50:09 +02:00
parent a542af36ea
commit 48a9582016
3 changed files with 16 additions and 3 deletions
+7 -1
View File
@@ -10,7 +10,8 @@
std::unique_ptr<ElectricField> ElectricFieldFactory::build(
std::string filename,
double cylinder_radius,
double cylinder_height)
double cylinder_height,
double scale_factor)
{
std::string dataset_path_Er("/Efield/efield_r");
std::string dataset_path_Ez("/Efield/efield_z");
@@ -19,6 +20,11 @@ std::unique_ptr<ElectricField> ElectricFieldFactory::build(
blitz::Array<double,3> Ez = read(filename, dataset_path_Ez);
blitz::Array<double,3> Ephi(Er.shape());
Ephi = 0.;
std::cout << scale_factor << std::endl;
std::cout << Ez(0,0,0) << std::endl;
Er *= scale_factor;
Ez *= scale_factor;
std::cout << Ez(0,0,0) << std::endl;
blitz::TinyVector<int,3> nx( Er.shape()(0), 1, Er.shape()(2));
+2 -1
View File
@@ -9,7 +9,8 @@ namespace ElectricFieldFactory {
std::unique_ptr<ElectricField> build(
std::string filename,
double cylinder_radius,
double cylinder_height);
double cylinder_height,
double scale_factor);
blitz::Array<double,3> read(std::string filename, std::string dataset_path);
+7 -1
View File
@@ -23,10 +23,16 @@ void initEField(const pugi::xml_node& E_params) {
double radius = atof(E_params.child_value("Radius"));
double height = atof(E_params.child_value("Height"));
double scale_factor = 1.;
if(!E_params.child("ScaleFactor").empty()) {
scale_factor = atof(E_params.child_value("ScaleFactor"));
}
Katrin_Fields::E_field_ptr = ElectricFieldFactory::build(
filename,
radius,
height);
height,
scale_factor);
}
void initKatrinFields(const pugi::xml_node& field_params) {