Open and closed coils in one MagDyn model

Numerical methods and mathematical models of Elmer
Post Reply
matsuiSL
Posts: 7
Joined: 15 Oct 2022, 02:48
Antispam: Yes

Open and closed coils in one MagDyn model

Post by matsuiSL »

I'm trying to model the interaction between a electromagnet and a straight wire, both with current running through it.

I'm finding that I can't seem to use two individual CoilSolver solvers in a single model, one which could be applied with the "Coil Closed = True" tag and one without (not to mention the normals would be off). I'm guessing this is just a fundamental decision here with the framework.

So instead I'm applying just a current density body force to the single, straight wire. However, when I do this, the solver doesn't seem to compute any magnetic fields emanating from the wire (solution is trivially zero), even though the output results indicate a current density is applied. Oddly enough, if I switch the CoilSolver to the straight wire (with all the correct parameters) I get the same current density but with magnetic fields properly computed.

Curious if anybody has any ideas as to what's going on here? I'm essentially just replicating the settings in the mgdyn_steady_wire and mgdyn_steady_wire_conforming test cases.

What I'm using/seeing:

.sif with just bodyforce (note coil current for the electromagnet is set to 0 for debugging)

Code: Select all

Header
  CHECK KEYWORDS Warn
  Mesh DB "." "."
  Include Path ""
  Results Directory ""
End

Simulation
  Max Output Level = 5
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Steady state
  Steady State Max Iterations = 100
  Output Intervals(1) = 10
  Coordinate Scaling = 1.0e-3
  Solver Input File = case.sif
  Post File = case.vtu
End

Constants
  Gravity(4) = 0 -1 0 9.82
  Stefan Boltzmann = 5.670374419e-08
  Permittivity of Vacuum = 8.85418781e-12
  Permeability of Vacuum = 1.25663706e-6
  Boltzmann Constant = 1.380649e-23
  Unit Charge = 1.6021766e-19
End

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

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

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

Solver 2
  Equation = MgDyn
  Use Elemental CoilCurrent = True
  Procedure = "MagnetoDynamics" "WhitneyAVSolver"
  Fix Input Current Density = True
  Exec Solver = Always
  Stabilize = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 30
  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 = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Solver 1
  Equation = MgDynPost
  Discontinuous Bodies = True
  Calculate Electric Field = True
  Calculate Joule Heating = True
  Skip Nodal Fields = False
  Calculate Nodal Forces = True
  Calculate Current Density = True
  Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
  Calculate Magnetic Field Strength = True
  Exec Solver = Before Saving
  Stabilize = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 20
  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 = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Solver 3
  Equation = CoilSolver
  Narrow Interface = True
  Desired Coil Current = 0
  Coil Closed = True
  Procedure = "CoilSolver" "CoilSolver"
  Coil Normal(3) = 0 0 1
  Fix Input Current Density = True
  Exec Solver = Before Simulation
  Stabilize = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 20
  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 = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Equation 1
  Name = "stator"
  Active Solvers(2) = 2 1
End

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

Equation 2
  Name = "air"
  Active Solvers(2) = 2 1
End

Material 1
  Name = "air"
  Relative Permittivity = 1.00059
  Sound speed = 343.0
  Heat Conductivity = 0.0257
  Heat Capacity = 1005.0
  Heat expansion Coefficient = 3.43e-3
  Relative Permeability = 1.00000037
  Density = 1.205
  Viscosity = 1.983e-5
End

Material 2
  Name = "alu"
  Relative Permeability = 1
  Electric Conductivity = 3.526e7
End

Body Force 1
! a) Give current density
  Current Density 1 = 0.0
  Current Density 2 = 400
  Current Density 3 = 0.0
End

Boundary Condition 1
  Target Boundaries(6) = 13 14 15 16 17 18 
  Name = "inf"
  AV {e} = 0
  Jfix = real 0.0
End

Boundary Condition 2
  Target Boundaries(1) = 5 
  Name = "volt"
!  AV = 0
  AV {e} = 0
!  AV {e} 1 = 0
!  AV {e} 2 = 0
End

Boundary Condition 3
  Target Boundaries(1) = 6 
  Name = "ground"
!  AV = 0
  AV {e} = 0
!  AV {e} 1 = 0
!  AV {e} 2 = 0
End
bodyforce.png
(373.5 KiB) Not downloaded yet
.sif with CoilSolver

Code: Select all

Header
  CHECK KEYWORDS Warn
  Mesh DB "." "."
  Include Path ""
  Results Directory ""
End

Simulation
  Max Output Level = 5
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Steady state
  Steady State Max Iterations = 100
  Output Intervals(1) = 10
  Coordinate Scaling = 1.0e-3
  Solver Input File = case.sif
  Post File = case.vtu
End

Constants
  Gravity(4) = 0 -1 0 9.82
  Stefan Boltzmann = 5.670374419e-08
  Permittivity of Vacuum = 8.85418781e-12
  Permeability of Vacuum = 1.25663706e-6
  Boltzmann Constant = 1.380649e-23
  Unit Charge = 1.6021766e-19
End

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

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

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

Solver 2
  Equation = MgDyn
  Use Elemental CoilCurrent = True
  Procedure = "MagnetoDynamics" "WhitneyAVSolver"
  Fix Input Current Density = True
  Exec Solver = Always
  Stabilize = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 30
  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 = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Solver 1
  Equation = MgDynPost
  Discontinuous Bodies = True
  Calculate Electric Field = True
  Calculate Joule Heating = True
  Skip Nodal Fields = False
  Calculate Nodal Forces = True
  Calculate Current Density = True
  Procedure = "MagnetoDynamics" "MagnetoDynamicsCalcFields"
  Calculate Magnetic Field Strength = True
  Exec Solver = Before Saving
  Stabilize = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 20
  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 = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Solver 3
  Equation = CoilSolver
  Narrow Interface = True
  Desired Coil Current = 1
  Procedure = "CoilSolver" "CoilSolver"
  Coil Normal(3) = 0 1 0
  Fix Input Current Density = True
  Exec Solver = Before Simulation
  Stabilize = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 20
  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 = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

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

Equation 2
  Name = "air"
  Active Solvers(2) = 2 1
End

Material 1
  Name = "air"
  Relative Permittivity = 1.00059
  Sound speed = 343.0
  Heat Conductivity = 0.0257
  Heat Capacity = 1005.0
  Heat expansion Coefficient = 3.43e-3
  Relative Permeability = 1.00000037
  Density = 1.205
  Viscosity = 1.983e-5
End

Material 2
  Name = "alu"
  Relative Permeability = 1
  Electric Conductivity = 3.526e7
End

Body Force 1
  Name = "coil current"
  Electric Potential = Equals "CoilPot"
End

Boundary Condition 1
  Target Boundaries(6) = 13 14 15 16 17 18 
  Name = "inf"
  AV {e} = 0
  Jfix = real 0.0
End

Boundary Condition 2
  Target Boundaries(1) = 5 
  Name = "volt"
  AV {e} 1 = 0
  Coil Start = True
  AV {e} 2 = 0
  AV = 0
End

Boundary Condition 3
  Target Boundaries(1) = 6 
  Name = "ground"
  AV {e} 2 = 0
  AV = 0
  AV {e} 1 = 0
  Coil End = True
End
coilsolver.png
(755.42 KiB) Not downloaded yet
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Open and closed coils in one MagDyn model

Post by raback »

Hi

Indeed, those were not additive. I made some small changes and just committed to devel. Now you should be able to have CoilCurrent and "Current Density" both active at the same time in different regions.

It would be a bigger change to have CoilSolver to deal with mixture of closed and open coils.

-Peter
Post Reply