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.
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.
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).
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.
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.
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.
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.
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
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: