Magnetic solver convergence criteria

Numerical methods and mathematical models of Elmer
Post Reply
evantandersen
Posts: 6
Joined: 20 Dec 2020, 18:50
Antispam: Yes

Magnetic solver convergence criteria

Post by evantandersen »

It's my first time using Elmer (or any FEM software)! I'm working on a 2d linear motor (also called planar motor). I'm trying to setup a simulation of a section of the stator. I was able to use the static current solver to find a solution for potential that aligns with the analytical result:

Image
(I've just turned on a single piece of wire right now, for simplicity)

However, when I try to add the magnetic solver, I've been unable to get it to converge. At first, I was using a potential body force, but that caused the solver to hover around an error magnitude of E+04. After reading some posts on this forum, I tried using current density instead. This improved the situation somewhat, as the solver seems to initially head in the right direction, reducing the error through each iteration. However, after a while, the error started to grow again, eventually reaching E+10. I then slightly lowered the convergence threshold, and it stopped the first stage after getting to E-11. Now it has a huge error that only grows on the second stage:

Code: Select all

OptimizeBandwidth: ---------------------------------------------------------
      20 0.3214E-01
      40 0.1895E-02
      60 0.3168E-03
      80 0.1910E-04
     100 0.9439E-05
     120 0.4633E-06
     140 0.1555E-07
     160 0.2175E-08
     180 0.2919E-08
     200 0.5198E-10
     204 0.7313E-11
MGDynAssembly: Elapsed REAL time:    10.2464 (s)
      10 0.1001E+02
      20 0.4629E+02
      30 0.1824E+03
      40 0.6690E+03
      50 0.4272E+04
      60 0.1441E+05
I noticed when using the statCurrentSolver that if I gave it something not physically possible (such as a body with a set of boundary currents not totalling 0) it diverged. Are there similar rules that have to be followed regarding the magnetic solver? Do the currents appearing out of the ether at the boundary cause a problem? That seems non-physical.

I want to understand what's going wrong here so I'll be able to debug further problems as the model complexity grows (adding the other currents, and a permanent magnet secondary).
Attachments
manualCase.sif
(5.64 KiB) Downloaded 157 times
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Magnetic solver convergence criteria

Post by raback »

Hi

Quickly looking at the sif file: you should at least solve the equations in correct order. The static current conduction before AV solver. Slightly difficult to track the problem looking at the sif file only.

Generally the challenge with the current source is that the source should be divergence free since otherwise the system cannot mathematically have a solution. For this reason you will find a lot of disccussion about Jfix etc. What is somewhat suspicious is that you computational domain seems not to extend too much beyond the conductors. The magnetic field should be given some free volume to die out.

-Peter
evantandersen
Posts: 6
Joined: 20 Dec 2020, 18:50
Antispam: Yes

Re: Magnetic solver convergence criteria

Post by evantandersen »

The air body is 3 times the size of the model, centred around it. I didn't have it displayed in the screenshot.

What is the ordering of the solvers? I thought they are running the correct order! In the sif file, Solver 1 is static current, solver 2 is magDyn. Then there is "Active Solvers(2) = 1 2" Is that not what determines the order?


And right, divergence of current makes it unsolvable. My design appears to have divergent current? I created the current using a boundary condition on the face of the conductor (and an opposite magnitude on the other end). How can the current be created without it being divergent? It can only be a loop? Will it count as divergent if the source is an edge of the simulation?

Perhaps I should model the return path for the current, and then have a single boundary condition that pushes a current through that loop instead?
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Magnetic solver convergence criteria

Post by raback »

Hi

Sorry, I checked the numbering too quickly. ElmerGUI writes them in unintuitive order which fooled me. It is ok.

The Jfix field should be able to take care of it if properly solved. Also you could try to set the "AV {e}" to zero at the ends of the current source.

There are 20 tests fixing the input current, maybe you get some inspiration from them

Code: Select all

elmeruser@elmeruser-VirtualBox:~/elmerfem/fem/tests$ grep -i 'fix input current density' */*.sif  | grep -i true | wc -l
20
-Peter
Post Reply