scientific computing i
play

Scientific Computing I Module 8: Discretisation of PDEs Michael - PowerPoint PPT Presentation

Scientific Computing I Michael Bader Outlines Part I: Finite Differences Part II: Finite Element Methods Scientific Computing I Module 8: Discretisation of PDEs Michael Bader Lehrstuhl Informatik V Winter 2006/2007 Scientific Part I:


  1. Scientific Computing I Michael Bader Outlines Part I: Finite Differences Part II: Finite Element Methods Scientific Computing I Module 8: Discretisation of PDEs Michael Bader Lehrstuhl Informatik V Winter 2006/2007

  2. Scientific Part I: Finite Differences Computing I Michael Bader Outlines Part I: Finite Differences Grid Generation Part II: Finite Element 1 Methods Discretisation 2 System of Linear Equations 3 Discretisation Stencil 4 Accuracy 5

  3. Scientific Part II: Finite Element Methods Computing I Michael Bader FEM Main Ingredients 6 Outlines Weak Forms and Weak Solutions 7 Part I: Finite Differences Part II: Finite Element Methods Ansatz Functions 8 Weak Solutions 9 10 Test and Ansatz Space 11 Discretisation 12 A Road to Theory 13 Choosing Basis Functions Nodal Basis 14 Element Stiffness Matrices Example: 1D Poisson Example: 2D Poisson Workflow

  4. Scientific The Model Problem Computing I Michael Bader Outlines Part I: Finite Differences Part II: Finite Element Methods 2D Poisson Equation on unit square: ∂ x 2 u ( x , y )+ ∂ 2 ∂ 2 in Ω = ( 0 , 1 ) 2 ∂ y 2 u ( x , y ) = f ( x , y ) Dirichlet boundary conditions: u ( x , y ) = g ( x , y ) on ∂ Ω

  5. Scientific Computing I Michael Bader Grid Generation Discretisation System of Linear Equations Part I Discretisation Stencil Accuracy Finite Differences

  6. Scientific Grid Generation Computing I Michael Bader Grid Generation generate a grid on the given domain Discretisation System of Linear Equations x i,j+1 h y Discretisation x i−1,j x i,j x i+1,j Stencil x i,j−1 Accuracy h z h y h x h x Compute values of unknown function u at each grid point: u ij ≈ u ( x ij ) u ijk ≈ u ( x ijk )

  7. Scientific Finite Difference Discretisation Computing I Michael Bader Replace derivatives (at each grid point) by Grid Generation difference quotients: Discretisation System of Linear ∂ 2 u Equations u ( x i + 1 , j ) − 2 u ( x i , j )+ u ( x i − 1 , j ) ∂ x 2 ( x i , j ) ≈ Discretisation h 2 Stencil x ∂ 2 u u ( x i , j + 1 ) − 2 u ( x i , j )+ u ( x i , j − 1 ) Accuracy ∂ y 2 ( x i , j ) ≈ h 2 y leads to linear system of equations ( h := h x = h y ): � 1 u i + 1 , j + u i , j + 1 − 4 u i , j h 2 � x i , j ∈ ( 0 , 1 ) 2 + u i , j − 1 + u i − 1 , j = f ( x i , j ) u ( x i , j ) = g ( x i , j ) x i , j ∈ ∂ Ω

  8. Scientific System of Linear Equations Computing I Michael Bader Grid Generation write linear system as A h x h = f h Discretisation x h = ( u 1 , 1 ,..., u 1 , n , u 2 , 1 ,..., u 2 , n ,..., u n , 1 ,..., u n , n ) System of Linear Equations A h is a sparse matrix (band structure): Discretisation Stencil   B h − I Accuracy ... ...   A h = 1 − I     ... ... h 2   − I   − I B h B h = tridiag ( − 1 , 4 , − 1 ) A h block-tridiagonal (5-diagonal) matrix boundary values to right-hand side

  9. Scientific Stencil Notation Computing I Michael Bader Grid Generation Discretisation illustrate matrix structure as a discretisation System of Linear stencil Equations represents one line of the matrix Discretisation Stencil elements placed according to the geometrical Accuracy position stencils for the Poisson equation:   1 � � 1 D : 2 D : 1 − 2 1 1 − 4 1   1

  10. Scientific Accuracy Computing I Michael Bader Grid Generation Discretisation for 5-point Poisson stencil; System of Linear order of accuracy: � u h − u � = O ( h 2 ) = O ( N − 2 ) Equations curse of dimension: Discretisation Stencil for that, we need O ( N d ) points Accuracy Possibilities of an improvement: use higher-order discretisation via higher order terms of Taylor series leads to larger stencils (involving more neighbouring grid points) use locally refined ( adaptive ) grids

  11. Scientific Computing I Michael Bader FEM Main Ingredients Weak Forms and Weak Solutions Part II Ansatz Functions Weak Solutions Test and Ansatz Finite Element Methods Space Discretisation A Road to Theory Choosing Basis Functions Nodal Basis Element Stiffness Matrices Example: 1D Poisson Example: 2D Poisson Workflow

  12. Scientific Finite Elements – Main Ingredients Computing I Michael Bader compute a function as numerical solution; 1 FEM Main Ingredients search in a function space V h : Weak Forms and Weak Solutions u h = ∑ u j ϕ j ( x ) , span { ϕ 1 ,... ϕ J } = W h Ansatz Functions Weak Solutions j Test and Ansatz Space solve weak form of PDE to reduce regularity 2 Discretisation properties A Road to Theory � � Choosing Basis u ′′ = f v ′ u ′ dx = − → vf dx Functions Nodal Basis Element Stiffness Matrices choose basis function with a local support , 3 Example: 1D Poisson e.g.: Example: 2D Poisson Workflow ϕ j ( x i ) = δ ij

  13. Scientific Choose Test and Ansatz Space Computing I Michael Bader FEM Main Ingredients search for solution functions u h of the form Weak Forms and Weak Solutions u h = ∑ u j ϕ j ( x ) Ansatz Functions Weak Solutions j Test and Ansatz Space the basis (ansatz) functions ϕ j ( x ) build a vector Discretisation space (or function space) W h A Road to Theory Choosing Basis span { ϕ 1 ,... ϕ J } = V h Functions Nodal Basis Element Stiffness the “best” solution u h in this function space is Matrices Example: 1D Poisson wanted Example: 2D Poisson Workflow

  14. Scientific Example: Nodal Basis Computing I Michael Bader  1 h ( x − x i − 1 ) x i − 1 < x < x i FEM Main  Ingredients  1 ϕ i ( x ) := h ( x i + 1 − x ) x i < x < x i + 1 Weak Forms and Weak Solutions   0 otherwise Ansatz Functions Weak Solutions Test and Ansatz Space 1 Discretisation 0,8 A Road to Theory Choosing Basis 0,6 Functions Nodal Basis 0,4 Element Stiffness Matrices 0,2 Example: 1D Poisson Example: 2D Poisson Workflow 0 0 0,2 0,4 0,6 0,8 1 x

  15. Scientific Weak Forms and Weak Solutions Computing I Michael Bader FEM Main Ingredients consider a PDE Lu = f (e.g. Lu = ∆ u ) Weak Forms and Weak Solutions transformation to the weak form : Ansatz Functions � � Weak Solutions � Lu , v � = vLu dx = vf dx = � f , v � ∀ v ∈ V Test and Ansatz Space Discretisation V a certain class of functions A Road to Theory “real solution” u also solves the weak form Choosing Basis Functions � Lu , v � a bilinear form ; often written as: Nodal Basis Element Stiffness Matrices a ( Lu , v ) = � f , v � ∀ v ∈ V Example: 1D Poisson Example: 2D Poisson Workflow

  16. Scientific Weak Form of the Poisson Equation Computing I Michael Bader Poisson equation with Dirichlet conditions: FEM Main Ingredients − ∆ u = f in Ω , u = 0 on δ Ω Weak Forms and Weak Solutions weak form: Ansatz Functions Weak Solutions � � − Ω v ∆ u d Ω = Ω vf d Ω ∀ v Test and Ansatz Space Discretisation apply Green’s formula (and boundary A Road to Theory conditions): Choosing Basis Functions � � Nodal Basis Ω ∇ v · ∇ u d Ω = Ω vf d Ω ∀ v Element Stiffness Matrices Example: 1D Poisson weaker requirements for a solution u : Example: 2D Poisson Workflow twice differentiabale → first derivative integrable

  17. Scientific Choose Test and Ansatz Space Computing I Michael Bader search for weak solutions u h in a certain FEM Main function space W h Ingredients Weak Forms and � � � � Weak Solutions ∑ vL u j ϕ j ( x ) dx = vf dx ∀ v ∈ V Ansatz Functions j Weak Solutions Test and Ansatz where span { ϕ j } = W h (“ansatz space”) Space choose a basis { ψ i } of the test space V ; Discretisation then: A Road to Theory Choosing Basis � � � � Functions ∑ ψ i L u j ϕ j ( x ) dx = ψ i f dx ∀ ψ i Nodal Basis Element Stiffness j Matrices Example: 1D Poisson leads to system of equations for unknowns u j Example: 2D Poisson Workflow V is often chosen to be identical to W h (Ritz-Galerkin method)

  18. Scientific Discretisation – Finite Elements Computing I Michael Bader FEM Main L linear ⇒ system of linear equations Ingredients Weak Forms and � � � � Weak Solutions ∑ ψ i L ϕ j ( x ) dx u j = ψ i f dx ∀ ψ i Ansatz Functions j Weak Solutions � �� � =: A ij Test and Ansatz Space aim: make matrix A sparse → most A ij = 0 Discretisation A Road to Theory approach: local basis functions on a Choosing Basis discretisation grid Functions Nodal Basis ψ j , ϕ j zero everywhere except in grid cells Element Stiffness Matrices adjacent to grid point x j Example: 1D Poisson Example: 2D Poisson A ij = 0, if ψ i and ϕ j don’t overlap Workflow

  19. Scientific A Road to Theory Computing I Michael Bader FEM Main Ingredients weak formulation is equivalent to variational Weak Forms and approach: Weak Solutions solution u minimises an energy functional Ansatz Functions Weak Solutions best approximation property: Test and Ansatz Space � � � u − u FE � � Discretisation a ≤ inf u h ∈ V � u − u h � a � h A Road to Theory Choosing Basis in terms of the norm induced by the bilinear Functions Nodal Basis form a (energy norm) Element Stiffness thus: error bounded by interpoplation error Matrices Example: 1D Poisson (in energy norm) Example: 2D Poisson Workflow

Recommend


More recommend