How to perform electromagnetic FEA

I often learn stuff when I write on the blog, as it forces me to rethink what I already know. This time, however, it’s completely different! I invited a friend of mine to teach me (and you) how to perform electromagnetic FEA! This will be super fun, because in Anttis words:

Electromagnetic FEA is performed exactly like mechanical – by meshing the geometry, setting up loads and boundary conditions, and making sense of the results that the computer then spits out.

It seems manageable right? But before we start, a few words about today’s Author!

Antti Lehikoinen did his Ph.D. in some sort of electromagnetic thing. Now his company is designing magnetic engines for startups… In his free time, he wrote his own nonlinear solver in Mathlab called SMEKlib and he also teaches at Alto University. You know… a typical guy : )

You can also learn more about him in his super fun to read blog!

Antti is taking over the mic!

Since you are reading Łukasz’s blog, I assume you are not an expert on that topic – just like I’m not that good at structural engineering. That’s why I started following Łukasz’s blog in the first place – to learn!

What I do know is electromagnetics, so buckle on for the crash course.

What is Electromagnetic FEA?

That, above, is the short version. To gain a little more useful understanding, let’s begin by defining what electromagnetic FEA is, and then look at some applications.

The ‘mathematical’ goal of electromagnetic finite element analysis is to obtain the electric and magnetic fields inside the problem domain. Exactly like to goal of structural FEA is to figure out the displacements and strains.

The ‘practical’ goal…well, that varies a lot and also influences the analysis part quite a lot.

For instance, when designing antennas for mobile phones, or other radio-frequency applications, the electric and magnetic fields are strongly coupled to each other. One influences the other, and vice versa, all thanks to mathematics. This is not my specialty, so I will not go deeper into that.

When things are fully static – not changing at all – the fields are fully decoupled, and can be analyzed separately. In this case, usually only one or the other is of any interest.

And somewhere in the middle – tens of Hertz to the low kHz – lies the so-called quasi-static range. Here, electric and magnetic fields are coupled, but only through the eddy currents induced by the magnetic field.

Applications

The most common application of quasi-static EM-FEA is the design of some kind of an electromagnetic actuator, machine, or device. Examples include:

  • solenoid magnets for small locks etc
  • electric motors and generators
  • electric transformers
  • electromagnets for e.g. medical imaging (MRI) devices

We will take another look at the applications later, together with different post-processing options. But first, let’s go through the typical analysis workflow.

Meshing

 

Obviously, the very first step should be understanding the problem and figuring out what you’re after and and and so forth. But, this is highly problem-specific and more related to basic engineering skills rather than FEA for that matter.

Thus, let’s skip that part and jump straight to the next one – meshing.

The basics are the same as in structural FEA. The mesh has to be dense enough where it counts to get a good solution, but not too dense, so that getting the solution takes forever. Usually easier said than done, depending on one’s experience.

There are some differences, though. Triangular and tetrahedral elements work just fine (which isn’t usually the case in structural FEA). They are indeed the most common type by far. Rectangles are quite rare, in fact.

Why do triangles work? Well, some math is needed for that (sorry Ł!). You see, in elasticity problems, the strain is essentially a derivative of the displacement, while stress is a derivative of the strain. Meaning, triangular elements, with their constant strain, kinda fail at predicting stress. However, in electromagnetic problems, we only need the “displacement” (usually potential of some kind) and the “strain” (magnetic flux density, for example), but not the “stress”. Hence, a constant “strain” is quite fine.

Editors note: You are in the clear Antti – I don’t see any math here!

But when you start to derive equations to support your conclusions, I will simply ban you*!

*I assume there is a way of banning someone from my blog… i would have to experiment here.

Additionally, 3D problems are often solved with so-called edge elements. The term is misleading, as the element shape is still the same (a tet, for instance). Instead, the name stems from the fact that we are using the edges of the elements to represent the solution, instead of its nodes as usually in structural problems (like is typically done; this would be called a nodal or Lagrangian element).

Share this post with your Friends!

Loads and boundaries

The ‘same but different’ principle also applies to loads and boundary conditions.

A huge majority of the time, a ‘magnetic load’ comes from either a current-carrying conductor or a permanent magnet. Both can be used to ‘drive’ the magnetic field, after all.

Both are also only applied to a certain volume – the conductor or magnet. They are not point loads, nor do they act everywhere as gravity would.

As for boundary conditions, there are normally three options to choose from.

Magnetic insulation is exactly as the name suggests – no flux is leaving the boundary. Depending on the software, it can also go by the name prescribed potential, fixed potential, or homogeneous Dirichlet for the more math-oriented.

If the next condition is used, the flux hits the boundary at a right angle. It can go by the name ‘natural boundary condition’ or ‘homogeneous Neumann’, or even ‘perfect magnetic conductor’ or something like that. Or, it might not have any name at all, as it is satisfied automatically for any boundary that is not assigned some other condition.

Finally, periodic and antiperiodic conditions are often used when modeling electric motors and other devices with a highly symmetric structure. When two boundaries are said to be periodic, any flux leaving the problem domain through one boundary will cause an equal flux to enter it through the other.

Analysis

The analysis part does not differ much from other types of FEA – the software does most of the heavy lifting.

Magnetic problems ARE usually nonlinear*, but that does not usually spell significant problems. Indeed, 2D problems especially are quite robust, and you should get a solution quite easily (in 3-10 iterations, normally). Exceptions might occur if your material model is not properly defined, though.

*Luckily, the nonlinearity is reversible (unlike plastic deformation, for instance) and nonhysteretic, in typical problems. Important exceptions exist, though. For example, permanent magnets can get demagnetized and need a ‘factory reset’ so to speak. In an actual factory, usually.

3D problems are trickier, though. They are large, and you have many solvers and solver options to try. Figuring out which one happens to work today on this problem can take a while – especially since you may have to wait hours or even days to even see that the solution has failed.

Worth noting is also the fact that many electromagnetic problems are time-dependent. An electric motor will rotate, and a transformer is fed with alternating current. So, instead of a single solution one often needs to compute several – from the high tens up to several thousand – time-steps. This can make the computation time of even 2D analysis notable, and 3D analysis downright nightmarish. This issue is compounded if more than a few designs have to be analyzed, as is typically the case in optimization.

Results

Sorry for interupting Antti but I can’t stop myself!

The “tentacle engin” must be one of the most satysfying things I saw done in FEA… but the mesh hurts my structural eyes! I know you are fine, but if I would ever get into your field I would mesh stuff like crazy out of habit!

As always, the analysis ends with post-processing. Meaning, lots of nice plots with lots of colors are drawn.

And I’m only half-joking. In magnetics, different density plots (flux, losses, current) are an important outcome. So are some slightly less-spectacular plots, too, such as current or torque waveforms.

On a more serious note, the most important post-processed characteristics depend on the application, of course. But typically, the ability of the device to perform its primary task is usually the first interest. For example, this could mean the torque capacity of a motor, the force of an actuator, or the power of a transformer. Other interesting quantities include efficiency, magnetic forces and electric voltages, force or torque smoothness, and so on.

However, most of them can be computed with magnetic FEA. And for the ones that can’t – like temperature, or vibrations and noise – other kinds of FEA are just around the corner to help.

Software

Finally, let’s look at some software options one could choose from.

On the commercial front, some big names include Ansys, JMag, Infolytica, Flux, Opera, and Comsol Multiphysics.

I can’t offer much insight here personally; I have used Comsol and think it’s a good general-purpose tool, and have heard good things about Ansys and motors/generators.

Furthermore, there are also some free and open-source options available.

FEMM is probably the most well-known and widely used, and for a good reason. It is easy to use for small and moderate problems and has enough functionality to get you quite far.

MotorAnalysis is another option for mentioning. Unlike FEMM, it has no full geometry editor but instead locks you into specific motor topologies. This has both benefits and drawbacks: faster analysis (e.g: drawing a specific slot shape in FEMM takes time), but only for the topologies included in the program.

For much more heavy-duty analysis, there’s the Finnish Elmer, getting its name from some wordplay (ELementtiMenetelmä = finite element method; while Elmeri is an oldish first name). It can do multiphysics and 3D, at the cost of an evesque learning curve.

And finally, I would be doing myself a disservice by not mentioning my own SMEKlib. SMEKlib is an open-source Matlab-based framework and a byproduct of my doctoral studies. It is tailored towards rotating machines, but a skilled user* can apply it to basically any problem. And like Elmer, you will need some skills – it’s more of a collection of building blocks rather than a ready-made tool in its current form.

* Or you can order a tailored app from Smeklab.

Conclusion

Electromagnetic FEA is quite similar to its structural engineering cousin. After all, its basic philosophy – solving complex problems through number crunching – is exactly the same, as is the overall meshing-solving-interpreting workflow.

But, as usual, the devil is in the details. Of said details, most differ to at least some degrees. But, those can be learned relatively quickly.

What takes longer, and is altogether more important, is actually understanding the problem. What are you solving and why, and what kind of results can you roughly expect.

And in that respect, there’s no substitute for hard-earned experience

Editors note

First of all, thank you Antti for sharing your thoughts on the matter with us! This is greatly appreciated.

I think that we both are starting a theme, that I really like: doing FEA is great, and not even that complicated if you get your head around it (but I know you know SO MUCH MORE on the math side that I do that it’s scary!). What is the most important part is the *understanding what you are trying to do and what to expect*! This is definitely the trick in advanced engineering, basically, regardless of the field, I think!

If you want to learn more about electromagnetic FEA definitely go to the Anttis blog!

If you are interested in the structural design, the best place to start is my FREE FEA course. You can get it by signing below:

10 FEA lessons I wish I knew a decade ago!

Join the course, don’t learn the hard way!

2 Comments

  1. Ivar KJELBERG November 6, 2019 at 2:15 pm - Reply

    Hi

    Nice blog again, a few comments from my experience:

    ACDC, as Structural, are the only two physics that requires full 3D to describe the equations correctly. Other “physics” like thermal or in general diffusion equations may generally have their equations separated per DoF and can be easily treated as 1D, or 2D or 3D models in full generality.
    In structural, the stiffness tensor couples stress in one direction, into strain in another direction (classical metals have a Poisson coefficient different from 0 or 0.5) which means that in 2D you must decide if you are using a plain strain or plain stress model for representing a 3D model of given thickness in 2D, these are for me the “fringe” effects of material in the middle of a part and the material at the edge, and influenced by the void at the boundary.

    In ACDC you have also different ways to represent the 3D in 2D or 2D-axi models via the Magnetic Potential or the fully coupled Maxwell equations the former requires often a gauge fixing point to stabilize the solver and make the solution unique. Here too in 2D one must take into account “fringe effects” or artifact due to a limits of a 2D model to produce a representative 3D model. Typically in ACDC 2D (X-Y plane) a current runs through the model plane (along Z), while the magnetic fields is expressed “in the 2D X-Y plane”.

    Second thing are the forces one like to extract from an ACDC model, these are somewhat like the stresses in structural, often calculated over as integrals over “smooth” boundaries and require quite some detailed mesh, and in particular do not like models with sharp corners where the gradient of the B field is not well defined. Hence has an impact on filleting corners and finer mesh.

    But as presented above, once one understands the principles of FEM (i.e. structural) then Multiphysics is not really that difficult, at least not with the modern tools we find today on the market.

    Sincerely
    Ivar

    • Łukasz Skotny November 7, 2019 at 9:00 am - Reply

      Thank you, Ivar for sharing your experience.

      All I can add here is, that it’s indeed incredible how powerfull tools are at our disposal. While this is definitely “crazy stuff” I’m not sure if understanding the principles of FEM in structural design would help me at all to do what Antti is doing. I mean sure, I know a lot of the “background stuff” that would help (as I wouldn’t have to learn them again). But I know next to nothing about engine design etc… and I feel that this is the critical knowledge. After all, it’s not only how to calculate stuff… it’s also why and what to calculate!

      But I know this is not precisely what you had in mind, and I agree that many things “overlap”.

      All the best
      Ł

Leave A Comment

Do NOT follow this link or you will be banned from the site!