Sliding mesh for electrical machines (3D) / mortar

Numerical methods and mathematical models of Elmer
Post Reply
mb5
Posts: 20
Joined: 10 Jun 2017, 18:07
Antispam: Yes

Sliding mesh for electrical machines (3D) / mortar

Post by mb5 »

Hi,

I`ve got a problem with the sliding/moving mesh for a electrical machine. In my problem I have an outer iron ring with a magnet and air body. For rotation I have a rotating square core with air. All outer boundaries are Vpot=0.
bodies.png
bodies.png (43.78 KiB) Viewed 5557 times
My sif file:

Code: Select all

$ p = 1             ! pole pairs
$ dangle = 45       ! angle for d-axis in degree
$ skew_angle = 00   ! skewing angle in degree
$ skew_length = 100 ! base length for skewing (epM: stack length)

$ speed = 1000      ! rotational speed in rpm
$ N_period = 1      ! number of electrical periods
$ Nsteps = 90       ! number of steps 


$ w_mech = 2.0*pi*speed/60.0
$ T = 1.0/(speed/60.0*p)*N_period
$ dt = T / Nsteps



Header 
  CHECK KEYWORDS Warn 
  Mesh DB "mesh" "." 
  Include Path "" 
  Results Directory "results" 
End 
!// include "mesh/entities.sif"

Simulation 
  Max Output Level = 3 
  Coordinate System = "Cartesian 3D"  
  Coordinate Scaling = 0.001 
  
  Simulation Type = Transient
  Timestep Size = $dt
  Timestep Intervals = $Nsteps+1
  Timestepping Method = BDF
  BDF order = 2
  
  Steady State Max Iterations = 10
  Output Intervals = 100
  Use Mesh Names = Logical True
  
  !// !!!!!!!! mesh interpolation tolerances
  Interpolation Numeric Epsilon = Real 5.0e-9
End 

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

Material 2 
  Name = "iron" 
  Relative Permeability = 1000
End 

Material 3 
  Name = "Ferritband" 
  Relative Permeability = 1.05
  Magnetization 1 = 187196.5283
  Magnetization 2 = 0
  Magnetization 3 = 0   
End 


!!!!!!!!!!!!!!!!!!!!!!!!!!  Boundary conditions  !!!!!!!!!!!!!!!!!!!!!!!!!!! 

Boundary Condition 1 
    Target Boundaries(11) = 2 3 4 5 6 7 8 9 10 11 12
    Name = "Boundary_Outer" 
    AV {e} = Real 0
End 



!!!!!!!!!!!!!!!!!!!!!!!!!!  Solver parameters !!!!!!!!!!!!!!!!!!!!!!!!!!! 

! solver for magnetic vector potential A [Vs/m] 
Solver 1
  Equation = "MGDynamics"
  Procedure = "MagnetoDynamics" "WhitneyAVSolver" 
  Variable = "AV"

  Apply Mortar BCs = Logical True
 
  ! Fix Input Current Density = Logical True
  Nonlinear System Convergence Tolerance = 1.0e-4 
  Nonlinear System Max Iterations = 50 
  Nonlinear System Relaxation Factor = 1 
  Newton-Raphson Iteration = Logical True
  
 ! Linear System Solver = Direct 
 ! Linear System Direct Method = UMFPACK
  
   Linear System Symmetric = Logical True
   Linear System Solver = "Iterative"
   Linear System Preconditioning = None
   Linear System Convergence Tolerance = 1e-8
   Linear System Residual Output = 100
   Linear System Max Iterations = 5000
   Linear System Iterative Method = CG   ! CG CGS BiCGStab l TFQMR GMRES GCR
End 


Solver 2
   Equation = "MGDynamicsCalc"
   Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
   Linear System Symmetric = True
   Potential Variable = "AV"
   !// Apply Mortar BCs = Logical True

   Calculate Magnetic Field Strength = Logical True
   Calculate Current Density = Logical True
   Calculate nodal forces = logical true
   Calculate Magnetic Vector Potential = Logical True
   
  
  ! Linear System Solver = Direct 
  ! Linear System Direct Method = UMFPACK
   Linear System Solver = "Iterative"
   Linear System Preconditioning = None
   Linear System Residual Output = 100
   Linear System Max Iterations = 5000
   Linear System Iterative Method = CG
   Steady State Convergence Tolerance = 1e-6
   Linear System Convergence Tolerance = 1.0e-8
End


!save to VTU format for ParaView with faces' IDs 
Solver 3
  Exec Solver = After Timestep 
  Procedure = "ResultOutputSolve" "ResultOutputSolver" 
  Output File Name = "step" 
  
!  Save Nodal Fields = Logical True
  
  Vtu Format = True 
  Binary Output = True 
  Single Precision = True 
  Save Geometry Ids = True 
End 



Equation 1 
  Name = "ModelDomain" 
  Active Solvers(3) = 1 2 3
End 


!!!!!!!!!!!!!!!!!!!!!!!!!!  Bodies are here !!!!!!!!!!!!!!!!!!!!!!!!!!! 
Body 1 
  Name = "yoke" 
  Equation = 1 
  Material = 2 
End 
 
Body 2 
  Name = "magnet" 
  Equation = 1 
  Material = 3
End 

Body 3
  Name = "air2" 
  Equation = 1 
  Material = 1
End 
 
Body 4
  Name = "air1" 
  Equation = 1 
  Material = 1
  Body Force = 1
End 

Body 5
  Name = "core" 
  Equation = 1 
  Material = 2
  Body Force = 1
End 
Without defining the slide mesh / mortar the results (flux density) looking correct.
induction.png
induction.png (70.64 KiB) Viewed 5557 times

But now I want to move the core and the inner mesh. Therefore I use the mortar boundary:

Code: Select all


$ p = 1             ! pole pairs
$ dangle = 45       ! angle for d-axis in degree
$ skew_angle = 00   ! skewing angle in degree
$ skew_length = 100 ! base length for skewing (epM: stack length)

$ speed = 1000      ! rotational speed in rpm
$ N_period = 1      ! number of electrical periods
$ Nsteps = 90       ! number of steps 


$ w_mech = 2.0*pi*speed/60.0
$ T = 1.0/(speed/60.0*p)*N_period
$ dt = T / Nsteps




Header 
  CHECK KEYWORDS Warn 
  Mesh DB "mesh" "." 
  Include Path "" 
  Results Directory "results" 
End 
!// include "mesh/entities.sif"

Simulation 
  Max Output Level = 3 
  Coordinate System = "Cartesian 3D"  
  Coordinate Scaling = 0.001 
  
  Simulation Type = Transient
  Timestep Size = $dt
  Timestep Intervals = $Nsteps+1
  Timestepping Method = BDF
  BDF order = 2
  
  Steady State Max Iterations = 10
  Output Intervals = 100
  Use Mesh Names = Logical True
  
  !// !!!!!!!! mesh interpolation tolerances
  Interpolation Numeric Epsilon = Real 5.0e-9
End 

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

Material 2 
  Name = "iron" 
  Relative Permeability = 1000
End 

Material 3 
  Name = "Ferritband" 
  Relative Permeability = 1.05
  Magnetization 1 = 187196.5283
  Magnetization 2 = 0
  Magnetization 3 = 0   
End 


!!!!!!!!!!!!!!!!!!!!!!!!!!  Boundary conditions  !!!!!!!!!!!!!!!!!!!!!!!!!!! 

Boundary Condition 1 
    Target Boundaries(11) = 2 3 4 5 6 7 8 9 10 11 12
    Name = "Boundary_Outer" 
    AV {e} = Real 0
End 

Boundary Condition 2
    Target Boundaries(1) = 1
    Name = "slide"
    Discontinuous Boundary = Logical True
    !// Save Line = True
    Mortar BC = 3
    !// Discontinuous BC = 3
    !// Galerkin Projector = Logical True      ! programm error on step 2
    !// Rotational Projector = Logical True    ! too much mesh skew
    Sliding Projector = Logical True       ! programm error on step 2
    !// Cylindrical Projector = Logical True   ! too much mesh skew
    !// Radial Projector = Logical True        ! leads to singular matrix
    !// Level Projector = Logical True         ! leads to singular matrix
    !// Plane Projector = Logical True         ! too much mesh skew
End



!!!!!!!!!!!!!!!!!!!!!!!!!!  Body Forces  !!!!!!!!!!!!!!!!!!!!!!!!!!! 

!// rotation of the rotor
Body Force 1
    Name = "BodyForce_Rotation"
    Mesh Rotate 3 = Variable time, timestep size
    Real MATC "180/pi*w_mech*(tx(0)-tx(1))" ! in degrees
End


!!!!!!!!!!!!!!!!!!!!!!!!!!  Solver parameters !!!!!!!!!!!!!!!!!!!!!!!!!!! 

!mesh rotation
Solver 1
    Exec Solver = Before Timestep
    Equation = MeshDeform
    Procedure = "RigidMeshMapper" "RigidMeshMapper"
End

! solver for magnetic vector potential A [Vs/m] 
Solver 2
  Equation = "MGDynamics"
  Procedure = "MagnetoDynamics" "WhitneyAVSolver" 
  Variable = "AV"

  Apply Mortar BCs = Logical True
 
  ! Fix Input Current Density = Logical True
  Nonlinear System Convergence Tolerance = 1.0e-4 
  Nonlinear System Max Iterations = 50 
  Nonlinear System Relaxation Factor = 1 
  Newton-Raphson Iteration = Logical True
  
   Linear System Symmetric = Logical True
   Linear System Solver = "Iterative"
   Linear System Preconditioning = None
   Linear System Convergence Tolerance = 1e-8
   Linear System Residual Output = 100
   Linear System Max Iterations = 5000
   Linear System Iterative Method = CG   ! CG CGS BiCGStab l TFQMR GMRES GCR
End 


Solver 3
   Equation = "MGDynamicsCalc"
   Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
   Linear System Symmetric = True
   Potential Variable = "AV"

   Calculate Magnetic Field Strength = Logical True
   Calculate Current Density = Logical True
   Calculate nodal forces = logical true
   Calculate Magnetic Vector Potential = Logical True
   
   Linear System Solver = "Iterative"
   Linear System Preconditioning = None
   Linear System Residual Output = 100
   Linear System Max Iterations = 5000
   Linear System Iterative Method = CG
   Steady State Convergence Tolerance = 1e-6
   Linear System Convergence Tolerance = 1.0e-8
End


!save to VTU format for ParaView with faces' IDs 
Solver 4 
  Exec Solver = After Timestep 
  Procedure = "ResultOutputSolve" "ResultOutputSolver" 
  Output File Name = "step" 
  
!  Save Nodal Fields = Logical True
  
  Vtu Format = True 
  Binary Output = True 
  Single Precision = True 
  Save Geometry Ids = True 
End 

!// save scalar variables - torque T [Nm]
Solver 5
    Exec Solver = After Timestep
    Filename = "scalars.dat"
    Procedure = "SaveData" "SaveScalars"
    Show Norm Index = 1
End

Equation 1 
  Name = "ModelDomain" 
  Active Solvers(5) = 1 2 3 4 5
End 


!!!!!!!!!!!!!!!!!!!!!!!!!!  Bodies are here !!!!!!!!!!!!!!!!!!!!!!!!!!! 
Body 1 
  Name = "yoke" 
  Equation = 1 
  Material = 2 
End 
 
Body 2 
  Name = "magnet" 
  Equation = 1 
  Material = 3
End 

Body 3
  Name = "air2" 
  Equation = 1 
  Material = 1
End 
 
Body 4
  Name = "air1" 
  Equation = 1 
  Material = 1
  Body Force = 1
End 

Body 5
  Name = "core" 
  Equation = 1 
  Material = 2
  Body Force = 1
End 
But on exute with ElmerSolver I get a segmentation fault.

What I am doing wrong with the sliding mesh?

Best regards
Martin
Attachments
mesh.zip
(106.12 KiB) Downloaded 361 times
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Sliding mesh for electrical machines (3D) / mortar

Post by raback »

Hi

Didn't try your case. However, the choices for mortar projector cannnot work. You could try to use these at the air gap:

Code: Select all

  Rotational Projector = Logical True  ! map rotating interface to plane 
  Galerkin Projector = Logical True     ! at the plane perform optimal weak projector
  Projector Skip Nodes = Logical True  ! if interface is nonconducting you can skip the nodes
-Peter
mb5
Posts: 20
Joined: 10 Jun 2017, 18:07
Antispam: Yes

Re: Sliding mesh for electrical machines (3D) / mortar

Post by mb5 »

Thank you for your reply, Peter.

I`ve tried these projectors. With direct solver (UMFPACK) I always get a segmentation fault. With iterative solver (CG) I have to reduce the Linear System Convergence Tolerance (1e-6) to get the calculation convergent. If I don't use the boundary in the airgap (no rotation) the iterations are about 10 times faster.
So I think I have a general problem with the mortar boundary.

Is there anything I could try?

Regards
Martin
Attachments
data.zip
(97.12 KiB) Downloaded 336 times
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Sliding mesh for electrical machines (3D) / mortar

Post by raback »

Hi

The linear system becomes much harder to solve with the continuity constraints over the rotating interface added.

You can try
1) Other linear iterative solvers: GCR, Bicgstabl, Idrs,...
2) The direct solver could work with the tree gauge, maybe you run out of memory?
3) You could add something to the diagonal of the mortar constraints (Solver i::Mortar Diag = Real)
4) You could add a multiplier to the mass matrix to gauge it (Solver i::Mass Regularize Epsilon = Real)
...

etc. Some of these require fresh version. This is a complex problem.

-Peter
mb5
Posts: 20
Joined: 10 Jun 2017, 18:07
Antispam: Yes

Re: Sliding mesh for electrical machines (3D) / mortar

Post by mb5 »

Thank you very much. I`ve tested different iterative solvers. Now I use the same as the test case "RotatingBCMagnetoDynamics2". With that it works! But with additional mortar boundaries (not a full 360° model) Its very hard to get the convergent solution. For the moment I use the full model.

I've got another question regarding torque calculation. I try to calculate it as "component". But all values for torque and force are zero in the output scalar.dat. In principle the nodel forces are calculated as I see in ParaView.

Code: Select all


$ p = 1             ! pole pairs
$ dangle = 45       ! angle for d-axis in degree
$ skew_angle = 00   ! skewing angle in degree
$ skew_length = 100 ! base length for skewing (epM: stack length)

$ speed = 1000      ! rotational speed in rpm
$ N_period = 1      ! number of electrical periods
$ Nsteps = 45       ! number of steps 


$ w_mech = 2.0*pi*speed/60.0
$ T = 1.0/(speed/60.0*p)*N_period
$ dt = T / Nsteps




Header 
  CHECK KEYWORDS Warn 
  Mesh DB "mesh" "." 
  Include Path "" 
  Results Directory "results" 
End 
!// include "mesh/entities.sif"

Simulation 
  Max Output Level = 3 
  Coordinate System = "Cartesian 3D"  
  Coordinate Scaling = 0.001 
  
  Simulation Type = Transient
  Timestep Size = $dt
  Timestep Intervals = $Nsteps+1
  Timestepping Method = BDF
  BDF order = 2
  
  Steady State Max Iterations = 1
  Output Intervals = 100
  Use Mesh Names = Logical True
End 

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

Material 2 
  Name = "iron" 
  Relative Permeability = 1000
End 

Material 3 
  Name = "Ferritband" 
  Relative Permeability = 1.05
  Magnetization 1 = 187196.5283
  Magnetization 2 = 0
  Magnetization 3 = 0   
End 


!!!!!!!!!!!!!!!!!!!!!!!!!!  Boundary conditions  !!!!!!!!!!!!!!!!!!!!!!!!!!! 
Boundary Condition 1 
    Target Boundaries(11) = 1 3 4 5 6 7 8 9 10 11 12
    Name = "Boundary_Outer" 
    AV {e} = Real 0
End 

Boundary Condition 2
    Target Boundaries(1) = 2
    Name = "airgap"
    Discontinuous Boundary = Logical True
    Mortar BC = 3
    
    Galerkin Projector = Logical True      ! programm error on step 2
    Rotational Projector = Logical True    ! too much mesh skew
    !// Projector Skip Nodes = Logical True
End




!!!!!!!!!!!!!!!!!!!!!!!!!!  Body Forces  !!!!!!!!!!!!!!!!!!!!!!!!!!! 
Body Force 1
    Name = "BodyForce_Rotation"
    Mesh Rotate 3 = Variable time, timestep size
    Real MATC "180/pi*w_mech*(tx(0)-tx(1))" ! in degrees
End


!!!!!!!!!!!!!!!!!!!!!!!!!!  Solver parameters !!!!!!!!!!!!!!!!!!!!!!!!!!! 

!mesh rotation
Solver 1
    Exec Solver = Before Timestep
    Equation = MeshDeform
    Procedure = "RigidMeshMapper" "RigidMeshMapper"
End


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

! Fix Input Current Density = Logical True

  Nonlinear System Convergence Tolerance = 1.0e-4   !// 1.0e-8
  Nonlinear System Max Iterations = 1  !// 50 
  Nonlinear System Relaxation Factor = 1 
  Newton-Raphson Iteration = Logical True
  Linear System Solver = "Iterative"
  Linear System Preconditioning = ILU1
  Linear System Residual Output = 20
  Linear System Max Iterations = 3000
  Linear System Iterative Method = BiCGStab2 
  BicGStabL Polynomial Degree = 4
  Linear System GCR Restart = 600
  Linear System Convergence Tolerance = 1e-8    ! 1e-10
  Linear System Abort Not Converged = False

  Steady State Convergence Tolerance = 1e-09

  Edge Basis = Logical True
  Apply Mortar BCs = Logical True
  Optimize Bandwidth = False
End 



Solver 3
   Equation = "MGDynamicsCalc"
   Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
   Linear System Symmetric = True
   Potential Variable = "AV"

   Calculate Magnetic Field Strength = Logical True
   Calculate Current Density = Logical True
   Calculate nodal forces = logical true
   Calculate Magnetic Vector Potential = Logical True
   !// Calculate Electric Field = True
   !// Calculate Maxwell Stress = Logical True
   
   
  Linear System Solver = "Iterative"
  Linear System Preconditioning = ILU1
  Linear System Residual Output = 20
  Linear System Max Iterations = 3000
  Linear System Iterative Method = BiCGStab2 
  BicGStabL Polynomial Degree = 4
  Linear System GCR Restart = 600
  Linear System Convergence Tolerance = 1e-8    ! 1e-10
  Linear System Abort Not Converged = False
   
   Steady State Convergence Tolerance = 1e-6
   Linear System Convergence Tolerance = 1.0e-8
   Discontinuous Bodies = True
   Apply Mortar BCs = True
End


!save to VTU format for ParaView with faces' IDs 
Solver 4 
  Exec Solver = After Timestep 
  Procedure = "ResultOutputSolve" "ResultOutputSolver" 
  Output File Name = "step" 
  
!  Save Nodal Fields = Logical True
  
  Vtu Format = True 
  Binary Output = True 
  Single Precision = True 
  Save Geometry Ids = True 
End 

!// save scalar variables - torque T [Nm]
Solver 5
    Exec Solver = After Timestep
    Filename = "scalars.dat"
    Procedure = "SaveData" "SaveScalars"
    Show Norm Index = 1
    save component results = logical True
End

Component 1
  Name = string "rotor"
  Master Bodies(2) = integer 13 19
  
  Torque Origin(3) = Real 0 0 0
  Torque Axis(3) = Real 0 0 -0.05
  Calculate Magnetic Force = Logical True
  Calculate Magnetic Torque = Logical True
End


Equation 1 
  Name = "ModelDomain" 
  Active Solvers(5) = 1 2 3 4 5
End 


!!!!!!!!!!!!!!!!!!!!!!!!!!  Bodies are here !!!!!!!!!!!!!!!!!!!!!!!!!!! 
Body 1 
  Name = "yoke" 
  Equation = 1 
  Material = 2 
End 
 
Body 2 
  Name = "magnet" 
  Equation = 1 
  Material = 3
End 

Body 3
  Name = "air2" 
  Equation = 1 
  Material = 1
End 
 
Body 4
  Name = "air1" 
  Equation = 1 
  Material = 1
  Body Force = 1
End 

Body 5
  Name = "core" 
  Equation = 1 
  Material = 2
  Body Force = 1
End 
In the output I get warning regarding torque calculation. Elmer doesn't know the keyword "torque origin". But it is described in the ElmerModelsManual. I use the newest Elmer version from ppa.
MAIN: -------------------------------------
MAIN: Reading Model: case.sif
LoadInputFile: Scanning input file: case.sif
LoadInputFile: Loading input file: case.sif
Model Input: Unlisted keyword: [torque origin] in section: [component 1]
Model Input: Unlisted keyword: [torque axis] in section: [component 1]
Has anybody an idea?

Best regards
Martin
mb5
Posts: 20
Joined: 10 Jun 2017, 18:07
Antispam: Yes

Re: Sliding mesh for electrical machines (3D) / mortar

Post by mb5 »

I got it. My mistake was, that I defined the physical Body indices from the mesh file for torque calculation. To get the correct torque one have to define the Body indices from the "Body" section from the *.sif file.

Code: Select all

Component 1
  Name = string "rotor"
  Master Bodies(3) = integer 1 2 !  << Define the "Body xy" IDs from the following "Body" sections
  Calculate Magnetic Force = Logical True
  Calculate Magnetic Torque = Logical True
End

Body 1 
  Name = "yoke" 
  Equation = 1 
  Material = 2 
End 
 
Body 2 
  Name = "magnet" 
  Equation = 1 
  Material = 3
End 
Post Reply