Hexahedral mesh - error message - magnetodynamic model

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

Hexahedral mesh - error message - magnetodynamic model

Post by ftrillaudp »

Dear all,

I have been trying to solve a simple magnetodynamic problem, magnetic flux density created by a closed coil. The problem can be solved using tetrahedron mesh, no issue there. When I am using a hexahedral mesh on the coil, an error occurs (The error is given below).

I am attaching the hexahedral mesh folder (MESH). The content of the case.sif file is given at the end of the post. The unv file built in Salome 9.9 is too heavy. It seems that ElmerGrid may have an issue handling the unv as I can see that an extra body is given in the mesh definition (entities.sif and mesh.names). The face of the coil made of quads appears as a body 3 and should not be there (see entitiesHexa.sif). The same face appears as a boundary as expected.

When using tetrahedral mesh, I get only in the entities.sif and mesh.names the right amount of geometries (see attached entitiesTet.mesh).

#### ERROR Elmerfem with hexahedral mesh ######

ELMER SOLVER (v 9.0) STARTED AT: 2022/07/21 06:39:44
ParCommInit: Initialize #PEs: 1
MAIN:
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 9.0 (Rev: unknown, Compiled: 2022-07-10)
MAIN: Running one task without MPI parallelization.
MAIN: Running with just one thread per task.
MAIN: MUMPS library linked in.
MAIN: Lua interpreter linked in.
MAIN: =============================================================
MAIN:
MAIN:
MAIN: -------------------------------------
MAIN: Reading Model: case.sif
LoadInputFile: Scanning input file: case.sif
LoadInputFile: Scanning only size info
LoadInputFile: First time visiting
LoadInputFile: Reading base load of sif file
LoadInputFile: Loading input file: case.sif
LoadInputFile: Reading base load of sif file
CheckKeyword: Unlisted keyword: [jfix] in section: [boundary condition 1]
CheckKeyword: Unlisted keyword: [save coil set] in section: [solver 1]
CheckKeyword: Unlisted keyword: [save coil index] in section: [solver 1]
LoadInputFile: Number of BCs: 1
LoadInputFile: Number of Body Forces: 1
LoadInputFile: Number of Initial Conditions: 0
LoadInputFile: Number of Materials: 1
LoadInputFile: Number of Equations: 2
LoadInputFile: Number of Solvers: 4
LoadInputFile: Number of Bodies: 2
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by area
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by volume
ElmerAsciiMesh: Base mesh name: ./MESH


ELMER SOLVER (v 9.0) STARTED AT: 2022/07/21 06:39:44
ParCommInit: Initialize #PEs: 1
MAIN:
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 9.0 (Rev: unknown, Compiled: 2022-07-10)
MAIN: Running one task without MPI parallelization.
MAIN: Running with just one thread per task.
MAIN: MUMPS library linked in.
MAIN: Lua interpreter linked in.
MAIN: =============================================================
MAIN:
MAIN:
MAIN: -------------------------------------
MAIN: Reading Model: case.sif
LoadInputFile: Scanning input file: case.sif
LoadInputFile: Scanning only size info
LoadInputFile: First time visiting
LoadInputFile: Reading base load of sif file
LoadInputFile: Loading input file: case.sif
LoadInputFile: Reading base load of sif file
CheckKeyword: Unlisted keyword: [jfix] in section: [boundary condition 1]
CheckKeyword: Unlisted keyword: [save coil set] in section: [solver 1]
CheckKeyword: Unlisted keyword: [save coil index] in section: [solver 1]
LoadInputFile: Number of BCs: 1
LoadInputFile: Number of Body Forces: 1
LoadInputFile: Number of Initial Conditions: 0
LoadInputFile: Number of Materials: 1
LoadInputFile: Number of Equations: 2
LoadInputFile: Number of Solvers: 4
LoadInputFile: Number of Bodies: 2
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by area
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by volume
ElmerAsciiMesh: Base mesh name: ./MESH

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:

#0 0x7f7d623e9d21 in ???
#1 0x7f7d623e8ef5 in ???
#2 0x7f7d6221a08f in ???
at /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
#3 0x7f7d62a15b0d in fixfaceedges
at /build/elmerfem-csc-vJmZtj/elmerfem-csc-8.4-0ppa0/fem/src/MeshUtils.F90:17702
#4 0x7f7d62a15b0d in __meshutils_MOD_findmeshedges3d
at /build/elmerfem-csc-vJmZtj/elmerfem-csc-8.4-0ppa0/fem/src/MeshUtils.F90:17689

#5 0x7f7d62a1b1e5 in __meshutils_MOD_findmeshedges
at /build/elmerfem-csc-vJmZtj/elmerfem-csc-8.4-0ppa0/fem/src/MeshUtils.F90:16568
#6 0x7f7d62a2ee25 in __meshutils_MOD_setmeshedgefacedofs
at /build/elmerfem-csc-vJmZtj/elmerfem-csc-8.4-0ppa0/fem/src/MeshUtils.F90:3419
#7 0x7f7d62a31b56 in nonnodalelements
at /build/elmerfem-csc-vJmZtj/elmerfem-csc-8.4-0ppa0/fem/src/MeshUtils.F90:3160
#8 0x7f7d62a32096 in __meshutils_MOD_preparemesh
at /build/elmerfem-csc-vJmZtj/elmerfem-csc-8.4-0ppa0/fem/src/MeshUtils.F90:2700
#9 0x7f7d62a3c2c4 in __meshutils_MOD_loadmesh2
at /build/elmerfem-csc-vJmZtj/elmerfem-csc-8.4-0ppa0/fem/src/MeshUtils.F90:2325
#10 0x7f7d627f7aac in __modeldescription_MOD_loadmodel
at /build/elmerfem-csc-vJmZtj/elmerfem-csc-8.4-0ppa0/fem/src/ModelDescription.F90:2701
#11 0x7f7d62bb9734 in elmersolver_
at /build/elmerfem-csc-vJmZtj/elmerfem-csc-8.4-0ppa0/fem/src/ElmerSolver.F90:380
#12 0x562715cc03cd in solver
at /build/elmerfem-csc-vJmZtj/elmerfem-csc-8.4-0ppa0/fem/src/Solver.F90:57
#13 0x562715cc013e in main
at /build/elmerfem-csc-vJmZtj/elmerfem-csc-8.4-0ppa0/fem/src/Solver.F90:34



####### Case.sif ########

! Parameters
#tmax = 1.0
#nt = 10
#dt = tmax / nt


Header
CHECK KEYWORDS Warn
Mesh DB "." "MESH"
Results Directory "RESU"
End

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

Simulation Type = String "Transient"

Steady State Max Iterations = 1

TimeStepping Method = BDF
BDF Order = 1

Timestep Sizes(1) = #dt
TimeStep Intervals(1) = #nt
Output Intervals(1) = Integer 1

Max Output Level = 5
End

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

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

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


! -- MATERIAL PROPERTIES --
Material 1
Name = "Non magnetic"
Relative Permeability = Real 1.0
Relative Permittivity = Real 1.0
End


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

! -- BODY FORCES --
Body Force 1
Name = "Source"
Current Density 1 = Variable "time", "CoilCurrent e 1"
Real LUA "tx[1] * (tx[0] / tmax)"
Current Density 2 = Variable "time", "CoilCurrent e 2"
Real LUA "tx[1] * (tx[0] / tmax)"
Current Density 3 = Variable "time", "CoilCurrent e 3"
Real LUA "tx[1] * (tx[0] / tmax)"
End


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


!-- EQUATIONS --
Equation 1
Name = "MagnetoDynamic for coils"
Active Solvers(4) = 1 2 3 4
End

Equation 2
Name = "MagnetoDynamic for air"
Active Solvers(2) = 2 3
End


!-- SOLVERS --
Solver 1
Exec Solver = Always
Equation = "CoilSolver"
Procedure = "CoilSolver" "CoilSolver"

Steady State Convergence Tolerance = 1e-06 ! related to the Steady State Iterations (see Simulation)

Linear System Solver = Iterative
Linear System Iterative Method = idrs
Linear System Convergence Tolerance = 1.e-08
Linear System preconditioning = ILU0
Linear System Max Iterations = 3000
Linear System Residual Output = 1
Idrs Parameter = 4

Nonlinear System Consistent Norm = True

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 Normal(3) = Real 0. 0. 1.
End

Solver 2
Exec Solver = Always
Equation = MGDynamics
Procedure = "MagnetoDynamics" "WhitneyAVSolver"

Variable = AV

Steady State Convergence Tolerance = 1.0e-6

Nonlinear System Max Iterations = 200
Nonlinear System Convergence Tolerance = 1.0e-6
Nonlinear System Newton After Iterations = 10
Nonlinear System Newton After Tolerance = 1.0e-6
Nonlinear System Relaxation Factor = 0.9
Nonlinear System Consistent Norm = Logical True

! some convergence issue here
Linear System Solver = iterative
Linear System Iterative Method = BiCGStab ! BiCGStabl or Idrs GCR
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-6 ! change this value to help out
Linear System Preconditioning = none
Linear System Residual Output = 1
Linear System Abort Not Converged = Logical False
Linear System Row Equilibration = Logical True

Fix Input Current density = True
Jfix: Linear System Solver = Iterative
Jfix: Linear System Iterative Method = bicgstab
Jfix: Linear System Preconditioning = ILU1
Jfix: Linear System Convergence Tolerance = 1.0e-6
Jfix: Linear System Max Iterations = 500
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
Exec Solver = Always
Equation = MGDynamicsCalc
Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"

Potential Variable = String "AV"

Steady State Convergence Tolerance = 1.0e-6

Nonlinear System Convergence Tolerance = 1.0e-6
Nonlinear System Max Iterations = 100
Nonlinear System Newton After Iterations = 10
Nonlinear System Newton After Tolerance = 1.0e-3
Nonlinear System Relaxation Factor = 1
Nonlinear System Consistent Norm = Logical True

Linear System Solver = Iterative
Linear System Symmetric = True
Linear System Iterative Method = CG
Linear System Max Iterations = 5000
Linear System Convergence Tolerance = 1.0e-6
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

Discontinuous Bodies = Logical True

Calculate Current Density = Logical True
Calculate Magnetic Field Strength = Logical True
Calculate Elemental Fields = Logical True
Calculate Joule Heating = Logical True ! only if there is an associated electrical conductivity
End


Solver 4
Exec Solver = After timestep ! After Simulation ! use to get only the last result for steady state
Equation = "ResultOutput"
Procedure = "ResultOutputSolve" "ResultOutputSolver"

Vtu Format = Logical True
!Gmsh Format = Logical True
Binary Output = Logical True
Discontinuous Bodies = Logical True

Output File Name = File "case"

Save Geometry Ids = Logical True ! to get the identifying numbers for paraview visualization (Threshold on GeomtryIds)
Vector Field 1 = String "magnetic flux density"
Vector Field 2 = String "magnetic field strength"
Vector Field 3 = String "coilcurrent"
End


Best,

Frederic
Attachments
entitiesTet.sif
Entities in Tetrahedral mesh
(305 Bytes) Downloaded 69 times
entitiesHexa.sif
Entities in Hexahedral mesh
(333 Bytes) Downloaded 68 times
MESH.zip
MESH folder
(402.03 KiB) Downloaded 72 times
kevinarden
Posts: 2308
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Hexahedral mesh - error message - magnetodynamic model

Post by kevinarden »

There are no hexahedrals in the posted mesh,

from the mesh.header file

5232 27767 708 (number of nodes, body element, boundary elements)
4 (types of element to read in)
202 350 (beam element in boundary elements)
303 358 (triangles in boundary elements)
404 550 (quad elements in body file, this is body 3)
504 27217 (tet elements contained in two bodies)
ftrillaudp
Posts: 42
Joined: 23 May 2012, 05:26
Antispam: Yes

Re: Hexahedral mesh - error message - magnetodynamic model

Post by ftrillaudp »

That is correct. i realized afterwards. Here is the correct MESH file. I have cleaned up and now the error is in the convergence of the whitney AV solver.

I have attached the file anew.

Sorry about that, best,

Frederic
Attachments
MESH.zip
MESH folder
(721.17 KiB) Downloaded 71 times
case.sif
case.sif
(5.89 KiB) Downloaded 75 times
raback
Site Admin
Posts: 4826
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Hexahedral mesh - error message - magnetodynamic model

Post by raback »

Hi

In the attached sif I tried to use the best tricks I have. But there is no convergence.

I think the mesh is not joined properly. This is the mesh.header:

Code: Select all

34385  34025  8015  
5     
202    618   
303    522   
404    6875  
504    2775  
808    31250 
There are only two types for elements for 3D. The structured coil (hexas) and the unstructured air (tets). However, you can not only have these two elements as there is no way to join a hexahedron to a tetrahedron. One has only quadrilateral faces and the other only triangular. You need some element that joins these together and that would be a pyramid.

Note that for nodal elements this could work if the meshes share the nodes even though there would be a small approximation error. The degrees of freedom would be still the same over the interface. However, for Hcurl element you don't have mapping between some of the edges.

-Peter
Attachments
case.sif
(6.33 KiB) Downloaded 69 times
kevinarden
Posts: 2308
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Hexahedral mesh - error message - magnetodynamic model

Post by kevinarden »

Your coil mesh has to share nodes with the air mesh, you can't just have one body inside of the other. There are other options for mortar boundary conditions for cases where nodes are not shared but you have to include those boundary conditions in the sif.
mesh.png
(148.77 KiB) Not downloaded yet
ftrillaudp
Posts: 42
Joined: 23 May 2012, 05:26
Antispam: Yes

Re: Hexahedral mesh - error message - magnetodynamic model

Post by ftrillaudp »

That is correct. I did not understand that I had to use "BooleanFragments{}" in Gmsh to be able to share nodes and the "Coherence Mesh" was not enough to do the trick.

Sorry for the delay to close the thread. With a correct mesh, it works fine thus far.

Best,

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

Re: Hexahedral mesh - error message - magnetodynamic model

Post by annier »

Dear Frederic,
Can you upload the file corresponding to the corrected mesh?

Best Regards,
Anil
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
Post Reply