A. Portela A. Charafi Finite Elements Using Maple
Springer -V erlag Berlin Heidelberg GmbH Engineering ONLINE library http://www.springer.deleng inel
A. Portela A. Charafi Finite Elements Using Maple A Symbolic Programming Approach lst ed. 2002. Corr. 2nd printing, Springer
Professor Artur Portela New University of Lisbon Civil Engineering Department Faculty of Science and Technology Quinta da Torre 2825-114 Caparica Portugal e-mail: aportela@mail.jct.unl.pt Dr. Abdellatif Charafi University of Portsmouth Computational Mathematics Group School of Computer Science and Mathematics Mercantile House Portsmouth POl 2EG United Kingdom e-mail: abdel.charafi@port.ac.uk Additional material to this book can be downloaded from http://extras.springer.com. ISBN 978-3-642-62755-2 Library of Congress Cataloging-in-Publication-Data applied for Die Deutsche Bibliothek - CIP-Einheitsaufnahme Portela, Artur: Finite elements using maple : a symbolic programming approach 1 A. Portela ; A. Charafi.- Berlin; Heidelberg ; New York; Barcelona ; Hong Kong ; London ; Milan ; Paris; Tokyo: Springer, 2002 (Engineering online Iibrary) ISBN 978-3-642-62755-2 ISBN 978-3-642-55936-5 (ebook) DOI 10.1007/978-3-642-55936-5 This work is subject to copyright. AII rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of iiiustrations, recitations, broadcasting, reproduction on microfilm or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German copyright Law of September 9,1965, in its current version, and permission for use must always be obtained from Springer-Verlag. Violations are Iiable for prosecution under the German Copyright Law. http://www.springer.de Springer-Verlag Berlin Heidelberg 2002 OriginalIy published by Springer-Verlag Berlin Heidelberg New York in 2002 The use of general descriptive names, registered names trademarks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. Typesetting: data delivered by authors Cover design: de'blik, Berlin Printed on acid free paper 62/3020/M - 5 4 3 2 1 O
To Eliane, Saffa, Felipe and lbrahim, who make life a gift.
Maple and Maple V are registered trademarks of Waterloo Maple Inc.
Preface Almost ali physical phenomena can be mathematicaliy described in terms of differential equations. The finite element method is a tool for the approximate solution of differential equations. However, despite the extensive use of the finite element method by engineers in the industry, understanding the principles involved in its formulation is often lacking in the common user. As an approximation process, the finite ele~ent method can be formulated with the general technique of weighted residuals. This technique has the advantage of enhancing the essential unity of ali processes of approximation used in the solution of differential equations, such as finite differences, finite elements and boundary elements. The mathematics used in this text, though reasonably rigorous, is easily understood by the user with only a basic knowledge of Calculus. A common problem to the courses of Engineering is to decide about the best form to incorporate the use of computers in education. Traditional compilers, and even integrated programming environments such as Turbo Pascal, are not the most appropriate, since the student has to invest much time in developing an executable program that, in the best of cases, will be able to solve only one definitive type of problems. Moreover, the student ends up learning more about programming than about the problem that he/she wants to solve with the developed executable program. The use of electronic spread sheets does not improve substantialiy this panorama since, beyond stil! demanding a significant effort of programming, they do not have the didactic characteristics necessary to the education in Engineering. Maple is a computational environment with symbolic, numerical and graphical programming capabilities that aliows a radical change in the way computers are used in education. Effectively, Maple software can be used in the form of non-declarative programming which means that the user telis the system what to do, without telling it how to do. Thus, Maple opens to the student the possibility of investing less time in programming and much more time in the study of the problem under consideration. Maple software embodies advanced technology that includes symbolic computation, infinite precision numerics and a powerfullanguage for solving a wide range of mathematical problems encountered in modelling and simulation, as well as in technica! education. Over a million world-wide users have adopted Maple system
VIII Preface as their preferred platform for exploring and managing complex problems in engineering, science, mathematics and education. Virtually every major university and research institute in the world, including Massachusetts Institute of Technology, Stanford, Oxford and Waterloo, have adopted Maple software as an essential tool to enhance their education and research activities. This textbook illustrates how Maple can be used in a finite element introductory course. Providing the user with a unique insight into the finite element method, along with symbolic programming that fundamentally changes the way applications can be developed. This book is an essential tool written to be used as a primary text for an undergraduate or early postgraduate course, as well as a reference book for engineers and scientists who want to develop quickly finite-element programs. The book is split into 7 chapters and 1 appendix. Chapter 1 presents a brief introduction of the computational system Maple, referring only to the aspects considered relevant in programming the finite element method which include mainly symbolic programming and graphic visualization. Chapter 2 presents an introduction to Computational Mechanics which deals with the mathematical modelling process of physical systems. The chapter begins with the presentation of the essential objective of the whole modelling process, the substitut ion of the continuous model of the physical system by a discrete model that is represented by a system of algebraic equations. A classification of physical systems, based on the type of the differential equation that defines the respective continuum model, is presented. As a consequence of the difficulty in obtaining analytical solutions of the differential equation that represents the continuous model of the physical system, the discretization process is then introduced to generate discrete models which lead to approximate solutions. Chapter 3 deals with the formulation of weighted residual approximation methods. The general equation of weighted residuals is presented as the start ing point of their formulation. The chapter considers first the case of approximation functions with a global definition and indirect discretization, setting up their admissibility conditions. Domain and boundary models are defined on the basis ofthe possibility ofthe approximation function satisfying the boundary conditions. The methods of Galerkin, least squares, moments and collocation, obtained by defining the appropriate weighting functions, are presented. Integration by parts of the general weighted residual equation is used to obtain weaker admissibility conditions for the approximation function, leading to the weak and transposed forms of the weighted residual equation. Approximation functions with a piecewise continuous definition and direct discretization are then considered, as well as their respective admissibility conditions. Finally, the models of finite differences, finite elements and boundary elements are presented, as representative of the direct methods with piece-wisely defimid continuous approximation.
Preface IX Chapter 4 presents some topics of interpolation. The chapter begins with general aspects of interpolation with both global and piecewise functions. The difficulty of spline interpolation is contrasted with the simplicity of finiteelement interpolation. Finite element interpolation functions, defined in terms of generalized coordinates, are first introduced along with the convergence conditions, referred to as conditions of compatibility and completeness. Finite elements with interpolation in terms of shape functions are then considered. Natural coordinates as well as curvilinear coordinates are introduced leading to the formulation of parametric finite elements. Chapter 5 introduces the finite element method. A steady-state continuous model, with a scalar variable, is considered for two--dimensional problems. Linear triangular isoparametric finite elements are used. The finite element package Cgt_fem, specially developed using Maple, is used to present the basic steps in the application of the finite element method. Chapter 6 applies the finite element method to problems of Fluid Mechanics. A description of continuous models relative to perfect-fluid flows, free-surface flows and flow through porous media is first presented. Finally, the finite element method is applied to sol ve steady-state problems, with the Maple package CgtJem. Chapter 7 formulates and applies the finite element method to problems of Solid Mechanics. The presentation, confined to the linear theory, deals with the so--ca!led assumed-displacement formulation. The chapter begins with a summary of the general continuous model that is the three-dimensional theory of elasticity, presenting the concepts of static and kinematic admissibility. The correspondence between the work theorem, specified for a virtual displacement, and the equation of weighed residuals is then presented. The minimum total potential energy is used to show that the finite element model is more rigid than the exact solution. Asymptotic models, derived from the three-dimensional model, are established for both one-dimensional and two--dimensional structural elements. The essential aspects of finite-element meshes are analyzed focusing, in particular, on the respective topology optimization. Maple package CstJem, specially developed for the finite element analysis of two--dimensional elasticity problems with linear triangular isoparametric elements, is then presented aud applied to the solution of severa! problems. Appendix A presents details of the content of the companion CD-ROM. AH the application examples ofthe book are included in the CD-ROM, where the results are presented in colour and with animations. The approach followed in this book allows the reader to have an integrated view of the mathematical modelling aspects of physical systems. Furthermore, the unity in the formulation of the finite difference, finite element and boundary element approximation methods emerges clearly in this text. The finite element method is now well established as a tool for numerical solution of mathematical models in Engineering. However, the use of symbolic compu-
x Preface tation in Maple system delivers new benefits in the analysis that may have a real impact on teaching the method. FinalIy, the authors wish to thank ali those who made this book possible, specialiy our families for giving us the time, which should have been theirs, to write this book. New University of Lisbon, Portugal University of Portsmouth, United Kingdom Artur Portela Abdelatiff Charafi
Contents 1. Introduction to Maple.................................... 1 1.1 Basics... 1 1.2 Entering Commands.................................. 1 1.3 Fundamental Data Types................................. 3 1.4 Mathematical Functions................................. 3 1.5 Names... 4 1.6 Basic Types of Maple Objects............................ 5 1.6.1 Sequences... 5 1.6.2 Lists... 6 1.6.3 Sets... 6 1.6.4 Arrays... 7 1.6.5 Tables... 7 1.6.6 Strings... 8 1.7 Evaluation Rules....................................... 8 1.7.1 Levels of Evaluation.............................. 8 1.7.2 Last-Name Evaluation... 9 1.7.3 One-Level Evaluation............................. 9 1.7.4 Special Evaluation Rules......................... 10 1.7.5 Delayed Evaluation............................... 10 1.8 Aigebraic Equations... 11 1.9 Differentiation and Integration........................... 12 1.10 Solving Differential Equations............................ 14 1.11 Expression Manipulation............................ 15 1.12 Basic Programming Constructs........................... 16 1.13 Functions, Procedures and Modules....................... 16 1.14 Maple's Organizat ion................................... 19 1.15 Linear Algebra Computations............................ 20 1.16 Graphics... 31 1.17 Plotter: Package for Finite Element Graphics... 34 1.17.1 Example............................ 39 1.17.2 Example... 41 1.17.3 Example... 42
XII Contents 2. Computational Mechanics... 45 2.1 Introduction... 45 2.2 Mathematical Modelling of Physical Systems............... 45 2.3 Continuous Models...,...... 47 2.3.1 Equilibrium... 47 2.3.2 Propagation... 49 2.3.3 Diffusion... 51 2.4 Mathematical Analysis..., 52 2.5 Approximation Methods................................. 52 2.6 Discrete Models........................................ 55 2.7 Structural Models......................... 56 3. Approximation Methods.................................. 59 3.1 Introduction... 59 3.2 Residuals... 60 3.3 Weighted-Residual Equation............................. 61 3.3.1 Example... 61 3.4 Approximation Functions..., 62 3.5 Admissibility Conditions... 62 3.5.1 Example... 63 3.6 Global Indirect Discretization............................ 64 3.6.1 Satisfaction of Boundary Conditions................ 65 3.6.2 Domain Methods of Approximation................. 66 3.6.3 Galerkin Method................................. 66 3.6.4 Least Squares Method... 67 3.6.5 Moments Method... 67 3.6.6 Collocation Method............................... 68 3.6.7 Example... 70 3.6.8 Example... 82 3.7 Integration by Parts................................... 84 3.7.1 Strong, Weak and Transposed Forms... 84 3.7.2 One-Dimensional Case....................... 85 3.7.3 Example... 85 3.7.4 Higher-Dimensional Cases......................... 86 3.7.5 Example... 88 3.8 Local Direct Discretization... 88 3.8.1 Nodes and Local Regions.......................... 89 3.8.2 Satisfaction of Boundary Conditions................ 89 3.8.3 Finite Difference Method.......................... 90 3.8.4 Finite Element Method... 93 3.8.5 Boundary Element Method........................ 96 3.8.6 Example... 98 3.8.7 Example... 113 3.8.8 Example... 132
Contents XIII 4. Interpolation.... 135 4.1 Introduction... 135 4.2 Globally Defined Functions... 136 4.2.1 Polynomial Bases... 136 4.2.2 Example... 137 4.2.3 Example... 138 4.2.4 Conclusions... 142 4.3 Piecewisely Defined Functions... 143 4.3.1 Spline Interpolation............................... 143 4.3.2 Finite Element Interpolation... 144 4.4 Finite Element Generalized Coordinates... 145 4.4.1 Convergence Conditions... 145 4.4.2 Geometric Isotropy... 146 4.4.3 Finite Element Families... 146 4.5 Finite Element Shape Functions... 148 4.5.1 Natural Coordinates... 150 4.5.2 Curvilinear Coordinates... 156 4.5.3 Example... 157 4.6 Parametric Finite Elements... 161 4.7 Isoparametric Finite Elements... 162 4.7.1 Convergence Conditions... 162 4.7.2 Evaluation of Element Equations... 164 4.7.3 Numerical Integration... 166 4.8 Linear Triangular Isoparametric Element... 168 4.8.1 Example... 169 4.8.2 Example... 171 4.8.3 Example... 174 4.8.4 Example... 176 5. The Finite Element Method... 179 5.1 Introd uction........................................... 179 5.2 Steady-State Models with Scalar Variable... 179 5.2.1 Continuous Model... 180 5.2.2 Weighted Residual Galerkin Approximation... 183 5.2.3 Discrete Model... 185 5.3 Finite Element Mesh... 186 5.3.1 Linear Triangular Isoparametric Element... 187 5.3.2 Total Potential Energy... 188 5.3.3 Internal Potential Energy Density... 188 5.3.4 Mesh Topology... 189 5.4 Local Finite Element Equations... 190 5.5 Global Finite Element Equations... 192 5.6 Exact Boundary Conditions... 193 5.7 Solution of the System of Equations... 194 5.8 Computation of Derivatives... 194
XIV Contents 5.9 Finite Element Pre- and Post- Processing... 196 5.10 Cgt_fem: Package for Finite Element Analysis... 197 5.10.1 Data Preparation... 197 5.11 Example... 198 5.12 Example... 208 5.13 Example... 213 5.14 Example... 217 6. Fluid Mechanics Applications... 223 6.1 Introduction... 223 6.2 Continuous Models of Fluid Flow... 223 6.2.1 Incompressible Fluids... 223 6.2.2 Inviscid Fluids... 224 6.2.3 Irrotational Flows... 224 6.2.4 Steady-State Flows... 224 6.2.5 Bernoulli's Energy Conservation... 225 6.2.6 Velocity Potential... 226 6.2.7 Stream Function... 226 6.3 Confined Flows... 227 6.4 U nconfined Flows... 228 6.5 Groundwater Flows... 229 6.5.1 Darcy's Hypothesis... 229 6.5.2 Dupuit's Hypothesis... 231 6.6 Example... 232 6.6.1 Flow U nder a Dam... 232 6.6.2 Problem's Solution... 233 6.7 Example... 240 6.7.1 Flow in an Unconfined Aquifer... 240 6.7.2 Problem's Solution... 241 7. Solid Mechanics Applications... 251 7.1 Introduction... 251 7.2 Continuous Models... 251 7.3 Fundamental Continuous Model: Elasticity Theory... 252 7.3.1 Strain-Displacement Equations... 253 7.3.2 Equilibrium Equations... 253 7.3.3 Stress-Strain Equations... 254 7.3.4 Boundary Conditions... 254 7.3.5 Elastic Fields... 255 7.3.6 The Work Theorem... 256 7.3.7 Theorem of Virtual Displacements... 256 7.3.8 Theorem of Total Potential Energy... 256 7.4 Finite Element Model... 257 7.4.1 Weighted Residual Equation... 257 7.4.2 Theorem of Work... 258
Contents xv 7.4.3 Theorem of Virtual Displacements... 259 7.4.4 Discretization... 259 7.5 Mesh Topology... 261 7.5.1 Total Strain Energy... 261 7.5.2 Distribution of the Strain Energy Density... 262 7.6 Constrained Displacements... 262 7.7 Application of the Finite Element Model... 264 7.8 Three-Dimensional Equilibrium States... 265 7.8.1 Constant-Strain Tetrahedron Element... 265 7.9 Two-Dimensional Equilibrium States... 267 7.9.1 Plane Stress and Plane Strain... 267 7.9.2 Asymptotic Model: Plane Elasticity... 269 7.9.3 Constant-Strain Triangular Isoparametric Element... 270 7.9.4 CsLfem: Package for Finite Element Analysis... 273 7.9.5 Data Preparation... 274 7.9.6 Example... 275 7.9.7 Example... 281 7.9.8 Example... 284 7.9.9 Example... 292 7.10 One-Dimensional Equilibrium States... 302 7.10.1 Asymptotic Model: Theory of Bars... 303 7.10.2 Truss Element... 312 7.10.3 Skew Elements... 314 7.10.4 Beam Element... 315 7.11 Further Study... 318 A. The Companion CD-ROM... 319 References... 321 Index... 323