MgDyn2DHarmonic gives wrong magnetic field value

Clearly defined bug reports and their fixes
Post Reply
akuthi
Posts: 6
Joined: 09 May 2019, 01:53
Antispam: Yes

MgDyn2DHarmonic gives wrong magnetic field value

Post by akuthi »

I have used MgDyn2DHarmonic and MgDyn2Post to solve a simple toroid generated magnetic field on axis. It gives a value which is exactly 4e-7 times the actual (analytic) value. Maybe a corrupted mu0 = 4 pi 1e-7 is the cause? Or maybe I am missing something...
The real trouble is that it also corrupts the Joule heating and current density calculations, so it is now difficult to use it with thermal stuff as input.
Andy
Attachments
toroid.geo
the geometry file
(543 Bytes) Downloaded 323 times
case.sif
the solver input file
(3.56 KiB) Downloaded 339 times
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: MgDyn2DHarmonic gives wrong magnetic field value

Post by mzenker »

Hi,

the models manual says that mu0 is 4 pi 10^-7 by default. To be sure, you can set

Permeability of Vacuum = 12.566e-7

in the Constants section.

HTH,

Matthias
akuthi
Posts: 6
Joined: 09 May 2019, 01:53
Antispam: Yes

Re: MgDyn2DHarmonic gives wrong magnetic field value

Post by akuthi »

Thanks, Matthias!
The previously enclosed case.sif file has the extra constant defined as 12.56e-7, but it did not change anything, the model output axial B-field (and also the potential) is still incorrect, the solver - it seems - does not use the vacuum permeability constant! For now, I can just calculate the correct values by dividing the model output vector potential by the permeability, but how do I use it for input to the Heat module?

Andy
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: MgDyn2DHarmonic gives wrong magnetic field value

Post by mzenker »

Hmmm...
I don't have experience with this solver myself.
What I would do is look into the code, search for "Permeability of Vacuum" and try to understand if it is used or not.
Or hope that someone with more knowedge about this solver will take over... ;)

Matthias
akuthi
Posts: 6
Joined: 09 May 2019, 01:53
Antispam: Yes

Re: MgDyn2DHarmonic gives wrong magnetic field value

Post by akuthi »

Thanks, Matthias!
I don't think the solver uses the permeability at all, as I tried to change the relative permeability to the vacuum value to fool the solver, and it gave the same wrong value as before...It clearly did not care about the permeability at all.

I am not good enough to repair the code, so maybe another Horatio will stand in the gate...

Andy
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: MgDyn2DHarmonic gives wrong magnetic field value

Post by mzenker »

Peter, could you look into this...? :)
mika
Posts: 230
Joined: 15 Sep 2009, 07:44

Re: MgDyn2DHarmonic gives wrong magnetic field value

Post by mika »

Hi,

One thing might be that in the sif file a keyword "Permittivity of Vacuum" is given, while the solver reads "Permeability of Vacuum". So try to set

Permeability of Vacuum = 8.8542e-12

instead of

Permittivity of Vacuum = 8.8542e-12

I'd also change the variable declaration "Variable = Potential[Potential Re:1 Potential:1]" to be

Variable = Potential[Potential Re:1 Potential Im:1]

so that the BC definitions would be compatible with the variable definition.

-- Mika
akuthi
Posts: 6
Joined: 09 May 2019, 01:53
Antispam: Yes

Re: MgDyn2DHarmonic gives wrong magnetic field value

Post by akuthi »

Hi Mika,
Thanks for catching the potential variable definition error. It was generated by the ElmerGui. I have changed to correct the potential Im:1, and added the extra permeability of Vacuum = 12.56e-7 to the constants section. Result: zero change to the output magnetic field and potential... So this is not the main cause of the wrong field/vector potential generated.

Andy
akuthi
Posts: 6
Joined: 09 May 2019, 01:53
Antispam: Yes

Re: MgDyn2DHarmonic gives wrong magnetic field value

Post by akuthi »

Additional info: It seems that the conductivity gets multiplied by mu and muvacuum, correctly, (the skin depth does scale correctly with mu) but the source current density instead of mu * muvacuum gets multiplied by muvacuum squared, thus the giant error in the computed field on axis. The system can be fooled by dividing the source current density in the sif file by muvacuum and multiplying it by mu. I have not checked the calculated joule heat yet, so this may fail...
will do some more sleuthing, but I can't fix it because I don't know how to recompile the solver with the fixed multiplications...

Andy
mika
Posts: 230
Joined: 15 Sep 2009, 07:44

Re: MgDyn2DHarmonic gives wrong magnetic field value

Post by mika »

Hi again,

I believe the model should be set up such that in an inductor (the source part of the model) the magnetic induction B satisfies curl(nu*B) = J, with J being the given source. To achieve this, the electrical conductivity should thus be specified to be zero in the inductor, although the prescribed source is a manifestation of the electrical conductivity. In regions which do not represent sources (none here) the electrical conductivity may be specified normally as a physical property.

So I'd suggest that you set "Electric Conductivity = 0.0" for the material which describes the coil in order to get the equations right. In addition, I think that a right symmetry BC on the axis would be the homogeneous natural BC. That is, for this part nothing needs to be specified in the sif file, so I'd remove the Dirichlet BCs on the axis.

I need to say that at the moment the solver doesn't superimpose the source current density to the current density that is generated by the postprocessing routine.

Best regards,
Mika
Post Reply