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.

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.

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.

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.

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.

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.

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.