40 "The \"DUMPEMFIELDS\" statement dumps a field map to a user-defined "
41 "field file, for checking that fields are generated correctly. "
42 "The fields are written out on a grid in space and time."),
48 (
"FILE_NAME",
"Name of the file to which field data is dumped");
51 (
"COORDINATE_SYSTEM",
"Choose to use CARTESIAN or CYLINDRICAL coordinates", {
"CARTESIAN",
"CYLINDRICAL"},
"CARTESIAN");
54 (
"X_START",
"(Cartesian) Start point in the grid in x [m]");
57 (
"DX",
"(Cartesian) Grid step size in x [m]");
60 (
"X_STEPS",
"(Cartesian) Number of steps in x");
63 (
"Y_START",
"(Cartesian) Start point in the grid in y [m]");
66 (
"DY",
"(Cartesian) Grid step size in y [m]");
69 (
"Y_STEPS",
"(Cartesian) Number of steps in y");
72 (
"Z_START",
"Start point in the grid in z [m]");
75 (
"DZ",
"Grid step size in z [m]");
78 (
"Z_STEPS",
"Number of steps in z");
81 (
"T_START",
"Start point in the grid in time [ns]");
84 (
"DT",
"Grid step size in time [ns]");
87 (
"T_STEPS",
"Number of steps in time");
90 (
"R_START",
"(Cylindrical) Start point in the grid in radius [m]");
93 (
"DR",
"(Cylindrical) Grid step size in radius [m]");
96 (
"R_STEPS",
"(Cylindrical) Number of steps in radius");
99 (
"PHI_START",
"(Cylindrical) Start point in the grid in phi [rad]");
102 (
"DPHI",
"(Cylindrical) Grid step size in phi [rad]");
105 (
"PHI_STEPS",
"(Cylindrical) Number of steps in phi");
111 Action(name, parent), grid_m(nullptr)
133 static const std::map<std::string, CoordinateSystem> stringCoordinateSystem_s = {
150 std::vector<double> spacing(4);
151 std::vector<double> origin(4);
152 std::vector<int> gridSize(4);
212 (*it)->writeFieldThis(field);
220 fout << 1 <<
" x [m]\n";
221 fout << 2 <<
" y [m]\n";
222 fout << 3 <<
" z [m]\n";
223 fout << 4 <<
" t [ns]\n";
224 fout << 5 <<
" Bx [kGauss]\n";
225 fout << 6 <<
" By [kGauss]\n";
226 fout << 7 <<
" Bz [kGauss]\n";
227 fout << 8 <<
" Ex [MV/m]\n";
228 fout << 9 <<
" Ey [MV/m]\n";
229 fout << 10 <<
" Ez [MV/m]\n";
233 fout << 1 <<
" r [m]\n";
234 fout << 2 <<
" phi [deg]\n";
235 fout << 3 <<
" z [m]\n";
236 fout << 4 <<
" t [ns]\n";
237 fout << 5 <<
" Br [kGauss]\n";
238 fout << 6 <<
" Bphi [kGauss]\n";
239 fout << 7 <<
" Bz [kGauss]\n";
240 fout << 8 <<
" Er [MV/m]\n";
241 fout << 9 <<
" Ephi [MV/m]\n";
242 fout << 10 <<
" Ez [MV/m]\n";
252 std::ofstream& fout)
const {
259 point[0] =
std::cos(pointIn[1])*pointIn[0];
260 point[1] =
std::sin(pointIn[1])*pointIn[0];
263 field->
apply(point, centroid, time, E, B);
272 fout << pointIn[0] <<
" " << pointIn[1]*
Units::rad2deg <<
" " << pointIn[2] <<
" " << time <<
" ";
274 fout << pointIn[0] <<
" " << pointIn[1] <<
" " << pointIn[2] <<
" " << time <<
" ";
277 fout << Bout[0] <<
" " << Bout[1] <<
" " << Bout[2] <<
" ";
278 fout << Eout[0] <<
" " << Eout[1] <<
" " << Eout[2] <<
"\n";
284 "The grid was nullptr; there was a problem with the DumpEMFields initialisation.");
286 if (field ==
nullptr) {
288 "The field to be written was nullptr.");
291 *gmsg << *
this <<
endl;
294 if (std::filesystem::path(
filename_m).is_absolute() ==
true) {
303 std::vector<double> point_std(4);
307 fout.open(fname.c_str(), std::ofstream::out);
310 "Failed to open DumpEMFields file " +
filename_m);
314 "Failed to open DumpEMFields file " +
filename_m);
321 it.getPosition(&point_std[0]);
322 for (
size_t i = 0; i < 3; ++i) {
323 point[i] = point_std[i];
325 double time = point_std[3];
330 "Something went wrong during writing " +
filename_m);
336 os <<
"* ************* D U M P E M F I E L D S ****************************************** " <<
std::endl;
337 os <<
"* File name: '" <<
filename_m <<
"'\n";
361 os <<
"* ********************************************************************************** " <<
std::endl;
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
static OpalData * getInstance()
void writeHeader(std::ofstream &fout) const
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
std::string getString(const Attribute &attr)
Get string value.
void writeFieldLine(Component *field, const Vector_t &point, const double &time, std::ofstream &fout) const
virtual void writeFieldThis(Component *field)
Mesh::Iterator end() const
void print(std::ostream &os) const
Inform & endl(Inform &inf)
std::string::iterator iterator
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B)
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
The base class for all OPAL exceptions.
std::string getAuxiliaryOutputDirectory() const
get the name of the the additional data directory
Attribute makePredefinedString(const std::string &name, const std::string &help, const std::initializer_list< std::string > &predefinedStrings)
Make predefined string attribute.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
static void writeFields(Component *field)
std::vector< Attribute > itsAttr
The object attributes.
Tps< T > cos(const Tps< T > &x)
Cosine.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special exception
std::string combineFilePath(std::initializer_list< std::string > ilist)
double getReal(const Attribute &attr)
Return real value.
virtual DumpEMFields * clone(const std::string &name)
CoordinateSystem coordinates_m
Interface for a single beam element.
void parseCoordinateSystem()
Mesh::Iterator begin() const
Tps< T > sin(const Tps< T > &x)
Sine.
void checkInt(double real, std::string name, double tolerance)
The base class for all OPAL actions.
interpolation::NDGrid * grid_m
static std::unordered_set< DumpEMFields * > dumpsSet_m