Elmer Solver
Elmer Solver
Computational Environment & Application CSCScientic Computing Ltd. The Finnish IT center for science Espoo, Finland
CSC
Zwinger p.1/33
Contents
On Bodies, Elements and Boundaries Finite Elements Linear Solver Preconditioning Solution Levels The Solver Input File (SIF) Header Simulation Solver Body Equation Bodyforce Material Initial Conditions Boundary Conditions Bodies on Boundaries Executing Elmer Tables MATC User Dened Functions User Dened Subroutine Multiple Meshes Element Types Specialities Elmer parallel version
CSC
Zwinger p.2/33
boundary element
body 2
body 1 node
bulk element
CSC
Zwinger p.3/33
Finite Elements
3 linear 2 5 1 1 4 2 3 Real geometry mesh 2 Elmer unit size elements quadratic 6
+ Coordinatesystem metric 3 3
CSC
Zwinger p.4/33
/t + u = () +
CSC
Zwinger p.5/33
/t + u = () +
Test function, and integration over domain :
/t d+
u d =
() d+
CSC
Zwinger p.5/33
/t + u = () +
Test function, and integration over domain :
/t d+
u d =
() d+
/t d +
u d +
d = d
CSC
( ) nd +
Zwinger p.5/33
CSC
Zwinger p.6/33
CSC
Zwinger p.6/33
a(t)
d +
M
u + d =
S
( ) nd + b(t)tt
nat. BC
d +
d
f
timeforce
CSC
Zwinger p.6/33
a(t)
d +
M
u + d =
S
( ) nd + b(t)tt
nat. BC
d +
d
f
timeforce
(M + S) = f
M. . . Mass matrix, S. . . Stiffness matrix, f . . . force vector
CSC
Zwinger p.6/33
Linear Solver
Three solution methods for A = f
Linear System Solver = Keyword
CSC
Zwinger p.7/33
Linear Solver
Three solution methods for A = f
Linear System Solver = Keyword
Direct)
CSC
Zwinger p.7/33
Linear Solver
Three solution methods for A = f
Linear System Solver = Keyword
Direct)
standard LAPACK ( banded ) alternatively UMFPACK - Unsymmetrical Multi Frontal ( UMFPACK ) Krylov subspace iterative methods (Keyword:
Linear System Iterative Method =
Conjugate Gradient ( ( (
Iterative)
CSC
Zwinger p.7/33
Linear Solver
Three solution methods for A = f
Linear System Solver = Keyword
Direct)
standard LAPACK ( banded ) alternatively UMFPACK - Unsymmetrical Multi Frontal ( UMFPACK ) Krylov subspace iterative methods (Keyword:
Linear System Iterative Method =
Conjugate Gradient ( ( (
Iterative)
Multilevel (Keyword:
Zwinger p.7/33
Precondition strategies
A=f
CSC
Zwinger p.8/33
Precondition strategies
A=f
solving instead:
AM1 = f , with = M
CSC
Zwinger p.8/33
Precondition strategies
A=f
solving instead:
AM1 = f , with = M
Why?: AM1 shall have a towards convergence of iterative methods improved spectrum
CSC
Zwinger p.8/33
Precondition strategies
A=f
solving instead:
AM1 = f , with = M
Why?: AM1 shall have a towards convergence of iterative methods improved spectrum Linear System Preconditioning =
None Diagonal ILUn n = 0,1,2,. . . ILUT Multigrid
CSC
Zwinger p.8/33
Solution Levels
time integration steady state iteration Solver 1 non-linear iteration linear iteration . . . end linear iteration end non-linear iteration Solver 2 direct solver . . . end steady state iteration
CSC
Time Steps
Zwinger p.9/33
Solution Levels
time integration steady state iteration Solver 1 non-linear iteration linear iteration . . . end linear iteration end non-linear iteration Solver 2 direct solver . . . end steady state iteration end time integration
CSC
Zwinger p.9/33
Solution Levels
time integration steady state iteration Solver 1 non-linear iteration linear iteration . . . end linear iteration end non-linear iteration Solver 2 direct solver . . . end steady state iteration end time integration
CSC
Zwinger p.9/33
Solution Levels
time integration steady state iteration Solver 1 non-linear iteration linear iteration . . . end linear iteration end non-linear iteration Solver 2 direct solver . . . end steady state iteration end time integration
CSC
Zwinger p.9/33
ElmerSolver mpi
CSC
Zwinger p.10/33
ElmerSolver mpi
can be exported by ElmerFront . . .
CSC
Zwinger p.10/33
ElmerSolver mpi
can be exported by ElmerFront . . . . . . but simply also composed using a text editor
CSC
Zwinger p.10/33
ElmerSolver mpi
can be exported by ElmerFront . . . . . . but simply also composed using a text editor The Rules:
CSC
Zwinger p.10/33
ElmerSolver mpi
can be exported by ElmerFront . . . . . . but simply also composed using a text editor The Rules: comments start with
CSC
Zwinger p.10/33
ElmerSolver mpi
can be exported by ElmerFront . . . . . . but simply also composed using a text editor The Rules: comments start with
CSC
Zwinger p.10/33
ElmerSolver mpi
can be exported by ElmerFront . . . . . . but simply also composed using a text editor The Rules: comments start with
! End
Important: do not use tabulators for indents! a section always ends with the keyword
CSC
Zwinger p.10/33
ElmerSolver mpi
can be exported by ElmerFront . . . . . . but simply also composed using a text editor The Rules: comments start with
! End
Important: do not use tabulators for indents! a section always ends with the keyword
parameters (except from Elmer keyword database) need to be casted by their types: Integer Real Logical String File
CSC
Zwinger p.10/33
ElmerSolver mpi
can be exported by ElmerFront . . . . . . but simply also composed using a text editor The Rules: comments start with
! End
Important: do not use tabulators for indents! a section always ends with the keyword
parameters (except from Elmer keyword database) need to be casted by their types: Integer Real Logical String File
Parametername(n,m)
indicates a nm array
CSC
Zwinger p.10/33
Header
The header declares where to search for the mesh database
CSC
Zwinger p.11/33
Constants
Declaration of constant values that can be obtained from within every solver and boundary condition subroutine or function, can be declared.
CSC
Zwinger p.12/33
Simulation
Principle declarations for simulation
Simulation Coordinate System = "Cartesian 2D"
choices:
Coordinate Mapping(3) = Integer 1 2 3 Simulation Type ="Steady" Output Intervals = 1 Steady State Max Iterations = 10 Steady State Min Iterations = 2 Output File = "name.result" Post File = "name.ep" max output level = n End
permute, if you want to interchange directions either Steady or Transient how often you want to have results maximum rounds on one time level minimum rounds on one Timestep contains data to restart run
ElmerPost-le n=1 talkative like a Finnish lumberjack, n=42 all and everything
CSC
Zwinger p.13/33
Solver
Example: (Navier) Stokes solver
Solver 1 Equation = "Navier-Stokes" Linear System Solver = "Direct" Linear System Direct Method = "UMFPack" Linear System Convergence Tolerance = 1.0E-06 Linear System Abort Not Converged = True Linear System Preconditioning = "ILU2" Steady State Convergence Tolerance = 1.0E-03 Stabilization Method = Stabilized Nonlinear System Convergence Tolerance = 1.0E-05 Nonlinear System Max Iterations = 1 Nonlinear System Min Iterations = 1 Nonlinear System Newton After Iterations = 30 Nonlinear System Newton After Tolerance = 1.0E-05 End
CSC
Iterative
a linear problem
Zwinger p.14/33
Body
Here the different bodies (there can be more than one) get their Equation, Material, Body Force and Initial Condition assigned
Body 1 Name = "identifier" Equation = 1 Material = 1 Body Force = 1 Initial Condition = 1 End
give the body a name
CSC
Zwinger p.15/33
Equation
set active solvers give keywords for the behaviour of different solvers
Equation 1 Active Solvers(2) = 1 2 Convection = Computed Flow Solution Name = String "Flow Solution" NS Convect = False End
CSC
Zwinger p.16/33
Bodyforce
declares the solver-specic f from A = f for the body body force can also be a dependent function (see later). Here for the (Navier) Stokes solver
Body Force 1 Flow BodyForce 1 = 0.0 Flow BodyForce 2 = -9.81 ! End good old gravity
CSC
Zwinger p.17/33
Material
sets material properties for the body. material properties can be scalars or tensors and also can be given as dependent functions
Material 1 Viscosity = 1.0E13 Density = 918.0 My Heat Capacity = Real 1002.0 End
not in keyword DB!
CSC
Zwinger p.18/33
Initial Conditions
initializes variable values sets initial guess for steady state simulation sets initial value for transient simulation variable values can be functions
Initial Condition 1 Velocity 1 = 0.0 Velocity 2 = 1.0 Pressure = 0.0 My Variable = Real 0.0 End
not in keyword DB
CSC
Zwinger p.19/33
Boundary Conditions
Dirichlet:
Neumann: often enabled with keyword (e.g., HTEqu. BC = True) followed by the ux value No BC Natural BC! values can be given as functions
Example: (Navier) Stokes with no penetration (normal) and free slip (tangential)
Boundary Condition 1 Name = "slip" Target Boundaries = 4 Normal-Tangential Velocity = Logical True Velocity 1 = Real 0.0 End
CSC
Zwinger p.20/33
Bodies on Boundaries
need to solve (dimension-1) PDEs (e.g., kinematic BC on free surface)
CSC
Zwinger p.21/33
Bodies on Boundaries
need to solve (dimension-1) PDEs (e.g., kinematic BC on free surface) need to dene the (dimension-1) entity as a separate body
CSC
Zwinger p.21/33
Bodies on Boundaries
need to solve (dimension-1) PDEs (e.g., kinematic BC on free surface) need to dene the (dimension-1) entity as a separate body in the corresponding Boundary-section: Body ID = n with n > highest occurring body in the mesh
CSC
Zwinger p.21/33
Bodies on Boundaries
need to solve (dimension-1) PDEs (e.g., kinematic BC on free surface) need to dene the (dimension-1) entity as a separate body in the corresponding Boundary-section: Body ID = n with n > highest occurring body in the mesh dene Body that body
Force, Material, Equation
and Initial
Condition
for
CSC
Zwinger p.21/33
Bodies on Boundaries
need to solve (dimension-1) PDEs (e.g., kinematic BC on free surface) need to dene the (dimension-1) entity as a separate body in the corresponding Boundary-section: Body ID = n with n > highest occurring body in the mesh dene Body that body
Force, Material, Equation
and Initial
Condition
for
full dimensional metric is still valid on the BC body has to be taken into account in user supplied subroutines
CSC
Zwinger p.21/33
Executing Elmer
make sure that the directory $ELMER of your OS
CSC
Zwinger p.22/33
Executing Elmer
make sure that the directory $ELMER of your OS serial either launch directly, with
ElmerSolver mysolverinputfile.sif
CSC
Zwinger p.22/33
Executing Elmer
make sure that the directory $ELMER of your OS serial either launch directly, with
ElmerSolver mysolverinputfile.sif
CSC
Zwinger p.22/33
Executing Elmer
make sure that the directory $ELMER of your OS serial either launch directly, with
ElmerSolver mysolverinputfile.sif
CSC
Zwinger p.22/33
Executing Elmer
make sure that the directory $ELMER of your OS serial either launch directly, with
ElmerSolver mysolverinputfile.sif
CSC
Zwinger p.22/33
Executing Elmer
make sure that the directory $ELMER of your OS serial either launch directly, with
ElmerSolver mysolverinputfile.sif
CSC
Zwinger p.22/33
Executing Elmer
make sure that the directory $ELMER of your OS serial either launch directly, with
ElmerSolver mysolverinputfile.sif
Zwinger p.22/33
CSC
Zwinger p.23/33
CSC
Zwinger p.23/33
CSC
Zwinger p.23/33
CSC
Zwinger p.23/33
MATC
library for the numerical evaluation of mathematical expressions
CSC
Zwinger p.24/33
MATC
library for the numerical evaluation of mathematical expressions dened in SIF for use in ElmerSolver
CSC
Zwinger p.24/33
MATC
library for the numerical evaluation of mathematical expressions dened in SIF for use in ElmerSolver or by ElmerPost as post-processing feature e.g. K C: math Celsius = Temperature +
273.16
CSC
Zwinger p.24/33
MATC
library for the numerical evaluation of mathematical expressions dened in SIF for use in ElmerSolver or by ElmerPost as post-processing feature e.g. K C: math Celsius = Temperature + very close to C-syntax
273.16
CSC
Zwinger p.24/33
MATC
library for the numerical evaluation of mathematical expressions dened in SIF for use in ElmerSolver or by ElmerPost as post-processing feature e.g. K C: math Celsius = Temperature + very close to C-syntax also logical evaluations (if) and loops (for)
273.16
CSC
Zwinger p.24/33
MATC
library for the numerical evaluation of mathematical expressions dened in SIF for use in ElmerSolver or by ElmerPost as post-processing feature e.g. K C: math Celsius = Temperature + very close to C-syntax also logical evaluations (if) and loops (for) documentation on Funet (MATC Manual)
273.16
CSC
Zwinger p.24/33
MATC contd.
or
CSC
Zwinger p.25/33
MATC contd.
or
CSC
Zwinger p.25/33
MATC contd.
or
CSC
Zwinger p.25/33
MATC contd.
or
CSC
Zwinger p.25/33
MATC contd.
or
CSC
Zwinger p.25/33
CSC
Zwinger p.26/33
REAL(KIND=dp) ::
CSC
Zwinger p.26/33
REAL(KIND=dp) ::
compile:
CSC
Zwinger p.26/33
REAL(KIND=dp) ::
compile: SIF:
Zwinger p.26/33
TransientSimulation
CSC
Zwinger p.27/33
Model Solver dt
TransientSimulation
CSC
Zwinger p.27/33
Model Solver dt
TransientSimulation
CSC
Zwinger p.27/33
Model Solver dt
TransientSimulation
Zwinger p.27/33
User Subroutine
Initialization Nonlinear iteration loop Domain element loop Matrix assembly for domain element until last bulk element Boundary element loop Matrix assembly for von Neumann and Newton conditions at boundary element until last boundary element set Dirichlet boundary conditions solve the system relative change of norms < Nonlinear Tolerance or nonlinear max. iterations exceeded relative change of norms < Steady State Tolerance until last timestep often provided as subroutine inside the solver routine often provided as subroutine inside the solver routine
CSC
Zwinger p.28/33
Pre-dened routines
CALL DefaultInitialize() CALL DefaultUpdateEquations( STIFF, FORCE ) CALL DefaultFinishAssembly()
User Subroutine
Initialization Nonlinear iteration loop Domain element loop Matrix assembly for domain element until last bulk element Boundary element loop Matrix assembly for von Neumann and Newton conditions at boundary element until last boundary element often provided as subroutine inside the solver routine often provided as subroutine inside the solver routine
set Dirichlet boundary conditions solve the system relative change of norms < Nonlinear Tolerance or nonlinear max. iterations exceeded relative change of norms < Steady State Tolerance until last timestep
CSC
Zwinger p.28/33
Multiple Meshes
In the Header, declare the global mesh database
Mesh DB "." "dirname"
CSC
Zwinger p.29/33
Multiple Meshes
In the Header, declare the global mesh database
Mesh DB "." "dirname"
In the Solver, declare the local mesh the solver is run on:
Mesh = File "/path/to/" "mesh"
CSC
Zwinger p.29/33
Multiple Meshes
In the Header, declare the global mesh database
Mesh DB "." "dirname"
In the Solver, declare the local mesh the solver is run on:
Mesh = File "/path/to/" "mesh"
CSC
Zwinger p.29/33
Multiple Meshes
In the Header, declare the global mesh database
Mesh DB "." "dirname"
In the Solver, declare the local mesh the solver is run on:
Mesh = File "/path/to/" "mesh"
variable values will be interpolated they will boldly be extrapolated, should your meshes not be congruent!
CSC
Zwinger p.29/33
Element Types
In section Equation:
CSC
Zwinger p.30/33
Element Types
In section Equation:
Element = [n:#dofs d:#dofs p:#dofs b:#dofs e:#dofs f:#dofs] n . . . nodal, d . . . DG element, p p-element, b . . . bubble, e . . . edge, f . . . face DOFs
CSC
Zwinger p.30/33
Element Types
In section Equation:
Element = [n:#dofs d:#dofs p:#dofs b:#dofs e:#dofs f:#dofs] n . . . nodal, d . . . DG element, p p-element, b . . . bubble, e . . . edge, f . . . face DOFs Element = [d:0]
CSC
Zwinger p.30/33
Element Types
In section Equation:
Element = [n:#dofs d:#dofs p:#dofs b:#dofs e:#dofs f:#dofs] n . . . nodal, d . . . DG element, p p-element, b . . . bubble, e . . . edge, f . . . face DOFs Element = [d:0]
If Equation applies to more than one solver, applies for all solver.
CSC
Zwinger p.30/33
Element Types
In section Equation:
Element = [n:#dofs d:#dofs p:#dofs b:#dofs e:#dofs f:#dofs] n . . . nodal, d . . . DG element, p p-element, b . . . bubble, e . . . edge, f . . . face DOFs Element = [d:0]
If Equation applies to more than one solver, applies for all solver. selectively for each solver:
Element[1] = ... Element[2] = ... . . . Element[n] = ...
CSC
Zwinger p.30/33
Specialities
given names for components of vector elds:
Variable = var name[cname 1:#dofs cname 2:#dofs ... ]
CSC
Zwinger p.31/33
Specialities
given names for components of vector elds:
Variable = var name[cname 1:#dofs cname 2:#dofs ... ]
internal Solver can be run as external Procedures (enabling denition of variable names)
Procedure = "FlowSolve" "FlowSolver" Variable = Flow[Veloc:3 Pres:1]
CSC
Zwinger p.31/33
Specialities
given names for components of vector elds:
Variable = var name[cname 1:#dofs cname 2:#dofs ... ]
internal Solver can be run as external Procedures (enabling denition of variable names)
Procedure = "FlowSolve" "FlowSolver" Variable = Flow[Veloc:3 Pres:1]
CSC
Zwinger p.31/33
Specialities
given names for components of vector elds:
Variable = var name[cname 1:#dofs cname 2:#dofs ... ]
internal Solver can be run as external Procedures (enabling denition of variable names)
Procedure = "FlowSolve" "FlowSolver" Variable = Flow[Veloc:3 Pres:1]
Solver execution:
Exec Solver = {Before Simulation, After Simulation, Never, Always}
CSC
Zwinger p.31/33
-partition 2 2 1 0 -partition 2 2 1 1
22=4 Partition using METIS:
CSC
Zwinger p.32/33
-partition 2 2 1 0 -partition 2 2 1 1
22=4 Partition using METIS:
Execution:
CSC
Zwinger p.32/33
-partition 2 2 1 0 -partition 2 2 1 1
22=4 Partition using METIS:
Execution:
Zwinger p.32/33
CSC
Zwinger p.33/33
Domain 2
Domain 3
CSC
Zwinger p.33/33
Domain 2
Domain 3
CSC
Zwinger p.33/33
Domain 2
Domain 3
Linear System Use Hypre = Logical True Linear System Preconditioning = ParaSails
CSC
Zwinger p.33/33
Domain 2
Domain 3
Linear System Use Hypre = Logical True Linear System Preconditioning = ParaSails ParaSails Threshold, ParaSails Filter, ParaSails Maxlevel, ParaSails Symmetry
CSC
Zwinger p.33/33