convertFieldComponentCartToCylZ.py

This analyzer converts 3D Field data from Cartesian to cylindrical coordinates. The script analyzes 3D vector field data specified on a 2D or 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 system around the z-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) x-axis towards the y-axis, and \(z^{\prime}=z\) points perpendicular from the plane swept out by \(\phi^{\prime}\).

Additionally, this script also adds a derived 2D vector to the input HDF5 file that contains the X and Y components of the field, which enables quiver plots for the field data for simulations on 2D meshes. Typically this might be used for plotting magnetic field data in cartesian plots.

-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)

The name of the field to be analyzed with a Cartesian coordinate system. i.e. edgeE or faceB.

-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>zRPhi (where the FieldName is used). The components \(z^{\prime}\), \(r^{\prime}\), \(\phi^{\prime}\) (where \(z -> z^{\prime}\), \(\sqrt{y^2+y^2}->r\) and \(\phi\)) are calculated from the arctangent of z and y.

This analyzer script outputs an HDF5 file named baseName_fieldNamezRPhi.h5, i.e. magnetron2D_edgeEzRPhi.h5. 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.