Magnetic field with eddy currents 2d/3d

Numerical methods and mathematical models of Elmer
akirahinoshiro
Posts: 27
Joined: 13 Aug 2013, 16:50
Antispam: Yes

Magnetic field with eddy currents 2d/3d

Post by akirahinoshiro »

Hello,

I want to simulate eddy currents in the frequency domain.
I have a current driven coil and want to induct eddy currents in an aluminum bar.
Dependent of the bar (with defects or without) I want the frequency dependent magnetic field at a point in the middle of the coil.
Or to be specific I want to simulate eddy current testing.
Which solver do I have to use in 2d and which in 3d?
Are there any examples that match my problems?
I found the tests folder but have trouble to use them for my problems.
NickR7
Posts: 18
Joined: 29 Jul 2013, 18:03
Antispam: Yes

Re: Magnetic field with eddy currents 2d/3d

Post by NickR7 »

Here is a test case I made for 3D time domain eddy currents.

It is a conducting ring surrounding a solenoid with linearly increasing current.

I think you should be able to adapt it to frequency domain pretty easily as a next step.

You will, of course, need to convert the gmsh2 format mesh "solenoid_ring.msh" to elmergrid format, by typing
ElmerGrid 14 2 solenoid_ring.msh -autoclean
Attachments
solenoid_ring.zip
(407.31 KiB) Downloaded 724 times
millim
Posts: 39
Joined: 04 Apr 2012, 14:58
Antispam: Yes

Re: Magnetic field with eddy currents 2d/3d

Post by millim »

Hi,

Nick you may have right for simple geometries where one can find a simple mathematical rule for the body force in 3D. I tried to model the "Team7" eddy benchmark problem with Elmer (see GUI screenshot below) with no success. My working assumption was to define a inner cross-section of the coil winding body (copper body) and forcing a current density boundary on that. Elmersovler gave me just "trivial solution found" which proved me wrong.

Maybe you or one who is reading this has an idea how to force a current density on a cross section boundary in a closed body. I modeled the coil winging as two symmetrical halves connected together in order to get a defined cross-section between.


Br
Attachments
"Team7" eddy benchmark problem
"Team7" eddy benchmark problem
team7_benchmark.jpg (140.49 KiB) Viewed 12166 times
raback
Site Admin
Posts: 4843
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Magnetic field with eddy currents 2d/3d

Post by raback »

Hi

I guess the problem is that the computational coil seems like a closed loop so the current is difficult to induce physically. In reality this is of course not the case as the wires are not closed. Now the coil is also unisotropic in a way that the current should always be oriented with the wires. Assuming that the wire density is constant the only thing then needed to generate the current would be a geometrically defined vector field. I'm total novice in the subject. Anybody have any good ideas how such field could be generated?

-Peter
akirahinoshiro
Posts: 27
Joined: 13 Aug 2013, 16:50
Antispam: Yes

Re: Magnetic field with eddy currents 2d/3d

Post by akirahinoshiro »

I still have a problem with the whitney harmonic solver.
Elmer do not converge after adapting the solenoid sif file from nick.
The frequency and current are just any values to test.
Attachments
eddy.zip
(440.58 KiB) Downloaded 557 times
NickR7
Posts: 18
Joined: 29 Jul 2013, 18:03
Antispam: Yes

Re: Magnetic field with eddy currents 2d/3d

Post by NickR7 »

I looked briefly at the team7 thing.

I think whitneyav solver will not like splitting a driven coil up into pieces because at the cut edges you have div(j)->infinity, and for the solver you need div(j)=0 everywhere (which also means you can't account for capacitive effects). If splitting it up into pieces works for you... Let me know.

Specifying the "body force" for that squarish looking coil I think should be done with a piecewise function. (circular current at each corner, straight current along the edges). Have the coil centered at the origin, and the "if" statements will take the angle (like atan(y/x) - but take into account the quadrant too since atan only works for -pi/2<theta<pi/2).

So you'll need if statements and such - it will take several lines of code. As such, it will be best to implement the "body force" / current density functions with two fortran functions (one for Current Density 1, one for Current Density 2), and compiling them into a shared object library (or .dll if you are using windows).

It is "easy" to do: For example the following snippet from a sif file of mine loads the functions jx_oh1 and jx_oh2 from the file ./fortran/current_density.so to set my current density.

Body Force 1
Name = "OH1 Current Density"

Current Density 1 = Variable coordinate, time
Procedure "fortran/current_density" "jx_oh1"
Current Density 2 = Variable coordinate, time
Procedure "fortran/current_density" "jy_oh1"
End

the fortran function jx_oh1 looks like this:

FUNCTION jx_oh1(Model, node, tx) RESULT(jx)
USE DefUtils
IMPLICIT none
TYPE(Model_t) :: Model
real(kind=dp),parameter :: n=88,h=1.208,w=0.04
REAL(KIND=dp) :: jx, i, j,node, current_from_file
REAL(KIND=dp) :: tx(4)

i = -1.0*current_from_file(tx(4))
j = i/(w*h)*n
jx = -j*tx(2)/SQRT(tx(1)**2+tx(2)**2)
END

Also the only time I got ElmerSolver to say "trivial solution it is zero" or whatever was when I was accidently dividing by zero when specifying my current density.
millim
Posts: 39
Joined: 04 Apr 2012, 14:58
Antispam: Yes

Re: Magnetic field with eddy currents 2d/3d

Post by millim »

@akirahinoshiro

take:
Linear System Preconditioning = NONE
Linear System Iterative Method = BigStabl

then it works.
Br
akirahinoshiro
Posts: 27
Joined: 13 Aug 2013, 16:50
Antispam: Yes

Re: Magnetic field with eddy currents 2d/3d

Post by akirahinoshiro »

@millim

Thank you that solved the convergence problem. But the current definition was wrong too.
millim
Posts: 39
Joined: 04 Apr 2012, 14:58
Antispam: Yes

Re: Magnetic field with eddy currents 2d/3d

Post by millim »

In general I have difficulties understanding the "Electric Current Density" Boundary condition option of the AVsolver. My working assumption was based on a simple conductive wire body in 3D having 2 ends (for current entrance and exit): If I apply a Current Density on one of these ends, the solver would calculate the proper current density in the conductor since the propagation is function of the geometry, which proved me wrong. I am getting "Solution trivially zero"

Avoiding a math 3D representation of the current density inside the body, I normally use the statcurrentsolver doing this, and by setting:

Body Force 1
Name = "Conductor Current Density"
Current Density 1 = Equals Volume Current 1
Current Density 2 = Equals Volume Current 2
Current Density 3 = Equals Volume Current 3
End

gives proper definitions for the AVsolver after.

BR
akirahinoshiro
Posts: 27
Joined: 13 Aug 2013, 16:50
Antispam: Yes

Re: Magnetic field with eddy currents 2d/3d

Post by akirahinoshiro »

I defined it as a vector field like the example of Nick.
The note about the current is just for other people reading my example.
Could you explain why your definitions in linear system worked and mine not?

By the way the units are strange in my example you should change it to millimeter to get "real" values.
Post Reply