This article is part of the continuing online course, Electric and magnetic field calculations with finite-element methods. This article continues an example 3D electrostatic solution. The previous article introduced the concept of mesh Parts and Regions. The emphasis was on input from 3D CAD programs via STL files. Here, we’ll consider how MetaMesh uses the STL data and processes extra information to create the result of Fig. 1. We could go through all the interactive operations in Geometer to define the parts, but there’s a quicker way to understand the setup. The end result Geometer activity is a succinct MetaMesh input script that includes all the information. We’ll study the script directly. A following article shows how to use Geometer to create a solution from scratch.
Run AMaze and launch MetaMesh. We’ll assume that the Data folder is still pointing to the working directory of the previous article. Click File/Load MIN file and choose sheetgun.min. Then click File/Edit MIN file to view the contents of the script. The first part of the Global section has detailed specifications for element sizes over multiple zones along the axes. The feature was necessary for accuracy in subsequent beam emission calculations – the details are not of immediate concern. Instead, we’ll concentrate on the Part definitions shown in Fig. 2 
The Parts named Anode, Focus and Cathode (marked in green) use the STL models that we previously discussed. The Type command of each part section reads the associated STL file. The Fab (fabrication) command defines fitting controls — default values are usually sufficient. Although the intent is build the mesh around the assembly positions of the STL parts, we do want to reverse the emission direction to +z. This is accomplished with the commands
Rotate 180.0 0.0 0.0 XYZ
Each command rotates the coordinates of all facet nodes 180° about the x-axis relative to the assembly origin. The commands
Surface Region VACUUM
instruct the code to adjust all element facets of the part adjacent to Vacuum elements to conform closely to the defined surface of the STL model.
The assembly is located inside a cylindrical vacuum chamber of radius 1.23″ that extends from z = 0.0″ to the boundary of the solution volume at z = -1.50″. For high speed, HiPhi uses a structured conformal mesh, which means that the elements are arranged like a big apartment building. The term conformal means that apartments are not necessarily right-angle boxes . The solution volume of a structured mesh is always a box. To create the vacuum chamber, we fill the entire volume with elements assigned to the fixed-potential region Ground (part VChamber) and then carve out a cylindrical volume of elements associated with the Vacuum region. The part ExitPort is a slot to accommodate the beam exit aperture. The final part (Support) is a cylindrical pipe attached to the cathode. Note that the part belongs to the same Region as the cathode and the focus electrode. The physical property of the Region in the HiPhi solution is is a fixed potential (-74.0 kV).
Exit the text editor and click the Process mesh command. MetaMesh reports the progress of the mesh creation. When the program is finished, right-click to exit the report and use the File/Save mesh command to create the file sheetgun.mdf (mesh definition file).
We can now proceed to the HiPhi solution. Run the program, click Setup and choose sheetgun.mdf to open the dialog of Fig. 3. Fill in the values as shown. Click OK and save the results as sheetgun.hin. The resulting file has the contents:
Mesh = sheetgun DUnit = 3.9370E+01 ResTarget = 5.0000E-08 MaxCycle = 4000 Parallel = 4
* Region 1: GROUND Potential(1) = 0.0000E+00
* Region 2: VACUUM Epsi(2) = 1.0000E+00
* Region 3: CATHODE Potential(3) = -7.4000E+04
The clear format of the file makes it easy to identify the functions of the commands. I have the Pro version of HiPhi and a core i7 computer, so I added the command
Parallel = 4
with a text editor to speed things up.
Click the Run button and choose the input file to generate a solution recorded as the binary file sheetgun.hou. We can get some useful information by checking the text listing files sheetgun.mls and sheetgun.hls created by MetaMesh and HiPhi. For example, I found that the mesh had 1,295,952 active  elements and took 19 seconds to process on my computer. The 4000 matrix-inversion cycles in HiPhi took 363 seconds to reach a relative residual of 8.6E-07 .
To complete the exercise, run PhiView and load sheetgun.hou. You can experiment with the options for 2D and 3D plots. Figure 4 shows an example. Here, I wanted to get a quick overview of levels of |E| on the focus-electrode surface. The red areas correspond to |E| = 16.7 MV/m (167 kV/cm).
 The attractive text display is from the ConText editor using syntax highlighting definitions that we supply with the software.
 The general term for a six-sided solid where facets may not be at right angles is a hexahedron.
 The term active means that the elements are not part of a fixed-potential region.
 The relative residual, a measure of the accuracy of the iterative solution, should be much smaller than unity.
 Contact us : email@example.com.
 Field Precision home page: www.fieldp.com.