### Defining coils currents / five coils example

Posted:

**18 Jan 2019, 12:47**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
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
The nodal values are not nearly as good
Nor is the built-in function that returns the potential
To conclude, if you precompute currents use the elemental ones, and set Jfix true if the currents are not divergence free.

-Peter

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
```

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"
```

Code: Select all

```
Current Density 1 = Equals "CoilCurrent 1"
Current Density 2 = Equals "CoilCurrent 2"
Current Density 3 = Equals "CoilCurrent 3"
```

Code: Select all

```
Electric Potential = Variable "time"
Real Procedure "CoilSolver" "CoilPotentialNormalized"
```

-Peter