Elmersolver Manual
Total Page:16
File Type:pdf, Size:1020Kb
ElmerSolver Manual Juha Ruokolainen, Mika Malinen, Peter Råback, Thomas Zwinger, Antti Pursula and Mikko Byckling CSC – IT Center for Science August 23, 2019 ElmerSolver Manual About this document The ElmerSolver Manual is part of the documentation of Elmer finite element software. ElmerSolver Man- ual describes the Elmer Solver options common for all specific equation solvers. The different equations solver options are described separately in Elmer Models Manual. The ElmerSolver Manual is best used as a reference manual rather than a concise introduction to the matter. The present manual corresponds to Elmer software version 8.4 for Windows NT and Unix platforms. The latest documentation and program versions of Elmer are available (or links are provided) at http://www.csc.fi/elmer. Copyright information The original copyright of this document belongs to CSC – IT Center for Science, Finland, 1995–2019. This document is licensed under the Creative Commons Attribution-No Derivative Works 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/3.0/. Elmer program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Elmer software is distributed in the hope that it will be useful, but without any warranty. See the GNU General Public License for more details. Elmer includes a number of libraries licensed also under free licensing schemes compatible with the GPL license. For their details see the copyright notices in the source files. All information and specifications given in this document have been carefully prepared by the best ef- forts of CSC, and are believed to be true and accurate as of time writing. CSC assumes no responsibility or liability on any errors or inaccuracies in Elmer software or documentation. CSC reserves the right to modify Elmer software and documentation without notice. 2 Contents Table of Contents 3 1 Solving a multiphysics problem with the solver of Elmer: Fundamentals 6 1.1 Basic concepts ......................................... 6 1.2 Handling interactions of multiple physical phenomena .................... 7 1.3 The key abilities ......................................... 8 2 Structure of the Solver Input File 10 2.1 Introduction ........................................... 10 2.2 The sections of solver input file ................................. 10 2.3 Keyword syntax ......................................... 14 2.4 Running several sequences ................................... 17 3 Restart from existing solutions 18 3.1 Restart file ............................................ 18 3.2 Initialization of dependent variables .............................. 19 4 Solution methods for linear systems 21 4.1 Introduction ........................................... 21 4.2 Direct methods ......................................... 21 4.3 Preconditioned Krylov methods ................................ 22 4.4 Multilevel methods ....................................... 23 4.5 Preconditioning via inner iterations ............................... 25 4.6 Keywords related to linear system solvers ........................... 26 4.7 Implementation issues ..................................... 30 Bibliography ............................................. 32 5 Nonlinear System Options 33 5.1 Introduction ........................................... 33 5.2 Keywords related to solution of nonlinear systems ....................... 33 6 Integration of time-dependent systems 36 6.1 Introduction ........................................... 36 6.2 Time discretization strategies .................................. 36 6.3 Keywords related to time discretization ............................ 37 6.4 On the treatment of time derivatives in Elmer Solver code ................... 39 6.5 Predictor Corrector Scheme ................................... 40 Bibliography ............................................. 40 7 Solving eigenvalue problems 41 7.1 Introduction ........................................... 41 7.2 Theory .............................................. 41 7.3 Keywords related to eigenvalue problems ........................... 42 7.4 Constructing matrices M and D in Solver code ......................... 44 3 CONTENTS 4 8 Dirichlet boundary conditions and limiters 45 8.1 Dirichlet constraints ....................................... 45 8.2 Soft limiters ........................................... 47 9 Enforcing shared conditions between boundaries 48 9.1 Periodic conditions ....................................... 48 9.2 Mortar conditions ........................................ 49 10 Linear systems with constraints 54 10.1 Introduction ........................................... 54 10.2 Keywords related to treatment of linear constraints ...................... 55 11 Solving constraint modes 56 11.1 Introduction ........................................... 56 11.2 Keywords related to constraint modes analysis ......................... 56 12 Working with nodal loads 57 12.1 Setting nodal loads ....................................... 57 12.2 Computing nodal loads ..................................... 57 12.3 Computing nodal weights .................................... 58 12.4 Energy norm .......................................... 58 13 Generic solver utilities 59 13.1 Solver activation ........................................ 59 13.2 Variable names ......................................... 59 13.3 Exported and derived variables ................................. 60 13.4 Active and passive elements .................................. 62 13.5 Timing the solvers ....................................... 62 13.6 Consistency testing of solvers .................................. 62 14 Meshing Utilities 63 14.1 Coordinate transformation ................................... 63 14.2 Mesh multiplication ....................................... 64 14.3 Mesh extrusion ......................................... 64 14.4 Discontinuous mesh for internal jumps ............................. 66 14.5 Discontinuous Galerkin for internal jumps ........................... 67 15 Adaptive Solution 68 15.1 Introduction ........................................... 68 15.2 Theory .............................................. 68 15.3 Keywords related to the adaptive solution ........................... 70 15.4 Implementing own error estimators ............................... 70 16 Parallel runs 73 16.1 Introduction ........................................... 73 16.2 Preprocessing of Parallel Runs ................................. 74 16.3 Parallel Computations in Elmer ................................. 77 16.4 Post-processing of Parallel Runs ................................ 82 17 Compilation and Linking 84 17.1 Compiling with CMake ..................................... 84 17.2 Compiling a user-defined subroutine .............................. 85 CONTENTS 5 18 Basic Programming 86 18.1 Introduction ........................................... 86 18.2 Basic Elmer Functions and Structures ............................. 86 18.3 Writing a User Function .................................... 94 18.4 Writing a Solver .........................................106 18.5 Compilation and Linking of User Defined Routines/Functions ................118 A Format of mesh files 119 A.1 The format of header file ....................................119 A.2 The formatof node file .....................................119 A.3 The format of element file ...................................120 A.4 The format of boundary element file ..............................120 A.5 The format of shared nodes file .................................120 A.6 Exceptions on parallel mesh format ..............................121 B Format of result output files 122 B.1 Format versions .........................................122 B.2 General structure ........................................122 B.3 The positions file ........................................125 C Format of ElmerPost Input File 126 D Basic element types 128 E Higher-order finite elements 131 E.1 Higher-order elements in Elmer ................................131 E.2 ElmerSolver services for higher-order elements ........................134 E.3 Basis functions .........................................136 Bibliography .............................................145 F Face and edge elements 146 F.1 The construction of face element interpolation .........................146 F.2 The construction of edge element interpolation ........................151 Bibliography .............................................155 G Advanced finite element definitions 156 G.1 Specification of the degrees of freedom ............................156 Index 157 Chapter 1 Solving a multiphysics problem with the solver of Elmer: Fundamentals Elmer software has been developed multiphysics simulations in mind. Thus, in addition to offering ways to produce computational solutions to single-physics models (the available collection of which is described in the Elmer Models Manual), Elmer provides procedures for creating computational models which describe interactions of multiple physical phenomena. Our intention here is to give an overview how this functionality is built into the solver of Elmer associated with the independent program executable ElmerSolver. 1.1 Basic concepts The models handled by Elmer may generally be stationary or evolutionary, with nonlinearities possible in both the cases. Starting