Magnetostatic Simulation Tutorials (for Beginners)

Magnetostatics is used when information of the magnetic field that surrounds a conductor is needed. In this context, a DC Conduction Steady Steate analysis is sometimes used as a preprocessing step, and the resulting currents are used as input to a subsequent magnetostatics analysis. This would be the case, for example, when analysing electromagnets. The fundamental material property for performing magnetostatics analysis’ is the relative magnetic permeability \(\mu_{r}\). For nonlinear magnetostatics analyses, a more general material relationship may be needed, such as a functional relationship between the magnetic field and the magnetic flux density: a so-called B-H curve. The ultimate goal of a magnetostatics analysis is, in many cases, to compute the forces and torques in a system of magnetic components.

Analysis of permanent magnets constitutes an important, special case of magnetostatics analysis. In this case, a permanent magnetization is the source of the magnetic field instead of an electrical current. In such cases, the magnetic flux strength and direction as well as forces are important analysis results.

Core and Inductor (Beginner)

In this example it is shown how to build up and analyse simple models in 2D or axial-symmetric situations. An electric coil is positioned near a magnetic core. The electric current in the coil creates a rotating magnetic field (ampere law), that affects the magnetic core material. We want to calculate for the magnetic field strength and flux density in the core. Also, we want to find the mechanical forces acting on the core.
The picture below left shows a sketch representing the model. In the 2D case, we assume an extruded geometry that is simulated by flat 2D elements and an applied thickness (150 mm.) On the right side, there is shown how this would look like in an axial-symmetric case (an angular piece is shown).
The coil is loaded with electric current of 5 Ampere DC and 36 winding-turns.
Following to this 2D analysis (with thickness) we will use the same model to analyse for the axial-symmetric situation.

image

Estimated time: 45 min. Follow the steps in Simcenter:

Preparations

  1. download the model files for this tutorial from the following link:
    https://www.magnetics.de/downloads/Tutorials/3.MagSta/3.1CoreInductor.zip

  2. unzip the archive. There will be one folder ’start’ and one ’complete’.

  3. Start the Program Simcenter 3D or NX. Use Version 12 or higher, preferably use the newest.

  4. In Simcenter, click Open image and navigate to folder ’start’. Select the file ’CoreInductor.prt’ and click OK. (Maybe you must set the file filter to ’prt’)

  5. From toolbar Application, click on ’Pre/Post’ image and the system switches into the simulation application.

  6. Hints: All information describing the Simcenter simulation is managed in basically three files (picture below): The Sim, the Fem and the Idealized file. The Sim file contains the solution, boundary conditions, loads. The Fem file contains the finite-element meshes, material properties and other physical properties. The Idealized file is optionally and can be used for simplifications or modifications of the CAD geometry without changing the original CAD file.
    image

Fem and Sim File Creation

Following, we will create the Fem and Sim file structure and then we will fill it up with data. The ’Simulation Navigator’ will allow us navigating in the file-structure.

  1. Click on ’New FEM and Simulation’ image.
    (That button is also found by RMB in Simulation-Navigator)
    image

  2. The window ’New FEM and Simulation’ appears.

  3. Following, a window ’Solution’ appears
    (if this does not automatically appear, click on ’Create Solution’) image)

Fem File Steps

  1. We are now going to create finite element meshes. Therefore, use the Simulation Navigator to set the Fem file to ’Open in Window’ (if this is not automatically done).
    image

  2. Mesh the Coil

  3. Assign Physical Properties to the Coil

  4. Mesh the core:

  5. Assign Properties to the Core

  6. Mesh the inner air
    Hint: In most cases air meshes are created as the last meshing step.

  7. Assign Properties to the inner air
    Important: Air must have a physical property type ’FluidPhysical’, not ’PlanePhysical’.

  8. Meshing the Infinity Air

  9. Assign Properties to the Infinity Air

Sim File Steps

  1. We are now going to create boundary conditions. Therefore, set the Sim file to the displayed part. (The meshes are blanked here for easier visibility)
    image

  2. Create a load for the electric current on the coil:

  3. Understanding constraints

  4. Creating constraints.
    According to such needs, now we will create two tangent and one normal constraint.

Solve and Post Processing

  1. Optionally, save the files and

  2. Click on ’Solve’ image from toolbar ’Solution’. Then click OK.

  3. Optionally, check for solver progress and errors

  4. Post Processing Force Results

  5. Post Processing Magnetic Flux Density

Axisymmetric Analysis of Core and Conductor

To analyze in an axial symmetric way (axis is Y) using the same geometry follow these steps:

  1. Clone the solution and

  2. Rename the new solution to ’Axisym1’.
    image

  3. Choose ’Edit Solution’ on the new ’Axisym1’ and switch to register ’2D’. Activate ’Axisymmetric’ and click OK.
    Hint: To use axis symmetric analysis, it is necessary to place all elements on the x/y plane for positive x. The axis must be Y.
    image

  4. Solve the solution image and post process the results:

  5. Check the force sum in Y direction again. It should be about 0.08 N. The axisymmetric effect (2*Pi) is already taken into account.

  6. The tutorial is complete. Save your files and close them.

Static Force on Solenoid (TEAM 20) (Beginner)

This example is a convenient training for all those who want to do electromagnetic analysis with complex 3D geometries, because it contains most necessary skills for dealing with this.

The Team20 benchmark is a test example for electromagnetic analysis software tools. There are measured force-results available that we will use for comparison with the simulation-results. We will use a nonlinear B-H curve that includes saturation effects for the core and iron parts.

image

For meshing, we want to exploit the ’Non-Manifold’ strategy, which automatically finds adjacent face pairs and creates conformal meshes (e.g. coincident nodes) at those interfaces. Thus, no Mesh-Mating conditions are needed any more. This feature is very powerful but only available in the newer versions of Simcenter/NX (best in 2406 or later).

Necessary time: 1 h.

Preparations

  1. download the model files for this tutorial from the following link:
    https://www.magnetics.de/downloads/Tutorials/3.MagSta/3.2Team20.zip

  2. unzip the archive. There will be one folder ’start’ and one ’complete’.

  3. Start the Program Simcenter 3D or NX. Use Version 12 or higher, preferably use the newest.

  4. Optionally: Enable ’Use Polygon Body Names for Meshes’. Find it here: File, Utilities, Customer Defaults. Then: Simulation, Pre-Post, Meshing, General.

  5. In NX/Simcenter, click Open image and navigate to folder ’start’. Select the file ’Team20.prt’ and click OK. (Maybe you must set the file filter to ’prt’)

  6. From toolbar ’Application’, click on ’Pre/Post’ image and the system switches into the simulation application.

Hints

  1. All information describing the simulation is managed in basically three files (see below): The Sim, the Fem and the Idealized file. The Sim file contains the solution, boundary conditions, loads. The Fem file contains the meshes, material properties and other physical properties. The Idealized file is optionally and can be used for simplifications or modifications of the geometry without changing the original CAD file.
    image
    Following, we will first create this file structure and then we will fill it up. The ’Simulation Navigator’ will allow us navigating through the structure.

  2. Notice, in the CAD Model, there is a spline curve extracted from the outside edges of the coil (see highlighted in below picture). This spline will be used to define the winding directions. It is necessary, that this spline is one single curve. In case there are multiple curve segments, there must be done a ’Join Curve’ operation to make one spline out of them. We will later have to activate one special button to transfer this spline into the Fem file.
    image

  3. A spherical air volume is placed around the solid geometry and an additional spherical shell is placed around the sphere. This sphere is necessary to model the magnetic (and in other cases also the electric) field in air. The shell additionally models the infinity air. We could solve without the infinity air, but in that case the air volume would have to be large enough to model the field. In case it would be too small, the simulation would model that field too much ‘compressed’ and results would become inaccurate. To decide about the size of such an air volume, it should also be considered whether the field ‘wants’ to leave the solid geometry (flux leakage): If there is a closed iron path, holding the magnetic flux like in our case, there is no need for a big sphere. In other cases, there may appear more flux leakage and the air volume should be larger. Instead of using a large air volume, we rather want to use infinity elements just like we already did in the previous tutorial ‘Core and Inductor’. In this example, we use a sphere, but alternatively box geometries would work as well. Advantage of a sphere is that it is kind of natural for the field lines. Also this makes it simple using infinity elements.
    imageimage

Fem and Sim File Creation

Following, we will create the Fem and Sim file structure and then we will fill it up with data. The ’Simulation Navigator’ will allow us navigating in the file-structure.

  1. Click on ’New FEM and Simulation’ image.
    (That button is also found by RMB in Simulation-Navigator. The picture shows both)
    image

  2. The window ’New FEM and Simulation’ appears.

  3. Switch off ’Create Idealized Part’ because the geometry is already very simple.

  4. Set the ’Strategy to Use’ to ’Non Manifold’.
    Hint: By this way, we don’t need Mesh-Matings. If the SC/NX version is older than 2406, see chapter ’Recommended System Settings, Create Non-Manifold Polygon Bodies’. Alternatively, create the conventional Mesh-Matings.

  5. Set the Solver to MAGNETICS and Analysis Type ’3D Electromagnetics’ and click OK. The files are created.

  6. Hint: In some cases, depending on the installation, a message ’Unsecure Solver Language File’ may appear. This can be accepted (press Ok).
    image image

Create the Solution

  1. In toolbar ’Home’, click on ’Create Solution’ image
    Hint: sometimes this is automatically triggered.

  2. Accept the Solver ’MAGNETICS’ and the Analysis Type ’3D Electromagnetics’,

  3. Accept the default Solution Type ’Magnetostatic’.

  4. Click ’Create Solution’.

  5. In register ’Output Requests’, ’Table’, activate ’Total Force - entire (virtual)’ to enable the system calculate forces by the virtual energy method.

  6. to see these forces in the plots and also the applied currents, also activate in ’Plot’ ’Current Density’ and ’Nodal Forces - entire (virtual)’.
    imageimage

  7. Click OK to finish the Solution window.

Optionally: Check Non Manifold Faces

  1. In the Simulation-Navigator, at ’Groups’, verify that there is a group with name ’non-manifold face’

  2. select that group and observe that faces are highlighted. These are those faces that belong to two bodies. Those faces are such that in older versions would need Mesh-Mating-Conditions. Here, the meshes need coincident nodes. That requirement will now automatically be fulfilled.
    image

Parametric Meshing

Following, we will create all element-sizes using one control-parameter ’MeshFactor’. This makes it simple later to do studies with different mesh-sizes and therefore, we recommend this approach.

  1. Do a ’Open in Window’ to the Fem part.
    image

  2. Mesh the CORE: Start the mesher ’3D Tetrahedral’ image, select the core body (either in the graphics window or in the Polygon Geometry list) and activate ’Automatic Element Size’. In the field ’Element Size Factor’, key in the text ’MeshFactor=1’ to create a parametric expression ’MeshFactor’. click ’Apply’. The mesh is created.
    image

  3. Mesh the remaining parts with the same settings as follows:

    Hint: the order of creation of meshes is important: We should always start with the most important parts.
    image

  4. The meshes are still quite coarse, because of the MeshFactor=1. We want to globally reduce the mesh size to the half. Thus, change the expression ’MeshFactor’ to 0.5. This is done in the ’Expressions’ window (Menu, Tools, Utilities, Expressions).
    image

  5. After the new value is set, click the ’Update’ button. A re-meshing starts and all elements will become smaller.
    image
    The picture below shows left the old and right the new meshes of core, iron and coil.
    imageimage

Define Air-Material

Important: Air must have a physical property type ’FluidPhysical’, not ’SolidPhysical’.

  1. Right mouse button (RMB) and ’Edit’ the mesh collector of the Air.

  2. Set the ’Type’ to ’FluidPhysical’ and click ’Create Physical’

  3. at ’Material’, activate ’Built-In’ and select ’Air’ from the list, click OK, OK
    imageimage image
    Alternatively, select ’AIR’ from library
    ...\NX-folder\SIMULATION\magnet\materials\Commonly Used Materials.xml

Alternative A: Use Built-In Material for Core/Iron

  1. RMB and ’Edit’ the mesh collector of the core.

  2. Accept the default physical property of type ’SolidPhysical’ and

  3. click ’Edit’. The window ’SolidPhysical’ appears.
    image image

  4. at Material, activate ’Built-In’

  5. from the list ’Built-In Materials’, select ’Steel (from TEAM20 benchmark)’
    Hint: This built-in material has the same properties as the one we create individually in the following chapter.

  6. Click OK, OK to finish the windows.

  7. Proceed in the same way for the iron part.

Alternative B: Define Individual Core/Iron Material

As an alternative to the prior chapter, here we define a typical steel material for the core and iron bodies. This material shows a nonlinear relationship between magnetic flux-density (B) and magnetic field-strength (H). Such a relation is often the case for steel and iron. Many material properties are already available in the material library, but often, we must insert individual data and define a individual material. The data points with H-B pairs are stored in a csv file (Team20MaterialCurve.csv) in the ’start’ folder of this tutorial. Proceed as follows to create a new material with these:

Define Stranded Coil Properties

Following, we will define the properties of the coil. Even though the CAD model is a simple solid, in the simulation we want to model the electric current as flowing through windings. As a side effect, there will be no eddy currents in the coil.

  1. Edit the Physical of the coil mesh.
    image image

  2. At ’Material’, select ’Built-In’ and choose ’Copper’ from the list ’Built-In Material’.
    Hint: Alternatively, use ’Choose Material’ and select one from the library.

  3. In the box ’Conductor Model’, set the options as follows:

  4. Define the stranded winding directions:

Define Infinity Properties

  1. Edit the mesh collector ’AIR_INF’, set the ’Type’ to ’Infinity3D’, select ’Create Physical’, accept the default type ’Spherical Shell’ and key in the two values for ’Inner Radius at Shell’ and ’Shell Thickness’ as shown below. Click OK, OK.
    image image
    Hint: The value ’Inner Radius at Shell’ is slightly reduced (3 mm, and the thickness value adds 3 mm to compensate) to avoid error messages like ’Bad parameters for transformation Jacobian’ that may appear from the solver. The reason for that error is that all elements of AIR_INF must be inside the two radii. But if the mesh is coarse, there may some element-edges crossing the radius value. To allow also these elements, we do that reduction.

Define Load and Constraint

  1. To finish the work in the Fem file it is a good practice to blank all meshes and unblank all polygon bodies.

  2. Switch to the Sim file.
    image

  3. To keep the magnetic flux inside the air sphere, it is necessary to use a constraint ’Flux tangent’. To do so, click on ’Constraints\(\rightarrow\)’New Constraint’\(\rightarrow\)’Flux tangent (zero a-Pot)’ image. Select all 8 outside faces of the air volume (selection filter ’Tangent Faces’ helps). Click OK.
    image
    image

  4. To create an electric current load for the coil:

Solve and Post Processing

  1. Optionally save the parts

  2. Solve the solution: Click on image and OK. The solver will run about 20 sec.

  3. Optionally, check for solver progress and errors:

  4. Close all windows that came up (Analysis Job Monitor, Information Window, Solution Monitor)

  5. Post processing

  6. Variants with 3A, 4.5A and 5A
    We want to compute two other electric currents and compare them with reference measurements. Solve using the following values for the current and compare the results against measurement data (Reference data is from [TakahashiNakataMorishige]).

Loss of Accuracy

Loss of accuracy normally results mainly from the mesh because of the approximation of finite elements. Thus, finer meshes or using higher order shape functions will help. On the other side, if there is an nonlinear material included, there also results some loss of accuracy from the nonlinear scheme what can be controlled by the residual tolerances. We will use both in the following.

Increasing Accuracy by Reducing Nonlinear Residuals

Because we us a nonlinear BH curve in one of the materials, there runs a Newton-Raphson-Iteration-loop in the solver. Tolerances control how tight our solution will be to the given BH curve. Thus, the first thing we do is reduce this tolerance by one order. Proceed as follows:

  1. RMB on the solution, click ’Edit Solver Parameters’. In register ’Numeric’, box ’Nonlinear Magnetic Material’, set ’Newton-Raphson-Method’ to ’Advanced Scheme (Default)’.

  2. reduce the two tolerances by one order, thus, from 5e-5 to 5e-6.
    image

  3. Solve again for the three currents and compare the force results. You may also notice in the logfile that the number of required iterations to converge increases.

  4. now we reduce the two tolerances again by one order to 5e-7. Solve again and find: results are the same as before. Thus, the prior tolerance 5e-6 worked already well.

  5. Set the two tolerances back to 5e-6.

Increasing Accuracy by global higher Order Shape Functions

The shape functions define the approximation of the main result in the finite elements. we can increase the order without changing the mesh. We use so called hierarchical shape functions, that means, no midnode elements are necessary. Increasing the order strongly increases the number of degrees of freedom (DOFs or unknowns) in the equation system. This results in more solve time and much more necessary memory (RAM). The number of DOFs is shown in the solution monitor quite at the beginning. There are several systems shown. The relevant one is simply the largest one. The picture below shows the DOFs with the origin (first order) left and a solve with third order on the right. Notice, that the number has increased by a factor of nearly 5.
image image
To test with third instead of first order, do this:

  1. switch to the Fem file,

  2. edit the physicals of Core, Iron, Air (if you want, also the coil) and for each of them

  3. in box ’Electromagnetic Solutions’, set the ’Shape Functions’ to ’Third Order’.
    image

  4. solve again for the three currents. The solve time will increase a lot. Compare the results:

Increasing Accuracy by local higher Order Shape Functions

Because the globally increased order of shape functions strongly increases the number of DOFs, there exists a feature for increasing that order on elements being connected to edges or faces. This is often a good compromise because the DOFs increase only slightly but the accurate shape functions are installed. For good efficiency, we should select faces or edges with sharp corners. Or simply those, where the magnetic fluxdensity changes rapidly. Proceed as follows for a test:

  1. switch back to the Fem file and set all physical shape functions back to ’First Order’

  2. switch to the Sim file.

  3. Create a ’Simulation Object’ of type ’Locally increased Order’
    image

  4. Accept the default type ’on Edges’ and select the 6 sharp corner edges at the upper side, where we have already seen the magnetic fluxdensity changing rapidly. These are shown in the picture.
    image image

  5. In ’Electromagnetic 3D Order’, set the ’Shape Function’ to ’Third Order’

  6. Create another ’Locally increased Order’, now set the type to ’on Faces’ and select the two faces at the lower side, where the flux jumps over the air-gap between the core and iron. Set the order to 3 here too.
    image image

  7. solve again for the three currents. Notice, that we now have 53345 DOFs, only a little more than with full first order.

Increasing Accuracy by Adaptive Meshing

To increase the result accuracy, one can also use adaptive meshing.

  1. Remove the two ’Locally increased Order’ features from the model first.

  2. set the core, iron and air physicals to ’Third Order’.

  3. Activate the button ’Perform Adaptive Meshing’ in the edit solution dialogue at register ’Adaptive Mesh’ as shown in the below picture. All default settings, as seen below, can stay in many cases.
    image

  4. The feature adaptive meshing takes more time to solve because it reflects the results and changes the mesh to find an optimal mesh. Therefore, it should be used only with one electric current value. For the other values, it should be switched off, so the system will use the already adapted mesh. Using this, we get the final result values as shown below.

    The mesh, as it comes out of the adaptive meshing process, is demonstrated in the below picture.
    image

This tutorial is complete. Save your files and close them.

Force on Magnet (TEAM 23)

In this tutorial forces between a coil and core are computed in 2D at different positions. A parameter sweep is performed to vary different CAD positions of the magnet. The model is already set up, we just have to create a second solution with a parameter sweep.

image

  1. download the model files for this tutorial from the following link:
    https://www.magnetics.de/downloads/Tutorials/3.MagSta/3.3ForceMagnetTeam23.zip

  2. unzip the archive. There will be one folder ’start’ and one ’complete’.

  3. Start the Program Simcenter 3D or NX. Use Version 12 or higher, preferably use the newest.

  4. In Simcenter, click Open image and navigate to folder ’complete’. Select the file ’Team23_sim1.sim’ and click OK. (Maybe you must set the file filter to ’.sim’) This file already contains the meshes, physical properties, loads and constraints.

  5. Create a new Solution image.

  6. click RMB on the solution ’2nd_Order_VarDis’ and click ’Edit Solver Parameters’.

    imageimage

  7. Explanation:

  8. Solve the ’VarDis’ solution.

  9. Open the ’.VarDis.Force.txt’ file or export the table in EXEL.
    Following two plotted graphs of the forces in the Y-direction.
    image
    One can see that the force becomes smaller with greater distance. This is because of the magnetic effect.