Similar documents
2x x l. Module 3: Element Properties Lecture 4: Lagrange and Serendipity Elements

Analysis of Continuous Beams in General

Hermite Splines in Lie Groups as Products of Geodesics

Mathematics 256 a course in differential equations for engineering students

R s s f. m y s. SPH3UW Unit 7.3 Spherical Concave Mirrors Page 1 of 12. Notes

CMPS 10 Introduction to Computer Science Lecture Notes

An Application of the Dulmage-Mendelsohn Decomposition to Sparse Null Space Bases of Full Row Rank Matrices

Lecture 5: Multilayer Perceptrons

An Approach in Coloring Semi-Regular Tilings on the Hyperbolic Plane

6.854 Advanced Algorithms Petar Maymounkov Problem Set 11 (November 23, 2005) With: Benjamin Rossman, Oren Weimann, and Pouya Kheradpour

Reading. 14. Subdivision curves. Recommended:

Programming in Fortran 90 : 2017/2018

GSLM Operations Research II Fall 13/14

An Optimal Algorithm for Prufer Codes *

For instance, ; the five basic number-sets are increasingly more n A B & B A A = B (1)

Compiler Design. Spring Register Allocation. Sample Exercises and Solutions. Prof. Pedro C. Diniz

AMath 483/583 Lecture 21 May 13, Notes: Notes: Jacobi iteration. Notes: Jacobi with OpenMP coarse grain

An Entropy-Based Approach to Integrated Information Needs Assessment

Support Vector Machines

Quality Improvement Algorithm for Tetrahedral Mesh Based on Optimal Delaunay Triangulation

UNIT 2 : INEQUALITIES AND CONVEX SETS

Intro. Iterators. 1. Access

Sum of Linear and Fractional Multiobjective Programming Problem under Fuzzy Rules Constraints

Sequential search. Building Java Programs Chapter 13. Sequential search. Sequential search

The Greedy Method. Outline and Reading. Change Money Problem. Greedy Algorithms. Applications of the Greedy Strategy. The Greedy Method Technique

Parallel Computation of the Functions Constructed with

A Newton-Type Method for Constrained Least-Squares Data-Fitting with Easy-to-Control Rational Curves

NUMERICAL SOLVING OPTIMAL CONTROL PROBLEMS BY THE METHOD OF VARIATIONS

Steps for Computing the Dissimilarity, Entropy, Herfindahl-Hirschman and. Accessibility (Gravity with Competition) Indices

Radial Basis Functions

Accounting for the Use of Different Length Scale Factors in x, y and z Directions

A SYSTOLIC APPROACH TO LOOP PARTITIONING AND MAPPING INTO FIXED SIZE DISTRIBUTED MEMORY ARCHITECTURES

Solutions to Programming Assignment Five Interpolation and Numerical Differentiation

Module Management Tool in Software Development Organizations

Assignment # 2. Farrukh Jabeen Algorithms 510 Assignment #2 Due Date: June 15, 2009.

SLAM Summer School 2006 Practical 2: SLAM using Monocular Vision

Lecture #15 Lecture Notes

The Codesign Challenge

Complex Numbers. Now we also saw that if a and b were both positive then ab = a b. For a second let s forget that restriction and do the following.

Problem Set 3 Solutions

Course Introduction. Algorithm 8/31/2017. COSC 320 Advanced Data Structures and Algorithms. COSC 320 Advanced Data Structures and Algorithms

Solving two-person zero-sum game by Matlab

Parallel Numerics. 1 Preconditioning & Iterative Solvers (From 2016)

Very simple computational domains can be discretized using boundary-fitted structured meshes (also called grids)

Fast Computation of Shortest Path for Visiting Segments in the Plane

Parallelism for Nested Loops with Non-uniform and Flow Dependences

F Geometric Mean Graphs

Line Clipping by Convex and Nonconvex Polyhedra in E 3

S1 Note. Basis functions.

Inverse Kinematics (part 2) CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Spring 2016

Harmonic Coordinates for Character Articulation PIXAR

Multiblock method for database generation in finite element programs

An Accurate Evaluation of Integrals in Convex and Non convex Polygonal Domain by Twelve Node Quadrilateral Finite Element Method

Interpolation of the Irregular Curve Network of Ship Hull Form Using Subdivision Surfaces

Support Vector Machines. CS534 - Machine Learning

CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vidyanagar

y and the total sum of

A CLASS OF TRANSFORMED EFFICIENT RATIO ESTIMATORS OF FINITE POPULATION MEAN. Department of Statistics, Islamia College, Peshawar, Pakistan 2

Mesh Editing in ROI with Dual Laplacian

BFF1303: ELECTRICAL / ELECTRONICS ENGINEERING. Direct Current Circuits : Methods of Analysis

S.P.H. : A SOLUTION TO AVOID USING EROSION CRITERION?

A Five-Point Subdivision Scheme with Two Parameters and a Four-Point Shape-Preserving Scheme

News. Recap: While Loop Example. Reading. Recap: Do Loop Example. Recap: For Loop Example

High-Boost Mesh Filtering for 3-D Shape Enhancement

Array transposition in CUDA shared memory

Simplification of 3D Meshes

Analysis of 3D Cracks in an Arbitrary Geometry with Weld Residual Stress

Introduction to Geometrical Optics - a 2D ray tracing Excel model for spherical mirrors - Part 2

Module 6: FEM for Plates and Shells Lecture 6: Finite Element Analysis of Shell

A MOVING MESH APPROACH FOR SIMULATION BUDGET ALLOCATION ON CONTINUOUS DOMAINS

A Binarization Algorithm specialized on Document Images and Photos

NAG Fortran Library Chapter Introduction. G10 Smoothing in Statistics

Electrical analysis of light-weight, triangular weave reflector antennas

Intra-Parametric Analysis of a Fuzzy MOLP

Wavefront Reconstructor

CHOICE OF THE CONTROL VARIABLES OF AN ISOLATED INTERSECTION BY GRAPH COLOURING

Machine Learning 9. week

Optimal Quadrilateral Finite Elements on Polygonal Domains

A Fast Content-Based Multimedia Retrieval Technique Using Compressed Data

Machine Learning. Support Vector Machines. (contains material adapted from talks by Constantin F. Aliferis & Ioannis Tsamardinos, and Martin Law)

Parallel Solutions of Indexed Recurrence Equations

Scan Conversion & Shading

Model Clipping Triangle Strips and Quad Meshes.

Computer Animation and Visualisation. Lecture 4. Rigging / Skinning

(e.g., []). In such cases, both the grd generaton process and the soluton of the resultng lnear systems can be computatonally expensve. The lack of re

Scan Conversion & Shading

An Improved Isogeometric Analysis Using the Lagrange Multiplier Method

ON SOME ENTERTAINING APPLICATIONS OF THE CONCEPT OF SET IN COMPUTER SCIENCE COURSE

arxiv: v3 [cs.na] 18 Mar 2015

APPLICATION OF MULTIVARIATE LOSS FUNCTION FOR ASSESSMENT OF THE QUALITY OF TECHNOLOGICAL PROCESS MANAGEMENT

Computational Geometry: Theory and Applications

Problem Definitions and Evaluation Criteria for Computational Expensive Optimization

Dijkstra s Single Source Algorithm. All-Pairs Shortest Paths. Dynamic Programming Solution. Performance. Decision Sequence.

On Some Entertaining Applications of the Concept of Set in Computer Science Course

Ecient Computation of the Most Probable Motion from Fuzzy. Moshe Ben-Ezra Shmuel Peleg Michael Werman. The Hebrew University of Jerusalem

An Iterative Solution Approach to Process Plant Layout using Mixed Integer Optimisation

Lecture 4: Principal components

Memory Modeling in ESL-RTL Equivalence Checking

Classification / Regression Support Vector Machines

Ramsey numbers of cubes versus cliques

Transcription:

Chapter 6 Programmng the fnte element method Inow turn to the man subject of ths book: The mplementaton of the fnte element algorthm n computer programs. In order to make my dscusson as straghtforward as possble, I wll devote Chapters 7?? to the mplementaton of lnear Lagrange trangles for the model problem r (»ru) =f n ; (6.1) u = g on 1 ; (6.2)» @u @n = h on 2; (6.3) where s a polygonal doman and @ = 1 [ 2. After carefully developng programs to handle the above problem, I wll extend them one step at a tme, frst to handle hgher-order Lagrange trangles (Chapter??) and then to handle curved boundares usng the soparametrc method (Chapter??). Fnally, n Chapter??, I wll extend the code to handle more general BVPs than (6.1 6.3). In the remander of ths chapter, I wll dscuss the mportant ssues that must be resolved n order to wrte a program mplementng the fnte element method, and outlne the overall strategy. 6.1 Assemblng the stffness matrx The fnte element method, appled to (6.1 6.3), produces a matrx-vector equaton KU = F, whose soluton vector U contans the nodal values of the approxmate soluton functon. There are three mportant steps n applyng the fnte element method: ffl Creatng a mesh on the computatonal doman. ffl Computng the stffness matrx K and the load vector F. ffl Solvng the lnear system KU = F. 101

102 Chapter 6. Programmng the fnte element method In ths part of the book, I wll concentrate on the second step. For now, I wll assume that the mesh s obtaned by standard refnement of a coarse mesh on the polygonal doman. In Part??, I dscuss algorthms for local refnement of meshes; these algorthms are ntended to produce a mesh that s custom-desgned for the gven problem. I defer the dscusson of the soluton of KU = F to Part??. For examples n ths part of the book, the lnear systems wll be solved by MATLAB's drect solver for sparse systems. Throughout the followng dscusson, I wll assume that T h s a trangulaton of the polygonal doman and that P (1) h s the space of contnuous pecewse lnear functons defned on T h. The stffness matrx K correspondng to the BVP (6.1 6.3) s defned by K j = a(ff j ;ff ); ; j =1; 2;:::;N f ; Φ Ψ where ff 1 ;ff 2 ;:::;ff Nf s the bass for the approxmatng subspace Vh and a(u; v) =»ru rv: In the case of lnear Lagrange trangles, whch I am consderng n ths and the next few chapters, the subspace V h s the followng subspace of P (1) h, as descrbed n Secton 4.1.1: n o V h = v 2 P (1) h : v = 0 on 1 : that correspond to the N f free nodes n the mesh. The reader should recall the followng requrement on the trangulaton: Any pont where 1 and 2 meet must be a node n the mesh, and ths node s consdered to belong to 1. The bass Φ ff 1 ;ff 2 ;:::;ff Nf Ψ conssts of the standard bass functons for P (1) h The reader wll recall that most entres K j of the stffness matrx are zero, snce the correspondng ntegrand»rff j rff s zero throughout. For those entres K j that are not zero, the support of»rff j rff conssts of a few trangles. One strategy for computng K s to loop over all ; j pars, determne f K j s nonzero, and, f t s, compute the ntegral that defnes t. If K j s nonzero and the support of»rff j rff s T r1 [ T r2 [ [T rt ; then K j = tx k=1 T rk»rff j rff : To compute these ntegrals, t s necessary to compute the bass functons ff and ff j (or, actually, ther gradents) on each of the trangles T r1 ;T r2 ;:::;T rt. Usng ths approach, I obtan the algorthm shown n Table 6.1 for computng K. Ths algorthm can be descrbed as node-orented, snce t nvolves loopng over the nodes n the mesh. The reader wll notce that only the upper trangle of K s computed drectly, snce the matrx s known to be symmetrc (K j = K j ). There are two problems wth ths algorthm. The more obvous one s that the value of any gven rff on any partcular wll contrbute to K j for several

6.1. Assemblng the stffness matrx 103 Intalze K to the zero matrx for =1; 2;:::;N f for j =1; 2;:::;N f Determne f K j s nonzero f K j 6=0 Determne the trangles T r1 ;T r2 ;:::;T rt formng the support of»rff j rff Set K(,j) to 0.0 for k =1; 2;:::;t Compute rff and rff j on T rk Compute»rff T rk j rff and add t to K(,j) Set K(j,) to K(,j) Table 6.1. Node-orented algorthm for computng the stffness matrx K. (usually three) values of j. For example, for the mesh llustrated n Fgure 6.1, the value of rff 13 on T 20 contrbutes to K 13;12, K 13;13, and K 13;18 (and, by symmetry, K 12;13, K 18;13 ). Therefore, t must be computed repeatedly (at the cost of some neffcency) or stored after t s computed (at the cost of some nconvenence). It would be preferable, f possble, to compute rff just once on each trangle n ts support, use ts value, and then dscard t. 1 0.8 0.6 0.4 25 26 17 18 9 10 27 28 19 20 11 12 29 30 21 22 13 14 31 32 23 24 15 16 0.2 1 3 5 7 2 4 6 8 0 0 0.5 1 1 0.8 16 17 18 19 20 0.6 11 12 13 14 15 0.4 0.2 6 7 8 9 10 0 1 2 3 4 5 0 0.5 1 Fgure 6.1. The support of ff 13 n a certan mesh. The trangles are labeled n the left graph, whle the free nodes are labeled n the rght graph. The above algorthm also mples a mesh data structure that s more complcated than s really necessary. Because of the need to ntegrate over the trangles, t s necessary to know, for each trangle, the coordnates of ts vertces. Ths suggests a lst of trangles, wth each trangle dentfed by ts vertces. On the other hand, when the above double loop s executed, t s necessary to loop over the vertces of the trangles and to know, for a gven vertex, whch other vertces are adjacent to t. Ths mples storng the connectvty" nformaton of the mesh (that s, storng,

104 Chapter 6. Programmng the fnte element method for each vertex, whch vertces are connected to t by a trangle edge). Ths connectvty nformaton s contaned n the trangle-vertex lst, but only mplctly. It would be neffcent to search through the lst of trangles and vertces to determne the connectvty of the vertces. The algorthm n Table 1.1 therefore requres that both the trangle-vertex lst and the connectvty nformaton be stored explctly. It turns out that, by adoptng a dfferent strategy for computng K, both of the above problems can be crcumvented: ff on need be computed only once, and the connectvty nformaton need not be stored explctly. The dea s to loop over the trangles n the mesh and, for each trangle, compute the contrbutons to all entres K j that are affected by the gven trangle. Ths s actually qute easy to do. Gven a trangle, the only bass functons whose support has a nontrval 15 ntersecton wth are those correspondng to the vertces of. There are at most three such bass functons (fewer f one or more vertces are constraned). If all three vertces of are free and the correspondng bass functons are ff`1 ;ff`2 ;ff`3 ; then the followng entres of K are affected: K`1;`1;K`1;`2;K`1;`3;K`2;`1;K`2;`2;K`2;`3;K`3;`1;K`3;`2;K`3;`3: The contrbuton to K`p;`q s»rff`p rff`q : To be precse, K`p;`q =»rff`p rff`q =»rff`p rff`q + :::; where + :::" represents ntegrals of»rff`p rff`q over the other trangles that form ts support. The ntegrals computed over are often collected n a 3 3 matrx called the element matrx (over ): 2 4»rff`1 rff`1»rff`2 rff`1»rff`3 rff`1»rff`1 rff`2»rff`2 rff`2»rff`3 rff`2»rff`1 rff`3»rff`2 rff`3»rff`3 rff`3 However, ths matrx need not be formed explctly (except possbly as a programmng convenence); rather, ts entres are added to the correspondng entres of K. As always, the symmetry of K should not be gnored. It s necessary to compute only sx of the nne entres of the element matrx, namely, those n the 15 If the ntersecton s only a trangle edge, t s trval and can be gnored, snce a double ntegral over a lne segment has value zero. 3 5 :

6.1. Assemblng the stffness matrx 105 upper trangle. If one of the three vertces of s constraned, then contrbutes to only four entres of K, whle f two of the vertces are constraned, then contrbutes to a sngle entry n K. It s possble that all three vertces of be constraned (but ths could hold for only a few trangles n a gven mesh, for example, those lyng at the corner of a rectangle). The algorthm n Table 6.2 ncorporates the above deas. The reader should recall that the vertces of are v nk;1 ;v nk;2 ;v nk;3. Intalze K to the zero matrx for k =1; 2;:::;N t for r =1; 2; 3 for s = r;:::;3 f v nk;r and v nk;s are both free Fnd the ndces `r and `s of v nk;r and v nk;s n the lst of free nodes Compute»rff`r rff`s and add t to K`r;`s (and to K`s;`r, fr 6= s) Table 6.2. Element-orented algorthm for computng K. To mplement ths algorthm, t s necessary to know, for each trangle, the nodes v nk;j, j = 1; 2; 3. Ths nformaton s requred by any concevable scheme, snce ntegrals over must be computed. In addton, t must be possble to determne f a gven vertex v n s free or not. If t s free, ts ndex n the lst of all free nodes must be known. I have already establshed the followng notaton: The free nodes are enumerated 1; 2;:::;N f and the vertces are enumerated 1; 2;:::;N v. Free node j s vertex v fj. That s, I have establshed a mappng from j 2 f1; 2;:::;N f g to f j 2 f1; 2;:::;N v g. Ths mappng s necessarly one-to-one, so t has an nverse mappng defned by p = j f and only f j 2 f1; 2;:::;N f g and = f j. Except n the case that every node s free, the quantty p s not defned for some 2f1; 2;:::;N v g. Snce I wll need t later, I wll also defne q = j f and only f j 2f1; 2;:::;N c g and = c j. Ths establshes the analogous relatonshp for the constraned nodes. In the above algorthm, t must be determned whether a node v nk;p s free or not, and, f free, ts ndex n the lst of free nodes. Ths mples that that, for each node v n, t s necessary to store p n or a flag ndcatng that v n s constraned. I wll present a convenent way to do ths n the next chapter. For now, I just pont out that, gven ths nformaton, the above algorthm s effcent and easy to mplement. Other ssues that must be addressed are the computatons of the gradents of the bass functons on each trangle and the computaton of the ntegrals over the trangles. These wll be addressed n future chapters.

106 Chapter 6. Programmng the fnte element method 6.2 Computng the load vector The algorthm for computng the load vector F s exactly analogous to the algorthm for assemblng the stffness matrx. If the boundary condtons are homogeneous (that s, f g and h are zero n (6.2 6.3)), then the components of F are defned by F = fff ; =1; 2;:::;N f : If the support of ff s T r1 [ T r2 [ [T rt, then F = T r 1 fff + T r 2 fff + + As n the case of the stffness matrx, the contrbutons to the components of the load vector are computed whle loopng over the trangles n the mesh. The algorthm s gven n Table 6.3 T r t fff : Intalze F to the zero vector for k =1; 2;:::;N t for r =1; 2; 3 f v nk;r s free Fnd the ndex `r of v nk;r n the lst of free nodes Compute fff`r and add t to F`r Table 6.3. Element-orented algorthm for computng F n the case of homogeneous boundary condtons. The reader should notce that the ndex of v nk;r n the lst of free nodes s `r = p nk;r : Ths sort of ndrect ndexng s essental for the computer mplementaton of the fnte element method. I explan t completely n the next few chapters, begnnng n Chapter 7, where I present a data structure contanng all of the necessary ndex nformaton. 6.2.1 Inhomogeneous Drchlet condtons When the Drchlet condtons are nhomogeneous (g 6= 0 n (6.2)), then the formula for F has an extra term, F = fff»rg rff ; =1; 2;:::;N f ; where G s a functon nterpolatng the Drchlet data g on 1. computng F by loopng over the trangles, ntegrals of the form T»rG rff When actually

6.2. Computng the load vector 107 must be computed. It s usual to choose, for G, the contnuous pecewse lnear functon satsfyng ρ 0; vn 62 G(v n )= 1 ; g(v n ); v n 2 1 : But v n 2 1 f and only f v n s a constraned node. Therefore t s necessary to know, for a gven node v n, whether t s constraned or not and, f so, ts ndex q n n the lst of constraned nodes. The mesh data structure must therefore contan ths nformaton f t s to be used for problems wth nhomogeneous Drchlet condtons. 6.2.2 Inhomogeneous Neumann condtons If the Neumann condton s nhomogeneous (that s, f h 6= 0 n (6.3), then the formula for F contans an addtonal term: F = fff»rg rff + 2 hff ; =1; 2;:::;N f : When computng F, t s therefore necessary to compute ntegrals of the form hff ; e where e s an trangle edge lyng n 2, that s, a free boundary edge. These contrbutons to F can be computed whle loopng over the trangles (along wth the contrbutons from the rght-hand sde of the PDE and the nhomogeneous Drchlet condtons). Then the values of ff on need only be computed once. Ths suggests that the data structure should record the edges of each trangle, wth an ndcaton of whch le on the boundary and whch boundary edges are free. The edges of a trangle are fully specfed by ther endponts, whch are the nodes v nk;1 ;v nk;2 ;v nk;3. It would be suffcent, then, for the algorthms descrbed thus far to augment a trangle-vertex lst wth flags descrbng the edges as nteror edges, free boundary edges, or constraned boundary edges. However, for the purpose of local refnement (n whch some trangles n a gven mesh are refned, but others are not), t s necessary to dentfy not only the edges of a gven trangle but also the trangle on the other sde of each edge. Ths nformaton s not easly extracted from the trangle-vertex lst. Therefore, n the data structure I descrbe n the next chapter, I mantan three lsts: trangles, edges, and nodes. Ihave already ntroduced the notaton T 1 ;T 2 ;:::;T Nt for the trangles and v 1 ;v 2 ;:::;v Nv for the nodes. I wll denote the edges n the mesh by e 1 ;e 2 ;:::;e Ne ;

108 Chapter 6. Programmng the fnte element method and defne ndces k ;1, k ;2 so that v k;1 and v k;2 are the endponts of e. Snce I need to pont from a trangle to ts edges, I defne ndces s k;1, s k;2, and s k;3 such that has edges e sk;1 ;e sk;2 ;e sk;3 : Each trangle s dentfed by ts three edges, each edge by the nodes formng ts endponts, and each nodeby ts coordnates. To these lsts wll be added arrays of flags and ponters as needed for the algorthms. For example, the mappngs 7! f and j 7! p j can be stored as arrays of ponters. From the resultng data structure, all of the nformaton needed by the algorthms descrbed n ths chapter can easly be extracted. I therefore abandon the trangle-vertex lst descrbed earler n favor of trangleedge and edge-vertex lst. Ths s convenent for handlng nhomogeneous Neumann condtons and essental for local refnement. The vertces of a trangle can be cheaply extracted from these lsts, so there s no sgnfcant penalty for elmnatng the trangle-vertex lst. When the Neumann data s specfced for nput to the algorthm for computng the load vector, t should be easy to determne whch boundary edges are free (wthout searchng through the lst of all trangles. I wll denote the number of free boundary edges by N b and the free boundary edges themselves wll be denoted e b1 ;e b2 ;:::;e bnb : The mappng 7! b wll also be stored. Ihave now descrbed the nformaton that must be contaned n a data structure descrbng a trangulaton. In the next chapter, I defne such a structure precsely.