MgDyn2D problem

Numerical methods and mathematical models of Elmer
Post Reply
doesi
Posts: 2
Joined: 22 Dec 2023, 15:11
Antispam: Yes

MgDyn2D problem

Post by doesi »

Hi,

I am completely new to ELMER (using the GUI) and want to calculate the B field of a copper conductor surrounded by air in 2D.
  • Then I added the equations MgDyn2D and MgDyn2DPost
  • Defined the materials copper and air
  • Set a current density in the copper (body force)
  • Addad an infinity boundary condition for the outer boundary
Here you can see the sif file:

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 = 1
  Output Intervals(1) = 1
  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 = "Body Property 1"
  Equation = 1
  Material = 1
  Body Force = 1
End

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

Solver 2
  Equation = MgDyn2D
  Procedure = "MagnetoDynamics2D" "MagnetoDynamics2D"
  Variable = Potential
  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 = 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 = BiCGStabl
  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 = MgDyn2DPost
  Procedure = "MagnetoDynamics2D" "BSolver"
  Discontinuous Galerkin = 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 = 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 = "Equation 1"
  Active Solvers(2) = 2 1
End

Material 1
  Name = "Copper (generic)"
  Density = 8960.0
  Sound speed = 3810.0
  Youngs modulus = 115.0e9
  Heat Conductivity = 401.0
  Electric Conductivity = 58e6
  Relative Permeability = 0.999994
  Relative Permeability = 1
  Poisson ratio = 0.34
  Heat expansion Coefficient = 16.5e-6
  Heat Capacity = 385.0
End

Material 2
  Name = "Air (room temperature)"
  Sound speed = 343.0
  Electric Conductivity = 0
  Heat Conductivity = 0.0257
  Heat expansion Coefficient = 3.43e-3
  Relative Permittivity = 1.00059
  Heat Capacity = 1005.0
  Viscosity = 1.983e-5
  Density = 1.205
  Relative Permeability = 1.00000037
End

Body Force 1
  Name = "BodyForce BusBar"
  Current Density = 1
  Calculate Potential = True
End

Boundary Condition 1
  Target Boundaries(1) = 1 
  Name = "BoundaryCondition 1"
  Infinity BC = True
End
Here is my solver log:

Code: Select all

ELMER SOLVER (v 9.0) STARTED AT: 2023/12/22 13:54:19
ParCommInit:  Initialize #PEs:            1
MAIN: 
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 9.0 (Rev: Release, Compiled: 2023-12-14)
MAIN:  Running one task without MPI parallelization.
MAIN:  Running with just one thread per task.
MAIN:  Lua interpreter linked in.
MAIN: =============================================================

MAIN: 
MAIN: 
MAIN: -------------------------------------
MAIN: Reading Model: case.sif

LoadInputFile: Scanning input file: case.sif
LoadInputFile: Scanning only size info
LoadInputFile: First time visiting
LoadInputFile: Reading base load of sif file

LoadInputFile: Loading input file: case.sif
LoadInputFile: Reading base load of sif file

LoadInputFile: Number of BCs: 1
LoadInputFile: Number of Body Forces: 1
LoadInputFile: Number of Initial Conditions: 0
LoadInputFile: Number of Materials: 2
LoadInputFile: Number of Equations: 1
LoadInputFile: Number of Solvers: 2
LoadInputFile: Number of Bodies: 2

ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by area
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by volume

ElmerAsciiMesh: Base mesh name: ./.

LoadMesh: Elapsed REAL time:     0.1000 (s)

MAIN: -------------------------------------
AddVtuOutputSolverHack: Adding ResultOutputSolver to write VTU output in file: case

OptimizeBandwidth: Initial bandwidth for mgdyn2dpost: 60150

OptimizeBandwidth: Optimized bandwidth for mgdyn2dpost: 981

OptimizeBandwidth: Initial bandwidth for mgdyn2d: 10416

OptimizeBandwidth: Optimized bandwidth for mgdyn2d: 340

MAIN: Number of timesteps to be saved: 1

MAIN: 
MAIN: -------------------------------------
MAIN:  Steady state iteration:            1
MAIN: -------------------------------------
MAIN: 

WARNING:: BSolver: This module is obsolete! USE MagnetoDynamicsCalcFields instead
BSolver: -------------------------------------
BSolver: Computing the magnetic field density
BSolver: -------------------------------------

SolveLinearSystem: Solution trivially zero!

SolveLinearSystem: Solution trivially zero!
BSolver:  Result Norm:    0.0000000000000000

MagnetoDynamics2D: ------------------------------------------------
MagnetoDynamics2D: Solving equation for magnetic vector potential
MagnetoDynamics2D: ------------------------------------------------

      10 0.5103E+00 0.5103E+00

      20 0.4186E-01 0.4186E-01

      30 0.4380E-02 0.4380E-02

      40 0.7034E-05 0.7034E-05

      50 0.2891E-07 0.2891E-07

BiCGStabl:       57 0.9459E-10 0.9459E-10

ComputeChange: NS (ITER=1) (NRM,RELC): ( 0.11982764E-07  2.0000000     ) :: mgdyn2d

ComputeChange: NS (ITER=2) (NRM,RELC): ( 0.11982764E-07  0.0000000     ) :: mgdyn2d

ComputeChange: SS (ITER=1) (NRM,RELC): ( 0.11982764E-07  2.0000000     ) :: mgdyn2d

ResultOutputSolver: -------------------------------------
ResultOutputSolver: Saving with prefix: case
ResultOutputSolver: Creating list for saving - if not present
CreateListForSaving: Field Variables for Saving
ResultOutputSolver: Saving in unstructured VTK XML (.vtu) format
VtuOutputSolver: Saving results in VTK XML format with prefix: case
VtuOutputSolver: Saving number of partitions: 1

ResultOutputSolver: -------------------------------------
MAIN: *** Elmer Solver: ALL DONE ***

MAIN: The end
SOLVER TOTAL TIME(CPU,REAL):         1.41        1.41
ELMER SOLVER FINISHED AT: 2023/12/22 13:54:21
It tells me to use MagnetoDynamicsCalcFields instead and that the solution is trivially zero but I don't know what to do with that information.
It only calculates the potential but not the B field.
Did I forget something important?
kevinarden
Posts: 2316
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: MgDyn2D problem

Post by kevinarden »

There are some 2D examples here
https://github.com/ElmerCSC/elmer-elmag
kevinarden
Posts: 2316
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: MgDyn2D problem

Post by kevinarden »

I have some 2D 3D comparisons to FEMM here
https://github.com/mrkearden/mag2D3D
kevinarden
Posts: 2316
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: MgDyn2D problem

Post by kevinarden »

I see the problem now that I ran your files. Solver 1 and 2 need to be switched, They are going in order of 1 2, i.e. the post-processing is happening first.
case.sif
(3.3 KiB) Downloaded 33 times
doesi
Posts: 2
Joined: 22 Dec 2023, 15:11
Antispam: Yes

Re: MgDyn2D problem

Post by doesi »

Thanks, that's it :D , in the GUI this is done by clicking MgDyn2DPost -> Edit Solver Settings -> General -> After saving
Post Reply