Weighted Residual Methods 1 Formulation of FEM Model Formulation of FEM Model Direct Method Variational Method Weighted Residuals • Several approaches can be used to transform the physical formulation of a problem to its finite element discrete analogue. • If the physical formulation of the problem is described as a differential equation, then the most popular solution method is the Method of Weighted Residuals. • If the physical problem can be formulated as the minimization of a functional, then the Variational Formulation is usually used. 2 Formulation of FEM Model Finite element method is used to solve physical problems Solid Mechanics Fluid Mechanics Heat Transfer Electrostatics Electromagnetism …. Physical problems are governed by differential equations which satisfy Boundary conditions Initial conditions One variable: Ordinary differential equation (ODE) Multiple independent variables: Partial differential equation (PDE) 3 Physical problems Axially loaded elastic bar A(x) = cross section at x b(x) = body force distribution y (force per unit length) x E(x) = Young’s modulus u(x) = displacement of the bar at x x x=0 x=L Differential equation governing the response of the bar d du AE b 0; dx dx 0 xL Second order differential equations Requires 2 boundary conditions for solution 4 Physical problems Axially loaded elastic bar y x x x=L x=0 Boundary conditions (examples) u0 u 1 at x 0 Dirichlet/ displacement bc at x L u 0 at x 0 du Neumann/ force bc EA F at x L dx Differential equation + Boundary conditions = Strong form of the “boundary value problem” 5 Physical problems Flexible string y x=0 x=L x x S S = tensile force in string p(x) = lateral force distribution (force per unit length) w(x) = lateral deflection of the string in the y-direction S p(x) Differential equation governing the response of the bar d 2u S 2 p 0; dx 0 xL Second order differential equations Requires 2 boundary conditions for solution 6 Physical problems Heat conduction in a fin y x x x=0 x =L A(x) = cross section at x Q(x) = heat input per unit length per unit time [J/sm] k(x) = thermal conductivity [J/oC ms] T(x) = temperature of the fin at x Q(x) Differential equation governing the response of the fin d dT Ak Q 0; dx dx 0 xL Second order differential equations Requires 2 boundary conditions for solution 7 Physical problems Heat conduction in a fin y x x x=0 x=L Q(x) Boundary conditions (examples) T 0 at x 0 dT k h at x L dx Dirichlet/ displacement bc Neumann/ force bc 8 Physical problems Fluid flow through a porous medium (e.g., flow of water through a dam) y x x x=0 x=L A(x) = cross section at x Q(x) = fluid input per unit volume per unit time k(x) = permeability constant j(x) = fluid head Q(x) Boundary conditions (examples) Differential equation d dj k Q 0; dx dx 0 xL j 0 at x 0 dj k Second order differential equations Requires 2 boundary conditions for solution 9 dx Known head h at x L Known velocity Physical problems 10 Physical problems 11 Formulation of FEM Model Observe: 1. All the cases we considered lead to very similar differential equations and boundary conditions. 2. In 1D it is easy to analytically solve these equations 3. Not so in 2 and 3D especially when the geometry of the domain is complex: need to solve approximately 4. We’ll learn how to solve these equations in 1D. The approximation techniques easily translate to 2 and 3D, no matter how complex the geometry 12 Formulation of FEM Model A generic problem in 1D d 2u x 0; 2 dx u 0 at x 0 u 1 at x 1 0 x 1 Analytical solution 1 7 u ( x) x 3 x 6 6 Assume that we do not know this solution. 13 Formulation of FEM Model A generic problem in 1D A general algorithm for approximate solution: Guess u( x) a0j o ( x) a1j1 ( x) a2j 2 ( x) ... where jo(x), j1(x),… are “known” functions and ao, a1, etc are constants chosen such that the approximate solution Satisfies the differential equation Satisfies the boundary conditions i.e., d 2jo ( x) d 2j1 ( x) d 2j 2 ( x) a0 a1 a2 ... x 0; 2 2 2 dx dx dx a0jo (0) a1j1 (0) a2j 2 (0) ... 0 0 x 1 a0jo (1) a1j1 (1) a2j 2 (1) ... 1 Solve for unknowns ao, a1, etc and plug them back into This is your approximate u ( x) a0j o ( x) a1j1 ( x) a2j 2 ( x) ... solution to the strong form 14 Formulation of FEM Model Solution of Continuous Systems – Fundamental Concepts Exact solutions limited to simple geometries and boundary & loading conditions Approximate Solutions Reduce the continuous-system mathematical model to a discrete idealization Variational Weighted Residual Methods Rayleigh Ritz Method Galerkin Least Square Collocation Subdomain 15 Weighted Residual Methods Weighted Residual Formulations Consider a general representation of a governing equation on a region V Lu 0 L is a differential operator eg. For Axial element d du EA P( x) 0 dx dx d d L EA dx dx u Assume approximate solution then Lu R 16 P( x) Weighted Residual Methods Weighted Residual Formulations Lu R Lu 0 Exact Approximate ERROR L u R Objective: Define u so that weighted average of Error vanishes Set Error relative to a weighting function w w L(u) dV 0 or V w R dV 0 V 17 Weighted Residual Methods Weighted Residual Formulations w w L(u ) dV 0 V w 1 ERROR 18 Weighted Residual Methods Weighted Residual Formulations w w L(u ) dV 0 V ERROR 19 Appendix 20 Weighted Residual Methods Start with the integral form of governing equations Assume functional form for trial (interpolation, shape) functions Minimize errors (residuals) with selected weighting functions x j Power series sin jx, cos jx Fourier series w j ( x) L j ( x) Lagrange Hermite H j ( x) T ( x ) Chebychev j 21 Weighted Residual Methods Assume certain profile (trial or shape function) between nodes J u ( x) a j j ( x) j 1 but L(u ) R( x) 0 , w R dx wL(u )dx 0 22 Residual Weighted Residual Weighted Residual Methods In general, we deal with the numerical integration of trial or interpolation functions Trial functions: constant, linear, quadratic, sinusoidal, Chebychev polynomial, …. Weighting functions: subdomain, collocation, least square, Galerkin, …. w( x, y, z) R( x, y, z)dxdydz wL(u)dv 0 V V 23 General Formulation Weighted Residual Methods (WRMs) Construct an approximate solution J u ( x, y, z ) uo ( x, y, z) a j j ( x, y, z) j 1 Chosen to satisfy I.C./B.C.s if possible Steady problems – system of algebraic equations for trial function j (x,y,z) Transient problems – system of ODEs in time 24 Weighted Residual Methods Consider one-dimensional diffusion equation L(u ) 0 L(u ) R ( x) 0 Exact solution Approximation In general, R 0 with increasing J (higher-order) w m ( x, y, z ) R( x, y, z )dxdydz 0, m 1, 2, Weak form – integral form, discontinuity allowed (discontinuous function and/or slope) 25 ,M Weighted Residual Methods Weak form – integral formulation Differential Form: Exact Integral Form: Discretization : L(u ) 0 w(x, y,z)L(u )dxdydz 0 w (x, y,z)L(u)dxdydz 0 m R 0, but “weighted R” = 0 Choices of shape or interpolation functions? Choices of weighting functions? 26 Subdomain Method w (x, y,z)L(u )dxdydz 0 m L(u ) R 0 Equivalent to finite volume method 1, wm 0, in Dm outside Dm w L(u)dxdydz m ; Dm R( x, y, z )dv 0 Dm : numerical element (arbitrary control volume) Dm may be overlapped 27 Collocation Method w (x, y,z)L(u )dxdydz 0 m L(u ) R 0 ; Zero residuals at selected locations (xm, ym, zm) wm x x xm w x R x dv x x R( x )dv m m R xm R xm , ym , zm No control on the residuals between nodes 28 Least Square Method w (x, y,z)L(u )dxdydz 0 m ; L(u ) R 0 Minimize the square error R 2 R ( x, y, z, am )dxdydz 0 Rdxdydz 0 am V am V R wm x am Square error R2 0 1 wm x R x dx 2 am 29 2 R dx 0 R2 0 Galerkin Method w (x, y,z)L(u )dxdydz 0 m ; L(u ) R 0 Weighting function = trial (interpolation) function wm x m x w x R x dx x R x dx m m For orthogonal polynomials, the residual R is orthogonal to every member of a complete set! 30 Numerical Accuracy How do we determine the most accurate method? How should the error be “weighted”? Zero average error? Least square error? Least rms error? Minimum error within selected domain? Minimum (zero) error at selected points? Minimax – minimize the maximum error? Some functions have fairly uniform error distributions comparing to the others 31 Application to an ODE Consider a simple ODE (Initial value problem) dy y 0 , 0 x1 x y e dx y (0) 1 Use global method with only one element Select a trial function of the form of N y 1 ajx j j 1 Automatically satisfy the auxiliary condition aj = constant, not a function of time 32 Application to an ODE Consider a cubic interpolation function with N = 3 N y 1 a j x j 1 a1 x a2 x 2 a3 x 3 j 1 QUESTION: Which cubic polynomial gives the best fit to the exact (exponential function) solution? Definition of best fit? Zero average error, least square, least rms, …? 33 Residual Substitute the trial function into governing equation N N N dy j 1 j R L( y ) y ja j x 1 a j x 1 a j x j 1 ( j x) dx j 1 j 1 j 1 For cubic interpolation function N = 3 R( x) 1 a1 (1 x) a2 (2x x 2 ) a3 (3x 2 x 3 ) (a1 1) (2a2 a1 ) x (3a3 a2 ) x 2 a3 x 3 0 The residual is a cubic polynomial R 0 Determine the optimal values of aj to minimize the error (under pre-selected weighting functions) 34 Subdomain Method Zero average error in each subdomain D1 x0 1 0 x1 D3 x2 Uniform spacing x3 xm a a a R( x)dx 0 (a1 1) x (a2 1 ) x 2 (a3 2 ) x 3 3 x 4 xm1 2 3 4 xm1 wm Rdx m 1 : m 2 : m 3 : D2 xm 1/ 3 0 Rdx 0 2/3 1 1/ 3 2/3 Rdx 0 Rdx 0 5 8 11 1 a1 a2 a3 18 81 324 3 3 20 69 1 a1 a2 a3 18 81 324 3 1 26 163 1 a1 a2 a3 18 81 324 3 Note: R(0) = 0.0156 0, R(1) = 0.0155 0 35 1.0156 ai 0.4219 0.2813 Subdomain Method Net area under each curve = 0 y 1 1.0156 x 0.4219x 2 0.2812x 3 R 0.0156 0.1719x 0.4219x 2 0.2812x 3 Zero average error in each subdomain 36 Subdomain Method Nonuniform subdomains? D1 D2 x0 x1 D1 x0 m 1 : m 2 : m 3 : D3 x2 D2 x1 D3 x2 x1 x2 x3 x0 x1 x2 x3 Grid clustering in highgradient regions x3 Rdx 0 Different coefficients for different choices of subdomains Rdx 0 Rdx 0 37 Least Square Method Minimum square errors over the entire domain N R( x) 1 am (mx m1 x m ) m 1 1 0 wm Rdx 1 0 1 (mx 0 m 1 R mx m 1 x m am R( x) R( x)dx 0 am N x )dx a j mj x m j 2 ( j m) x m j 1 x m j dx 0 m 1 j 1 For arbitrary N (symmetric matrix) mj 1 1 m aj 1 1 m j 1 m 1 m 1 j 1 m j 1 N 38 Least Square Method For cubic interpolation function (N=3) R a1 1 2a2 a1 x 3a3 a2 x 2 a3 x 3 1 R 1 x 1 x Rdx 0 m 1, w1 0 a 1 1 R 2 2x x 2x x 2 Rdx 0 m 2, w2 0 a2 1 R 2 3 3x x 3x 2 x 3 Rdx 0 m 3, w3 0 a3 Nonuniform weighting of residuals over the domain 39 Least Square Method Cubic trial function mj mj m aj j 1 m j 1 m j 1 m 1 1 1 1 1 m 1 , 3 a1 4 a2 5 a3 2 1.0131 1 8 2 2 0.4255 m 2 , a a a a 1 2 3 i 4 15 3 3 0.2797 1 2 33 3 m 3 , 5 a1 3 a2 35 a3 4 3 R(0) = 0.0131 0, R(1) = 0.0151 0 40 Least Square Method Weighted average errors = 0 Minimum sqaure error 41 Least Square Method Weighted average error = Net area under curve = 0 Weighted average error = 0 Weighted average error = 0 42 Galerkin Method Weighting function = Trial function 0 1 2 3 ( x ) x , x , x , x , m m1 w ( x ) ( x ) x m m , x N 1 N R( x) 1 am (mx m1 x m ) m 1 1 0 1 wm Rdx x 0 m 1 1 R( x)dx 0 x m 1 0 N 1 j 1 0 dx a j j 1 1 a j j m 1 j m m j 1 N N S j 1 mj a j dm 43 SA D jx m j 2 x m j 1 dx Galerkin Method For cubic interpolation function (N=3) R a1 1 2a2 a1 x 3a3 a2 x 2 a3 x 3 m 1, W x0 1 1 1 m 2, W2 x x m 3, W3 x 2 1 Rdx 0 0 1 xRdx 0 0 1 x 2 Rdx 0 0 Small weighting of residuals near x = 0 Largest weight for residuals near x = 1 44 Galerkin Method Cubic trial function j 1 1 a j j 1 m j 1 m j m 1 2 3 a1 a2 a3 1 2 3 4 1.0141 1 5 11 1 a1 a2 a3 ai 0.4225 6 12 20 2 0.2817 1 3 13 1 a1 a2 a3 12 10 30 3 3 m 1, m 2, m 3, 2 3 y( x) 1 1.0141x 0.4225x 0.2817 x 2 3 R ( x ) 0 . 0141 0 . 1691x 0 . 4226 x 0 . 2817 x R(0) = 0.0141 0, R(1) = 0.0141 0 45 Galerkin Method W1 = 1 Weighting functions W2 = x W3 = x2 Weighted residuals xR x2R R 46 Galerkin Method Order of approximation: Linear, Quadratic, and Cubic Trial functions 47 Galerkin Method 48 Galerkin Method Alternative choice of weighting functions R (a1 1) (2a2 a1 ) x (3a3 a2 ) x 2 a3 x 3 3 1 (1 x)a1 (2x x 2 )a2 (3x 2 x 3 )a3 1 a j j j 1 m 1, W 1 x 1 2 m 2 , W 2x x 2 m 3, W3 3x 2 x 3 1 (1 x ) Rdx 0 0 1 (2x x 2 ) Rdx 0 0 1 (3x 2 x 3 ) Rdx 0 0 More uniform weighting functions Identical to the least square method 49 Collocation Method R = L(u) = 0 at collocation points x0 1 0 x1 x2 R(u ) 0 but R(u ) 0 wm Rdx R( xm ) (a1 1) (2a2 a1 ) xm (3a3 a2 ) xm2 a3 xm3 m 1 : x1 0 1 m 2 : x 2 2 m 3 : x3 1 a1 1 1 3 5 a1 a2 a3 1 2 4 8 a2 2a3 1 y ( x) 1 x 1 1 ai 3 / 7 0.4286 2 / 7 0.2857 3 2 2 3 5 x x y (1) 2 e 2.71828 7 7 7 Identical to Galerkin method if the residuals are evaluated at x = 0.1127, 0.5, 0.8873 50 Collocation Method Zero residuals at collocation points R(0) = R(0.5) = R(1) = 0 But y yexact at collocation points y(1) = 2.7142857 e 51 Taylor-series Expansion Truncated Taylor-series 2 3 x x e 1 x 2 ! 3! x 1 1 ai 1 / 2 0.5 1 / 6 0.1667 R(0) = 0, R(1) = 1/6 = 0.1667 0 Poor approximation at x = 1 Power series has highly nonuniform error distribution 52 Interpolation Functions 53 Numerical Accuracy 54 Interpolation Functions Comparison of numerical errors for weighted residual methods 55