2D magnet simulation - unphysical results

General discussion about Elmer
Post Reply
gcoopermax
Posts: 2
Joined: 23 Sep 2019, 19:04
Antispam: Yes

2D magnet simulation - unphysical results

Post by gcoopermax »

I have been trying to simulate a simple 2D magnet and I referred horseshoe magnet tutorial for this, however while the horseshoe simulation shows sensible result, I can't get 2D magnet to work.
Image

The potential seems to be "caged" inside the top and bottom magnetization bodies and doesn't spread through inner iron body or air.

sif file is as below:

Code: Select all

Header
  CHECK KEYWORDS Warn
  Mesh DB "." "."
  Include Path ""
  Results Directory ""
End

Simulation
  Max Output Level = 5
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Steady state
  Steady State Max Iterations = 1
  Output Intervals = 1
  Timestepping Method = BDF
  BDF Order = 1
  Solver Input File = case.sif
  Post File = case.ep
End

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

Body 1
  Target Bodies(1) = 1
  Name = "Body Property 1"
  Equation = 1
  Material = 1
End

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

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

Body 4
  Target Bodies(1) = 4
  Name = "Body Property 4"
  Equation = 1
  Material = 4
End

Solver 2
  Equation = MgDyn2DPost
  Procedure = "MagnetoDynamics2D" "BSolver"
  Exec Solver = Always
  Stabilize = True
  Bubbles = False
  Lumped Mass Matrix = False
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 20
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Solver 1
  Equation = MgDyn2D
  Procedure = "MagnetoDynamics2D" "MagnetoDynamics2D"
  Variable = Potential
  Exec Solver = Always
  Stabilize = True
  Bubbles = False
  Lumped Mass Matrix = False
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 20
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Equation 1
  Name = "MgDyn2D"
  Active Solvers(2) = 2 1
End

Equation 2
  Name = "MgDyn2DPost"
  Active Solvers(2) = 2 1
End

Material 1
  Name = "Air"
  Relative Permeability = 1
End

Material 2
  Name = "Iron"
  Relative Permeability = 5000
End

Material 3
  Name = "IronPlus"
  Relative Permeability = 5000
  Magnetization 2 = Real 8000
End

Material 4
  Name = "IronMinus"
  Relative Permeability = 5000
  Magnetization 2 = Real -8000
End

Boundary Condition 1
  Target Boundaries(4) = 1 2 3 4 
  Name = "FarField"
  Infinity BC = True
End
What am I missing here?

Mesh is shown below
Image
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: 2D magnet simulation - unphysical results

Post by mzenker »

Hi,

have you checked that the mesh is conformal, i.e. the nodes are the same at the interfaces between bodies?

HTH,
Matthias
gcoopermax
Posts: 2
Joined: 23 Sep 2019, 19:04
Antispam: Yes

Re: 2D magnet simulation - unphysical results

Post by gcoopermax »

Thanks for the pointer. I am using GMSH, tried using coherence command however the mesh doesn't become conformal, any suggestions? Perhaps I need to use a different mesh generator...
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: 2D magnet simulation - unphysical results

Post by kevinarden »

You can use ElmerGrid to tranlsate mesh and merge nodes using -merge flag

However I much prefer Salome for meshing
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: 2D magnet simulation - unphysical results

Post by mzenker »

gcoopermax wrote: 23 Sep 2019, 21:34 Thanks for the pointer. I am using GMSH, tried using coherence command however the mesh doesn't become conformal, any suggestions? Perhaps I need to use a different mesh generator...
Hi,

you can indeed use Salomé (make a partition before meshing) or use the OpenCascade engine in gmsh which has boolean operations.
If you still have problems then you can look for help on the gmsh mailing list.

HTH,
Matthias
annier
Posts: 1168
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: 2D magnet simulation - unphysical results

Post by annier »

Hi,
Any expert dealing with gmsh + ElmerSolver can reply you on these things.
I am an user of Salome + ElmerSolver . In Salome, I use techniques such as submesh (to increase mesh density on certain parts), grouping Mesh of faces or edges, partitioning mesh, different type of mesh elements (quadrilateral, triangular etc for 2D, tetrahedron, hexahedron for 3d) etc. Then, I export the mesh in .unv format. The .unv format is again converted to Elmer Mesh format using ElmerGrid command.


Yours Sincerely,
Anil Kunwar
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
Post Reply