Numerical Integration = Quadrature

Total Page:16

File Type:pdf, Size:1020Kb

Numerical Integration = Quadrature

Numerical Integration => Quadrature.

1 1   d x d y     J  d   d     1   1

Gaussian Quadrature is based on -1< () < 1 domain. 1 Dimensional:

1 N G x  d x  x k  w g h t k  1   k  1 { Exact polynomial of order (2NG - 1)} wghtk = 2 since if integrate a constant (1) over range [-1, 1] want solution of 2. An integral over [a, b] must be changed into an integral over [−1, 1] before applying the Gaussian quadrature rule. This change of interval can be done in the following way:

After applying the Gaussian quadrature rule, the following approximation is obtained:

ME 515 (Sullivan) Numerical Integration - Quadrature

1 In 2-D same idea:

1 1 1          x , y d x d y     x k , y w g h t k  d y 1 1  1  k 

        x k , y m w g h t k  w g h t m m  k 

G a u s s I n t e g r a t i o n P o i n t s

o r

N W  j i  w i t h        d x d y x x  N, W, are functions of 

  1  y   y        x  J       

N j  C o n s t a n t a l o n g a n y  l i n e 

y N  y k   k  in x, y space J> in space.

ME 515 (Sullivan) Numerical Integration - Quadrature

2 N W T h u s , j i c a n b e e x p r e s s e d a s : x x

1  y N y N  1  y W y W   j  j   i  i   J         J       

x y y x w i t h  J        4 4  N N N N  o r | J |  x y  k m  m k   k m       k  1 m  1

and each of these terms can be evaluated at the Gauss points such that the integration can be determined via: 2 2        w g h t w g h t  k m k m k 1 m 1

Some low-order rules for solving the integration problem are listed below.

Number of Points, Weights, points, n xi wi

1 0 2

2 1

8 3 0 ⁄9

5 ⁄9

ME 515 (Sullivan) Numerical Integration - Quadrature

3 Consider the following PDE:

U   V  U  f U  g

The Galerkin finite element formulation of this is:

抖N N 抖 N N 轾 j抖Wi j W i j j 犏< -K( + ) > + < ( Vx + V y ) W i >+ < fN j W i > { U j } 臌 抖x x 抖 y y 抖 x y

{} - K Ugn W i dS S K, Vx, Vy, f, and g are known values that may vary with (x, y).

A skeleton program outline for the solution of this problem is:

Main Program Dimension N(4), dNx(4), dNy(4), xl(4), yl(4) Call Element Subroutine (Apply Boundary Conditions ) Call banded matrix solver End

Element Subroutine for L = 1 : NE ! Loop over each element for k = 1 : 4 ! Assign 4 local node XL(k) = X(in(k,L)) ! coordinates YL(k) = Y(in(k,L)) end (k loop) Gauss point loops : For GPx = 1 : 2 ! quadrature in one direction Wx = Weight (GPx) xi = GValue (GPx) For GPy = 1 : 2 ! quadrature in the other direction Wy = Weight (GPy) eta = GValue (GPy) [N, dNx, dNy, DJ] = GP2DLF ( XL, YL, xi, eta)

ME 515 (Sullivan) Numerical Integration - Quadrature

4 ! assemble coefficients at the current Gauss Point

for k = 1 : 4 KM =>  K(in(k,L)) * N(k) VXM => VX(in(k,L)) * N(k) VYM =>  VY(in(k,L) * N(k) ! etc. End (k Loop) ! Now evaluate each local node I, J contribution within the element L at the ! Gauss Point (GPx, GPy) for i = 1 : 4 IRow = in(i,L) for j = 1 : 4 JCol = NDiag + (in(j,L) - IRow) Band (IRow,JCol) = Band (IRow,JCol) + DJ * Wx * Wy { - KM * [ dNx(j) dNx(i) + dNy(j) * dNy(i)] + [ VXM * dNx(j)+VYM * dNy(j)] * N(i) + FM * N(j) * N(i) } end (j Loop) Rhs(IRow) = RHS(IRow) +DJ * Wx * Wy * (GM * N(i)) end (i Loop) end (L Element Loop) % Apply BC’s % Call Solver End of code

ME 515 (Sullivan) Numerical Integration - Quadrature

5

ME 515 (Sullivan) Numerical Integration - Quadrature

6

Recommended publications