--Your friends at LectureNotes

Note for Finite Element Methods - FEM by Praveen Lohar

  • Finite Element Methods - FEM
  • Note
  • B. K birla - Rtu
  • Uploaded 1 year ago
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-2

1 In this lecture we will talk about 1. FDM vs FEM. 2. Perspective: different ways of solving approximately a PDE. 3. Basic steps of any FEM intended to solve PDEs. 4. FEM in 1-D: heat equation for a cylindrical rod. 5. FEM in 2-D: the Poisson equation. 6. Sparse Matrixes (band matrixes) and FEM. 7. Other tricks for FEM and beyond. 8. Bibliography. 2 FDM vs FEM 1. With FEM you can handle better boundary problems with odd geometries. 2. With FEM it is easier to make more finer subdivisions of the space in regions where you need more accuracy. This is not so easy to do with FDM. A word of caution: FEM as FDM are suitable for linear PDE’s. If you have non-linear PDEs. You will have first to linearize it. 3 Perspective: different ways of solving approximately a PDE. I have a PDE with certain bc (boundary conditions) to be solved, which options do I have: 1. Analytical solution: the best, but not always available. 2. Approximate solutions. There is always an error. The difference between the exact value and the approximate value is called the residual, we will denote it by R. For instance, let’s suppose I have to solve the following ODE: dφˆ ˆ + φ(x) = 0 dx (1) if my approximate solution is φ(x) = 1 + a1 x + a2 x2 , where a1 and a2 must be determined to get the φ as close to the exact solution φˆ as I can. In that example the residual is R(x; a1 , a2 ) ≡ dφ + φ(x) = 1 + (1 + x) a1 + (2x + x2 ) a2 dx 2 (2)

Text from page-3

There are several ways of solving approximately a PDE, the most usual are: 1. Ritz method (aka Goodman’s method): we get a1 and a2 via asking Z R(x; a1 , a2 )dx = 0 (3) Domain 2. Variational method (Rayleight-Ritz method): from the PDE we get its variational integral. The function φˆ that minimizes that variational integral is the solution to the problem. [FALTA] 3. Weighted residual methods: in this methods we assume the parameters a1 , a2 (, ..., an if we have n in a general case) to be determined by asking the residual to obey a set of equations: Z R(x; a1 , .., an ) ωi (x) dx = 0 (4) Domain where ωi (x) with i = 1, ..n are n arbitrary functions called weighting functions. Some usual choices of ωi (x) are a) Collocation method: we ask the residual R to be zero at n points {xi }i=n i=1 inside the domain. which is equivalent to say ωi (x) = δ(x − xi ). b) Sub-domain method: we split the domain in n regions and we ask the averaged R, < R >, to be zero inside each region. ∂R c) Least-Squares method: we set ωi (x) = ∂a i d) Galerkin method: if we use approximate solutions of the type φ(x) = 1 + a1 x + a2 x2 , this means that Ni (x) = x and N2 (x) = x2 are a set of basis vectors for all our possible solutions. We set ωi (x) = Ni (x),i.e., we have to solve n equations (in our example n = 2) like Z R(x; a1 , .., an ) Ni (x) dx = 0. (5) Domain 4. FDM: Finite Difference Methods. 5. FEM: Finite Element Methods. 6. FVM: Finite Volume Methods. A refined FDM popular in Computational fluid dynamics. 7. MOM:method of moments. You convert your differential equation into an integral equation. Used specially in electromagnetics. 3

Text from page-4

4 Basic steps of any FEM intended to solve PDEs. In all FEM variants there are always the same sequence of steps to be taken 1. Discretize the continuum: divide the solution into smaller regions that we call elements. The elements contain inside a certain number of points we call nodes. There are lots of shapes the elements can have. From segments of lines, triangles, squares, etc, to curved elements. The one/ones you will use depends on the problem you want to solve. For instance, for a 1D problem, like a cylindrical rod with radial symmetry, the most simple is to take the elements as linear segments with two nodes per segment (see Fig.1) and discretize it is as shown in figure 2. For a 2D problem, the most simple can be using triangular elements (see figure 3). 2. Select the type of trial function to use, and in turn the shape functions: We select what kind of functions we will take to describe the variation of the function φ inside each element (the trial function). This is equivalent to say, that we select the basis set of functions that will describe our solution. One of the usual choices is to take a polynomial like for instance φ(x) = a0 + a1 x (known as linear element) or φ(x) = a0 + a1 x + a2 x2 (known as quadratic element). If we have n unknown coefficients a0 , a1 , ..., an−1 we will need the element to have n nodes to be able to determine them. Is it easy to show that the value of our trial function φ for a given position x inside an element can be written as a function of the values of φ at the N nodes the of element ([φ1 , φ2 , ..., φN ]) , i.e. φ(x) = [φ] · [N] = [φ1 , φ2 , ..., φN ] · [N1 (x), N2 (x), ..., NN (x)] (6) where the {Ni (x)}i=N i=1 are known as the Shape Functions. 3. The formulation: Given the PDE you want to solve, now you must find a system of algebraic equations for each element "e" such that by solving it you got the values of of φ at the position of nodes of the element "e" ([φ1 , φ2 , ..., φN ] ≡ [φ]e ), i.e., you must find for each element "e" the matrix [K]e and the vector [f ]e such that, [K]e · [φ]e = [f ]e . (7) This is one of the more tricky parts of the FEM. There are different ways of getting the matrix [K]e , we will see it later. 4. Assembling the equations for different elements: one has to assemble the equations for all elements. The "problem" is that usually contiguous elements have nodes in common (see for instance figure 2, and therefore two algebraic equations may refer to the same node, and that has to be taken into account. At the end, if we have a total of M effective nodes1 in the system, then we must build up a global matrix [K] of size M × M and a 1 For instance in figure 1 we have a total of 5 elements that have each one two nodes, nonetheless due to the nodes in common, the number of effective nodes we have (the number of unknowns) is just M = 6 and not 10. 4

Text from page-5

global vector [f ] of size M such that the FEM problems "reduces" to solve the following matrix equation: [K] · [φ] = [f ]. (8) where [φ] ≡ [φ1 , φ2 , ..., φM ] is the value of the approximate solution φ at the position where the effective nodes are. Notice that once we now [φ1 , φ2 , ..., φM ] one is able to calculate the value of φ at whatever point x of the system, just make use of equation 6. 5. Solve the system of equations: In principle you can use whatever method you want, but the more the number of nodes the use, the better is the quality of the solution, the matrices we will build up can be very large, i.e. M becomes very large. As we will see, most of elements of matrix [K] are zero, sparse matrix, so you can save a lot of time and memory if you use special methods for sparse matrixes, we will see it later. 6. Compute secondary quantities: Once you know the φ values, you can compute other magnitudes using the values of φ. Let’s see now two examples about how this works in practice Figure 1: A single one dimensional element 5 FEM in 1-D: heat equation for a cylindrical rod. In this section we plan to build up a very simple and basic one-dimensional FEM method. Let’s consider a cylindrical rod of radius R and length L with one end insulated an the other held to constant temperature Ttip , while the surrounding environment has a temperature Tenv (see figure 2). We assume the cylinder lies along the x-axis, and the insulated tip is located at x = 0. The lost of heat occurs via the lateral surface of the cylinder at a rate characterized by the heat transfer coefficient h which units are W/(m2 K), we assume that the thermal conductivity 5

Lecture Notes