Vous êtes sur la page 1sur 2

Institute of Scientic Computing Technical University Braunschweig Prof. Hermann G. Matthies Dr.

Alexander Litvinenko

Winter Term 2010/2011 01.12.2010

Introduction to PDEs and Numerical Methods: Assignment 6: Introduction to Finite Element Method (FEM)
Exercise 1: FEM Algorithm (25 points) Applying FEM onto the one-dimensional stationary heat equation leads to a linear system Ku = f . The so called stiffness matrix K and the right hand side f was derived in the lecture for piece-wise linear Ansatzfunctions. Here, you shall reconstruct the content of the lecture in form of writing an algorithm for the Finite Element Method solving the problem with FEM. The algorithm shall be written in a pseudocode. For each of the following algorithms declare inputs and outputs. (a) Construct a coarse FEM algorithm. Involve the keywords (global) stiffness matrix, load (including Neumann conditions and source/sink terms), right hand side, reduce and solve. The input of the algorithm is given by the model specic informations: nodes, elements, Dirichlet and Neumann conditions, source/sink terms. (5 points) (b) Construct a detailed algorithm which builds up the ith local stiffness matrix. (5 points)

(c) Construct an algorithm for building up the non-reduced global stiffness matrix by assembling it from the local stiffness matrices. (5 points) (d) Construct an algorithm for building up the non-reduced load. (5 points)

(e) Construct an algorithm for reducing the global stiffness matrix and building up the reduced right hand side (so that the known Dirichlet solutions are ejected). (5 points) Exercise 2: FEM Implementation (45 points) In this exercise you shall implement a FEM code in MATLAB for solving the one-dimensional stationary heat equation. Therefor use the algorithms from the previous exercise. Download the MATLAB framework of the FEM code from the webpage. The framework contains three MATLAB les: the main script assignment9.m, the model data le model.m (containing nodes, elements, Dirichlet conditions, Neumann conditions and the source/sink function) and the FEM framework fem.m. The functions which are called in fem.m are not implemented and thus the code is not executable without crashing. The comments shall help you to understand the given MATLAB code. (a) Implement the MATLAB functions build stiff matrix and load and reduce. build stiff matrix and load builds up the non-reduced stiffness matrix and the non-reduced

load. Non-reduced means that Dirichlet values are treated like unknowns. The load builds up the part of the right hand side which contains the source/sink term and the Neumann conditions. To compute the source/sink part one needs to integrate over the domain. Therefore apply the Simpsons rule. The function reduce transfers the Dirichlet conditions (captured by the non-reduced stiffness matrix and the Dirichlet values) onto the right hand side (RHS), builds up the RHS, reduces it and reduces also the stiffness matrix (by ejecting the Dirchlet specic rows and columns). Compute the problem given in model.m and plot the result. (30 points) (b) Rene the model by choosing 19 (instead of 10) nodes. Change all required data of the model, so that the model is the same, only the discretisation is changed. Compute and plot the result. (10 points) (c) Change the model, so that the left Dirichlet condition is 1, the right one is 2 (that means no Neumann conditions) and no source/sink term is applied. Compute the problem and plot the result. (5 points)

Vous aimerez peut-être aussi