Field Precision title

Understanding coordinate units

Distance units are a potential source of confusion in scientific work. It is often convenient to work in convenient units like centimeters or microns, but we must ensure that the physical calculations are performed in consistent SI units. Rules for using units in our software are discussed in several sections of the instruction manuals. I thought it would be useful to collect them in a single place.

A spatial mesh is a required component in any finite-element calculation. A mesh is a list of the identities of elements (the fundamental division of space) and the coordinates of the element nodes. The node coordinates define the element shapes. In our packages, the Mesh program is used to generate two-dimensional meshes and MetaMesh is applied for three-dimensional meshes. In both programs, node coordinates are simply numbers without reference to a physical solution. It is not necessary to specify units in Mesh or MetaMesh. A value of 5.5 could represent microns in one solution and miles in another.

Units come into play in programs that use the meshes to perform physical calculations (e.g., EStat, Magnum, GamBet,...). To avoid confusing ourselves, we have an incontrovertible rule at Field Precision that internal operations of the programs use SI units. When a mesh is loaded, all coordinate numbers are converted to meters according to

XProg = XMesh/DUnit

The quantity DUnit is the number of mesh units per meter. For example, if coordinates in the input mesh are in cm, then DUnit = 100.0. You can set units in the solution program script using a command like

DUNIT 100.0

When using a setup dialog (like Fig. 1), the DUnit drop-down list box picks an appropriate value for the chosen unit.


Figure 1. Setting DUnit in a dialog.

The main output files from technical programs include information on the mesh and the solution values. The mesh coordinates are recorded in meters. The value of DUnit used for the solution is also recorded. This number is used in post-processing operations. The post-processors use meters for internal calculations, but use the units chosen for the solution for external displays. In other words, if the solution was performed in microns (DUnit = 1.0E6), then plot axes are displayed in microns and the program expects the user to enter dimensions in microns. The motivation is that it is easier and more intuitive to specify a calculation at the point (0.5,24.0,6.0) than (5.0E-7,2.4E-5,6.0E-6).

Questions of units also arise when entering information on charged particles to the codes Trak, OmniTrak and GamBet. The identity, energy, position and direction of input particles may be specified in PRT or SRC files. The files may be created by previous runs of the programs, the GenDist utility or by the user with a text editor. The following rules apply:

1) Particle positions in the PRT and SRC? files may be specified in any convenient units.

2) A DUnit command giving the appropriate conversion factor should appear in the Trak, OmniTrak or GamBet script before any particle file is loaded.

3) The solution program converts dimensions in the PRT or SRC? file to meters for internal use according to

XProg = Xprt/DUnit
YProg = Yprt/DUnit
ZProg = Zprt/DUnit

4) When Trak or OmniTrak writes an output PRT file or GamBet creates an escape file, position values are converted back to the original units,

Xprt = DUnit*XProg
Yprt = DUnit*YProg
Zprt = DUnit*ZProg

The value of DUnit is also recorded in the PRT or SRC file as a comment line for reference.

LINKS