Elmer Introduction into Elmer multiphysics FEM package Thomas Zwinger CSC – Tieteen tietotekniikan keskus Oy CSC – IT Center for Science Ltd. Contents • Elmer – Background • FEM formulation – History – Weak form – users, community – Test and weight functions – contacts and links • Elmer – Features – Implemented models – parallel computations • Elmer – Modules – Package modules – Workflow – Standard Galerkin – Stabilization • Something on numerics – Elements – Pre-conditioners and Solvers Elmer - Background • Solution of partial differential equations by FEM (Finite Element Method) • Elmer development was started in 1995 as part of a national CFD program, also funded by Tekes (Finnish technol. agency) • After the initial phase the development has been driven by applications (MEMS, Glaciology, medical application, …) Elmer – Background ctd. • In September 2005 Elmer was published under GNU Public Licence • Goals of the open source publication: – Expand the Elmer community – New resources for code development – Improved verification process – Free software good adverticiment for CSC • Roughly 300000 lines of code! – IP stays with CSC Elmer – Background Elmer – Background Use the force! – elmerfem.org • Wiki, Forum – www.csc.fi/elmer • Main Elmer page – sourceforge.net • Main distribution channel – www.nic.funet.fi • Manuals and binaries Elmer - Features • Fluid Mechanics: RANS, VMS, Reynolds, free surfaces • Structural Mechanics: non/linear elasticity, plates • Heat Transfer: phase change • Electro-Magnetics • Accoustics: Helmholtz equation • Quantum Chemistry: DFT Elmer – Features parallel Scaling of wall clock time with dofs in the cavity lid case using GMRES+ILU0. Simulation Juha Ruokolainen, CSC, visualization Matti Gröhn, CSC . Parallel Runs: using MPI; interfaces to external libraries: Hypre, MUMPS, Pardiso, SuperLU Elmer – Features parallel Elmer - Modules • Generating geometry • Meshing the geomtry Preprocessing • Determining the physical and numerical simulation parameter Solution Postprocessing • Launching the simulation • Numbercrunching • Monitoring of convergence • Visualization of results (3D, 4D) • Data output Elmer - Modules ElmerGUI/ElmerGrid ElmerSolver ElmerPost Elmer - Modules FEM formulation • Stokes equation: • Integration over volume function : using test- FEM formulation • Partial integration of l.h.s.: • Divergence theorem on first term l.h.s.: FEM formulation • Weak formulation: • Linearization of deviatoric stress: FEM formulation • Discretization by weighting function : FEM formulation • Standard Galerkin: S x =f FEM formulation FEM formulation Real Geometry Coordinate system Internal FEM formulation • Saddle point problem: • S is not positive definite no minimization problem • Usual way of solution: X= S-1F – BUT: is S-1 ”well behaving”? FEM formulation • What’s the problem?: – First row: – Insert into 2nd row: FEM formulation • Condition for stability: – Depends on the space of the test-functions – Bad news: standard Galerkin + Stokes = not stable – Stabilization. Methods in Elmer: 1. Residual square methods 2. Residual free bubbles FEM formulation • Residual square method = Stabilized Finite Elements – Simplified example: – Weak formulation (energy minimization): – Adding (element-wise) residual of equation: FEM formulation • Residual free bubbles: – Additional degrees of freedom – Locally on elements – Adding to the orginal system (condensation) equivalent to RSM Something on numerics • General advection-diffusion problem – For instance, heat transfer problem: – Coupled to (Navier-)Stokes via velocity: u – Non-linearities via material parameters, e.g., Something on numerics • Weak formulation: – Time integration – Steady State:dependence on other variables – Non-linear iteration: internal dependence Something on numerics Something on numerics • Time integration – two different methods: – Crank – Nicholson: Crank – Nicholson – Backward Difference Formula: BDF • BDF Order (if 1, then backward Euler – only choice for adaptive time-stepping) • Additional settings: – Time Derivative Order (if 2 then Bossak) – Timestep Intervals – Timestep Sizes Something on numerics • Steady State Problem – Mutual dependence between two segregated Solvers (e.g., Flow solution and convected temperature) – Steady State Convergence Tolerance – Steady State Max Iterations – Steady State Relaxation Factor Something on numerics • Nonlinear Problem: – Nonlinear System Convergence Tolerance – Nonlinear System Max Iterations – Nonlinear System Relaxation Factor Something on Numerics • Solving the Linear(ized) Problem • Keyword: Linear System Iterative Method • 3 ways to do that in Elmer: 1. Direct methods (= inversion of A) 2. Iterative methods (=working with approximations to A) 3. Multi-grid methods (not discussed here) Something on numerics • But, before we solve, we usually apply a pre-conditioner – Find P~A, but much easier to invert – P-1A ~ I has favourable condition number Linear System Preconditioning • None • Diagonal • ILUn (n=0,1,2,...) and ILUT Something on numerics • Direct linear system solver • Keyword: Linear System Direct Method • Banded (default) LAPack • UMFPACK Unsymmetric MultiFrontal method (only serial) • MUMPS Unsymmetric MultiFrontal method (only parallel) – Sometimes the only way to go (if bad conditioned) – Costly: Elimination takes ~N3 operations and needs to store N2 unknows in memory Something on numerics • Iterative solvers: – Krylov subspace: – Linear System Iterative Method • GMRES Generalized Minimal Residual Method • CG, CGS, BiCGStab Conjugate Gradient • TFQMR Transpose-free quasi-minimal residual • GCR Generalized Conjugate Residual