# Discussion Forum

## A problem with Comsol’s Axial Magnetic Bearing example

Hello all, I have downloaded the example “Axial Magnetic Bearing Using Permanent Magnets” (Application ID: 14367) to learn how to calculate the force between two permanent magnets. Without making any changes (except removing the parametric sweep and setting dz=0), I tried to verify that the force acting upon each magnet is the of same value and opposite direction. The modeling instructions do not specify a certain mesh resolution. Since electromagnetic force calculations require high resolution, it was no wonder that force equality was not obtained for the default element size.

I started to increase the mesh density, and allegedly reached force equality for the predefined “Extremely Fine” element-size, but with a maximal element size of 0.16mm (which is 10 times smaller than its nominal value). When increasing the resolution even further to 0.05mm, the equality held, but the value dropped by two orders of magnitude(!). I Increased the resolution to 0.01mm and left the simulation to run during night, but by morning it progressed only by ~5%.

I must emphasize that I this is a 2D simulation, so it’s hard to imagine what kind of computational resources are required to calculate forces for my 3D simulations. So am I missing something or is there a problem with this example? Should this relatively simple 2D simulation be so computationally expensive or is there still hope for 3D cases?

1 Reply Last Post Oct 22, 2020, 10:13 AM EDT

Posted: 1 month ago

Boundary integration of the Maxwell surface stress tensor will often give rather modest accuracy, especially when applied directly on a permanent magnet as the H and B fields directly outside a magnet are dominated by the magnet's own field. However, the force arises by the perturbation to that dominant field by the comparatively smaller field of the other magnet. This becomes more obvious when the "other magnet" is just a piece of passive iron like in the first attached modell. The solution in that case is to compute the force on the piece with the smallest "own field". As the perturbation field near the magnet scales as the inverse fourth power of the magnet-iron distance, it is quite easy to envision a situation when computing the force directly on the magnet is virtually impossible within double precision numerics.

Another numerical issue is that integrating the Maxwell stresses on a magnet-air boundary requires the evaluation of the fields in the air and single-sided extrapolation to the boundary (gradients are typically computed inside elements - not on element boundaries). This results in extrapolation errors. A partial cure is to go for higher order elements with better extrapolation power. It is also worth noting that Magnetic Fields (vector potential) often is more accurate than Magnetic Fields, No Currents (scalar potential) as the normal (B and H) fields then result from tangential derivatives (computed directly on the boundary) of the vector potential and hence suffer less from extrapolation errors.

Other approaches is to introduce fictive boundaries or control volumes in the air on the outside of the object and integrate on such a boundary or in the resulting air volume (eggshell method). Or one may use sensitivity/energy/coenergy based methods (virtual work method).

When it comes to the Axial Magnetic Bearing example, the special case of dZ=0 should result in zero axial force on the magnets. From what I have written above it should be clear that finite elements and the Maxwell Stress method on boundaries does neither guarantee zero force, nor perfectly balancing forces on the magnets unless the mesh is perfectly symmetric. However, when looking at the model in its context, that is exploring the forces as a function of dZ, it is clear that the discrepancies are small in a relative sense. In the attached version of the model, I compute the forces using both the scalar and vector potential formulations and the latter seems a bit more accurate. As can be seen in 1D Plot Group 6, the deviations from zero axial forces for dZ=0 are small in a relative sense.

Accurate numerical magnetic (and electric) force calculations are unfortunately very difficult to automate and it usually requires both an understanding of the numerical method and some experimentation to gain confidence in the results.

-------------------
Magnus