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 April 1, 2021 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 9.0. 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 9.3 Conforming conditions ..................................... 53 10 Linear systems with constraints 55 10.1 Introduction ........................................... 55 10.2 Keywords related to treatment of linear constraints ...................... 56 11 Solving constraint modes 57 11.1 Introduction ........................................... 57 11.2 Keywords related to constraint modes analysis ......................... 57 12 Working with nodal loads 58 12.1 Setting nodal loads ....................................... 58 12.2 Computing nodal loads ..................................... 58 12.3 Computing nodal weights .................................... 59 12.4 Energy norm .......................................... 59 13 Generic solver utilities 60 13.1 Solver activation ........................................ 60 13.2 Solver execution by a master solver .............................. 60 13.3 Variable names ......................................... 61 13.4 Exported and derived variables ................................. 62 13.5 Active and passive elements .................................. 64 13.6 Timing the solvers ....................................... 64 13.7 Consistency testing of solvers .................................. 64 14 Block-matrix construct to build tightly coupled solvers 65 14.1 Creating a fully coupled model ................................. 65 15 Meshing Utilities 68 15.1 Coordinate transformation ................................... 68 15.2 Mesh multiplication ....................................... 69 15.3 Mesh extrusion ......................................... 69 15.4 Discontinuous mesh for internal jumps ............................. 71 15.5 Discontinuous Galerkin for internal jumps ........................... 72 16 Adaptive Solution 73 16.1 Introduction ........................................... 73 16.2 Theory .............................................. 73 16.3 Keywords related to the adaptive solution ........................... 75 16.4 Implementing own error estimators ............................... 75 17 Parallel runs 78 17.1 Introduction ........................................... 78 17.2 Preprocessing of Parallel Runs ................................. 79 17.3 Parallel Computations in Elmer ................................. 82 17.4 Post-processing of Parallel Runs ................................ 87 CONTENTS 5 18 Compilation and Linking 88 18.1 Compiling with CMake ..................................... 88 18.2 Compiling a user-defined subroutine .............................. 89 19 Basic Programming 90 19.1 Introduction ........................................... 90 19.2 Basic Elmer Functions and Structures ............................. 90 19.3 Writing a User Function .................................... 98 19.4 Writing a Solver .........................................110 19.5 Compilation and Linking of User Defined Routines/Functions ................122 A Format of mesh files 123 A.1 The format of header file ....................................123 A.2 The formatof node file .....................................123 A.3 The format of element file ...................................124 A.4 The format of boundary element file ..............................124 A.5 The format of shared nodes file .................................124 A.6 Exceptions on parallel mesh format ..............................125 B Format of result output files 126 B.1 Format versions .........................................126 B.2 General structure ........................................126 B.3 The positions file ........................................129 C Format of ElmerPost Input File 130 D Basic element types 132 E Higher-order finite elements 135 E.1 Higher-order elements in Elmer ................................135 E.2 ElmerSolver services for higher-order elements ........................137 E.3 Basis functions .........................................140 Bibliography .............................................148 F Face and edge elements 149 F.1 The construction of face element interpolation .........................149 F.2 The construction of edge element interpolation ........................154 Bibliography .............................................158 G Advanced finite element definitions 159 G.1 Specification of the degrees of freedom ............................159 Index 160 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