Closed coil with core simulation

Numerical methods and mathematical models of Elmer
ftrillaudp
Posts: 42
Joined: 23 May 2012, 05:26
Antispam: Yes

Re: Closed coil with core simulation

Post by ftrillaudp »

Dear Kevin,

It does compute without warning or errors. However, here is the expected result obtained with Onelab (http://onelab.info). It provides a reasonable magnetic flux density of 0.13 T (attached to this post). Elmer gives a result that is way too small of 1.7e-5 T which arises from the small value of magnetic strength. More intriguing is the fact that the magnitude of both B and H does not change even though I change the current density. IThe results are from a linear case for which I set:

Material 3
Name = "Iron"
Relative Permeability = 1.0 !instead of 1000.0
Relative Permittivity = 1.0
End

Something is definitively off.

Elmer Version 8.4 on Ubuntu 18.04LTS from PPA.

Onelab:
magneticVectorPotential.png
(795.47 KiB) Not downloaded yet
Elmer:
magneticFluxDensityElmer.png
(187.88 KiB) Not downloaded yet
Best,

Frederic
ftrillaudp
Posts: 42
Joined: 23 May 2012, 05:26
Antispam: Yes

Re: Closed coil with core simulation

Post by ftrillaudp »

An error in printing out the result of Onelab. Here comes the scale.
magneticFluxdensityOnelab.png
(683.3 KiB) Not downloaded yet
raback
Site Admin
Posts: 4828
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Closed coil with core simulation

Post by raback »

Hi

There was a problem. It seems that the normalization of the current to desired current density was not applied in combination with elemental current density. Other ways of defining the amplitude did work, and also the nodal current density worked. You could see this looking at the amplitude of both currents. Of course the results were then also quite a bit off. Sorry for this!

There is a fix now in CoilSolver.F90

You can wait for a new build or just copy this one file from GitHub and compile it with: elmerf90 -o CoilSolver.so CoilSolver.F90

After the fix there seems to be agreement with OneLab.

-Peter
ftrillaudp
Posts: 42
Joined: 23 May 2012, 05:26
Antispam: Yes

Re: Closed coil with core simulation

Post by ftrillaudp »

Dear Peter,

Thanks for the corrected file. I will try to compile it until a new built is available. I will post the results of the test in the post.

Best regards,

Frederic
ftrillaudp
Posts: 42
Joined: 23 May 2012, 05:26
Antispam: Yes

Re: Closed coil with core simulation

Post by ftrillaudp »

Dear all,

I have compiled the GiHub CoilSolver.F90 patched solver as recommended by Peter into my elmerfem installation in Ubuntu 18.04LTS (Elmer version 8.4). Here is the result which responds as expected with the change of current density. Disregarding some peak magnetic flux densities, it is the magnitude expected for the linear case study given in the previous exchanges.

Best,

Frederic
Attachments
magneticFluxDensityElmer.png
new run with patched CoilSolver.F90
(228.55 KiB) Not downloaded yet
ftrillaudp
Posts: 42
Joined: 23 May 2012, 05:26
Antispam: Yes

Re: Closed coil with core simulation

Post by ftrillaudp »

Dear all,

Moving forward with the model. I have implemented a H-B curve for the iron part. I am experiencing some issues and as previously I am stuck.
Elmer's result is a too large by an order of magnitude (31 T on the coil). Same as the linear case, I have benchmarked with Onelab. I am expecting for a current density of 1e8 A/m^2, a peak magnetic flux density of the order of 2.15 T (same B-H table used in Onelab).

If someone has some idea what I did wrong or missed.

I have joined the full model.

Best,

Frederic

Header
CHECK KEYWORDS Warn
Mesh DB "." "assembly"
Results Directory "Results"
End

Simulation
Coordinate System = "Cartesian 3D"
Coordinate Mapping(3) = 1 2 3

Simulation Type = Steady
Steady State Max Iterations = 1

Max Output Level = 6
End

Constants
Gravity(4) = 0 0 -1 9.82
Stefan Boltzmann = 5.67e-08
Permittivity of Vacuum = 8.8542e-12
Boltzmann Constant = 1.3807e-23
Unit Charge = 1.602e-19
End

! -- BODIES --
Body 1
Name = "SOL001"
Target Bodies(1) = 1
Equation = 2
Material = 1
Body Force = 1
End

Body 2
Name = "SOL002"
Target Bodies(1) = 2
Equation = 1
Material = 3
End

Body 3
Name = "SOL003"
Target Bodies(1) = 3
Equation = 1
Material = 2
End

! -- MATERIAL PROPERTIES --
Material 1
Name = "Conductor"
Relative Permeability = 1.0
Relative Permittivity = 1.0
Electric Conductivity = 1.0
End

Material 2
Name = "Air"
Relative Permeability = 1.0
Relative Permittivity = 1.0
End

Material 3
Name = "Iron"
Relative Permeability = 1.0
!Relative Permittivity = 1.0

H-B Curve = Variable "dummy"
Real Cubic Monotone
INCLUDE HB_2.dat
End
End

! -- COMPONENTS --
Component 1
Name = String "Coil1"
Coil Type = String "test"
Master Bodies(1) = Integer 1
Desired Current Density = Real -1e8
End

! -- BODY FORCE --
Body Force 1
Name = "Source"
Current Density 1 = Equals "CoilCurrent e 1"
Current Density 2 = Equals "CoilCurrent e 2"
Current Density 3 = Equals "CoilCurrent e 3"
End

!-- BOUNDARY CONDITIONS --
Boundary Condition 1
Name = "FAC003"
Target Boundaries(1) = 6
AV {e} = real 0
AV = real 0
Jfix = real 0.0
End

!-- EQUATIONS --
Equation 1
Name = "MGDyn for air/iron"
Active Solvers(2) = 2 3 5
End

Equation 2
Name = "MGDyn for coils"
Active Solvers(3) = 1 2 3
End

!-- SOLVERS --
Solver 1
Equation = "CoilSolver"

Procedure = "CoilSolver" "CoilSolver"

Linear System Solver = "Iterative"
Linear System Preconditioning = ILU1
Linear System Max Iterations = 1000
Linear System Convergence Tolerance = 1e-10
Linear System Iterative Method = BiCGStab
Linear System Residual Output = 10
Steady State Convergence Tolerance = 1e-06

Normalize Coil Current = Logical True
Nonlinear System Consistent Norm = Logical True
Coil Closed = Logical True
Narrow Interface = Logical True
Save Coil Set = Logical True
Save Coil Index = Logical True
Calculate Elemental Fields = Logical True

!Coil Center(3) = Real ...
Coil Normal(3) = Real 0. 0. 1.
End

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

Fix Input Current density = True

Steady State Convergence Tolerance = 1.0e-5
Nonlinear System Max Iterations = 1

Linear System Solver = iterative
Linear System Iterative Method = BiCGStabl

Linear System GCR Restart = 100
BiCGStabl Polynomial Degree = 6
Idrs Parameter = Integer 6

Linear System Robust = Logical True

Linear System Max Iterations = 1000
Linear System Convergence Tolerance = 1.0e-8
Linear System Preconditioning = none
Linear System Residual Output = 1
Linear System Abort Not Converged = False

Linear System Row Equilibration = Logical True
Nonlinear System Consistent Norm = Logical True

Jfix: Linear System Solver = Iterative
Jfix: Linear System Iterative Method = bicgstab
Jfix: Linear System Preconditioning = ILU1
Jfix: Linear System Convergence Tolerance = 1.0e-10
Jfix: Linear System Max Iterations = 5000
Jfix: Linear System Residual Output = 100
Jfix: Linear System Abort Not Converged = False
Jfix: Linear System Precondition Recompute = 1
Jfix: Optimize Bandwidth = True
End

Solver 3
Equation = MGDynamicsCalc
Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
Potential Variable = String "AV"

Steady State Convergence Tolerance = 1.0e-5
Nonlinear System Convergence Tolerance = 1.0e-8
Nonlinear System Max Iterations = 100
Nonlinear System Newton After Iterations = 10
Nonlinear System Newton After Tolerance = 1.0e-3
Nonlinear System Relaxation Factor = 1

Linear System Solver = Iterative
Linear System Symmetric = True
Linear System Iterative Method = CG
Linear System Max Iterations = 5000
Linear System Convergence Tolerance = 1.0e-8
Linear System Preconditioning = ILU0
Linear System ILUT Tolerance = 1.0e-3
Linear System Abort Not Converged = False
Linear System Residual Output = 1
Linear System Precondition Recompute = 1

Nonlinear System Consistent Norm = Logical True
Discontinuous Bodies = True

Calculate Current Density = True
Calculate Magnetic Field Strength = True
Calculate Maxwell Stress = True
Calculate Elemental Fields = True
End

Solver 4
Exec Solver = after all
Equation = "ResultOutput"
Procedure = "ResultOutputSolve" "ResultOutputSolver"
Output File Name = case
Vtu format = Logical True
Binary Output = True
Discontinuous Bodies = Logical True
Save Geometry Ids = True
End

Solver 5
Name = "SaveDep"
Procedure = "SaveData" "SaveDependence"
Filename = depHB.dat
Lower Limit = Real 0.0
Upper Limit = Real 800000
Number of Points = Integer 100
Expression 1 = Variable "dummy"
Real Cubic Monotone
include HB_2.dat
End
End
Attachments
ShareNL.zip
(778.24 KiB) Downloaded 252 times
raback
Site Admin
Posts: 4828
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Closed coil with core simulation

Post by raback »

Hi

Solver 2 is now nonlinear where as Solver 3 is always linear. So swapping their nonlinear system keywords might be useful.

-Peter
ftrillaudp
Posts: 42
Joined: 23 May 2012, 05:26
Antispam: Yes

Re: Closed coil with core simulation

Post by ftrillaudp »

Dear Peter,

I did not pay attention indeed. I have fixed the nonlinear parameters in the solver 2. I have attached the files for anyone to use as example.

Best,

Frederic
Attachments
ShareNL.zip
(777.46 KiB) Downloaded 313 times
raback
Site Admin
Posts: 4828
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Closed coil with core simulation

Post by raback »

Hi Frederic,

Thanx for taking the effort! This is a nice example. Devil often lies in the detail. Resolving the small details will make the software more widely usable.

-Peter
ftrillaudp
Posts: 42
Joined: 23 May 2012, 05:26
Antispam: Yes

Re: Closed coil with core simulation

Post by ftrillaudp »

Dear Peter and all,

To definitively close the post, I have a question regarding the post-processing. When the the vtu files are generated from steady-state model, several files are actually created and some of them seems not to hold any results. Is it due to the use of iterative solvers?

In fact, it is not clear to me what it means and therefore which results are actually the correct ones. I have not found any answer on the web :ugeek:

Best regards,

Frederic
Post Reply