Matrix Assembly in FEA

Similar documents
Scientific Computing

Can ANSYS Mechanical Handle My Required Modeling Precision?

Numerical Methods I Non-Square and Sparse Linear Systems

Numerical Linear Algebra

Program Lecture 2. Numerical Linear Algebra. Gaussian elimination (2) Gaussian elimination. Decompositions, numerical aspects

LU Factorization. Marco Chiarandini. DM559 Linear and Integer Programming. Department of Mathematics & Computer Science University of Southern Denmark

MAE 323: Chapter 6. Structural Models

AMS526: Numerical Analysis I (Numerical Linear Algebra for Computational and Data Sciences)

5.1 Banded Storage. u = temperature. The five-point difference operator. uh (x, y + h) 2u h (x, y)+u h (x, y h) uh (x + h, y) 2u h (x, y)+u h (x h, y)

Linear Algebra Section 2.6 : LU Decomposition Section 2.7 : Permutations and transposes Wednesday, February 13th Math 301 Week #4

Numerical Methods I Solving Square Linear Systems: GEM and LU factorization

Direct and Incomplete Cholesky Factorizations with Static Supernodes

Power System Analysis Prof. A. K. Sinha Department of Electrical Engineering Indian Institute of Technology, Kharagpur. Lecture - 21 Power Flow VI

1 Computing with constraints

Iterative Methods for Solving A x = b

LU Factorization. LU factorization is the most common way of solving linear systems! Ax = b LUx = b

Linear System of Equations

Content. Department of Mathematics University of Oslo

Notes for CS542G (Iterative Solvers for Linear Systems)

1 GSW Sets of Systems

Numerical Linear Algebra

Matrices, Row Reduction of Matrices

Improvements for Implicit Linear Equation Solvers

Getting Started with Communications Engineering

Direct solution methods for sparse matrices. p. 1/49

22A-2 SUMMER 2014 LECTURE 5

Consider the following example of a linear system:

(x 1 +x 2 )(x 1 x 2 )+(x 2 +x 3 )(x 2 x 3 )+(x 3 +x 1 )(x 3 x 1 ).

Maximum-weighted matching strategies and the application to symmetric indefinite systems

Math 471 (Numerical methods) Chapter 3 (second half). System of equations

Designing Information Devices and Systems I Spring 2018 Lecture Notes Note Introduction to Linear Algebra the EECS Way

A Review of Matrix Analysis

ACM106a - Homework 2 Solutions

1.Chapter Objectives

Designing Information Devices and Systems I Fall 2018 Lecture Notes Note Introduction to Linear Algebra the EECS Way

V C V L T I 0 C V B 1 V T 0 I. l nk

Lecture 9. Errors in solving Linear Systems. J. Chaudhry (Zeb) Department of Mathematics and Statistics University of New Mexico

Linear System of Equations

Chapter 4. Solving Systems of Equations. Chapter 4

Example: 2x y + 3z = 1 5y 6z = 0 x + 4z = 7. Definition: Elementary Row Operations. Example: Type I swap rows 1 and 3

10-725/36-725: Convex Optimization Spring Lecture 21: April 6

Advantages, Limitations and Error Estimation of Mixed Solid Axisymmetric Modeling

Lab 1: Iterative Methods for Solving Linear Systems

Lecture 3: Special Matrices

Sparse Linear Systems. Iterative Methods for Sparse Linear Systems. Motivation for Studying Sparse Linear Systems. Partial Differential Equations

Linear Algebra, Summer 2011, pt. 2

. =. a i1 x 1 + a i2 x 2 + a in x n = b i. a 11 a 12 a 1n a 21 a 22 a 1n. i1 a i2 a in

Gaussian Elimination and Back Substitution

Quick Introduction to Nonnegative Matrix Factorization

Bindel, Fall 2016 Matrix Computations (CS 6210) Notes for

Alvaro F. M. Azevedo A. Adão da Fonseca

Eigenvalues by row operations

Lab 2 Worksheet. Problems. Problem 1: Geometry and Linear Equations

Direct Methods for Solving Linear Systems. Matrix Factorization

Introduction to Parallel Programming in OpenMP Dr. Yogish Sabharwal Department of Computer Science & Engineering Indian Institute of Technology, Delhi

Differential Equations

Applications of Randomized Methods for Decomposing and Simulating from Large Covariance Matrices

NUMERICAL MATHEMATICS & COMPUTING 7th Edition

LU Factorization. LU Decomposition. LU Decomposition. LU Decomposition: Motivation A = LU

Linear Least-Squares Data Fitting

This ensures that we walk downhill. For fixed λ not even this may be the case.

GAUSSIAN ELIMINATION AND LU DECOMPOSITION (SUPPLEMENT FOR MA511)

MATH 612 Computational methods for equation solving and function minimization Week # 6

Linear equations The first case of a linear equation you learn is in one variable, for instance:

Lecture 4: Linear Algebra 1

Generating Function Notes , Fall 2005, Prof. Peter Shor

Numerical Analysis Fall. Gauss Elimination

CS 542G: Conditioning, BLAS, LU Factorization

Paul Heckbert. Computer Science Department Carnegie Mellon University. 26 Sept B - Introduction to Scientific Computing 1

Numerical Analysis: Solutions of System of. Linear Equation. Natasha S. Sharma, PhD

Concepts. 3.1 Numerical Analysis. Chapter Numerical Analysis Scheme

Numerical Linear Algebra Primer. Ryan Tibshirani Convex Optimization /36-725

SOLVING SPARSE LINEAR SYSTEMS OF EQUATIONS. Chao Yang Computational Research Division Lawrence Berkeley National Laboratory Berkeley, CA, USA

Scientific Computing with Case Studies SIAM Press, Lecture Notes for Unit VII Sparse Matrix

MATH 3511 Lecture 1. Solving Linear Systems 1

L2-7 Some very stylish matrix decompositions for solving Ax = b 10 Oct 2015

6. Iterative Methods for Linear Systems. The stepwise approach to the solution...

Section 3.5 LU Decomposition (Factorization) Key terms. Matrix factorization Forward and back substitution LU-decomposition Storage economization

Iterative Methods for Linear Systems

AM 205: lecture 8. Last time: Cholesky factorization, QR factorization Today: how to compute the QR factorization, the Singular Value Decomposition

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 13

Numerical Solution Techniques in Mechanical and Aerospace Engineering

7.2 Linear equation systems. 7.3 Linear least square fit

Review of matrices. Let m, n IN. A rectangle of numbers written like A =

MAA507, Power method, QR-method and sparse matrix representation.

Next topics: Solving systems of linear equations

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel

Methods for improving sequentially linear analysis

Linear Algebraic Equations

Computational Techniques Prof. Sreenivas Jayanthi. Department of Chemical Engineering Indian institute of Technology, Madras

Quadratic Equations Part I

Numerical Methods I: Numerical linear algebra

Let s now begin to formalize our analysis of sequential machines Powerful methods for designing machines for System control Pattern recognition Etc.

Sparse solver 64 bit and out-of-core addition

1 Multiply Eq. E i by λ 0: (λe i ) (E i ) 2 Multiply Eq. E j by λ and add to Eq. E i : (E i + λe j ) (E i )

5.7 Cramer's Rule 1. Using Determinants to Solve Systems Assumes the system of two equations in two unknowns

MTH Linear Algebra. Study Guide. Dr. Tony Yee Department of Mathematics and Information Technology The Hong Kong Institute of Education

Linear Algebra in Derive 6. David Jeffrey, New FACTOR commands in Derive 6

Lecture: Face Recognition and Feature Reduction

Transcription:

Matrix Assembly in FEA 1

In Chapter 2, we spoke about how the global matrix equations are assembled in the finite element method. We now want to revisit that discussion and add some details. For example, during matrix assembly, how do we know (in general) how to associate nodal DoFs with matrix row and column entries? First, let s revisit the three-spring system we used as an example x y u 1 u 2 u 3,F 3 1 2 3 k 1 k 2 k 3 When we first looked at this problem, we weren t concerned with node numbering. With the system at the left the spring one is constrained at one of it s nodes (not shown). At that time, we simply called it node 0 This time, we re going to be more careful and use everything we ve already learned about finite element analysis to determine how this problem is actually solved in real software today 2

First, we know that any general purpose code will use the numerical (rather than the canonical) spring formulation because of its generality (we don t want to be tied to any one spring orientation) So, the element matrices would be of the form: u F k = 2 2 c cs c cs 1 1x 2 2 v cs s cs s F 1 1y 2 2 c cs c cs u F 2 2x 2 2 cs s cs s v F 2 2 y The cosine and sine terms will be quickly evaluated early (before assembly). If we do the same we end up with (for all springs) 3

0 0 0 0 u1 F1 x 0 1 0 1 v F k = 0 0 0 0 0 1 0 1 v F 1 1y u F 2 2x 2 2 y (1) x y u 1 u 2 u 3,F 3 1 2 3 4 k 1 k 2 k 3 We also need to number all the nodes starting with the number 1. This will help in developing an automated scheme for matrix assembly. Specifically, what we want to do is come up with an automated means of associating a DoF with matrix rows and columns. This will be done by associating DoFs with node numbers 4

A simple and common way to assocate DoFs with node numbers is to number them with a scheme such as: DoF # = n* i q, q = { q q,0 q n} where i is the node number, n is the number of DoFs per node, and q is an integer than ranges between 0 and n (inclusive) Thus, for example, element 1 (k1) with nodes 1 and 2, would receive the following DoF indices (third column below): element # node # q n DoF #(n*i-q) description 1 1 1 2 1 ux 1 1 1 0 2 2 uy 1 1 2 1 2 3 ux 2 1 2 0 2 4 uy 2 5

And, similarly for elements 2 and 3: element # node # q n DoF #(n*i-q) description 2 2 1 2 3 Ux 2 2 2 0 2 4 Uy 2 2 3 1 2 5 Ux 3 2 3 0 2 6 uy 3 element # node # q n DoF #(n*i-q) description 3 3 1 2 5 Ux 3 3 3 0 2 6 Uy 3 3 4 1 2 7 Ux 4 3 4 0 2 8 uy 4 Notice the last DoF number (8) corresponds with the size of the assembled matrix (which we already knew thanks to our estimate of number of nodes x number of DoFs per node): 6

We now have everything we need to assemble the global stiffness matrix and applied load vector (the system equations). Recall from Chapter 2 that the Direct Stiffness Method (DSM) gives us the assembly algorithm: K = F = N n= 1 N n= 1 f k n n (2) Where K and F are the (initialized) assembled stiffness matrix and force vector, respectively, and kn and fn are the element stiffness matrix and force vector for element n in the global reference frame (this last part is important). And the global matrix indices for each element (and associated load vector) are given by the three tables we saw previously 7

So, to keep things simple, lets assume that the k 1 =k 2 =k 3 =k. We can rerewrite (1) using the global indices: 0 0 0 0 u1 0 0 1 0 1 u 2 0 k1u1 = f1 = k = 0 0 0 0 u3 0 0 1 0 1 u4 0 Similarly, for the other elements: 0 0 0 0 u3 0 0 1 0 1 u 4 0 k 2u2 = f2 = k = 0 0 0 0 u5 0 0 1 0 1 u6 0 k u f 0 0 0 0 u5 0 0 1 0 1 u 0 k 0 0 0 0 0 0 1 0 1 u F 6 3 3 = 3 = = u7 8 (3) (4) (5) 8

The global matrix equation is assembled by first initializing an 8 x 8 matrix and an 8 x 1 vector for K and F respectively. Then equation (2) is applied using (3), (4), and (5) to yield: 0 0 0 0 0 0 0 0 u1 0 0 1 0 1 0 0 0 0 u 2 0 0 0 0 0 0 0 0 0 u 3 0 0 1 0 2 0 1 0 0 u4 0 k = 0 0 0 0 0 0 0 0 u5 0 0 0 0 1 0 2 0 1 u6 0 0 0 0 0 0 0 0 0 u7 0 0 0 0 0 0 1 0 1 u 8 F (6) But now we have a problem. What to do about the zeros on the diagonal? These correspond to the fact that the springs have no stiffness in the x-direction. Although we don t have any loads in the x-direction, we still have a singular system. If we were solving this system by hand, we might simply eliminate the rows and columns with zeros in them. However, this is not a robust programming solution 9

A simpler programming approach (which allows us to keep the same matrix size throughout) would be to set all x DoFs to zero using the zero-one rule *. This rule operates as follows. For each prescribed DoF, u J : 1. Subtract K ij u J from the RHS 2. Set entries on row J equal to zero 3. Set the diagonal member on row J (JJ) equal to 1 and set F J =u J Application of these rules to u 2, but also all x DoFs yields: *This is a common solution, but one must remember that, rather than actually being zero, the x DoF simply doesn t exist for bar elements 1/ k 0 0 0 0 0 0 0 u1 0 0 1/ k 0 0 0 0 0 0 u 2 0 0 0 1/ k 0 0 0 0 0 u 3 0 0 0 0 2 0 1 0 0 u4 0 k = 0 0 0 0 1/ k 0 0 0 u5 0 0 0 0 1 0 2 0 1 u6 0 0 0 0 0 0 0 1/ k 0 u7 0 0 0 0 0 0 1 0 1 u 8 F (7) 10

Solution of (7) yields: 0 0 0 F / k u = 0 2 F / k 0 3 F / k Which we immediately recognize to be the correct solution Now, we have applied the zero-one rule, not only to the applied zero y- displacement at node 1 (u 2 ), but also to all the DoFs in the x-direction. We have done this because: We know the springs can t dissipate energy in the x-direction (so setting them equal to zero shouldn t hurt anythingas long as we remember that this direction doesn t have physical significance for springs. We ll revisit this concept later The only other option is to change the matrix size, which we don t want to do 11

Equation (7) reveals another important property of finite element equations Namely, that they result in sparse systems. A sparse matrix is one which is made mostly of zeroes. Another helpful feature of finite element equations is that they tend to be banded, meaning that the majority of nonzero terms cluster around the main diagonal (or can be made to do so). This feature greatly reduces solution times in direct solvers. We will spend some time explaining these concepts in more detail. An official definition of bandwidth is* the following: For a square banded matrix A=a ij, all matrix elements are zero outside a diagonally bordered band whose range is given by constants k 1 and k 2. More formally: a = 0 if j < i k or j > i + k, where k, k 0 ij 1 2 1 2 The quantities k 1 and k 2 are called the left and right half-bandwidth. The matrix bandwidth is k 1 +k 2 +1 * http://en.wikipedia.org/wiki/matrix_bandwidth 12

In other words, the bandwidth is the smallest number of adjacent diagonals to which all nonzero elements are confined. Clearly, as the bandwidth approaches the matrix size, the matrix is no longer considered banded.. Some examples: The K matrix of equation (7) has a half bandwidth of 2 and a bandwidth of 5. it is sometimes helpful to plot such matrices as a grid with nonzero entries represented as colored cells, and each cell of the grid representing a matrix element (symbolic math software tends to come with such functionality. We re using Mathematica). The stiffness matrix of (7) looks like this when plotted in this way: We ll call such a plot the sparsity pattern of the matrix 13

Below is the sparsity pattern of the stiffness matrix generated for the following plane stress problem 2100 nodes, 2 nd order quadrilateral elements Ω 1 Ω 2 a 0.1 h c 0.02 a 14

Hopefully, the student can now see the value of sparse matrices. Consider the case shown in the previous slide, for example. This matrix is 4251 x 4251. Now, if the computer is using double-precision arithmetic, each element of the matrix would get stored as a floating point number consisting of 8 bytes of memory*. This results in 4251 x 4251 x 8 bytes, or approximately 144 Mbytes of storage. One can see that this quickly gets out of hand, as the storage requirement grows in proportion to the square of the matrix size. For example, if the matrix size were increased by a factor of 10, the storage requirement would grow to approximately 14 Gbyte! In this case, a factor of 10 increase in matrix size corresponds to only a factor of 5 increase in model size (node count). In other words, a 10,000 node plane stress model would push the current limits of personal computing! *on 64-bit machines using the IEEE 754 standard 15

But what if we only had to store the nonzero matrix entries? In the previous case, this would result in a requirement of only around 4251 x 380 x 8 =12.9 Mbytes (almost a factor of 12 reduction!) Actually, this is still an over-estimate. What I did was multiply the number of rows by the bandwidth, which still contains lots of zeroes. This type of storage is called banded storage. Let s look at a more concrete example. Consider the following matrix (notice its asymmetric but banded): B11 B12 0 0 0 0 B21 B22 B23 0 0 0 0 0 B33 0 0 0 0 0 B43 B44 B45 0 0 0 0 0 B55 0 0 0 0 0 B65 B66 0 B11 B12 B21 B22 B 23 0 B33 0 B43 B44 B45 0 B55 0 B65 B66 0 It can be stored much more efficiently in the 6 x 3 banded form on the right 16

So, banded storage certainly helps. But one can see there s still room for improvement. In the previous example, we managed to reduce the storage requirement for a 6 x 6 down to a 6 x 3. But this is still 50 percent larger than the number of nonzero entries (12). So, we can see that, to the extent that not all banded matrices are perfectly banded (that is to say: still contain zeroes within their bands), and not all sparse matrices will be banded (for example, adding constraints tends to destroy bandedness), a more robust storage mechanism is required. Such storage mechanisms are usually referred to as sparse Solvers can be modified to operate on matrices stored in banded format without too much effort (both Cholesky and LU deocomposition methods, for example, can be easily modified to accommodate the banded format). Such banded storage schemes and solvers dominated much finite element code from the late 70 s into the early 90 s 17

Sparse matrix storage involves storing the nonzero terms of a matrix in a vector. The row and column indices of each entry are stored in separate vectors. Several competing methods exist which are beyond the scope of this course. It is important, however, to know whether a particular linear solver operates on matrices stored in a sparse format or not. Because such solvers are relatively new to the marketplace (beginning in the 90 s), not all commercial codes may utilize sparse matrix solvers or formats 18

Matrix Solvers 19

There are basically two types of matrix solvers. We might call these direct and iterative. Direct matrix solvers use some variant of the Gaussian elimination procedure, while iterative solvers start with an solution vector guess, and then iterate until a residual is smaller than some threshold value. Depending on the software either or both of these methods might be available. Typically either or both will support either banded or sparse matrix formats. 20

Direct Methods Solving the Matrix Equations Most direct methods use a factorization scheme (decomposition*) with back substitution**. What this means in practice is that, in order to be successful: The system equations must be easily factorable (positive definite, for example) You must have enough computer resources (usually RAM) in order to perform this costly step The model must be fully constrained and not have material properties which vary greatly (Ratios of Young s modulus, for example, that exceed values of around 1,000) The last requirement is rather important. When material properties are vastly different, the matrix behaves as though the model is not properly constrained. Most solvers catch this during the pivot operation, in which they attempt to perform row or column operations to maximize the absolute value of numbers on the diagonal. This operation is important for stability and accuracy see: http://en.wikipedia.org/wiki/matrix_factorization **: http://en.wikipedia.org/wiki/back_substitution#forward_and_back_substitution 21

Direct Methods Solving the Matrix Equations We should mention here that some codes offer another variant of the direct method, which uses a Gaussian procedure to incrementally solve the model AS the matrices are being assembled! Such solvers are called frontal or wavefront solvers (this option is still available in ANSYS Mechanical APDL) The number of equations which are active after any element has been processed is called the wavefront at that time. The maximum size of this wavefront can be controlled. This is very beneficial when one has limited available RAM (this is why the procedure was once quite popular it dates to a time when such memory was only available on the CPU itself and then only at a fraction of what is available today) The total number of operations performed with this method, while still vastly smaller than if one solved the full (unbanded) system at once, is still greater than that achieved in sparse solvers. Again, the main benefit here is when available RAM is severely limited (as might be the case with an old computer) 22

Iterative Methods Solving the Matrix Equations If a matrix fails to obey any or all of the previous requirements of direct solvers, it may be beneficial to use an iterative technique. Most modern commercial codes will have at least one such method available, which will operate either on a banded or sparse matrix format. The most popular and general method available today is the Conjugate Gradient Method (of which there are many variants. This is the default solver you get when you choose an iterative solver in Workbench). Benefits of iterative methods are: They tend to use less RAM than direct methods for the same problem size They can still converge to reasonable solutions even when the matrices are ill-conditioned, as can occur when the model is either improperly constrained, or has considerably dissimilar material properties Their performance is far less dependent on matrix properties such as symmetry. This makes them well-suited for nonlinear tasks such as contact with friction and fluid/structure interaction 23

Solving Structural Problems in ANSYS 24

From the ANSYS 13.0 documentation (March, 2011. Performance Guide), we learn the following very important facts: The amount of memory needed to assemble a matrix entirely within available RAM is approximately 1 Gbyte per million DoFs The amount of memory needed to hold the factored matrix in memory is approximately 10 to 20 Gbyte per million DoFs The second bullet above is more relevant to our discussion. It means that if you want to use the direct solver (the default in Workbench), and you have a model with one million DoFs (not uncommon today), you need anywhere from 10 to 20 Gbyte of RAM if you want to solve entirely within available RAM! 25

The factor of 10-20 to 1 (factored matrix to assembled sparse matrix) is a direct result of the fact that decomposed triangular matrices (which is what the factorization routine tries to achieve) are necessarily dense, even if the parent matrix was very sparse! This represents a significant obstacle to the efficient solving of sparse systems. ANSYS offers their own rather unique solution to this restriction with an out-of-core solution capability. This is a proprietary means of solving the factored matrix incrementally by reading and writing pieces of it to the disk drive sequentially When this happens, the user is informed through the output window (Solution Information in Workbench) that an out-of-core solution is taking place. The user is also told how much RAM is required for a complete in-core solution 26

By contrast the iterative family of solvers have the following basic system requirements: Base amount of availabe RAM: 1 Gbyte per Million DoFs Basic I/O requirement (disk read/write): 1.5 Gbyte per Million DoFs So one sees that the iterative solver is potentially much more efficient for large problems. Although a precise prediction of the performance can get rather complicated, it is the instructor s experience (and that of PADT generally) that the PCG solver usually produces the fastest results on large models running on typical workstations. In addition, we have found it to be superior in handling systems with many constraints. Students should beware, however, that this directly contradicts the ANSYS documentation 27