problem with mortar periodic BC

Numerical methods and mathematical models of Elmer
Post Reply
lazyTom
Posts: 25
Joined: 05 Jun 2013, 01:32
Antispam: Yes

problem with mortar periodic BC

Post by lazyTom » 13 May 2017, 19:20

Hi all,

I'm trying to solve for the magnetic field in a 3D electric motor using mortar BCs but I can't make the solver converge. Please find below the details of the model.

This is an overview of the mesh, you can see the motor model with the energised coil (it is immersed in air) and the simmetry plane used to further decrease meshing domain
motore with transparent air and symmetry plane.png
motore with transparent air and symmetry plane.png (676.28 KiB) Viewed 1906 times
And these are the mortar BCs
complete mesh and mortar BC.png
complete mesh and mortar BC.png (544.87 KiB) Viewed 1906 times
the sif file is here

Code: Select all

!------ Skeleton for body section -----
!Body 1 = stator
!Body 2 = rotor
!Body 3 = 3Dcoil
!Body 4 = air

!BC 01 = current in
!BC 02 = current out
!BC 03 = surface top
!BC 04 = surface bottom
!BC 05 = lateral surface simmetry top
!BC 06 = lateral surface simmetry top
!BC 07 = radial open air

Header
   Check Keywords "Warn"
   Mesh DB "." "GMSH_geometry_V17_6_central_coil_addded_physical_surface_m_coarse_mesh_s"   

  Include Path ""
  Results Directory ""
End

Simulation
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
! Coordinate Scaling=0.001  
  Simulation Type = Steady
  Steady State Max Iterations = 1
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) = 4
  Name = "Air"
  Equation = 2
  Material = 1
End

Body 2
  Target Bodies(1) = 3
  Name = "3D Coil"
  Equation = 1
  Material = 2
  Body Force = 1
End

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

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

Material 1
  Name = "Air (room temperature)"
  Viscosity = 1.983e-5
  Heat expansion Coefficient = 3.43e-3
  Heat Conductivity = 0.0257
  Sound speed = 343.0
  Density = 1.205
  Heat Capacity = 1005.0

  Relative Permittivity = Real 1
  Relative Permeability = Real 1
  Electric Conductivity = Real 0
End


Material 2
  Name = "Copper (generic)"
  Heat expansion Coefficient = 16.5e-6
  Heat Conductivity = 401.0
  Sound speed = 3810.0
  Heat Capacity = 385.0
  Density = 8960.0
  Mesh Poisson ratio = 0.34
  Poisson ratio = 0.34
  Youngs modulus = 115.0e9

  Relative Permittivity = Real 1
  Relative Permeability = Real 1
  Electric Conductivity = Real 5.96e7
End

Material 3
  Name = "Iron (generic)"

  Poisson ratio = 0.29
  Heat expansion Coefficient = 11.8e-6
  Youngs modulus = 193.053e9
  Heat Conductivity = 80.2
  Sound speed = 5000.0
  Heat Capacity = 449.0
  Mesh Poisson ratio = 0.29
  Density = 7870.0
  relative Permittivity = 1.0
  Relative Permeability = 1000
  Electric Conductivity = 10.30e6  
End

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

Equation 2
  Name = "Equation magnetic field"
  Active Solvers(2) = 2 3
End

!==STATIC CURRENT SOLVER==============================
!=====================================================

Solver 1
  Equation = Static Current Conduction
  Variable = Potential
  Procedure = "StatCurrentSolve" "StatCurrentSolver"
  Calculate Volume Current = True
  Current Control = 40
  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-8
  Nonlinear System Max Iterations = 1
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Abort Not Converged = True
  Linear System Residual Output = 1
!===============================================
! iterative method and options

  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-8
  Linear System Preconditioning = ILU0
!  Linear System Preconditioning = none
  Linear System ILUT Tolerance = 1.0e-3
 Linear System Precondition Recompute = 1
!===============================================  
End


!==MAGNETIC FIELD SOLVER==============================
!=====================================================
Solver 2
  Equation = "MGDynamics"

  Variable = P
  Procedure = "MagnetoDynamics" "WhitneyAVSolver"
  Fix Input Current Density = Logical True

  Optimize Bandwidth = True

  Steady State Convergence Tolerance = 1e-09
  Nonlinear System Convergence Tolerance = 1.0e-8
  Nonlinear System Max Iterations = 1
  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 Preconditioning = ILU2
  Linear System Residual Output = 20
  Linear System Max Iterations = 5000
!  Linear System Iterative Method = BiCGStab2
  !  Linear System Iterative Method = GCR
!  BicGStabL Polynomial Degree = 4
!  Linear System GCR Restart = 600
  Linear System Convergence Tolerance = 1e-9
 

!  Linear System Normwise Backward Error = Logical True

  Linear System Abort Not Converged = False

  Apply Mortar BCs = Logical True
  Edge Basis = Logical True
 
End

!=====================================================
!=====================================================


Solver 3
  Equation = "MGDynamicsCalc"

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

  Potential Variable = P

!  Calculate Current Density = Logical True
!  Calculate Electric Field  = Logical True
  Calculate Magnetic Field Strength = Logical True
  Calculate Magnetic Field Density = Logical True  

!  Calculate Field Energy = Logical True  
!  Calculate Current Density E = Logical True
!  Calculate Electric Field  E = Logical True
!  Calculate Magnetic Field Strength E = Logical True
!  Calculate Magnetic Field Density E = Logical True

!  Steady State Convergence Tolerance = 0
  Steady State Convergence Tolerance = 1e-09
  Linear System Solver = "Iterative"
  Linear System Iterative Method = CG

  Linear System Preconditioning = None

 
  Linear System Residual Output = 0
  Linear System Max Iterations = 5000

  Linear System Convergence Tolerance = 1.0e-8
End



Solver 4
  Equation = Result Output
!  Exec Solver = Never
  Procedure = "ResultOutputSolve" "ResultOutputSolver"
  Binary Output = True
  Output Format = vtu
  Output File Name = results
End

Solver 5
  Equation = "scalars"
  procedure = "SaveData" "SaveScalars"
  Filename = "data_scalars.dat"  
End

!=========================================================
!BC 01 = current in
!BC 02 = current out
!BC 03 = surface top
!BC 04 = surface bottom
!BC 05 = lateral surface simmetry top
!BC 06 = lateral surface simmetry top
!BC 07 = radial open air


Boundary Condition 1
  Target Boundaries(1) = 1
  Name = "Current in"

  Potential = 0.055
  P {e} 1 = real 0
  P {e} 2 = real 0
End

Boundary Condition 2
  Target Boundaries(1) = 2
  Name = "Current out"

  Potential = 0
  P {e} 1 = real 0
  P {e} 2 = real 0
End

Boundary Condition 3
  Target Boundaries(2) = 3 7
  Name = "Outer space"
  P {e}= real 0
End

Boundary Condition 4
  Target Boundaries(1) = 4
  Name = "BCn Flux Parallel" ! Simmetry surface
  P {e} 1 = real 0
  P {e} 2 = real 0
end


!============MORTAR==================================
! 5 on 6

Boundary Condition 5
  Name = "Periodic air Master"
  Target Boundaries(1) = 5

  Mortar BC = 6
!  anti sliding Projector = Logical True
  Radial Projector = Logical True
!  Galerking Projector = Logical True
!  Level Projector = Logical False
  Level Projector Generic = Logical True

!  Level Projector Strong = Logical True
End

Boundary Condition 6
  Name = "Periodic air Target"
  Target Boundaries(1) = 6
End

!====================================================

Body Force 1
  Name = "Current Density"

  Current Density 1 = Equals Volume current 1
  Current Density 2 = Equals Volume current 2
  Current Density 3 = Equals Volume current 3
End
By allowing the solver to continue even if convergence tollerance is not met I get the following solution
B soultion.png
B soultion.png (616.57 KiB) Viewed 1906 times
As you can see, the solution for B is not correct. It looks like the top mortar BC is doing well but something is not right at the bottom. If, on the same BC, I replace mortar projection with P{e} tangential = 0, then the solver converges and the solution seems reasonable.

Any help with the problem would be much apreciated,

Regards,

Marco

PS: If you want to give it a try, the mesh (Elner native) is here: http://www.engandmath.com/public/ElmerF ... mesh_s.zip

lazyTom
Posts: 25
Joined: 05 Jun 2013, 01:32
Antispam: Yes

Re: problem with mortar periodic BC

Post by lazyTom » 01 Jun 2017, 01:05

Hi all,

ok, I think I spotted my first error. Also, I have prepared a simpler model and added more details on what I want to do, I hope this will give more chances to get to the bottom of the problem.

By the way, I have available data from a real motor design. I think this is a great opportunity to build a contributed case and see how Elmer performs in 3D electromagnetics.

So, by all means, any idea or suggestion is welcome!! :D

But going back to the problem, searching within test cases, I have found two types of radial projectors (see picture below): Radial (on the left, it rotates vector B) and Anti Radial (on the right, it rotates and changes sign to vector B). I assume that projection is independent from the sign of the surface. Can someone confirm this?
radial projectors.png
radial projectors.png (114.06 KiB) Viewed 1837 times
Now, the figure below (B = magnetic field density) shows the problem that I want to study (on the left), and how it translates into Elmer model (on the right).
6-4 generic 3 phase anti periodic symmetry with B.png
6-4 generic 3 phase anti periodic symmetry with B.png (119.36 KiB) Viewed 1837 times
This shows that I need to set Anti Radial Projector = True. And this was my mistake in the previous model.
However, after amending this, Linear System Convergence error for magnetic solver didn't change. It remained in the range of 10^-3. Looking at other magnetic mortar test cases, it appears to be quite high (usually around 10^-8). Any suggestion here? The new sif file is shown below.

Code: Select all

!------ Skeleton for body section -----
!Body 1 = stator
!Body 2 = rotor
!Body 3 = 3Dcoil
!Body 4 = air

!BC 01 = current in
!BC 02 = current out
!BC 03 = air surface top
!BC 04 = surface bottom
!BC 05 = surface simmetry at 0 deg
!BC 06 = simmetry at end deg
!BC 07 = yoke open air


Header
  Check Keywords "Warn"
  Mesh DB "." "6-4_m_generic_added_one_physical_surface_at_top_and_one_on_bottom"
  Include Path ""
  Results Directory ""
End

Simulation
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
! Coordinate Scaling=0.001  
  Simulation Type = Steady
  Steady State Max Iterations = 1
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) = 4
  Name = "Air"
  Equation = 2
  Material = 1
End

Body 2
  Target Bodies(1) = 3
  Name = "3D Coil"
  Equation = 1
  Material = 2
  Body Force = 1
End

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

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

Material 1
  Name = "Air (room temperature)"
  Viscosity = 1.983e-5
  Heat expansion Coefficient = 3.43e-3
  Heat Conductivity = 0.0257
  Sound speed = 343.0
  Density = 1.205
  Heat Capacity = 1005.0

  Relative Permittivity = Real 1
  Relative Permeability = Real 1
  Electric Conductivity = Real 0
End


Material 2
  Name = "Copper (generic)"
  Heat expansion Coefficient = 16.5e-6
  Heat Conductivity = 401.0
  Sound speed = 3810.0
  Heat Capacity = 385.0
  Density = 8960.0
  Mesh Poisson ratio = 0.34
  Poisson ratio = 0.34
  Youngs modulus = 115.0e9

  Relative Permittivity = Real 1
  Relative Permeability = Real 1
  Electric Conductivity = Real 5.96e7
End

Material 3
  Name = "Iron (generic)"

  Poisson ratio = 0.29
  Heat expansion Coefficient = 11.8e-6
  Youngs modulus = 193.053e9
  Heat Conductivity = 80.2
  Sound speed = 5000.0
  Heat Capacity = 449.0
  Mesh Poisson ratio = 0.29
  Density = 7870.0
  relative Permittivity = 1.0
  Relative Permeability = 1000
  Electric Conductivity = 10.30e6  
End

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

Equation 2
  Name = "Equation magnetic field"
  Active Solvers(2) = 2 3
End

Solver 1
  Equation = Static Current Conduction
  Variable = Potential
  Procedure = "StatCurrentSolve" "StatCurrentSolver"
  Calculate Volume Current = True
  Current Control = 40
  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-8
  Nonlinear System Max Iterations = 1
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Abort Not Converged = True
  Linear System Residual Output = 1
!===============================================

  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-8
  Linear System Preconditioning = ILU0
!  Linear System Preconditioning = none
  Linear System ILUT Tolerance = 1.0e-3
 Linear System Precondition Recompute = 1
!===============================================  
End


!===============================================  
!=========== MAGNETIC FIELD SOLVER =============  
Solver 2
  Equation = "MGDynamics"

  Variable = P
  Procedure = "MagnetoDynamics" "WhitneyAVSolver"
  Fix Input Current Density = Logical True

!  Linear System Symmetric = True
!  Optimize Bandwidth = True

  Steady State Convergence Tolerance = 1e-09
  Nonlinear System Convergence Tolerance = 1.0e-8
  Nonlinear System Max Iterations = 1
  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 = GCR
!  Linear System Iterative Method = BiCGStab
  Linear System Iterative Method = BiCGStab2
!  BicGStabL Polynomial Degree = 4

  Linear System Preconditioning = none
!  Linear System Preconditioning = ILU2
!  Linear System ILUT Tolerance = 1.0e-3

!  Linear System Precondition Recompute = 1  
!  Linear System Residual Output = 20
!  Linear System Residual Output = 1

  Linear System Max Iterations = 400 !5000
  Linear System Convergence Tolerance = 1.0e-8

  Linear System Abort Not Converged = False

  Edge Basis = Logical True
  Apply Mortar BCs = Logical True
 
End

Solver 3
  Equation = "MGDynamicsCalc"
  Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"

  Potential Variable = P

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

  Steady State Convergence Tolerance = 1e-09
  Linear System Solver = "Iterative"
!  Linear System Iterative Method = CG
  Linear System Iterative Method = BiCGStab
  
  Linear System Max Iterations = 5000
  Linear System Convergence Tolerance = 1.0e-8
End



Solver 4
  Equation = Result Output
!  Exec Solver = Never
  Procedure = "ResultOutputSolve" "ResultOutputSolver"
  Binary Output = True
  Output Format = vtu
  Output File Name = results
End

Solver 5
  Equation = "scalars"
  procedure = "SaveData" "SaveScalars"
  Filename = "data_scalars.dat"  
End

Boundary Condition 1
  Target Boundaries(1) = 1
  Name = "Current in"

  Potential = 0.055
  Magnetic Flux Density {n} = real 0
End

Boundary Condition 2
  Target Boundaries(1) = 2
  Name = "Current out"
  Potential = 0
  Magnetic Flux Density {n} = real 0
End

Boundary Condition 3
  Target Boundaries(2) = 3 7
  Name = "Outer space"
  P {e}= real 0
End

Boundary Condition 4
  Target Boundaries(1) = 4
  Name = "BCn Flux Parallel" ! Simmetry surface
  Magnetic Flux Density {n} = real 0
end


!============MORTAR==================================
!5 on 6 

Boundary Condition 5
  Name = "Periodic Top"
  Target Boundaries(1) = 5

  Mortar BC = 6
  Anti Radial Projector = Logical True

!  Plane Projector = Logical True
!  Level Projector = Logical True
!  Level Projector Strong = Logical True
End

Boundary Condition 6
  Name = "Periodic Bottom"
  Target Boundaries(1) = 6
End
!====================================================

Body Force 1
  Name = "Current Density"

  Current Density 1 = Equals Volume current 1
  Current Density 2 = Equals Volume current 2
  Current Density 3 = Equals Volume current 3
End
Furthermore, looking at the solver output, I've found (in projector section) a warning complaining that my mesh is skewed. But my mesh isn't skewed, any idea why is this happening? (see part of output below).

Code: Select all

LevelProjector: Checking mesh skew
LevelProjector: This mesh has also triangles
LevelProjector: Maximum skew in this mesh:    8.241E+01
LevelProjector: Checking mesh skew
LevelProjector: Target mesh has also triangles
LevelProjector: Maximum skew in target mesh:    8.241E+01
WARNING:: LevelProjector: Target mesh has too much skew, using generic integrator!
The complete output is here
output.txt
(39 KiB) Downloaded 49 times
Model mesh can be found here: http://www.engandmath.com/public/ElmerF ... bottom.zip

Hope someone can give me a hand with this,

Marco

raback
Site Admin
Posts: 3309
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: problem with mortar periodic BC

Post by raback » 01 Jun 2017, 19:36

Hi Marco

We have had some trouble with mortar BCs associated with edge elements. We need to enforce the continuity weakly and as it is difficult to integrate exactly in 3D we flatten the inteface meshes into 2D. The flattening requires that the projector is either Rotational (r=cost), Radial (phi=const), or Axial (z=const). Adding the "Anti" results to the sign of the projector being multiplied by -1 for radial projector, and for rotational projector if we have a on odd modulo position offset. So I would think that both need to be "Anti" if either is.

For structured interface meshes one can use simple strong projectors since the edge dofs are easily expressed with the help of the slave dofs. If the interface meshes are triangular there is no way to do it simply and hence the code automatically switches to weak projectors.

What basis functions to use to test for the continuity is a little puzzling. Now the code code uses Hcurl also for testing the continuity in Hcurl. We have also tested with Hdiv, but not with full success. Literature proposes notorious Buffa-Cristiansen basis functions for which we haven't done. It is probably that the the convergence issues are related to these questions.

Some minor tips:
- If the is no conductivity you may say "Projector Skip Nodes = True"
- If you have more than one pair of mortars say "Mortar BCs additive = True" in Solver section
- If you do parallel runs ensure that the partitions are with same partitions using -connect flag (or within few)
- You could test with GCR and BiCGStabl (with L set to ~4), and increase number of iterations. 500 is not too much (except for GCR which allocates for all the vectors)

This is an promising field for Elmer and certainly rigorous testing for the mortar projectors is important and appreciated.

-Peter

lazyTom
Posts: 25
Joined: 05 Jun 2013, 01:32
Antispam: Yes

Re: problem with mortar periodic BC

Post by lazyTom » 02 Jun 2017, 01:37

Hi Peter,

Glad to hear that you see 3D electromagnetics as a promising field ^^

By the way, I assume you are aware of the article "Electromagnetic transient finite element 3D modelling of electrical machines using open-source tools"?
Ive found it in this post:
viewtopic.php?f=7&t=4406&p=15901&hilit= ... 354#p15902
I started to build my model after I read it. It seemed so simple :D

Thanks for your comments, it helps a lot! From what you are saying it appears that for the moment having a structured (at least interface) mesh is the best way to to solve the problem.

Before I move to structured mesh however I want to try all your advices. Can you please provide more details on your tips please? In detail:

- If you have more than one pair of mortars say "Mortar BCs additive = True" in Solver section
If you look at my picture with magnetic field B colored in green, my master BC is a single physical surface made of several surfaces coming from the bodies facing the master BC (hope this make sense :D). And the same apply for slave BC. Does this qualify for the use of "Mortar BCs additive = True"?

- You could test with GCR and BiCGStabl (with L set to ~4) ...
do you mean say "BicGStabL Polynomial Degree = 4"?

Regards,

Marco

lazyTom
Posts: 25
Joined: 05 Jun 2013, 01:32
Antispam: Yes

Re: problem with mortar periodic BC

Post by lazyTom » 17 Jun 2017, 19:55

Hi Peter,

About the minor tips, I have tried all of them but it didn't help. Though my questions reamin still open, I have tried Mortar BC Additive (True/False) but again no resuts.

After that, I have prepared a new mesh that uses an unstructured mesh for the volume and a structured 2D mesh on Mortar BC only (see picture below)
structured_mesh_interface.png
structured_mesh_interface.png (22.84 KiB) Viewed 1739 times
The projector appears to be ok (skew found around 10^-9, no warnings, I assume this is good?). However, after that, things got immediately ugly, I've got the following error

Code: Select all

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

Backtrace for this error:
#0  0x7F6482045E08
#1  0x7F6482044F90
#2  0x7F6481C964AF
#3  0x7F6472CD0B04
#4  0x7F6472CD217A
#5  0x7F6472CE51D7
#6  0x7F648252691E
#7  0x7F64825371E1
#8  0x7F6482538331
#9  0x7F648253AABC
#10  0x7F64826DBEF2
#11  0x7F64826E1007
#12  0x401075 in MAIN__ at Solver.F90:69
Segmentation fault
The complete output is here: .

Note that this happened with all available iteraive solvers.
Disabling one by one the solvers ("Exec Solver = Never") showed that the problem is WhitneyAVSolver.

I also tried a finer mesh (10^6 elements), however the solver failed with the same error.

The sif file is here. Please note that only one coils is energised (3Dcoil_1), all the others are assumed to be air

Code: Select all

!!------ Skeleton for body section -----
!Body 1 = stator
!Body 2 = rotor
!Body 3 = air
!Body 4 = 3Dcoil_1
!Body 5 = 3Dcoil_2
!Body 6 = 3Dcoil_3

!BC 01 = mortar left (master)
!BC 02 = mortar right (slave)
!BC 03 = external air (where vector potential is assumed to be 0)
!BC 04 = simmetry at XY plane
!BC 05 = coil 1 current in
!BC 06 = coil 1 current out
!BC 07 = coil 2 current in
!BC 08 = coil 2 current out
!BC 09 = coil 3 current in
!BC 10 = coil 3 current out


Header
   Check Keywords "Warn"

Mesh DB "." "6-4_m_generic_added_one_physical_surface_at_top_and_one_on_bottom_structured_grid"    

  Include Path ""
  Results Directory ""
End

Simulation
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
! Coordinate Scaling=0.001  
  Simulation Type = Steady
  Steady State Max Iterations = 1
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(3) = 3 5 6
  Name = "Air"
  Equation = 2
  Material = 1
End

Body 2
  Target Bodies(1) = 4
  Name = "3D Coil 1"
  Equation = 1
  Material = 2
  Body Force = 1
End

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

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

Material 1
  Name = "Air (room temperature)"
  Viscosity = 1.983e-5
  Heat expansion Coefficient = 3.43e-3
  Heat Conductivity = 0.0257
  Sound speed = 343.0
  Density = 1.205
  Heat Capacity = 1005.0

  Relative Permittivity = Real 1
  Relative Permeability = Real 1
  Electric Conductivity = Real 0
End


Material 2
  Name = "Copper (generic)"
  Heat expansion Coefficient = 16.5e-6
  Heat Conductivity = 401.0
  Sound speed = 3810.0
  Heat Capacity = 385.0
  Density = 8960.0
  Mesh Poisson ratio = 0.34
  Poisson ratio = 0.34
  Youngs modulus = 115.0e9

  Relative Permittivity = Real 1
  Relative Permeability = Real 1
  Electric Conductivity = Real 5.96e7
End

Material 3
  Name = "Iron (generic)"

  Poisson ratio = 0.29
  Heat expansion Coefficient = 11.8e-6
  Youngs modulus = 193.053e9
  Heat Conductivity = 80.2
  Sound speed = 5000.0
  Heat Capacity = 449.0
  Mesh Poisson ratio = 0.29
  Density = 7870.0
  relative Permittivity = 1.0
  Relative Permeability = 1000
  Electric Conductivity = 10.30e6  
End

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

Equation 2
  Name = "Equation magnetic field"
  Active Solvers(2) = 2 3
End

Solver 1
  Equation = Static Current Conduction
  Variable = Potential
  Procedure = "StatCurrentSolve" "StatCurrentSolver"
  Calculate Volume Current = True
  Current Control = 40
  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-8
  Nonlinear System Max Iterations = 1
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Abort Not Converged = True
  Linear System Residual Output = 1
!===============================================

  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-8
  Linear System Preconditioning = ILU0
! Linear System Preconditioning = none
  Linear System ILUT Tolerance = 1.0e-3
 Linear System Precondition Recompute = 1
!===============================================  
End


!===============================================  
!=========== MAGNETIC FIELD SOLVER =============  
Solver 2
!  Exec Solver = Never
  Equation = "MGDynamics"
  Variable = P
  Procedure = "MagnetoDynamics" "WhitneyAVSolver"
  Fix Input Current Density = Logical True

!  Linear System Symmetric = True
!  Optimize Bandwidth = True

  Steady State Convergence Tolerance = 1e-09
  Nonlinear System Convergence Tolerance = 1.0e-8
  Nonlinear System Max Iterations = 1
  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 = GCR
!  Linear System Iterative Method = BiCGStab
!  Linear System Iterative Method = BiCGStab2
!  Linear System Iterative Method = BiCGStabl
!   BicGStabL Polynomial Degree = 4

  Linear System Preconditioning = none
!  Linear System Preconditioning = ILU2
!  Linear System ILUT Tolerance = 1.0e-3

!  Linear System Precondition Recompute = 1  
!  Linear System Residual Output = 20
!  Linear System Residual Output = 1

  Linear System Max Iterations = 1400 !5000
  Linear System Convergence Tolerance = 1.0e-8

  Linear System Abort Not Converged = False

  Edge Basis = Logical True
  Apply Mortar BCs = Logical True
!  Mortar BCs additive = True
 
End

Solver 3
!  Exec Solver = Never
  Equation = "MGDynamicsCalc"
  Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"

  Potential Variable = P

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

  Steady State Convergence Tolerance = 1e-09
  Linear System Solver = "Iterative"
!  Linear System Iterative Method = CG
  Linear System Iterative Method = BiCGStab
  
  Linear System Max Iterations = 5000
  Linear System Convergence Tolerance = 1.0e-8
End



Solver 4
!  Equation = Result Output
!  Exec Solver = Never
  Procedure = "ResultOutputSolve" "ResultOutputSolver"
  Binary Output = True
  Output Format = vtu
  Output File Name = results
End

Solver 5
!  Equation = "scalars"
!  Exec Solver = Never  
  procedure = "SaveData" "SaveScalars"
  Filename = "data_scalars.dat"  
End

Boundary Condition 1
  Target Boundaries(1) = 5
  Name = "Current in"

  Potential = 0.055
  Magnetic Flux Density {n} = real 0
End

Boundary Condition 2
  Target Boundaries(1) = 6
  Name = "Current out"
  Potential = 0
  Magnetic Flux Density {n} = real 0
End

Boundary Condition 3
  Target Boundaries(1) = 3
  Name = "Outer space"
  P {e}= real 0
End

Boundary Condition 4
  Target Boundaries(5) = 4 7 8 9 10
  Name = "BCn Flux Parallel" ! Simmetry surface
  Magnetic Flux Density {n} = real 0
end


!============MORTAR==================================
!1 on 2 

Boundary Condition 5
  Name = "Periodic Top"
  Target Boundaries(1) = 1

  Mortar BC = 6
  Anti Radial Projector = Logical True
!  Projector Skip Nodes = True
!  Level Projector = Logical True
!  Level Projector Strong = Logical True
End

Boundary Condition 6
  Name = "Periodic Bottom"
  Target Boundaries(1) = 2
End
!====================================================

Body Force 1
  Name = "Current Density"

  Current Density 1 = Equals Volume current 1
  Current Density 2 = Equals Volume current 2
  Current Density 3 = Equals Volume current 3
End
The new mesh can be downloaded here:https://www.dropbox.com/s/3vjksd6phkfx7 ... d.zip?dl=0

Any feedback is welcome,

Regards,

Marco

raback
Site Admin
Posts: 3309
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: problem with mortar periodic BC

Post by raback » 18 Jun 2017, 02:06

Hi Marco

The code is terminated to some gauge tree related problem that should not happen. It may be a leftover from recent developments. We'll look into that.

However, even after that there seems to be something beyond the mortar FEs making your system hard to converge. If the system does not converge without the mortar BCs for symmertry, it probably does not converge with them.

I did try to also give the current source with > Electric Potential = Equals "Potential" < and eliminate the jfix but this didn't help the convergce. I would try with direct but this laptop does not have enough memory... Sorry, could not reach convergce either with the fifteen minutes spent on this. My hunch is that the turning currents may be quite tricky. Often the machines with success have been purely extruded with endwinding effects modeled.

The robustness of the linear solvers is a recognized issue. I hope good remedies will be found.

-Peter

lazyTom
Posts: 25
Joined: 05 Jun 2013, 01:32
Antispam: Yes

Re: problem with mortar periodic BC

Post by lazyTom » 18 Jun 2017, 13:50

Good morning Peter,

" ...However, even after that there seems to be something beyond the mortar FEs making your system hard to converge... " - bad luck?!? :D

About your comment of convergence without Mortar BC. If you mean using pure simmetry conditions instead of mortar than I can confirm that the model converges (tollerance goes beyond 10^-9).

Note that I have tried this with the unstructured mesh only.

Here is the sif

Code: Select all

!------ Skeleton for body section -----
!Body 1 = stator
!Body 2 = rotor
!Body 3 = 3Dcoil
!Body 4 = air

!BC 01 = current in
!BC 02 = current out
!BC 03 = surface top
!BC 04 = surface bottom
!BC 05 = simmetry surface
!BC 06 = radial open air

Header
   Check Keywords "Warn"

   Mesh DB "." "6-4_m_generic_with_single_physical_surface_for_symmetry"      

  Include Path ""
  Results Directory ""
End

Simulation
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
! Coordinate Scaling=0.001  
  Simulation Type = Steady
  Steady State Max Iterations = 1
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) = 4
  Name = "Air"
  Equation = 2
  Material = 1
End

Body 2
  Target Bodies(1) = 3
  Name = "3D Coil"
  Equation = 1
  Material = 2
  Body Force = 1
End

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

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

Material 1
  Name = "Air (room temperature)"
  Viscosity = 1.983e-5
  Heat expansion Coefficient = 3.43e-3
  Heat Conductivity = 0.0257
  Sound speed = 343.0
  Density = 1.205
  Heat Capacity = 1005.0

  Relative Permittivity = Real 1
  Relative Permeability = Real 1
  Electric Conductivity = Real 0
End


Material 2
  Name = "Copper (generic)"
  Heat expansion Coefficient = 16.5e-6
  Heat Conductivity = 401.0
  Sound speed = 3810.0
  Heat Capacity = 385.0
  Density = 8960.0
  Mesh Poisson ratio = 0.34
  Poisson ratio = 0.34
  Youngs modulus = 115.0e9

  Relative Permittivity = Real 1
  Relative Permeability = Real 1
  Electric Conductivity = Real 5.96e7
End

Material 3
  Name = "Iron (generic)"

  Poisson ratio = 0.29
  Heat expansion Coefficient = 11.8e-6
  Youngs modulus = 193.053e9
  Heat Conductivity = 80.2
  Sound speed = 5000.0
  Heat Capacity = 449.0
  Mesh Poisson ratio = 0.29
  Density = 7870.0
  Relative Permittivity = 1.0
  Relative Permeability = 1000
  Electric Conductivity = 10.30e6  

  H-B Curve(26,2) = Real
INCLUDE BH  
  
End

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

Equation 2
  Name = "Equation magnetic field"
  Active Solvers(2) = 2 3
End

!==STATIC CURRENT SOLVER==============================
!=====================================================

Solver 1
  Equation = Static Current Conduction
  Variable = Potential
  Procedure = "StatCurrentSolve" "StatCurrentSolver"
  Calculate Volume Current = True
  Current Control = 26
  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-8
  Nonlinear System Max Iterations = 1
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Abort Not Converged = True
  Linear System Residual Output = 1
!===============================================
! iterative method and options

  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-8
  Linear System Preconditioning = ILU0
!  Linear System Preconditioning = none
  Linear System ILUT Tolerance = 1.0e-3
 Linear System Precondition Recompute = 1
!===============================================  
End


!==MAGNETIC FIELD SOLVER==============================
!=====================================================
Solver 2
  Equation = "MGDynamics"

  Variable = P
  Procedure = "MagnetoDynamics" "WhitneyAVSolver"
  Fix Input Current Density = Logical True

  Optimize Bandwidth = True

  Steady State Convergence Tolerance = 1e-09
  Nonlinear System Convergence Tolerance = 1.0e-8
  Nonlinear System Max Iterations = 1
  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 Preconditioning = ilu0
!  Linear System Residual Output = 10
  Linear System Max Iterations = 5000
!  Linear System Iterative Method = BiCGStabl
  Linear System Convergence Tolerance = 1.0e-11

!  BicgStabl Polynomial Degree = 4


!====  

  Linear System Abort Not Converged = False
 
End

!=====================================================
!=====================================================


Solver 3
  Equation = "MGDynamicsCalc"

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

  Potential Variable = P

!  Calculate Current Density = Logical True
!  Calculate Electric Field  = Logical True
  Calculate Magnetic Field Strength = Logical True
  Calculate Magnetic Field Density = Logical True  

!  Calculate Field Energy = Logical True  
!  Calculate Current Density E = Logical True
!  Calculate Electric Field  E = Logical True
!  Calculate Magnetic Field Strength E = Logical True
!  Calculate Magnetic Field Density E = Logical True

!  Steady State Convergence Tolerance = 0
  Steady State Convergence Tolerance = 1e-09
  Linear System Solver = "Iterative"
  Linear System Iterative Method = CG

  Linear System Preconditioning = None

 
  Linear System Residual Output = 0
  Linear System Max Iterations = 5000

  Linear System Convergence Tolerance = 1.0e-8
End



Solver 4
  Equation = Result Output
!  Exec Solver = Never
  Procedure = "ResultOutputSolve" "ResultOutputSolver"
  Binary Output = True
  Output Format = vtu
  Output File Name = results
End

Solver 5
  Equation = "scalars"
  procedure = "SaveData" "SaveScalars"
  Filename = "data_scalars.dat"  
End

!=========================================================
!BC 01 = current in
!BC 02 = current out
!BC 03 = surface top
!BC 04 = surface bottom
!BC 05 = simmetry surface
!BC 06 = radial open air


Boundary Condition 1
  Target Boundaries(1) = 1
  Name = "Current in"

  Potential = 0.055
  Magnetic Flux Density 3 = Real 0
End

Boundary Condition 2
  Target Boundaries(1) = 2
  Name = "Current out"

  Potential = 0
  Magnetic Flux Density 3 = Real 0  

End

Boundary Condition 3
  Target Boundaries(2) = 3 6
  Name = "Outer space"
  P {e}= real 0
End

Boundary Condition 4
  Target Boundaries(1) = 4
  Name = "BCn Flux Parallel" ! Simmetry surface
  Magnetic Flux Density 3 = Real 0  
end


!=================== SYMMETRY =======================
! Symmetry o BC 5

Boundary Condition 5
  Name = "Periodic air Top"
  Target Boundaries(1) = 5
!  Magnetic Flux Density 1 = Real 0
  Magnetic Flux Density 2 = Real 0   
  Magnetic Flux Density 3 = Real 0     
End

!====================================================

Body Force 1
  Name = "Current Density"

  Current Density 1 = Equals Volume current 1
  Current Density 2 = Equals Volume current 2
  Current Density 3 = Equals Volume current 3
End
The uotput file is here:
6-4_m_generic_symmetry_out.txt
(42.74 KiB) Downloaded 45 times
The mesh can be found here: https://www.dropbox.com/s/mkvfl8oq56u7o ... y.zip?dl=0

Please let me know if you manage to do further tests.

By the way, what do you mean by "turning currents"?

Marco

lazyTom
Posts: 25
Joined: 05 Jun 2013, 01:32
Antispam: Yes

Re: problem with mortar periodic BC

Post by lazyTom » 06 Jul 2017, 02:34

Hi Peter,

to further avoid problems with mesh complexity I have prepared a very simple model yet representative of a real world system (KISS rule ;) ).

Consider the system shown in the picture below (NB: clicking the picture will expand it, just found it, but maybe I'm the only one that didn't know it :D ), this is a gappend inductor. However, it can also be seen as a very basic structure resembling a reluctance motor or an electromagnet.
forum 1 OK.png
forum 1 OK.png (80.28 KiB) Viewed 1613 times
If we study the solution for coils carrying currents in opposite direction (picture below) the flux density will follow the path shown in figure c and d (picture below)
Due to simmetry the solution can be studied by using only a part (figure d picture below) of the initial domain. The domain in figure d could be further halved but this will not be done because I want to solve the problem with two approaches.
forum 2 OK.png
forum 2 OK.png (159.08 KiB) Viewed 1613 times
Due to the simple structure the domain can be discretized with a structured extruded mesh containing a single type of element (see picture below). The picture shows also that the problem can be solved in tow ways, one uses assign boundary conditions on flux density normal (Solution 1) and the other uses Mortar Radial projectors. Please note that you can use Anti Radial projectors as well, however, the solution will be different and you will need to make sure that the current in both coils flows in the same direction (with this condition the symmetry BC defined in Solution 1 will not work).
forum 3 OK.png
forum 3 OK.png (437.13 KiB) Viewed 1613 times
The simulation shows that Solution 1 converges while Solution 2 still fails with "Segmentation fault - invalid memory reference"

Here are the files:

mesh (to be used for both slution 1 and 2) : http://www.engandmath.com/public/ElmerF ... t_size.zip

sif file, Solution 1 (Bn = 0): http://www.engandmath.com/public/ElmerF ... 01.sif.zip
Output file, Solution 1: http://www.engandmath.com/public/ElmerF ... output.txt

sif file, Solution 2 (Mortar): http://www.engandmath.com/public/ElmerF ... 02.sif.zip
Output file, Solution 2: http://www.engandmath.com/public/ElmerF ... output.txt

Last but not least, so far I have always used Gmsh to generate the mesh and I've always assumed that there is no problem with its mesh format and/or its translation to Elmer format.
For this reason, if anybody would like to try a different mesher, below there is a link to the gapped inductor 3D model in FreeCAD and STEP:

FreeCAD model: http://www.engandmath.com/public/ElmerF ... _model.zip
Step model: http://www.engandmath.com/public/ElmerF ... _model.zip

I think this should be enought to understand if the mesh is a problem.

Marco

niranjan9ua
Posts: 15
Joined: 27 Jun 2018, 10:49
Antispam: Yes

Re: problem with mortar periodic BC

Post by niranjan9ua » 03 Jul 2018, 14:06

Hi Marco,

Did you manage to get the solution for your motor problem using ELMER? I believe by now all the issues are resolved and the software might able to do the analysis. We recently started modelling an electric motor but not sure which software to use for solution. As you have already same a year back you can suggest me way ahead.

Which software (open source) can be used for an electric motor analysis? Is the Elmer is much better now and fully capable of performing analysis?

Thanks in advance.

Post Reply