## Defining coils currents / five coils example

Numerical methods and mathematical models of Elmer
raback
Posts: 3880
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Defining coils currents / five coils example

Hi All,

There are multiple ways in Elmer to define coil currents in hierarchical simulations for the Whitney AV solver to compute magnetic fields. Basically one can give "Current Density i", i=1,2,3 or "Electric Potential" which is used to internally compute the current sources in the AV solver.

Now the caveat of the given source is that they must be divergence free. Elmer has built-in automated logic to do this but it only works for the given current density, not for the potential. To control the fixing there is the keyword

Code: Select all

``````  Fix Input Current density = True
``````
Since quite recently there is a possibility to also compute elemental fields of current density. These basically utilize the discontinuous galerkin features of Elmer where each nodal value is independent between elements. This avoids the intermediate and unnecessary projection to nodes and seems to be very beneficial for the convergence of the linear system of the vector potential.

Attached is a simple case with five coils (including geo file for netgen). The coil currents are generated automatically to the coil solver. Of all the choices the elemental currents works the best by far

Code: Select all

``````  Current Density 1 = Equals "CoilCurrent e 1"
Current Density 2 = Equals "CoilCurrent e 2"
Current Density 3 = Equals "CoilCurrent e 3"
``````
The nodal values are not nearly as good

Code: Select all

``````  Current Density 1 = Equals "CoilCurrent 1"
Current Density 2 = Equals "CoilCurrent 2"
Current Density 3 = Equals "CoilCurrent 3"
``````
Nor is the built-in function that returns the potential

Code: Select all

``````  Electric Potential = Variable "time"
Real Procedure "CoilSolver" "CoilPotentialNormalized"
``````
To conclude, if you precompute currents use the elemental ones, and set Jfix true if the currents are not divergence free.

-Peter
Attachments
fivecoils.sif
command file for ElmerSolver
figure of magnetic flux density in Paraview
FiveCoilsMagVec_960x512.jpg (167.43 KiB) Viewed 3040 times
fivecoils.geo
geometry file for Netgen -> export in Elmer format
ftrillaudp
Posts: 32
Joined: 23 May 2012, 05:26
Antispam: Yes

### Re: Defining coils currents / five coils example

Dear Peter,

I have tried to apply your example to 2 racetrack-shaped coils on iron support. The current density is impressed into the coils. Actually, I do not understand how to build the current density in the coil and I have just copied your example. Especially, I did not grasp the Body Force for the coil: ".. CoilCurrent e 1", etc....

The geometry and mesh were built in Salome platform, exported via *.unv using ElmerGrid (ElmerGrig 8 2 assembly.unv).

The current density is not as expected. I would definitively appreciate some guidance here.

I have attached the geometry and the case.sif files to this post.

Best regards,

Frederic
Attachments
Shared.zip
ftrillaudp
Posts: 32
Joined: 23 May 2012, 05:26
Antispam: Yes

### Re: Defining coils currents / five coils example

Dear all,

See solved post for coil + iron core: viewtopic.php?f=3&t=6954

Best,

Frederic