02 ElmerWebinar Multiphysics
02 ElmerWebinar Multiphysics
Webinar Series
CSC, Espoo, Finland
via Zoom
Thursdays
15 EET, 14 CET, 8 ET, 22 JST
Spring 2021
Practical guidelines for the webinar
• This webinar will be recorded and will for most parts be available later on youtube
Elmer FEM webinar series - program
• 11.3. Peter Råback & Thomas Zwinger: Introduction to Elmer & How to teach yourself Elmer
• 18.3. Peter Råback & Jonathan Velasco: Overview of capabilities of Elmer - where to go from here?
• 25.3. Peter Råback & Thomas Zwinger: Parallel Computing with Elmer
• 1.4. Juris Vencels: Elmer-OpenFOAM library
• 8.4. Eelis Takala & Frederic Trillaud: Electrical circuits with Elmer with applications
• 15.4. Mika Malinen: Solvers for solid mechanics - Recent progress
• 22.4. Minhaj Zaheer:
Induction Machine Open-source FEA Computations comparison with Measurement and Commercial FEA
• 29.4. Arved Enders-Seidlitz: pyelmer - Python interface for Elmer workflow
• 13.5. Roman Szewczyk, Anna Ostaszewska-Liżewska, Dominika Kopala & Jakub Szałatkiewicz:
Industrial applications oriented, microwave modelling in Elmer
• Additional slots available: contact organizers if you’re interested!
Overview of capabilities of Elmer
Physical models and
some of their common features
ElmerTeam
CSC – IT Center for Science, Finland
• Where to go next?
8 18.3.2021
Example of minimal sif file
! Minimal sif file example Solver 1
Check Keywords "Warn" Equation = ”HeatEq"
Variable = ”Temperature"
Header :: Mesh DB "." "square" Procedure = ”HeatSolve" ”HeatSolver"
Linear System Solver = Direct
Simulation End
Max Output Level = 5
Coordinate System = Cartesian Material 1
Simulation Type = Steady Heat Conductivity = 1.0
Output Intervals(1) = 1 End
Steady State Max Iterations = 1 solver
Post File = "case.vtu" Boundary Condition 1 specific
End Name = ”Fixed” keywords
Target Boundaries(1) = 1
Body 1 Temperature = 0.0
Equation = 1 End
Material = 1
End Boundary Condition 2
Name = ”Flux”
Equation 1 Target Boundaries(1) = 2
Active Solvers(1) = 1 Heat Flux = 1.0
End End
Elmer – abstraction of Solvers
• High level of abstraction ensures flexibility in implementation and simulation
• Solver is an asbtract dynamically loaded object with standard API
o Solver may be developed and compiled without touching the main library
o No upper limit to the number of Solvers
14 18.3.2021
Undocumented Models
AllocateSolver.F90 % just dummy solver for allocation OdeSolver.F90 % ordinary differential equation solver
CoordinateTransform.F90 % RotMSolver: using distances create direction PartitionMesh.F90 % partition mesh solver
CraigBamptonSolver.F90 % model reduction solver PoissonDG.F90
DCRComplexSolve.F90 % complex diffusion-convection-reaction Poisson.F90
DFTSolver.F90 % charge density using the eigenvectors RigidBodyReduction.F90 % reduction of rigid pieces
DirectionSolver.F90 SaveMesh.F90 % mesh saving
DistanceSolve.F90 % compute distance in two methods ScannedFieldSolver.F90 % treating scanned field solutions
DistributeSource.F90 % local to global mesh sources ShallowWaterNS.F90
ElementSizeSolver.F90 % element size with Galerkin ShearrateSolver.F90
EliminateDirichlet.F90 Spalart-Allmaras.F90 % turbulence
EliminatePeriodic.F90 SSTKomega.F90 % turbulence
EnergyRelease.F90 % energy release rate for crack propagation StatCurrentSolveVec.F90 % new version of StatCurrentSolve
FacetShellSolve.F90 ThermoElectricSolver.F90 % strongly coupled thermal & electrostatics
FDiffusion3D.F90 % Complex nodal equation for vector fields TransientCost.F90 % integral over cost
FDiffusion.F90 % Complex nodal equation for scalar fields UMATLib.F90
HeatSolveVec.F90 % new generation HeatSolve V2FSolver.F90 % turbulence
HelmholtzProjection.F90 % purifying vector potential WPotentialSolver.F90 % potential for directions
IncompressibleNSVec.F90 % new generation flowsolve
KESolver.F90 % turbulence • 76 models have been documented
Komega.F90 % turbulence • Tens of modules have not been documented!
Mesh2MeshSolver.F90 % interpolation
MeshChecksum.F90 % utility to check mesh consistency
• Some are of little use but might find users if people
ModelPDE.F90 % simple advection-diffusion-reaction would find them.
NormalSolver.F90 % calculate normal • 5 undocumented turbulence models exist but they
are not that robust…
15 3/18/2021
Example: TwelveSolvers2D
• The purpose of the example is to show how • Square with hot and cold walls
number of different solvers are used • Filled with viscous fluid
• Bouyancy modeled with Boussinesq approximation
• The users should not be afraid to add new • Temperature difference initiates a convection roll
atomistic solvers to perform specific tasks
• A case of 12 solvers is rather rare, yet not
totally unrealitistic
• Added now also as test case Cold Hot
wall wall
gmsh
GiD Paraview
Example: total flux
• Saved by SaveScalars
• Two ways of computing the
total flux give different
approximations
• When convergence is reached
the agreement is good
Example: boundary flux
• Saved by SaveLine
• Three ways of computing the
boundary flux give different
approximations
• At the corner the nodal flux
should be normalized using
only h/2
Some common features for PDE solvers
• Iteration scheme & coupling: linear, nonlinear & steady state level
• Generalized fetching of keywords
• Execution of Solvers
• Time dependency modes
• Finite element basis
• Dirichlet BCs
• Nodal loads
• Shared boundary conditions
• Overlapping meshes
• …
24 18.3.2021
Nested iterations in Elmer as defined by the SIF file
25
Solution of linear system
• Keywords starting with ”Linear System”
• The lowest level operation
• Tens of different techqniques in serial and parallel
• We will go through these next week!
26 18.3.2021
Solution of nonlinear system
• Keywords starting with ”Nonlinear System”
• The level for iterating over one single nonlinear equation
oBy default ElmerGUI assumes nonlinear iteration => always two iterations
Solver i
Nonlinear System Max Iterations = Integer
Nonlinear System Convergence Tolerance = Real
Nonlinear System Relaxation Factor = Real ”norm”
Nonlinear System Convergence Measure = String
Nonlinear System Newton After Tolerance = Real
Nonlinear System Newton After Iterations = Real
Nonlinear system consistent norm = Logical ”solution”
…
”residual”
27 18.3.2021
Solution of coupled system
• Keywords starting with ”Steady State”
• The level for iterating over set of Solvers to find the solution satisfying all of
them
Simulation
Steady State Max Iterations = Integer
Steady State Min Iterations = Integer
Solver i
Steady State Convergence Tolerance = Real
Steady State Relaxation Factor = Real
Steady State Convergence Measure = Real
…
28 18.3.2021
Solution strategies for coupled problems
hierarchical
iterative
monolithic
Weak coupling in Elmer
30 18.3.2021
Real valued keyword functions
1) Tables can be use to define a piecewise linear (or cubic) dependency of a variable
Density = Variable Temperature
Real cubic
173 990 Inside range: Interpolation
273 1000
373 1010
Outside range: Extrapolation!
End
Linux
$ elmerf90 mymodule.F90 –o mymodule.so
Windows
$ elmerf90 mymodule.F90 –o mymodule.dll
32
ElmerSolver - Controlling execution order of Solvers
• By default each a Solver is executed in order of their numbering numbering
• ”Exec Solver” keyword can be used to alter this
o”always” – execute in the coupled system loop of the nested iteration
o”before all” or ”before simulation” -
o”after all” or ”after simulation” – perform something
o”before saving” – perform before saving sequence, maybe compute something for saving
o”after saving” – perform after saving sequence, maybe save someting
o”before timestep” – perform before timestep only
o”after timestep” – perform after timestep only
o”never” – skip solver for debugging etc.
• ”Slave solver” slots (rather new feature) may be used to have some master
Solver call other solvers within their execution.
oAdded flexibility to complex cases
34
ElmerSolver – Time dependency modes
• Transient simulation
o1st order PDEs: Simulation
o Backward differences formulae (BDF) up to 6th degree Simulation Type = Transient
o Newmark Beta (Cranck-Nicolsen with =0.5) Timestep Intervals = 100
Timestep Sizes = 0.1
o 2nd order Runge-Kutta
Timestepping Method = implicit euler
o Adaptive timestepping
o 2nd order PDEs:
o Bossak
36 18.3.2021
ElmerSolver – Finite element shapes
Element shapes are define already in the mesh files
0D: vertex
1D: edge
2D: triangles, quadrilateral
3D: tetrahedrons, prisms, pyramids, hexahedrons
ElmerSolver – Finite element basis functions
•…
39 18.3.2021
ElmerSolver: Exported Variables
• Any solver may allocate additional variables called
”Exported Variables”
• These may be used for various uses, for example
create derived fields easily
#R=8.31
oMay be used in the same way for ”Initial Condition” as #Ea=123.4
regular variables. #A=5.67e-3
oMay be updated if defined in ”Body Force” section and
”Update Exported Variables” is requested. Solver i
Exported Variable 1 = Rate
• Often defined inside the code Updated Exported Variables = True
42 18.3.2021
ElmerSolver - Dirichlet Conditions
• Dirichlet keywords are set by the library for ”Varname”
oTemperature = 273.0
oVelocity = Variable ”Coordinate 2”; Real LUA ”4*tx[0]*(1-tx[0])”
oAV {e} = 0.0 ! For edge degree of freedom
• Boundary Condition i
• Body Force i
oEnables bodywise Dirichlet conditions also
43 18.3.2021
ElmerSolver – Computing nodal forces
47 18.3.2021
Mortar Boundary conditions (surface-to-surface)
Boundary Condition 6
Target Boundaries(1) = 7
Name = "Mortar Left Master"
Mortar BC = Integer 7
Galerkin Projector = Logical True
Plane Projector = Logical True
End
Boundary Condition 7
Target Boundaries(1) = 6
Name = "Mortar Left Target"
End
….
Example: toy model for temperature between 2D rotor and stator
50 18.3.2021
Example: Rotating 2D and 3D ”machines”
51 18.3.2021
Comparison of shared boundary conditions in Elmer
54 18.3.2021
Soft Limiters in Elmer (Inequality Constraints)
test case: LimitDisplacement2
• General way to ensure min/max limit of solution
• A priori contact surface => soft limiters
• Uses two consepts
oNodal load evaluation Solver 1
oContact set Apply Limiter = True
…
• Applicable to
oHeat equation
Boundary Condition 2
oElasticity Name = "Contact"
oRichards equation Target Boundaries(1) = 6
o…
Displacement 3 Upper Limit = Variable time
Real Procedure "ContactBC" "SphereBottom" Hertz problem
End
55 18.3.2021
Contact mechanics in Elmer
• Utilizes the optimal mortar methods +
contact sets of soft limiters
• Results to difficult linear systems
oElimination by using dual basis test functions
59 18.3.2021
Consistency between meshes (as opposed to boundaries)
• Consistency between different meshes may only be
enforced explicitely
test case: multimesh
• Mapping is done automatically when variables is needed
o Octree search – optimal in speed
Boundary Condition 2
Name = "Local2Global"
localT Target Boundaries = 2
globalT
globalT = Equals localT
End
Triggers
mesh-to-mesh Boundary Condition 3
interpolation Name = "Global2Local"
Target Boundaries = 3
localT = Equals globalT
End
60 18.3.2021
Summary
• ~100 Solvers that try to do some specific
tasks
oElmerModels Manual
61 18.3.2021
Discussion: where to go from here?
• Current focus in Elmer/Ice and electromechanics +
some smaller projects
• Architectures change as a driver
oThreading and GPU developments
oNeeded to take use of supercomputers
• Comments?
62 18.3.2021
Most important Elmer resources
• http://www.csc.fi/elmer
o Official Homepage of Elmer at CSC
• http://www.elmerfem.org
o Discussion forum, wiki, elmerice community
• https://github.com/elmercsc/elmerfem
o GIT version control
• http://youtube.com/elmerfem
o Youtube channel for Elmer animations
• http://www.nic.funet.fi/pub/sci/physics/elmer/
o Download repository