Circuits and dynamics with full coil

Numerical methods and mathematical models of Elmer
Post Reply
Davide
Posts: 2
Joined: 25 Mar 2019, 16:53
Antispam: Yes

Circuits and dynamics with full coil

Post by Davide » 13 Nov 2019, 12:15

Hi,
starting from the tests examples circuits_harmonic_stranded, I have modelled a simple stranded coil in air.
Following you can find the .sif file, circuit definitions file and a screenshot of the computed magnetic flux density.

Code: Select all


INCLUDE circuits.definitions
Header
  CHECK KEYWORDS Warn
  Mesh DB "."
End


Initial Condition 1
   A re {e} = Real 0
   A im {e} = Real 0
End


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

  Simulation Type = Steady
  Steady State Max Iterations = 1
  BDF Order = 1
  Output Intervals = 1

  Coordinate scaling = 0.001
  Max Output Level = 6
  Angular Frequency = 314.15926
  Vtu format = Logical True
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) = 2
  Name = "Coil"
  Equation = 1
  Material = 2
  Body Force = 1  
  Alpha reference (3) = Real 0 1 0
  Beta reference (3) = Real 0 0 1
  Initial Condition = 1
End

Body 2
  Target Bodies(1) = 1
  Name = "Air"
  Equation = 2
  Material = 1
  Initial Condition = 1
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
   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 !-- WpotentialSolver - Wsolve
   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 !-- CircuitsAndDynamics - CircuitsAndDynamicsHarmonic
   Exec Solver = Always
   Equation = Circuits
   Variable = X
   No Matrix = Logical True
   Procedure = "CircuitsAndDynamics" "CircuitsAndDynamicsHarmonic"
End

Solver 6 !-- MagnetoDynamics - WhitneyAVHarmonicSolver
   Exec Solver = Always
   Equation = "MGDynamics"
   Variable = "A[A re:1 A im:1]"
   Procedure = "MagnetoDynamics" "WhitneyAVHarmonicSolver"
   Angular Frequency = 314.15926
   Export Lagrange Multiplier = Logical True
   Linear System Symmetric = Logical True
   Linear System Complex = Logical True
   Linear System Solver = Iterative
   Linear System Iterative Method = BicgstabL
   Linear System preconditioning = Circuit
   Linear System Convergence Tolerance = 1.e-7
   Linear System Max Iterations = 5000
   Linear System Residual Output = 100
   BicgStabL Polynomial Degree = 4
   Linear System Abort not Converged = False
   Steady State Convergence Tolerance = 1e-06
 !  Fix Input Current Density  = Logical True

End

Solver 7
   Exec Solver = Always
   Equation = "MGDynamicsCalc"
   Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
   Linear System Symmetric = True
   Potential Variable = String "A"
   Calculate Current Density = Logical True
   
   !Calculate Winding Voltage = Logical True

   Loss Estimation = Logical 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
End

Solver 8
   Exec Solver = Always
   Equation = "ResultOutput"
   Procedure = "ResultOutputSolve" "ResultOutputSolver"
   Output File Name = results
   Vtu format = Logical True
   Save Geometry Ids = Logical True
End

Solver 9
   Exec Solver = Always
   Equation = Circuits Output
   Procedure = "CircuitsAndDynamics" "CircuitsOutput"
End

Solver 10
   Exec Solver = Always
   Equation = "sv"
   Procedure = "SaveData" "SaveScalars"
   Filename = out.dat
End


! The coils 

Component 1 
 Name = String "Coil"
! Coil Type = String "test"
! Master Bodies(1) = Integer 1
! Desired Current Density = Real 0.777e6  ! pk
! Coil Normal(3) = Real 0 0 1

 Body = Integer 1
 Coil Type = String stranded
 Electrode Area = Real 0.0001466
! Electrode Boundaries(2) = Integer 8 10 
 Number of Turns = Real 114

End 




Equation 1
  Name = "MGDyn for coil"
  Active Solvers(10) = 1 2 3 4 5 6 7 8 9 10
End
Equation 2
  Name = "MGDyn for air"
  Active Solvers(2) = 6 7 
End

Material 1
  Name = "Space"
  Relative Permeability = 1.0
  Electric Conductivity = 0
End

Material 2
  Name = "Conductor"
  Relative Permeability = 1.0
  Electric Conductivity = 58e6
End


Boundary Condition 1
   Name = Alpha0
   Target Boundaries = 7
   Body 1: Alpha = Real 0
End
Boundary Condition 2
   Name = Alpha1
   Target Boundaries = 4
   Body 1: Alpha = Real 1
End
Boundary Condition 3
   Name = Beta1
   Target Boundaries = 6
   Body 1: Beta = Real 1
End
Boundary Condition 4
   Name = Beta0
   Target Boundaries = 5
   Body 1: Beta = Real 0
End

Boundary Condition 5
   Name = sfera
   Target Boundaries = 7
   A re {e} = Real 0
   A im {e} = Real 0
End

Boundary Condition 6
   Name = ground
   Target Boundaries = 8
   W = Real 0
   A re {e} = Real 0
   A im {e} = Real 0
End
Boundary Condition 7
   Name = current in foil winding
   Target Boundaries = 10
   W = Real 1
   A re {e} = Real 0
   A im {e} = Real 0
End

Boundary Condition 8
   Name = sfera_tagliata
   Target Boundaries = 9
   A re {e} = Real 0
   A im {e} = Real 0
End



Body Force 1
   Name = "Circuit"
   S Re = Real $ cos(0.0*pi/3) * 1.41421356237
   S Im = Real $ sin(0.0*pi/3) * 1.41421356237
End


!Solver 4 :: Reference Norm = Real 5.88944303E-01 
!Solver 4 :: Reference Norm Tolerance = Real 1E-3
!Solver 6 :: Reference Norm = Real 4.11924917E-07
!Solver 6 :: Reference Norm Tolerance = Real 1E-3
$fprintf( stderr, "TEST CASE 1\n");
RUN

Code: Select all

$ Circuits = 1



! ------------------------ Circuit 1 ------------------------
! Define variable count and initialize circuit matrices.
$ C.1.perm = zeros(4)
!$ C.1.perm(0) = 0
!$ C.1.perm(2) = 1
!$ C.1.perm(3) = 2
!$ C.1.perm(1) = 3

$ C.1.variables = 4
$ C.1.A = zeros(4,4)
$ C.1.B = zeros(4,4)
$ C.1.Mre = zeros(4,4)
$ C.1.Mim = zeros(4,4)

! Define variables.
$ C.1.name.1 = "i_S"
$ C.1.name.2 = "v_S"
$ C.1.name.3 = "i_component(1)"
$ C.1.name.4 = "v_component(1)"

! Define sources:
!------------------
$ C.1.B(0,0) = 1
$ C.1.source.1 = "S"

! Define network cycles:
!-------------------------
!Voltage relations.
$ C.1.B(1,1) = 1
$ C.1.B(1,3) = -1
!Current relations.
$ C.1.B(2,0) = 1
$ C.1.B(2,2) = 1

magnetic_flux_density.png
magnetic_flux_density.png (64.34 KiB) Viewed 2448 times
Like the example I have modelled half coil in order to apply correct boundary conditions (i.e. w potential) obtaining the correct result.
Now I’m interested in modelling the 3D full coil without cuts.
Is it possible? In the past for modelling a full massive coil I have used coilsolver, but I didn’t manage to use it in conjunction with circuits and dynamics.
I’m wondering which is the correct approach. Any suggestions?
Just to clarify: My goal is the modelling of arbitrary shaped stranded coils in harmonic domain.
Thanks

Post Reply