Numerical PDE An introduction to Finite Elements ... - Nicolas Fourrier

Introduction ... General equation φ ... Solving a problem with F.E.M.. Presentation of the problem. Problem .... In the case of the two problems, let Ω be a plate of length x and width y. ... Each point of the grid is a node (defined by its coordinates).
459KB taille 2 téléchargements 249 vues
Numerical P.D.E. An introduction to Finite Elements Methods Nicolas Fourrier University of Virginia [email protected]

November 9, 2010

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

1 / 35

Overview

1

Introduction

2

Solving a problem with F.E.M.

3

F.E.M Process

4

Results

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

2 / 35

Introduction

Definition

Introduction

Computational technique to approximate solutions to PDE. Solution of the PDE is approximated by a simple polynomial function on each element. Process: 1 2 3 4

Scheme Physical System Mathematical Model Discrete Method Solution

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

3 / 35

Introduction

Context

Context

Initially, it was uniquely used for elliptic problem. Nowadays, it is also used to solve parabolic and hyperbolic problems. Anticipate the behavior of a structure, optimize its shape are some of the most common application of F.E.M.

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

4 / 35

Introduction

Model Problem

Model Problem General equation φ

δu ~ = uˆf + div (−D∇u) + div (Au) δt

φ δu δt : the accumulation term div (−D∇u): the diffusion term ~ div (Au): the advection term uˆf : the source ~A: Darcy velocity ~ vanishes or is sufficiently small, we neglect the advection If the velocity A term and obtain a diffusion equation. Focus on the heat equation: div (−D∇u) = f . Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

5 / 35

Solving a problem with F.E.M.

Overview

1

Introduction

2

Solving a problem with F.E.M. Presentation of the problem Example

3

F.E.M Process

4

Results

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

6 / 35

Solving a problem with F.E.M.

Presentation of the problem

Problem

Domain 2 Consider Ω ⊂ R2 , an open S set of R . Consider ∂Ω = Γ = ΓN ΓD the border of Ω.

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

7 / 35

Solving a problem with F.E.M.

Presentation of the problem

Domain

Γ3 In this picture: 1

Ω: Plate

2

Γi : Border

3

Lx : Length

4

Ly : Width

Ly



Γ4

Γ2

Γ1 Lx

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

8 / 35

Solving a problem with F.E.M.

Presentation of the problem

Problem definition

Problem definition   −∆u = f (P) : u|Γd = u¯  ∂u|ΓN = g

(Dirichlet’s conditions) (Neumann’s conditions)

Function’s domains  2  f ∈ L (Ω) 1 u¯ ∈ H 2 (Γd )  g ∈ L2 (Γn )

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

9 / 35

Solving a problem with F.E.M.

Presentation of the problem

Find u ∈ V u¯ V u¯ = {v ∈ V with v |γN = u¯ }. After multiplying by a test function v and integrating both members of the equality of the strong fomulation, we get the variational formulation. Variational formulation  Find u ∈ V u¯   R  R − Ω ∆u.v dΩ = Ω fv dΩ (P) ⇔ ∂n u|ΓN = g    u|Γd = u¯

Nicolas Fourrier (U.V.A.)

PDE Seminar

(Neumann’s conditions) (Dirichlet’s conditions)

November 9, 2010

10 / 35

Solving a problem with F.E.M.

Presentation of the problem

Integration by parts

u ¯ Find R u∈ V R ∇u ∇v dΩ − Γ δn uv dΓ = Ω fvdΩ Ω (P) ⇔ g  (Neumann’s conditions) ∂n u|ΓN =   (Dirichlet’s conditions) u|Γd = u¯

   

R

System Au = f After making an integration by parts, we make appear the different components of the system Au = f .

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

11 / 35

Solving a problem with F.E.M.

Presentation of the problem

Well-Posed

Lax-Milgram lemma Let V be an Hilbert space and a : V × V → R. If a is a continuous, bilinear and coercive form, then it exists one and only one u ∈ V such that a(u, v ) = f (v ) ∀v ∈ V . And the problem is well-posed. Well-posed Problem Lax-Milgram R lemma allows to say thatR this problem is well-posed by letting a(u, v ) = Ω ∇u ∇v dΩ and f (v ) = Ω fv dΩ.

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

12 / 35

Solving a problem with F.E.M.

Example

Two problems to solve Problem 1  −∆u = 0    u |Γ1 = x (P1 ) ∂ u | = ∂n u |Γ3 = 1    n Γ2 u |Γ4 = y Problem 2  −∆u = −4      u |Γ1 = x 2 ∂n u |Γ2 = 40 (P2 )    ∂n u |Γ3 = 20   u |Γ4 = y 2 Nicolas Fourrier (U.V.A.)

u1 (x, y ) = x + y

u2 (x, y ) = x 2 + y 2

PDE Seminar

November 9, 2010

13 / 35

F.E.M Process

Overview 1

Introduction

2

Solving a problem with F.E.M.

3

F.E.M Process Geometry & Meshing Definition of an element Stiffness Matrix Shape function Rewrite the problem at each node Computing the solution at each nodes Second Member Boundary Condition Resolution

4

Results Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

14 / 35

F.E.M Process

Geometry & Meshing

Any dimension Domain Ω can be in 1-D, 2-D or 3-D. In the case of the two problems, let Ω be a plate of length x and width y. Meshing Meshing the domain (here a plate) is one of the most difficult and decisive part in F.E.M.. Depending on the choices done at this step, one might get some very different results. Meshing need not to be completely regular. Around point of interests, it is common to increase the density of the meshing.

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

15 / 35

F.E.M Process

Geometry & Meshing

Examples Different type of meshing: 1

2-D: Square, rectangles, triangles ...

2

3-D: Cube, polyhedral ...

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

16 / 35

F.E.M Process

Definition of an element

Element

Definition The plate is discretized as grid. Each point of the grid is a node (defined by its coordinates). If the elements are triangles, then a triple of nodes will form an element. Smaller the elements are, better the approximation is going to be. Difficulty One might would like to simply create an extremly dense meshing, but the storage and computation costs (both in time and power) is quickly becoming a big deal.

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

17 / 35

F.E.M Process

Stiffness Matrix

Recall F.E.M. leads to solve the system Au = f where u is the solution to the PDE. More precisely, u is the approximate solution at each node. Stiffness Matrix A is the stiffness matrix. Symmetric matrix. The stiffness matrix will be modified during the application of the boundary condictions (in the case of Dirichlet’s conditions).

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

18 / 35

F.E.M Process

Stiffness Matrix

Calculation of coefficients

Importance of Reference Element In order to generalize the process and make the computation easier, each real element is expressed in term of the reference element. All calculation are done on reference elements, then the reference element is tranformed into each real element.

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

19 / 35

F.E.M Process

Stiffness Matrix

Triangle Element η Real Element Consider a triangle element, generated by the 3 apexes: 1

(x1 , y1 )

2

(x2 , y2 )

3

(x3 , y3 )

Nicolas Fourrier (U.V.A.)

(x1 , y3 )

T (0, 1) (x1 , y1 ) (x1 , y2 ) Real Element ξ (0, 0) (1, 0) Reference Element

PDE Seminar

November 9, 2010

20 / 35

F.E.M Process

Stiffness Matrix

Node vs. entry in the stiffness matrix

6 Coefficients per triangle element The stiffness matrix is a n × n matrix if there are n nodes in the system. The entry (i , j) corresponds to the node (i , j). Since the computation are done on reference element, it is enough to consider local stiffness matrices, and then sum up all these small matrices to get the global stiffness matrix. For instance, in the case of triangle element, the local stiffness matrix is defined as follows: 1

A′ is a 3 × 3 matrix.

2

A′ij = A′ji : Contribution of the node (i , j) to the current element.

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

21 / 35

F.E.M Process

Stiffness Matrix

Notation

Let m be the number of elements, and n the number of nodes. ¯ be the reference element. Let K be the real element and K Let T be the set of all elements. A is the stiffness matrix, n × n invertible matrix.

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

22 / 35

F.E.M Process

Shape function

Shape function

To describe the elements (reference or real), it is important to describe mathematically an element. This is the purpose of the shape functions. Shape function describes how the nodal solutions (it can be displacements for example) are distributed throughout the element.

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

23 / 35

F.E.M Process

Shape function

Shape functions’ equation Triangle element - Reference In the case of triangle elements, the shape functions are: 1

φ1 = 1 − ξ − η

2

φ2 = η

3

φ3 = ξ

The index corresponds to one side of the triangle. Recall, we need to compute the gradiant these functions. Computation of the coefficients In order to compute each coefficient for each element, and to avoid the consideration of the geometry (shape and orientation of the triangle), it is possible to find a formula allowing to make the computation of each real element on the reference element. Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

24 / 35

F.E.M Process

Shape function

Recall

Problem 2  −∆u = −4     u  |Γ1 = x 2 (P2 ) ∂n u |Γ2 = 40   ∂ u | = 20    n Γ3 2 u |Γ4 = y

u2 (x, y ) = x 2 + y 2

From Variational to F.E.M. R R R Recall: Ω ∇u ∇v dΩ − Γ δn uv dΓ = Ω fvdΩ Goal: discretize this variational form, and get a formula for each element. The shape functions represent the solution on each element.

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

25 / 35

F.E.M Process

Rewrite the problem at each node

Rewrite the problem at each node

Recall, A is the stiffness matrix. Let K be a real element, and T the meshing. Z ∇φi ∇φj dΩ Aij = Ω XZ = ∇φi ∇φj dΩ K ∈T

=

Nicolas Fourrier (U.V.A.)

(2)



X Z

K ∈T (i ,j)∈K

(1)

∇φi ∇φj dΩ

(3)



PDE Seminar

November 9, 2010

26 / 35

F.E.M Process

Computing the solution at each nodes

Computing the solution at each nodes We deduce  the derivatives of the shape functions:  −1 for node 1  −1 for node 1 dφi dφi for node 2 for node 2 dξ :  1 dη :  0 0 for node 3 1 for node 3 The coordinate x and y can be determined as followed: x(ξ, η) = (1 − ξ − η)X1 + ξX2 + ηX3 y (ξ, η) = (1 − ξ − η)Y1 + ξY2 + ηY3 And the determinant of Jacobian matrix J (the matrix which transforms real elements to reference elements) is: det(J) =

Nicolas Fourrier (U.V.A.)

∂x ∂y ∂y ∂x − ∂ξ ∂η ∂ξ ∂η

PDE Seminar

November 9, 2010

27 / 35

F.E.M Process

Computing the solution at each nodes

Computing the solution at each nodes II Let C = ∇φi (x(ξ, η), y (ξ, η)).∇φj (x(ξ, η), y (ξ, η)) = constant. Z C .det(J)dξdη Aij = K Z 1 Z 1−η 1dξdη = C .det(J) 0

=

(4) (5)

0

C .det(J) 2

(6)

Extending this process from one element to whole system, we get: Aij =

X Cij .det(Jij ) 2

i ,j∈K

where the node (i , j) belongs to the element K. Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

28 / 35

F.E.M Process

Second Member

Second member Recall that we are solving a system of the form Au = f , so far we have defined the stiffness matrix. Let’s define the second member f. The construction is very similar to the one of A. For each element, there are 3 coefficients to calculate: F1 , F2 and F3 , where the index are given with respect to the reference element. Considering the whole system, the i th entry of the second member F corresponds to the i t h node. Again a node might be inside several elements. Thus, Fi is given by summing each contribution. In (P1 ), f = 0, we get that F1 = F2 = F3 = 0. In (P2 ), f = −4, we get that F1 = F2 = F3 = − 23 .det(J).

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

29 / 35

F.E.M Process

Boundary Condition

Boundary Condition Neumann It is essential to apply the Neumann conditions first, since they only affect the second member, whereas, the Dirichlet conditions will modify both the stiffness matrix and the second member. The Neumann conditions add a contribution to the second member at some nodes. The Neumann conditions will give us two coefficients per element. Indeed, we are not dealing anymore with triangular elements but with linear elements. Dirichlet The Dirichlet conditions give the solution at some nodes. In other words, the calculation done at the node where the conditions were applied are replaced. From a computational point of view, it is trivial to add the Dirichlet Condition. Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

30 / 35

F.E.M Process

Boundary Condition

Application of Neumann

In general R The integral Γ ∂n uvdΓ corresponds to the Neumann conditions. And it is given by ∂uΓ = f (x, y ). Again, it is necessary to compute the contribution on a reference element to compute each contribution. In our case In =1 R (P1 ), we have∂n u |Γ2 = ∂Rn u |Γ31−ξ 1 1 Γ2 ∂n u.φ1 .det(J)dξ dη = Γ2 1. 2 .( 2 (y2 − y1 ))dξ dη = 2 (y2 − y1 ) Adding these contributions to the appropriate nodes of the second member, give the second member under Neumann Condition.

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

31 / 35

F.E.M Process

Resolution

Algorithms

Resolution Finally, the problem to solve is Au = F where A is a symmetric, positive definite matrix. In addition, A contains a lot a zero. However, the matrix A is huge, so there is a matter of cost. Use Cholesky Algorithm.

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

32 / 35

Results

Errors

Cea’s lemma If u ∈ H 2 (Ω) and triangulation is regular, then: ku − uh k ≤ C1 .ku − v k2,Ω ∀v ∈ A

Vh : finite dimensionnal supspace of H 2 (Ω) uh ∈ A: approximate solution u: analytic solution C1 : constant

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

33 / 35

Results

Errors II

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

34 / 35

Results

The end

Nicolas Fourrier (U.V.A.)

PDE Seminar

November 9, 2010

35 / 35