## Mgdyn shows ~20% of expected flux through a surface

Numerical methods and mathematical models of Elmer
mkloter
Posts: 1
Joined: 15 May 2018, 18:06
Antispam: Yes

### Mgdyn shows ~20% of expected flux through a surface

I am attempting to use the mgdyn solver to determine the inductance (dc) of an arbitrary structure in 3d via I have created two basic hand solvable test geometry's, a wire loop and parallel wire to test my understanding of the solver. With each geometry I only see approximately 42% of the expected inductance which stems from an incorrect total flux. The simulated current density (and by extension total current used in the above formula) always matches hand calculations. I have tried stimulating through boundary and body force cases. I am post processing through paraview and calculating flux with the surface flow filter (Integrate filter gives same answer) through an extracted surface. I have also visually inspected the flux field orientation of the entire simulation and extracted surface areas to make sure they are as expected.

Am I defining my Dirichlet conditions incorrectly?
Am I deriving the total flux density incorrectly in paraview?
Am I over/under constraining something?

The attached images show:
-Parallel wire geometry
-Parallel wire extracted plane an integration area for flux
-Parallel wire flux field
-Loop geometry

Sif for parallel wire boundary stimulation

Code: Select all

``````Check Keywords "Warn"

Mesh DB "."
End

Simulation
Max Output Level = 5
Coordinate System = "Cartesian"
Steady State Max Iterations = 1
Output Intervals(1) = 1

!Coordinate Scaling = 1.0e-3
End

Constants
Gravity(4)             = 0 0 -1 9.81 ! N            | m s^-2
Stefan Boltzmann       = 5.67e-08    ! W m^-2 °K^-4 | kg s^-3 °K^-4
Permittivity of Vacuum = 8.8542e-12  ! F m^-1       | A^2 s^4 kg^-1 m^-3
Permeability of Vacuum = 1.2566e-6   ! H m^-1       | kg m s^-2 A^-2
Boltzmann Constant     = 1.3807e-23  ! J °K^-1      | m^2 kg s^-2 °K^-1
Unit Charge            = 1.602e-19   ! C            | A s
End

Body 1
Name = "Wire1"
Equation = 1
Material = 1
End

Body 2
Name = "Air"
Equation = 1
Material = 2
End

Body 3
Name = "Wire2"
Equation = 1
Material = 1
End

Material 1
Name = "Cu"
Relative Permittivity = 1
Relative Permeability = 1
Electric Conductivity = 58e6
End

Material 2
Name = "Air"
Relative Permittivity = 1.0
Relative Permeability = 1.0
Electric Conductivity = 0.0
End

Equation 1
Active Solvers(2) = 1 2
End

Solver 1
Equation = "MGDynamics"
Variable = "AV"
Procedure = "MagnetoDynamics" "WhitneyAVSolver"

Element = n:1 e:1

Fix Input Current density = Logical  True

Automated Source Projection BCs = Logical False

Linear System Symmetric = True
Linear System Solver = "Iterative"
Linear System Preconditioning = none
Linear System Residual Output = 50
Linear System Max Iterations = 1000
Linear System Iterative Method = GCR
Linear System Convergence Tolerance = 1.0e-5
BicgStabl Polynomial Degree = 4
Linear System Abort Not Converged = False
End

Solver 2
Equation = "MGDynamicsCalc"

Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
Linear System Symmetric = True

Potential Variable = String "AV"

Calculate Current Density = Logical True
Calculate Electric Field = Logical True
Calculate Magnetic Field Strength = Logical True
Calculate Joule Heating = True

Steady State Convergence Tolerance = 0
Linear System Solver = "Iterative"
Linear System Preconditioning = None
Linear System Residual Output = 0
Linear System Max Iterations = 2000
Linear System Iterative Method = CG
Linear System Convergence Tolerance = 1.0e-8

Calculate Nodal Fields = Logical False
Impose Body Force Potential = Logical True
Impose Body Force Current = Logical True

Discontinuous Bodies = True
End

Solver 3
Exec Solver = after all
Equation = "ResultOutput"
Procedure = "ResultOutputSolve" "ResultOutputSolver"
Output File Name = inductor
Vtu format = Logical True
Discontinuous Bodies = Logical True
End

Boundary Condition 1
Name = "WireStart"
Target Boundaries(1) = 1

!Coil Start = Logical True

!AV {e} 1 = Real 0.0
!AV {e} 2 = Real 0.0
!AV {e} 3 = Real 0.0
!AV = Real 10e-3

Electric Current Density = Real 3.18e3

End

Boundary Condition 2
Name = "WireEnd"
Target Boundaries(3) = 2 6 7

!Coil End = Logical True

AV {e} = Real 0.0

!Electric Current Density = Real 125e3

AV = Real 0
End

Boundary Condition 3
Name = "Torus_surface"
Target Boundaries(1) = 4 !Surface 3&5 are wire boundaries

AV {e} = Real 0.0

End

``````
Sif for parallel wire body force stimulation

Code: Select all

``````Check Keywords "Warn"

Mesh DB "."
End

Simulation
Max Output Level = 5
Coordinate System = "Cartesian"
Steady State Max Iterations = 1
Output Intervals(1) = 1

!Coordinate Scaling = 1.0e-3
End

Constants
Gravity(4)             = 0 0 -1 9.81 ! N            | m s^-2
Stefan Boltzmann       = 5.67e-08    ! W m^-2 °K^-4 | kg s^-3 °K^-4
Permittivity of Vacuum = 8.8542e-12  ! F m^-1       | A^2 s^4 kg^-1 m^-3
Permeability of Vacuum = 1.2566e-6   ! H m^-1       | kg m s^-2 A^-2
Boltzmann Constant     = 1.3807e-23  ! J °K^-1      | m^2 kg s^-2 °K^-1
Unit Charge            = 1.602e-19   ! C            | A s
End

Body 1
Name = "Wire1"
Equation = 1
Material = 1
Body Force = 1
End

Body 2
Name = "Air"
Equation = 1
Material = 2
End

Body 3
Name = "Wire2"
Equation = 1
Material = 1
End

Material 1
Name = "Cu"
Relative Permittivity = 1
Relative Permeability = 1
Electric Conductivity = 58e6
End

Material 2
Name = "Air"
Relative Permittivity = 1.0
Relative Permeability = 1.0
Electric Conductivity = 0.0
End

Equation 1
Active Solvers(2) = 1 2
End

Solver 1
Equation = "MGDynamics"
Variable = "AV"
Procedure = "MagnetoDynamics" "WhitneyAVSolver"

Element = n:1 e:1

Fix Input Current density = Logical  True

Automated Source Projection BCs = Logical False

Linear System Symmetric = True
Linear System Solver = "Iterative"
Linear System Preconditioning = none
Linear System Residual Output = 50
Linear System Max Iterations = 1000
Linear System Iterative Method = GCR
Linear System Convergence Tolerance = 1.0e-5
BicgStabl Polynomial Degree = 4
Linear System Abort Not Converged = False
End

Solver 2
Equation = "MGDynamicsCalc"

Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
Linear System Symmetric = True

Potential Variable = String "AV"

Calculate Current Density = Logical True
Calculate Electric Field = Logical True
Calculate Magnetic Field Strength = Logical True
Calculate Joule Heating = True

Steady State Convergence Tolerance = 0
Linear System Solver = "Iterative"
Linear System Preconditioning = None
Linear System Residual Output = 0
Linear System Max Iterations = 2000
Linear System Iterative Method = CG
Linear System Convergence Tolerance = 1.0e-8

Calculate Nodal Fields = Logical False
Impose Body Force Potential = Logical True
Impose Body Force Current = Logical True

Discontinuous Bodies = True
End

Solver 3
Exec Solver = after all
Equation = "ResultOutput"
Procedure = "ResultOutputSolve" "ResultOutputSolver"
Output File Name = inductor
Vtu format = Logical True
Discontinuous Bodies = Logical True
End

Body Force 1
Name = "Current"
Current Density 3 = real 150e3
End

Boundary Condition 1
Name = "Farfield"
Target Boundaries(1) = 3 4 5 !Surface 3&5 are wire boundaries
AV {e} = Real 0.0

End

``````
Thanks everyone,
Mike
Attachments
Capture.PNG

Takala
Posts: 183
Joined: 23 Aug 2009, 23:59

### Re: Mgdyn shows ~20% of expected flux through a surface

Hi Mike,

you could try to compute the average flux through some surface by defining a keyword in a boundary section:

Code: Select all

``````Boundary 1
Name = "Boundary where flux is computed"
Target Boundaries(1) = \$ flux_boundary
Magnetic Flux Average = Logical True
End
``````
Another way to compute inductance is via energy. In fact, if I remember correctly,
Elmer does report the total magnetic field energy. I would advice to do all the computations
always in Elmer and only the visualization in Paraview.

You should also remember the fact that the A-formulation naturally gives too low inductance
and too low magnetic energy. You get closer to the correct result by increasing the number of elements.

BR,

Eelis