## Integration of current density in 2D Axi symmetric steady state to obtain current in circular wire

Numerical methods and mathematical models of Elmer
FFF
Posts: 7
Joined: 11 Jun 2021, 11:00
Antispam: Yes

### Integration of current density in 2D Axi symmetric steady state to obtain current in circular wire

Hello Elmer community,

I want to integrate the current density over a wire's cross section in a steady state 2Daxi simulation.

To do so, I followed the following post:
viewtopic.php?f=3&t=7521&hilit=boundary+integrals
Unfortunately I don’t get results.

In the name output of savescalars, the boundary integral is listed but the magnitude is zero.

I work on windows and use Version: 9.0 (Rev: Release, Compiled: 2021-06-15)

Could anybody be so kind and have a look at my case?
current2Daxis.zip
current2Daxis.sif
current2Daxis.msh
Your help would be much appreciated.

Felix
raback
Posts: 4173
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: Integration of current density in 2D Axi symmetric steady state to obtain current in circular wire

Hi Felix,

Did you use the last setup as verified by laurent on May 31st in that thread? I see some small differences in the SaveScalars operation.

-Peter
FFF
Posts: 7
Joined: 11 Jun 2021, 11:00
Antispam: Yes

### Re: Integration of current density in 2D Axi symmetric steady state to obtain current in circular wire

Hi Peter,

Yes, as far as I see it is pretty equal. Please see my code below:

Code: Select all

``````Solver 2
Equation = MgDynPost
Calculate Magnetic Field Strength = True
Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
Potential Variable = String "Potential"

Calculate Nodal Fields = False
Calculate Elemental Fields = True
Calculate Nodal Forces = True

Calculate Magnetic Field Strength = True
Calculate Electric Field = True
Calculate Current Density = True

End

Solver 3
Exec Solver = After All
Equation = SaveScalars
Procedure = "SaveData" "SaveScalars"
Filename = "data2d.dat"
Save Component Results = logical true
File Append = Logical True
Variable 1 = current density e
Operator 1 = boundary int

End

Boundary Condition 3
Target Boundaries(1) = 1
Name = "excitation"
!save scalars = Logical True
curr=logical true
End``````

As you can see I use the command

Code: Select all

``Mask Name 1= curr``
I also tested it with

Code: Select all

``save scalars = Logical True``
But in both versions the numerical output is zero.

What is diffrernt from laurent, is that I use

Code: Select all

``````Body Force 1
Current Density = 828736! J=1.1 A / (pi* rW^2) -> Radius of Wire -> rW=0.65e-3
! curr=logical true
!Save Scalars = Logical True
End``````
But when I enable Save Scalars or curr there is no output (dat.names) at all.

Any ideas what went wrong?

Best regards,

Felix
Rich_B
Posts: 53
Joined: 24 Aug 2009, 20:18

### Re: Integration of current density in 2D Axi symmetric steady state to obtain current in circular wire

Thanks, Rich.
FFF
Posts: 7
Joined: 11 Jun 2021, 11:00
Antispam: Yes

### Re: Integration of current density in 2D Axi symmetric steady state to obtain current in circular wire

Hi Rich,

sure!
solver.log
I am suspicious about the following line:

Code: Select all

``CheckKeyword:  Unlisted keyword: [curr] in section: [boundary condition 3]``
but when I skip the command of mask name 1 in SaveScalars

and implement the following:

Code: Select all

``````Boundary Condition 3
Target Boundaries(1) = 1
Name = "excitation"
save scalars = Logical True
!  curr=logical true
End``````
The numerical output is still empty.

Can you see something else form solver.log?

I would highly appreciate if you could have a look.
Rich_B
Posts: 53
Joined: 24 Aug 2009, 20:18

### Re: Integration of current density in 2D Axi symmetric steady state to obtain current in circular wire

This post viewtopic.php?f=9&t=4114 shows how you found a way to integrate the current density over a surface using Paraview. Nicely done!

It seems that SaveScalars and SaveLine aren't suited to provide results over a surface in 2D? One could select a boundary, such as the circle outlining the conductor, which in your case sums to zero since no current crosses the circle. In this 2D case, selecting the body (the conductor) would provide a surface to integrate over, but when you tried to add 'save scalars' to the body, it didn't work. Maybe someone who knows more about the inner workings of SaveScalars and SaveLine could shed some light on this topic?

Rich.
FFF
Posts: 7
Joined: 11 Jun 2021, 11:00
Antispam: Yes

### Re: Integration of current density in 2D Axi symmetric steady state to obtain current in circular wire

Hi all,

Yes in Paraview i get plausible results:)

I did some further tests with the integration of the B-field of the enclosing air.

IntegrateB-Field2Daxi.png
I get some values of the B-Field integration where the Flux = 9.0E-008
(see fluxdata2d.dat.names and fluxdata2d.dat of
2DaxiFlux.zip
)

I believe the must be multiplied by 2*pi

Hence the result is around 5.6e-07

The energy of the 2Daxi simulation is around 3.6E-009*2*pi=2.2619e-08 J

The integration of the current density is still zero. I included the solver.log with a Max Output Level = 32

1. I have no clue why this is the case for the integration of current density. Does anybody know?

I did an equal integration of the B-field with the 3D case.
3dFlux.zip
The mesh is too big to upload it here. Hence, I provide the .hdf of Salome. You can compute the mesh there and export it to .unv

Then use the command:

Code: Select all

``elmergrid 8 2 Mesh_1.unv``
in the Command Prompt of Windows

If you want to compare the Boundary Numbers of the mesh with the sif use the command

Code: Select all

``elmergrid 8 4 Mesh_1.unv``
in the Command Prompt of Windows and observe it in gmsh.

In 3D case, the simulated flux is 4.22E-008 Wb

I had the chance to simulate this also in comsol and get an equal result of 4.23E-8 Wb

2. Why do I have the deviation in the 2D case?

The energy in the 3D case is similar to the 2Daxi case of elmer with around 2.3E-008 J

In 3D I also get an eddy current power of around 1.02E-003

3. Shouldn’t the eddy current power be zero for a stationary simulation?

I highly appreciate if somebody could have a look at my simulations and/or provide an answer to my 3 questions above.

Felix
FFF
Posts: 7
Joined: 11 Jun 2021, 11:00
Antispam: Yes

### Re: Integration of current density in 2D Axi symmetric steady state to obtain current in circular wire

Hi everybody,

I found the answer to my Question 2 of my previous post.

The problem was the mesh resolution of the edge. See the picture of my changes.
Now I get a coinciding flux of 4.44E-008 Wb

Here you have the updated simulation file with the integration of the Bfield only.
Circular2Daxi_FluxIntegration.zip
The eddy current power (Question 3) changed back to 0.
Does anybody has further information how eddy current power did appear in the first place?

How to conduct the integration of the current density in the 2Daxi case (Question 1 from previous post) remains still a mystery to me.

I appreciate any hints!

Best regards!

Felix
raback
Posts: 4173
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: Integration of current density in 2D Axi symmetric steady state to obtain current in circular wire

Hi Felix,

There is nothing to worry about the code not finding "curr". It was just a temporal tag that we know to look for because we given the same in "mask name 1". This way we can refer to the boundaries where we want to operate in.

If you follow my example, the possible problems are:

1) Too old version of code
2) You try to integrate over wrong or non-existing boundary
3) The variable you're interested in does not exist.

You could also try with variable "current density" (without the "e").

The coordinate system should be accounted for in the integration.

-Peter