convertFieldComponentCartToCylX.py

This analyzer converts 3D Field data from Cartesian to cylindrical coordinates. The script analyzes 3D vector field data specified on a 3D Cartesian mesh \(F_{x}(x,y,z), F_{y}(x,y,z), F_{z}(x,y,z)\) and provides a copy of the field’s components from a Cartesian system to a cylindrical polar system around the x-axis of the Cartesian mesh \(F_{z^{\prime}}(x,y,z), F_{r^{\prime}}(x,y,z), F_{\phi^{\prime}}(x,y,z)\). We treat the system as right handed, so the angle \({\phi^{\prime}}\) increases from the (Cartesian) y-axis towards the z-axis, and \(z^{\prime}=x\) points perpendicular from the plane swept out by \(\phi^{\prime}\).

-s <simname>, --simulationName=<simname>

(string, required)

<simname> is the name of the simulation to be analyzed. The file extension should NOT be included in this text field.

-f, --fieldName

(string, required)

Name of the field to rewrite, e.g. edgeE.

-Z, --compMajorC

(flag)

The indexing order for written datasets. If checked, use “compMajorC”. If unchecked, use the default “compMinorC”

-w, --overwrite

(flag)

Whether a dataset or group should be overwritten if it already exists.

Output

The output is a field whose name is “<fieldName>xRPhi” (where the option --fieldName is used). The components \(z^{\prime}\), \(r^{\prime}\), \(\phi^{\prime}\) (where \(x->z\), \(\sqrt{y^2+z^2}->r\) and \(\phi\)) are calculated from the arctangent of z and y.

This analyzer script outputs an HDF5 file, titled baseName_fieldNamexRPhi.h5, i.e. magnetron2D_edgeExRPhi. The fields will be available in the Visualize tab of XSimComposer under Scalar Data, where there will be a list of three components, 0, 1, and 2 which map to \(z^{\prime}\), \(r^{\prime}\) and \(\phi^{\prime}\) respectively.

If the Visualize tab has already been opened, the Reload Data button must be clicked in order to load the new file.

If you are running this analyzer from the UI, and the output dataset file already exists, then it will be overwritten each time the analyzer is run, unless you uncheck the Overwrite Existing Files box near the bottom of the Analysis Results pane.

If you are running the analyzer from the command line, the dataset will not be overwritten unless the -w, or --overwrite flag is specified on the command line.

The results of your analyzer may not be written into the output file if you have not specified the overwrite option to be True.