Resources for finite-element electric/magnetic field solutions

This is the concluding article of the online course, Electric and magnetic field calculations with finite-element methods. In the course, we’ve had a chance to get familiar with the operation sequences and data organization of 2D and 3D programs and discovered many useful analysis techniques. Hopefully, the material will help you get started on your own applications. There’s still a lot to discover – EStat, PerMag, HiPhi and Magnum have a wealth of capabilities that I couldn’t cover in a short introduction. This article lists resources supplied with the programs or available on our Internet site to help you build your expertise.

First, let’s review materials included with the software packages. There are individual PDF manuals for Mesh, EStat, PerMag, MetaMesh, HiPhi and Magnum. They serve as versatile references through the intensive use of hyperlinks. The active table of contents is displayed if you activate the bookmark view in your PDF reader. Each manual also has a index with active page links.

All software packages include an example library containing ready-to-run, annotated input files for wide variety of applications. Be sure to look at text files in the example directories with names like HIPHI_EXAMPLE_INDEX.TXT. They contain a list of the examples along with a brief description of interesting features.

The following free resources are available on our Internet site:

 

Finite-element Methods for Electromagnetics
This full length text was published in 1997 by CRC Press. It reviews the physics of electrostatics and magnetostatics and gives a detailed description of the mechanics of EStat and PerMag. The book is an essential reference if you want to check under the hood to see how finite-element programs work.

 

Example input files
Complete input files for all the examples discussed in the course.

 

Field Precision Technical library
This Internet page has downloadable copies of the latest manuals for all Field Precision programs. In addition, there are many tutorials in PDF format that review solution techniques for electric and magnetic field applications. Here are links to the tutorials:

 

Field Precision software tips blog
We’ve added numerous how-to articles to this blog, whenever there is an interesting tech-help question. The following articles are related to mesh generation, electrostatics and magnetostatics.

Mesh

MetaMesh

 EStat and HiPhi

PerMag and Magnum

Footnotes

[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.

3D magnetic fields: iron and permanent magnets

This article is part of the continuing online course, Electric and magnetic field calculations with finite-element methods. For the final calculation of the course, we’ll characterize forces in a latching solenoid. The example exercises the full finite-element capabilities of Magnum and provides an opportunity to use the force-calculation capabilities of MagView. In preparation, copy the files LATCHING.CDF, LATCHING.MIN and LATCHING.GIN to a working directory and set the Data folder of AMaze. The three input files have the same functions as the ones we encountered in the previous article.

Figure 1 shows a drawing of the solenoid assembly along with the mesh created by MetaMesh. The neodymium-iron permanent magnets have magnetization directions pointing toward the plunger. They provide a resting holding force to keep the plunger in contact with the steel bobbin. Depending on the polarity of solenoid current, the coil may work in opposition to the permanent magnet to unlatch the plunger or it may assist the permanent magnet to pull in the plunger.

Latching solenoid assembly

Figure 1. Latching solenoid assembly — drawing and three-dimensional mesh. The parts are displayed in the space y > 0.0 mm and the coil in y < 0.0 mm. The plunger has diameter 10.0 mm and length 28.0 mm.

Run Geometer and load the file LATCHING.MIN. Check out the script content with the internal editor. By now, you should be familiar with the format conventions. A variable-resolution foundation mesh is employed for accurate field calculations at the gap between the bobbin and plunger. The solution includes five physical regions: air, the steel of the case, the steel plunger and the upper and lower magnets. Notice the use of labels and comments to document features of the calculation. Construction of the mesh is straightforward. The Box model is used to represent the steel plates and the magnets, while the bobbin is a Cylinder. The plunger is a Turning, a model we have not yet discussed. A turning is an outline rotated about the z axis of the workbench space. Note the outline vectors in the script following the Type command of the Plunger section.

Outline editor showing the outline for the plunger turning

Figure 2. Outline editor showing the outline for the plunger turning.

To see the outline, exit the editor and click Outline. Geometer opens the window of Fig. 2. In contrast to the convention for extrusions, the outline of a turning is defined in cylindrical coordinates, (z,r)[1]. In the editor, you can modify vectors of the outline using the CAD operations. The changes appear immediately in the Geometer display when you return to the main menu. Changes are recorded if you save the MIN file under the same or a different name. To check the variable mesh definitions, exit the outline editor and click Foundation. The foundation mesh window (Fig. 3) shows 2D plots of the assembly along with the initial mesh divisions (before fitting). Figure 3 is a zoomed view in a plane normal to the y axis. Note the region of very fine elements (0.025 mm) along z near the gap between the bobbin and plunger. To investigate the holding force of the solenoid, we need to perform surface integrals with very small gaps.

Detailed view of the foundation mesh

Figure 3. Detailed view of the foundation mesh showing the fine division in z at the bobbin-plunger gap.

Let’s proceed to the solution. Run Magwinder and load LATCHING.CDF with the content:

GLOBAL
  DUnit:   1.0000E+03
  Ds:   2.0000E+00
END
COIL
  Name: Solenoid
  Current: -1.0000E+03
  Part
    Name: Solenoid
    Type: Solenoid
    Fab:   6.0  10.0  27.0  2    20    20
    Shift:   0.00  0.00  -9.50
  End
END
ENDFILE

The coil definition file uses the Solenoid model to create 800 applied current elements with a coil current of -1000 A-turn. The negative value gives a coil field inside the bobbin in the same direction as the permanent magnet field. Click File/Save element file to create LATCHING.WND.

Run MetaMesh and process the MIN file to create LATCHING.MDF. To check out the controls for the finite-element solution, run Magnum, click File/Edit input files and choose LATCHING.GIN. The file has the following content:

SolType = STANDARD
Mesh = Latching
Source = Latching
DUnit = 1000.0
ResTarget = 5.00E-08
MaxCycle = 2000
* Region 1: AIR
Mu(1) =   1.0
 * Region 2: STEEL
Mu(2) =   1000.0
 * Region 3: PLUNGER
Mu(3) =   1000.0
 * Region 4: MAGNETUP
PerMag(4) =   1.25 ( -1.0 0.0 0.0)
 * Region 5: MAGNETDN
PerMag(4) =   1.25 (  1.0 0.0 0.0)
EndFile

In contrast to the free space solutions we discussed previously, the solution type is set to Standard and physical parameters are assigned to the regions. The quantities ResTarget and MaxCycle control the iterative solution of the finite-element equations (default values are usually appropriate). For magnetic-field solutions, material quantities are the relative magnetic permeability and the parameters of permanent magnets. Because we do not expect saturation effects at the device field levels, we assign the high value μr = 1000.0 to the case, bobbin and plunger. The specification of a permanent magnet material includes the remanence field Br = 1.25 tesla and a vector pointing along the direction of magnetization. The magnetization of the top magnet points in the -x direction and the top magnet in the +x direction.

Run Magnum to create the output file LATCHING.GOU. Figure 4 shows the distribution of |B| in the plane y = 0.0 mm with the plunger in contact with the bobbin. The combination of flux from the two magnets produces an approximately uniform field at the contact point of B0 = 1.61 tesla. Note that it is not necessary to surround the assembly with a large external volume because the flux is well-contained in the magnetic circuit.

Field distribution in the latched state in the plane y = 0.0 mm

Figure 4. Field distribution in the latched state in the plane y = 0.0 mm. Color-coding shows |B| in tesla.

The goal of the calculation is to find the force on the plunger as a function of the gap width. The force calculation is easy when the plunger is well-separated from the bobbin. Because the plunger is surrounded by air (μr = 1.0) elements, we can apply a surface integral of the Maxwell stress tensor over the plunger facets. The definition of the Maxwell tensor is contained in the configuration file Magview_Standard.CFG[2]. It is useful to take a moment to look at the configuration file (usually contained in the Program folder defined in AMaze). Open the file with an editor. It contains definitions for plot quantities and numerical calculations. This section applies to automatic surface integrals:

SURFACE
  ...
* Force components
  FxSurf = &Bx 2 ^ &BMag 2 ^ 2.0 / - $IMu0 *;&Bx &By * $IMu0 *;&Bx &Bz * $IMu0 *
  FySurf = &By &Bx * $IMu0 *;&By 2 ^ &BMag 2 ^ 2.0 / - $IMu0 *;&By &Bz * $IMu0 *
  FzSurf = &Bz &Bx * $IMu0 *;&Bz &By * $IMu0 *;&Bz 2 ^ &BMag 2 ^ 2.0 / - $IMu0 *
  ...
END

The expressions give the force components determined from the Maxwell integral at a point. Quantities like &Bx are calculated field quantities at the point, while quantities like $IMu0 are defined constants.

Run MagView and load LATCHING.GOU. To find the total force on the plunger, click Analysis/Surface integrals in the main menu to bring up the dialog of Fig. 5. The internal region is the Plunger and the single external region is Air. Click OK and save the results to the file LATCHING.DAT. Here is the result for a gap width of 0.20 mm with zero coil current:

---------- Surface Integrals ----------
 Region status
 RegNo   Status    Name
 ===================================
     1  External   AIR
     3  Internal   PLUNGER
 Surface area of region set (m2):   1.076727E-03
   FxSurf:   1.103232E-04
   FySurf:  -1.477638E-03
   FzSurf:  -2.413384E+02

As an indication of accuracy, the force components Fx and Fy (theoretically zero) are smaller than Fz by a factor exceeding 1/100,000. With a gap of 3.0 mm, the axial force with no coil current is Fz = -1.111 N. The force increases to -7.427 N with a coil current of -1000 A-turns.

Surface integral dialog

Figure 5. Surface integral dialog. In this case, the integral is taken over all external facets of the plunger in contact with air elements.

A quantity of particular interest is the holding force in the latched state (i.e., plunger touching the bobbin with no coil current). In this case, a Maxwell stress tensor integral around the plunger does not apply because the plunger and bobbin are effectively the same piece of material. One option is to perform a series of calculations with an air gap of decreasing width dg. The goal would be to fit the force variation with an interpolation function that could be extrapolated to dg = 0.0.

Figure 6 shows results of the calculation. A simple plot of Fz versus dg would not be informative because the force varies by orders of magnitude. The strong variation reflects the familiar experience of two magnets snapping together when they are close. A helpful observation is that force scales as 1/dg^2 for gaps greater than 0.5 mm. Therefore, it is useful to construct a log-log plot of 1/√Fz versus dg. The data of Fig. 6 suggest show that the force approaches a constant value at zero spacing. This approach requires considerable accuracy and effort. It is necessary to include results for very small gap widths (dg = 0.05 mm) to observe the inflection toward a constant value.

Function of force versus gap with

Figure 6. Plot of 1/sqrt(Fz) as function of the gap between the plunger and the bobbin, where Fz is the force on the plunger in newtons. Blue circles indicate results determined by a MagView surface integral. The dashed red line indicates the theoretical value for zero gap.

Fortunately, there is a simple way to determine the exact holding force from a knowledge of the flux distribution at dg = 0.0 mm. Suppose we displace the plunger an infinitesimal distance dx from the bobbin. The field in the air gap would remain confined to the cross section area A of steel parts with a value approximately equal to the zero gap field, B0. The change in field energy in the magnet circuit is

dU = [B0^2/(2 μ0)] A dx.

Using the principle of virtual work, the holding force is

Fz = – dU/dx = – [B0^2/(2 μ0)] A.

With a plunger diameter of 10.0 mm, the area is A = 7.854E-5 m^2. With B0 = 1.61 tesla, the total predicted force is Fz = -80.935 N (plotted as a dashed red line in Fig. 6). The mass equivalent is 8.25 kg.

We’ve covered a lot of territory in these articles, hopefully enough to get you started on finite-element calculations for your electric or magnetic field application. The final article will discuss additional resources to guide your calculations.

Footnotes

[1] Vector coordinates of outlines for turnings must satisfy the condition r ≥ 0.0.

[2] The MagView default configuration file is sufficient for most code users. On the other hand, MagView has the flexibility to meet the needs of power users. You can set up custom configuration files with user-defined quantities.

[3] Contact us : techinfo@fieldp.com.

[4] Field Precision home page: www.fieldp.com.

3D magnetic fields: free-space calculations

This article is part of the continuing online course, Electric and magnetic field calculations with finite-element methods. We’ll continue the topic of 3D magnetic fields by discussing Magnum operation in the FreeSpace mode. The mode applies to calculations in an infinite space without magnetic materials. In other words, all objects in the solution space have μr = 1.0. To start, let’s determine the field generated by the set of three solenoid coils that we built in the previous article. The end result of that work was the file ReversingSolenoid.WND that contained a set of current elements to approximate the coil set.

The first step in the field solution is to create a mesh. Wait a minute — why do we need a mesh? The previous article stated that free space calculations used Biot-Savart integrals and had nothing to do with finite-element methods. Here’s the reason. An integral over the full set of current elements involves considerable computational work and gives the magnetic flux density [Bx, By, Bz] at a single point in space. With this approach, it could take several minutes to create a high-resolution plot of field quantities in a plane. Particle tracking, which involves field calculations at thousands of points along the trajectory, would be impossible. It is much more efficient to apply integrals to calculate field values at a given set of points in space (i.e. a mesh), and then to use interpolations to find field values at intervening points. In other words, we do the Biot-Savart integrals once to fill in the B values at mesh points, and then we can use the values to make any plots and trajectory calculations we want. Another advantage is that all the Magnum plotting and interpolation routines developed for finite-element calculations can be applied directly.

Fortunately, it takes only a minute to make a mesh for a Magnum free-space calculation. All we need is an appropriate set of interpolation points. It is not necessary to make a detailed conformal mesh to represent physical objects[1]. Run Geometer and choose File/New script. We’ll create an interpolation mesh that encompasses the three coils[2]. Supply the name ReversingSolenoid and the following dimensions for the solution volume: -5.0 ≤ x ≤ 5.0, 14.0 ≤ y ≤ 24.0, -10.0 ≤ z ≤ 10.0. When you click OK, Geometer sets up the mesh with one default region and partthat covers the full volume. Go to the Foundation menu and change the element sizes along each axis to 0.10. Then, save the mesh. Run MetaMesh and process ReversingSolenoid.MIN to create ReversingSolenoid.MDF.

Run Magnum, click Setup and choose ReversingSolenoid.MDF. Figure 1 shows the setup dialog with appropriate settings. Note that the dialog fields associated with finite-element solutions (including the material properties at the bottom) become inactive when you click the Free space radio button. Save the information as ReversingSolenoid.GIN. We now have the three files necessary for the calculation:

  • ReversingSolenoid.CDF: current elements for the Biot-Savart integral.
  • ReversingSolenoid.MDF: interpolation points to calculation [Bx,By,Bz].
  • ReversingSolenoid.GIN: a short control script to let Magnum know what it’s supposed to do.

In the main Magnum menu, click Run to create the solution file ReversingSolenoid.GOU.

Magnum input dialog for a free-space calculation

Figure 1. Magnum input dialog for a free-space calculation.

To analyze the results, run MagView, click File/Load solution file and choose the solution. Go to Slice plots and click Slice normal to X. Zoom in to the create the plot of Fig. 2, showing the distribution of |B| in the plane x = 0.0. MagView has plot and analysis capabilities similar to those of PhiView. For example, we can make a quick check of the magnitude and direction of B with the vector probe. To activate it, click Vector tools/Vector probe and then move the mouse cursor into the plot region. The probe, shown in Fig. 2, points along B. Values of the current position and |B| are listed in the status bar at the bottom.

Reversing solenoid example, plot of |B| in the plane x = 0.0.

Figure 2. Reversing solenoid example, plot of |B| in the plane x = 0.0 showing the vector probe.

To conclude this article, we’ll run through an application example with prepared input files (CathodeHeater.CDF, CathodeHeater.MIN and CathodeHeater.GIN). The goal is to find the magnetic flux density on the surface of a thermionic cathode generated by its heater coil. Figure 3 shows the heater geometry, counter-wound helices with connections and leads. Arrows have been added to show the direction of current. The drive coils are defined in the file CathodeHeater.CDF, with the contents:

GLOBAL
  DUnit = 39.37
   Ds = 0.010
END
COIL 1
  Current = 1.0
* Outer helical coil, half turn extra
  Part
    Type = Helix
    Fab = 0.095 0.060 0.310 0.020
  End
* Connection near surface, inner to outer
  Part
    Type = Line
    Fab = 0.070 0.000 0.060  0.095  0.000  0.060
  End
* Input lead
  Part
    Type = Line
    Fab = 0.070 0.000 0.650  0.070 0.000  0.300
  End
* Output lead
  Part
    Type = Line
    Fab = -0.095 0.000 0.310  -0.095 0.000  0.650
  End
END
* Inner helical coil (input, current in -z direction)
COIL  2
  Current = -1.0
  Part
    Type = Helix
    Fab = 0.070 0.060 0.300 0.020
  End
END
ENDFILE

 

Geometry of the heater coil

Figure 3. Geometry of the heater coil, arrows added to show the direction of the current.

The assembly contains two coils. The first coil, with current 1.0 A, consists of four parts. Three of the parts are straight wires, defined by their start and end points in the solution space: the input and output leads and the connection between the helical coils. Current always flows from start to end. The Helix model requires four fabrication parameters:

  • Radius (0.095″)
  • ZStart (0.060″)
  • ZEnd (0.310″)
  • Pitch, or distance between the turns (0.020″)

The number of turns equals |ZEndZStart|/Pitch. The cathode surface is at z = 0.00″, so the distance to the closest part of the coil is 0.060″. Helices always have positive rotation proceeding from ZStart to ZEnd. To make counter-wound coils, the return helix is contained in its own coil structure with current -1.0 A. For physically-correct results, it’s important that different parts connect to make a continuous coil and that currents flow in the correct direction. To check validity, you can use the Plot/Sperm plot option in either the 2D or 3D views. Figure 4 shows the result. The elements swim in the direction of the current. In particular, the helix currents are correct with respect to the leads and to each other. Move the example files to a working directory, set the Data folder in Amaze and run MagWinder. Load the coil-definition file and click File/Save element file to create CathodeHeater.WND.

Heater coil sperm plot option

Figure 4. Heater coil, sperm plot option to show the direction of current flow in the elements.

The file CathodeHeater.MIN defines a network of points in space where values of B are calculated from the current elements and recorded. It has the content:

GLOBAL
  RegName 1 Air
  RegName 2 Assembly
  XMesh
    -0.150 0.150 0.005
  End
  YMesh
    -0.150 0.150 0.005
  End
  ZMesh
    -0.100 0.400 0.005
  End
END
PART
  Type Box
  Name SolutionVolume
  Region Air
  Fab 0.3 0.3 0.800
END
PART
  Type Cylinder
  Name CathodeOutline
  Region Assembly
  Fab 0.125 0.400
  Shift 0.000 0.000 0.200
  Surface Region Air Edge 0.95
END
ENDFILE

The commands in the Global section create a solution volume that encloses the heater coil and cathode surface. The solution volume part fills the entire solution space. Note that there is an additional region that represents the cylindrical cathode volume. The conformal region has no effect on the calculation of applied fields — it is added to include a reference outline of the cathode in plots. Run MetaMesh, process the mesh and save the file CathodeHeater.MDF.

The file to control the Magnum calculation, CathodeHeater.GIN, is quite simple:

SOLTYPE Free
MESH CathodeHeater
SOURCE CathodeHeater
DUNIT 39.37
ENDFILE

The actions are to load CathodeHeater.WND and CathodeHeater.MDF and to interpret the dimensions in inches. Run Magnum and generate the solution, then run MagView to analyze the results. Figure 5 shows a filled-contour plot of |B| in the plane y = 0.0″. As expected, the magnetic flux is concentrated between the helices. The plot illustrates two special features of MagView slice plots:

  • The drive coils can be superimposed on field plots. The command File/Load coils was used to CathodeHeater.WND. The intersections of the coil with the plane y = 0.0″ are shown as cyan and violet rectangles in the plot.
  • Arrows showing the direction of B were added with the command Vector tools/Vector arrow plot.
Heater coil, variation of |B| in the plane y = 0.0

Figure 5. Heater coil, variation of |B| in the plane y = 0.0″. The plot shows the intersection points of the helical coils and arrows to designate the direction of B.

The cathode boundary is marked by yellow lines. The field at the surface approximates a dipole variation . Finally, Fig. 6 shows a plot of |B| at the cathode surface. The field from the heater configuration approaches 2 Gauss, about 8 times higher than the earth’s field. It would be worthwhile to check alternate heater geometries.

Variation of |B| at the cathode surface

Figure 6. Variation of |B| at the cathode surface.

In the next article, we’ll advance to an application that involves a full finite-element magnetic field solution.

Footnotes

[1] There is considerable flexibility in creating meshes for free-space calculations. You could employ variable resolution for high accuracy in a region. You could even use a conformal mesh if you wanted to represent object boundaries in plots.

[2] It is important to realize that the size and location of the interpolation mesh has no effect on the field values. You could create a small mesh if you wanted detailed field values within one of the coils.

[3] Contact us : techinfo@fieldp.com.

[4] Field Precision home page: www.fieldp.com.

3D magnetic fields: defining coil currents

This article is part of the continuing online course, Electric and magnetic field calculations with finite-element methods. We’ll start the final topic, three-dimensional magnetic field solutions. The previous articles on electrostatics covered many common techniques for 3D solutions, particularly mesh generation. Here, we’ll focus on the differences between Magnum and HiPhi calculations that arise from the unique characteristics of magnetic fields[1].

  • The vector driving terms for magnetic solutions require more intensive input data.
  • Two completely different solution techniques apply in magnetic solutions, depending on whether ferromagnetic materials are present.
  • Magnetic materials have more complex properties.

By driving terms, I mean the information we must supply to a finite-element program to create fields. For example, the drivers of electrostatic solutions are differences in the electrostatic potential between electrodes and space-charge. In other words, we apply a fixed potential to the nodes of a region of the solution volume or define the space-charge density ρ over elements of a region. In both cases, the specified quantities are scalar. For either drive type, we must employ the finite-element technique to determine the self-consistent charge density on electrode surfaces.

There are two possible drives in magnetic-field solutions:

  • Currents in coils.
  • Material currents in permanent magnets.

Coil currents constitute a unique challenge in 3D solutions. To review, a previous article showed that it was easy to define currents in 2D solutions. In cylindrical geometries, current flowed only in θ and in planar solutions the current flow was along z. In other words, current was a scalar quantity assigned to regions that represented the cross sections of coils. In 3D solutions, the drive current is a vector quantity that can flow anywhere. If you think about devices like electric motors, it’s clear that drive coils may be highly complex assemblies. The implication is that the definition of drive coils can be a significant task in 3D solutions, on a par with mesh generation. In consequence, the Magnum package contains a utility MagWinder specifically for coil winding.

Next, consider solution procedures. Suppose we have a set of drive coils in a system with no ferromagnetic materials. (In other words, all objects in the solution space have relative magnetic permeability μ0 = 1.0.) In this case, there are no unknown currents. The field at any point can be determined by a Biot-Savart integral[2] over the drive current elements. It is not necessary to build a conformal mesh of regions or to apply the finite-element method. On the other hand, a mesh and a finite-element solution are essential when the solution space contains permanent magnets or magnetic materials (μr ≠ 1.0). Here, material currents that are not known a priori have a significant effect on the fields. The implication is that a 3D magnetic field program must be capable of two completely different types of calculations.

Finally, let’s consider the nature of materials. In electrostatic solutions, dielectrics have a moderate influence on the total fields and preserve their properties over the practical range of field intensity. An isotropic dielectric can be characterized by a single value of relative dielectric constant εr (usually in the range <100) that changes little all the way to breakdown. In contrast, values of the relative magnetic permeability for iron and other ferromagnetic materials may exceed 10,000 at low field levels. In other words, these materials sustain large surface currents and have a strong effect on the total field. The challenge follows from the fact that the materials may become saturated at fields levels that may occur in practical systems. Here, the value of μr depends on the local level of magnetic flux density. A magnetic field program must be capable of handling nonlinear solutions.

In the coming articles, we’ll work through two application examples. The first demonstrates the free-space solution type (no magnetic materials). We’ll investigate the stray fields generated by  a heater coil on the emission surface of a thermionic cathode, a concern for the creation of high-brightness electron beams. The second application, the holding force of a latching solenoid, demonstrates a full finite-element solution. It involves drive coils, permanent magnets and high-permeability steel. Both applications require work with MagWinder. In the remainder of this article, we’ll get familiar with the program.

Figure 1 shows the coil assembly we will construct, part of a transport system for a high-current electron beam. The full assembly is an array of solenoid lenses with alternating polarity to focus the beam through a 90° bend. The bend is centered at the origin of the y-z plane at x = 0.0″. The bend radius from the origin to the solenoid centers is 20.0″. We will build three of the coils with total amp-turns I = 20 kA, -20 kA and -20 kA. We’ll start with the middle coil. Click the MagWinder button in the AMaze program launcher[3]. Click File/New coil assembly. In the dialog of Fig. 2, supply the name ReversingSolenoids and set the length units to inches.

Demonstration coil assembly displayed in the MagWinder working environment

Figure 1. Demonstration coil assembly displayed in the MagWinder working environment.

 

Some explanation is required to understand the quantity Default element width. For the Biot-Savart integral, wires are divided into a large number of short elements. In the present setup, we will divide each current loop in the solenoid into 20 azimuthal pieces. Although the elements are plotted as thin wire segments, they are not treated that way in Magnum. Infinitely-thin wires would give rise to discontinuous, diverging values for the applied field. Instead , each element is treated as a cylinder of uniform current density with a diameter equal to the length. Therefore, the wire arrays shown in Fig. 1 act more like a current density layers than a set of discrete wires.

Dialog to start a new drive coil assembly

Figure 2. Dialog to start a new drive coil assembly.

 

Next we need to add coils to the assembly.  We’ll start with the middle coil. The central field points along z. The center is displaced 20.0″ along y. Click Build/New coil to display the dialog of Fig. 3. Fill out the values as shown. Then click OK.

Dialog to add a coil to the assembly

Figure 3. Dialog to add a coil to the assembly.

A coil is data structure that may contain one or more physical parts. In order to see a plot, we need to add a part. Click Build/Add part to open the dialog of Fig. 4. MagWinder includes several prefabricated models — the solenoid is one of the most useful. Note that the active fields and labels change when you choose the model. The values shown in Fig. 4 designate that the solenoid has inner radius 2.5″, outer radius 3.0″ and a length 3.0″. The radial thickness is represented by two layers. There are 20 sets of circular coils along the axial direction for a total of 40. Each circle is divided into 20 parts. Therefore, MagWinder will construct 800 current elements to represent the solenoid. Note that the positions and rotations of parts are taken relative to the coil. We’ll leave the quantities at the bottom of the dialog at their default values. For the other solenoids, we will apply shifts and rotations to the full coil. Click OK when you are finished entering values. Figure 5 shows the MagWinder display of the first coil [4].

Dialog to add a solenoid part

Figure 4. Dialog to add a solenoid part.

MagWinder display with one coil added

Figure 5. MagWinder display with one coil added.

The second coil is identical to first except that it is rotated -15° about the x axis at the origin of the y-z plane and has a current of -20 kA. Click File/New coil assembly. Fill in the dialog with the values shown in Fig. 6. For reference, the displacement in z is 20.0*sin(-15°) and in y is 20.0*cos(-15°). A rotation of +15° about the x axis aligns the solenoid with the beam axis. Rather than redefine the solenoid part in an Add part dialog, we will copy and paste the part from the first coil. Click Build/Set current coil and pick the first coil. Then click Build/Copy part and pick the solenoid. Change the current coil setting back to the second coil and click Build/Paste part. When you click OK, the plot shows both coils and the total number of elements is 1600. Use a similar procedure to create a third coil rotated +15° about the y-z origin.

Dialog to add a second coil to the assembly

Figure 6. Dialog to add a second coil to the assembly.

Assuming the assembly looks like Fig. 1, we need to save the work. There are two types of output files:

  • The coil-definition-file (CDF) is a symbolic representation of the coil geometry. This file may be reloaded and modified.
  • The winding file (WND) is a list of current elements, input for Magnum. A WND file can always be regenerated from the CDF file, but the CDF file cannot be inferred from information in the WND file.

Both files are in text format. Click File/Save coil file and create the file ReversingSolenoids.CDF. You can view it with the internal program editor. By now, the conventions of the formatted scripts should be familiar. You should be able to recognize the values you entered via the interactive dialogs. Finally, click File/Save element file to generate ReversingSolenoids.WND. Again, this well-formatted file can be inspected with an editor. Here is an excerpt:

Magnum Current Element File (Field Precision, Albuquerque NM)
NCoil:   3
NElem:   2400
Coil     I
 No     (A)
 ===============
 1  2.0000E+04
 2 -2.0000E+04
 3 -2.0000E+04
Coil   XStart      YStart      ZStart       XEnd        YEnd        ZEnd         I
No     (m)         (m)         (m)          (m)         (m)         (m)        (A)
=======================================================================================
 1  6.6675E-02  5.0800E-01 -3.6195E-02  6.3412E-02  5.2860E-01 -3.6195E-02  5.0000E+02
 1  6.3412E-02  5.2860E-01 -3.6195E-02  5.3941E-02  5.4719E-01 -3.6195E-02  5.0000E+02
 1  5.3941E-02  5.4719E-01 -3.6195E-02  3.9191E-02  5.6194E-01 -3.6195E-02  5.0000E+02
 ...

There are 2400 element data lines. Dimensions have been converted to meters for input to Magnum. There are 40 current loops per solenoid, so each loop carries 20000/40 = 500 A.

In the next article, we’ll concentrate on the free-space mode of Magnum. We’ll calculate the field for this assembly, and then walk through the application example for the cathode heater.

Footnotes

[1] Because of the unique features of 3D magnetic fields, it is easier to use a dedicated solver rather than a generalized finite-element package. It would take considerable effort on the part of the user to create setups in Comsol that duplicate the solution and analysis features of Magnum.

[2] Section 9.1 of my book Finite-element Methods for Electromagnetics reviews the Biot-Savart law.

[3] The MagWinder button becomes active when Magnum is installed.

[4] The three coils of the assembly each contain one part (a solenoid). An example of a coil with multiple parts is a solenoid with wire leads.

[5] Contact us : techinfo@fieldp.com.

[6] Field Precision home page: www.fieldp.com.

3D electrostatic application example: mutual capacitance

This article is part of the continuing online course, Electric and magnetic field calculations with finite-element methods. We’ll conclude the application example by calculating the electric field and discussing two useful techniques:

  • Determining mutual capacitances in a system with multiple electrodes.
  • Setting up HiPhi solutions for automatic operation in the background.

Run HiPhi, click Setup and load CapDetector.MDF. We discussed the Setup dialog in a previous article. Its function is to create a HiPhi input script to control the field calculation, CapDetector.HIN. Here, we’ll concentrate on the contents of the file (Fig. 1). The values at the top are control parameters (mostly defaults). The DUnit command states that the coordinates in the MetaMesh file are given in cm. The remaining commands specify the identity and physical properties of regions. The value of the drive voltage, 1.0 V, is a convenient choice for capacitance calculations. Note that there are two entries for the detected Object (Region 5), one of which is commented out. To begin, we will calculate the field without the object, equivalent to setting εr = 1.0. Click Run in HiPhi and pick CapDetector.HIN to generate the solution file CapDetector.HOU.

File CapDetector.HIN

Figure 1. File CapDetector.HIN, viewed in ConText with syntax highlighting.

Run PhiView and load the solution file. To begin, we’ll make a plot of |E| along x at the position of the object (y = 0.000 cm, z = 0.625 cm) to find the region of linear field variation. Click Slice plots and choose Slice normal to y. Click Plot control/Plot style and set the style to Element. Click Plot control/Plot quantity and chpose |E| to create the top plot of Fig. 2. Make sure Analysis/Scan plot quantity is set to Ez. Choose the command Analysis/Line scan. You can specify the endpoints for the scan with the mouse. In this case, we want to be sure the line is at the horizontal position of the object center. Press the F1 key to type values for the start position: z = 0.625 cm, x = -2.25 cm. Click OK and press F1 again to define the end position: z = 0.625 cm, x = 2.25 cm. PhiView calculates numbers and displays the graph shown at the bottom of Fig. 2. The region of approximately linear variation covers the range -1.25 cm ≤ x ≤ 1.25 cm.

Electric field calculation

Figure 2. Top: Variation of |E| in the plane y = 0.0 cm. Bottom: Scan of |E| along x at y = 0.0 cm, z = 0.625.

We will proceed to the calculation of mutual capacitance between the drive and detector electrodes, advancing to a higher level of automatic analysis at each stage. For the discussions, the three electrodes in the solution have been numbered in Fig. 2. We’ll start with single operations controlled by the user in the interactive environment of PhiView, appropriate to one or a few calculations.

The mutual capacitance between electrodes 1 and 2 is given by C12 = Q2/(V1-V2). The charge induced on the detector is given by the surface integral:

Q2 = ∫∫ εr*ε0 ENorm dS2,    [1]

where εr is the relative dielectric constant of the medium surrounding the detector (εr = 1.0) and ENorm is the electric field normal to the surface. The PhiView configuration file phiview_dielectric.cfg contains this definition:

SURFACE
  Charge = &Ex $Epsi0 * &Q[2] *;&Ey $Epsi0 * &Q[2] *;&Ez $Epsi0 * &Q[2] *
END

Here, &Ex is a calculated component of electric field and &Q[2] is the relative dielectric constant. PhiView can takes automatic surface integrals over regions by evaluating the quantities of Eq. [1] just outside the facets of the region boundary. The result is the quantity Q2 in coulombs. Because we picked an applied voltage of 1.0 V, the result can also be interpreted directly as the mutual capacitance.

Return to the main PhiView menu and click Analysis/Surface integral to bring up the dialog of Fig. 3. Because PhiView can take integrals over the combined surface of multiple regions, we need to specify which regions are inside the surface and which ones are outside. In this case, the detector is inside and all others are outside as shown. When you click OK, the program prompts you to create a file CapDetector.DAT to record the results. This is a useful feature of numerical work — otherwise, it would be necessary to copy the results from the screen.

Dialog to control the PhiView surface integral

Figure 3. Dialog to control the PhiView surface integral.

To see the results, click File/Close data file and then File/Edit data file. Here is the entry:

---------- Surface Integrals ----------
Region status
RegNo   Status    Name
===================================0
 1  External   METALWALL
 2  External   AIR
 3  External   DRIVE
 4  Internal   DETECTOR
 5  External   OBJECT
Surface area of region set (m2):   8.187500E-04
Charge:  -3.015445E-13

The mutual capacitance without the object is 0.30154 pF. When possible, it’s always a good idea to make an analytic check to make sure we haven’t made a error in the numerical setup. The mutual capacitance is approximately

C12 = A2*ε0/D12.   [2]

The average distance between the drive and detector is D12 = 0.015 m. The area of the upper detector surface is  A2 = (0.0175 m)(0.0325 m)= 5.7E-4 m2. Substituting in Eq. [2], the estimated capacitance is C12 = 0.335 pF.

Open the file CapDetector.HIN with an editor and change the object properties to

* Region 5: OBJECT
* Epsi(5) =   1.0000E+00
Epsi(5) =   4.0000E+00

Recalculate the field with HiPhi and find the detector surface integral with PhiView. The result with the object centered at x = 0.0 cm is C12 = 0.3162745 pF. The object raises the mutual capacitance by about 4.9%.

To complete the calculation, we want to find C12 with the object at positions x = -0.50, -0.25, 0.00, 0.25 and 0.50 cm. To analyze each solution, we must load CapDetector.HOU into PhiView and call up the surface integral. Rather than perform the same operations every time, we can define an automatic analysis sequence. In the PhiView main menu, click File operations/Create script. Supply the file prefix CapDetector. The program opens the internal editor with a template of available analysis script operations. Type in information so that the script looks like this:

INPUT CapDetector.HOU
OUTPUT CapDetector.DAT Append
SURFACEINT 4 -1 -2 -3 -5
ENDFILE

Click Save to create the file Surface.SCR and exit the editor. The script specifies the following operations

  • Load the HiPhi solution CapDetector.HOU.
  • Write information to a data file CapDetector.DAT. The Append directive signals that PhiView should add data to the file if it exists.
  • Perform a surface analysis. The numbers following the command indicate that that Region 4 (the detector) should be inside and all others outside.

To add a value of mutual capacitance to the output file, simply click File operations/Run script in the main menu of PhiView and choose CapDetector.SCR.

A manual run to find C12 for an object position requires the following activities.

  • Edit CapDetector.MIN. To move the object to x = -0.5 cm, change the Shift command in the object section to Shift:   -0.500  0.000  0.0625
  • Run MetaMesh, click File/Load MIN file and choose CapDetector.MIN. Then click Process followed by File/Save mesh.
  • Run HiPhi, click Run/Start run and choose CapDetector.HIN.
  • Run PhiView and start the analysis script CapDetector.SCR.

There are many redundant operations. To start, let’s automate the second, third and fourth activities with a Windows batch file. We’ll assume that you are running the programs from the AMaze program launcher and that the Data folder is set to the working directory. In AMaze, click the Create task button to bring up the dialog of Fig. 4. Fill in the task prefix as CapDetector. Under action, click the arrow to activate the popup menu. In contains a list of AMaze programs and common batch operations. Pick MetaMesh. Then, click on the cell under File in and click the Select file button to show a list of MetaMesh input files in the working directory. Choose CapDetector.MIN. The output file of the activity is always CapDetector.MDF, so we do not need to specify a value. Go to the next Action cell and pick HiPhi. For File in, choose CapDetector.HIN.  Set PhiView for the next action with CapDetector.SCR as the input file. When you click OK, AMaze saves the setup as CapDetector.BAT, a standard batch file. Here is the content:

START /B /WAIT C:\fieldp_pro\amaze\metamesh.exe C:\...\CapDetector
START /B /WAIT C:\fieldp_pro\amaze\hiphi.exe C:\...\CapDetector
START /B /WAIT C:\fieldp_pro\amaze\phiview.exe C:\...\CapDetector
START /B /WAIT C:\fieldp_pro\amaze\NOTIFY.EXE
IF EXIST CapDetector.ACTIVE ERASE CapDetector.ACTIVE
AMaze dialog to create a task

Figure 4. AMaze dialog to create a task.

The batch runs each program in the background with the specified input file, waiting until the operation is completed before moving to the next one. The fourth line signals the end of the sequence. The fifth line deletes a temporary file used to keep track of which tasks are active.

At this stage, for each position of the object we perform two operations:

  • Edit the Shift operation in CapDetector.MDF to change the object position along x.
  • In AMaze, click the Run task button and choose CapDetector.BAT from the list of available tasks. In response, the mesh is regenerated, the field solution is updated and the surface analysis result is added to the data file CapDetector.DAT.

The end result is a list of C12 values at the different positions.

To conclude, we can eliminate the first task, automating the entire procedure. Here. we will specify the object position within the calling batch file. We need to make two changes. First, the Part section for the object in the MetaMesh input file should be changed to

PART
  Region: Object
  Name: Object
  Type: Sphere
  Fab:   3.75000E-01
  Shift:   %1   0.00000E+00  6.25000E-01
  Surface Region Air
END

Note that the x position in the Shift operation is represented by a variable. The value to be used is given as the first command line parameter when calling MetaMesh. The file CapDetector.BAT should be edited to look like this:

START /B /WAIT C:\fieldp_pro\amaze\metamesh.exe C:\...\CapDetector -0.50
START /B /WAIT C:\fieldp_pro\amaze\hiphi.exe C:\...\CapDetector
START /B /WAIT C:\fieldp_pro\amaze\phiview.exe C:\...\CapDetector
START /B /WAIT C:\fieldp_pro\amaze\metamesh.exe C:\...\CapDetector -0.25
START /B /WAIT C:\fieldp_pro\amaze\hiphi.exe C:\...\CapDetector
START /B /WAIT C:\fieldp_pro\amaze\phiview.exe C:\...\CapDetector
  ...
START /B /WAIT C:\fieldp_pro\amaze\metamesh.exe C:\...\CapDetector 0.50
START /B /WAIT C:\fieldp_pro\amaze\hiphi.exe C:\...\CapDetector
START /B /WAIT C:\fieldp_pro\amaze\phiview.exe C:\...\CapDetector
START /B /WAIT C:\fieldp_pro\amaze\NOTIFY.EXE
IF EXIST CapDetector.ACTIVE ERASE CapDetector.ACTIVE

This task generates the entire data set. Figure 5 shows a plot of the results. The dashed line is the mutual capacitance with no object. The relative variation of C12 with position of the object is about ±1.1%. The conclusions are that the application would require a sensitive detector and that small variations in the size or properties of the dielectric object could overwhelm the measurement.

Variation of C12 with the displacement of the dielectric object

Figure 5. Variation of C12 with the displacement of the dielectric object. The dashed line shows the value with no object.

An alternate way to find mutual capacitance is the energy method described in the HiPhi manual and in another blog article. In this case, it is necessary to make three solutions for each configuration with different combinations of electrode voltages. The capacitance values C12, C10 and C20 are determined by comparing values of the total field energy. The procedure requires 15 solutions — here, the automation features of HiPhi provide real benefits. In the calculations, the electrode voltages as well as the object position are set by command line parameters. The energy method gives about the same variations as the surface integral method, although there is about a 4% difference in the absolute values of C12.

In the next article, we will move on to 3D magnetic field calculations with Magnum.

Footnotes

[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.