Discrepancy between Elmer and COMSOL results of 3D coil

Numerical methods and mathematical models of Elmer
Post Reply
heqiang
Posts: 3
Joined: 12 Mar 2023, 16:58
Antispam: Yes

Discrepancy between Elmer and COMSOL results of 3D coil

Post by heqiang »

We have built a 3D one-sixth wire coil model and an axisymmetric 2D model using Elmer. We found that when the coil type is massive, the results from Elmer 2D, Elmer 3D, and COMSOL 3D models match very well. However, when the coil type is stranded and the shape of the coil is rectangular, particularly with a large aspect ratio, Elmer 3D results show significant deviation from the other two models. We have identified that the main cause of this deviation is the calculation of the coil's resistance.

I have included the code below for your analysis. Could you please help us understand the reason behind this deviation?

Furthermore, I kindly request your assistance in reviewing the attached Google Drive link. https://drive.google.com/file/d/1z26iNv ... sp=sharing
It contains all the necessary files for the calculation. If you could take a look and provide guidance based on those files, I would greatly appreciate it.


mag.sif

Code: Select all

INCLUDE mesh/mesh.names
Header
Mesh DB "mesh"
Results Directory "magnetic_results"
End

include mag_params.dat
Simulation
Max Output Level = 3
Coordinate System = Cartesian 3D
!Coordinate Scaling = 0.001
Simulation Type = Transient
Timestepping Method = BDF
BDF Order = 2
Output Intervals(1) = 1
Timestep Sizes = $ 1/f/50
Timestep Intervals = 150
Use Mesh Names = Logical True
End

! Air
Material 1
Relative Permeability = 1
Electric Conductivity = 0
End

! Copper
Material 2
Relative Permeability = 1
Electric Conductivity = 1e3
End

Body 1
Name = Air
Equation = 1
Material = 1
Target Bodies = 1
End

Body 2
Name = U_1
Equation = 2
Material = 2
Target Bodies = 2
Body Force = 1
Initial Condition = 1
Alpha reference (3) = Real 0 1 0
Beta reference (3) = Real 0 0 1
End


Equation 1
  Active Solvers(6) = 5 6 7 8 9 10
End
Equation 2
   Active Solvers(10) = 1 2 3 4 5 6 7 8 9 10
End
Solver 1  
   Exec Solver = Before all
   Procedure = "DirectionSolver" "DirectionSolver"
   Linear System Solver = Iterative
   Linear System Iterative Method = BiCGStab
   Linear System Max Iterations = 5000
   Linear System Convergence Tolerance = 1.0e-10
   Linear System Abort Not Converged = True
   Linear System Residual Output = 1000
   Equation = Direction Alpha
   Variable =  Alpha
End
Solver 2  
   Exec Solver = Before all
   Procedure = "DirectionSolver" "DirectionSolver"
   Linear System Solver = Iterative
   Linear System Iterative Method = BiCGStab
   Linear System Max Iterations = 5000
   Linear System Convergence Tolerance = 1.0e-10
   Linear System Abort Not Converged = True
   Linear System Residual Output = 1000
   Equation = Direction Beta
   Variable =  Beta
End
Solver 3 
   Exec Solver = Before All
   Equation = Transformation matrix
   Procedure = "CoordinateTransform" "RotMSolver"
   Variable = -nooutput Dummy
   Optimize Bandwidth = False
   Polar Decomposition Determinant Tolerance = Real 1.0e-9
   Polar Decomposition Max Iterations = Integer 100
   Exported Variable 1 = -nooutput RotM E[RotM E:9]
   Exported Variable 2 = -nooutput Alpha Vector E[Alpha Vector E:3]
   Exported Variable 3 = -nooutput Beta Vector E[Beta Vector E:3]
   Exported Variable 4 = -nooutput Gamma Vector E[Gamma Vector E:3]
   Discontinuous Galerkin = True
End
Solver 4 
   Exec Solver = Before All
   Procedure = "WPotentialSolver" "Wsolve"
   Equation = "Wire direction"
   Variable = W
   Linear System Solver = Iterative
   Linear System Iterative Method = CG
   Linear System Max Iterations = 10000
   Linear System Convergence Tolerance = 1.0e-10
   Linear System Abort Not Converged = True
   Linear System Residual Output = 1000
End

Solver 5
Exec Solver = Always
Equation = Circuits
Variable = X
Procedure = "CircuitsAndDynamics" "CircuitsAndDynamics"
No Matrix = Logical True
End

Solver 6
Exec Solver = Always
Equation = Magmod3D
Variable = A
Procedure = "MagnetoDynamics" "WhitneyAVSolver"
Stabilize = True
Newton-Raphson Iteration = Logical True
Nonlinear System Max Iterations = 20
Nonlinear System Convergence Tolerance = 1e-6

Export Lagrange Multiplier = Logical True
Linear System Solver = Iterative
Linear System Iterative Method = BicgstabL
Linear System preconditioning = Circuit
Linear System Convergence Tolerance = 1e-7
Linear System Max Iterations = 5000
Linear System Residual Output = 1000
Linear System ILUT Tolerance = 1e-5
BicgstabL polynomial degree = 6
Linear System Abort Not Converged = False
End

Solver 7
Exec Solver = Always
Equation = CalcFields
Potential Variable = A
Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
Linear System Symmetric = True
Steady State Convergence Tolerance = 0
Linear System Solver = "Iterative"
Linear System Preconditioning = None
Linear System Residual Output = 1000
Linear System Max Iterations = 5000
Linear System Iterative Method = CG
Steady State Convergence Tolerance = 1e-6
Linear System Convergence Tolerance = 1.0e-8
Calculate Current Density = Logical True 
Calculate Electric Field = Logical True
Calculate Magnetic Field Strength = Logical True
Calculate JxB= Logical True
Calculate Joule Heating = Logical True
End

Solver 8
Exec Solver = after saving
Equation = "ResultOutput"
Procedure = "ResultOutputSolve" "ResultOutputSolver"
Output File Name = magnetic
Output Directory = ./results
Binary Output = Logical True
Vtu format = Logical True
Single Precision = Logical True
!Vector Field 1 = "magnetic flux density e"
!Vector Field 2 = "electric field e"
!Scalar Field 1 = "Joule Heating E"
Discontinuous Bodies = Logical True  
End 

Solver 9
Exec Solver = Always
Equation = CircOutput
Procedure = "CircuitsAndDynamics" "CircuitsOutput"
End

Solver 10
Exec Solver = After timestep
Equation = scalars1
Procedure = "SaveData" "SaveScalars"
Filename = magnetic_results.dat
Output Directory = magnetic_results
Parallel Reduce = Logical True
End

Boundary Condition 1
Name = BCn Flux Parallel  
Target Boundaries(2) = 1 2
A {e} = Real 0
A = Real 0
End

Boundary Condition 2
  Name = Alpha0
  Target Boundaries = 6
  Body 2: Alpha = Real 0
End

Boundary Condition 3
  Name = Alpha1
  Target Boundaries = 9
  Body 2: Alpha = Real 1
End

Boundary Condition 4
  Name = Beta0
  Target Boundaries = 7
  Body 2: Beta = Real 0
End

Boundary Condition 5
  Name = Beta1
  Target Boundaries = 8
  Body 2: Beta = Real 1
End

Boundary Condition 6
   Name = coil_begin1
   Target Boundaries = 11
   A {e} = Real 0
   A  = Real 0
   W = Real 0
End

Boundary Condition 7
   Name = coil_end1
   Target Boundaries = 5
   A {e} = Real 0
   A  = Real 0
   W = Real 1.0
End
mag_params.dat

Code: Select all

$ f = 50		! [Hz] electrical frequency
$ U = 1.0       ! [V] rated voltage

!----------------------------------------------------------
! Stator voltage driven circuits for 3 phases
!----------------------------------------------------------
$ Circuits = 1
!----------------------------------------------------------
! Phase U_plus
!----------------------------------------------------------

! init matrices phase U
! init matrices of Ax' + Bx = Source
$ C.1.variables = 5
$ C.1.perm = zeros(C.1.variables)
$ C.1.A = zeros(C.1.variables,C.1.variables)
$ C.1.B = zeros(C.1.variables,C.1.variables)


! define circuit variables
$ C.1.name.1 = "i_V1"
$ C.1.name.2 = "i_component(1)"
$ C.1.name.3 = "v_V1"
$ C.1.name.4 = "v_component(1)"
$ C.1.name.5 = "u_2_circuit_1"


! -----------------------------------------------------------------------------
! Source Vector Definition
! -----------------------------------------------------------------------------
$ C.1.source.5 = "V1_Source"

! -----------------------------------------------------------------------------
! KCL Equations
! -----------------------------------------------------------------------------
$ C.1.B(0,0) = 1
$ C.1.B(0,1) = 1

! -----------------------------------------------------------------------------
! KVL Equations
! -----------------------------------------------------------------------------
$ C.1.B(1,2) = 1
$ C.1.B(1,4) = 1
$ C.1.B(2,3) = -1
$ C.1.B(2,4) = 1

! -----------------------------------------------------------------------------
! Component Equations
! -----------------------------------------------------------------------------
$ C.1.B(4,2) = 1


Component 1
  Name = String Uplus
  Body = Integer 2
  Coil type = string stranded
  Number of Turns = real 10
  Electrode Boundaries(2) = Integer 6 5
  Circuit Equation Voltage Factor = Real $1/6
End


Body Force 1
  Name = "Circuit"
  V1_Source = Variable time
    Real MATC "sqrt(2/3)*U*sin(tx(0)*2*pi*f)"
End
Takala
Posts: 186
Joined: 23 Aug 2009, 23:59

Re: Discrepancy between Elmer and COMSOL results of 3D coil

Post by Takala »

Hello

I think the problem might be related to this keyword:
Circuit Equation Voltage Factor = Real $1/6

If I remember correctly, there was some issue with that. There is another keyword, used in reducing symmetries, which I have forgotten. Someone else working with electrical machines might remember it.

Cheers,

Eelis
Post Reply