lecture 14

# lecture 14 - CE 30125 Lecture 14 LECTURE 14 PRACTICAL...

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CE 30125 - Lecture 14 LECTURE 14 PRACTICAL ISSUES IN APPLYING FINITE DIFFERENCE APPROXIMATIONS Derivatives of Variable Coefficients • Consider the term d df x ----- g x ------------ dx dx where g is a coefficient which is a function of x • Proceed in steps. First let: df u g x ----dx • Now evaluate: du 1 ----- = u i dx p. 14.1 CE 30125 - Lecture 14 hi i-1 hi+1 x i-1/2 u 1 ui • Now evaluate u 1 i + -2 and u x i+1/2 i+1 i 1 i + -2 –u 1 i – -2 = -----------------------------1 -- h i + h i + 1 2 1 i – -2 u u 1 i + -2 1 i – -2 =g =g 1f 1 1 i + -- i + -2 2 1 1 i – -- i – -2 2 1f =g =g p. 14.2 fi + 1 – fi 1 ------------------ i + -- h i + 1 2 fi – fi – 1 1 ------------------ hi i – -- 2 CE 30125 - Lecture 14 • Hence 1 ui where g i + 1/2 g i – 1/2 g i – 1/2 g i + 1/2 = f i + 1 ---------------------- – f i ---------------------- + -------------- + f i – 1 -------------h avg h i + 1 h avg h i h avg h i + 1 h avg h i hi + hi + 1 h avg --------------------2 • When h = h i + 1 = h i , then the approximation reduces to: 1 ui 1 = ----- f i + 1 g 1 – f i g 1 + g 1 + f i – 1 g 1 2 i + -i + -i – -- i – -h 2 2 2 2 • Example Applications with variable coefficients: • Fluids: spatially varying viscosities/diffusivities • Solids: spatially varying elasticities p. 14.3 CE 30125 - Lecture 14 Two Dimensional Finite Difference Approximations • Define nodes in a two-dimensional plane with • i = spatial index in the x -direction • j = spatial index in the y -direction f y fi , j+2 i, j+2 fi+2 , j+2 i+2, j+2 i, j+1 Dy i-2, j i-1, j fi , j i, j i, j-1 i, j-2 p. 14.4 Dx fi+2, j i+1, j i+2, j x CE 30125 - Lecture 14 • When taking partial derivatives w.r.t. x , we hold y constant f ----x i j f i + 1 j – f i – 1 j = -------------------------------2x and 2 f ------2 x i j f i + 1 j – 2 f i j + f i – 1 j = -----------------------------------------------2 x • Similarly 2 f ------2 y i j f i j + 1 – 2 f i j + f i j – 1 = -----------------------------------------------2 y p. 14.5 CE 30125 - Lecture 14 Example 1 • Consider Laplace’s equation and x = y = h : 2f 2f 2f = ------- + ------x2 y2 i j 2 f i j 1 = ----- f i + 1 j + f i – 1 j + f i j + 1 + f i j – 1 – 4 f i j 2 h • This may be viewed as follows in terms of a molecule: fi , j+1 1 1 h2 fi-1, j 1 fi, j -4 1 p. 14.6 fi+1, j 1 fi , j-1 CE 30125 - Lecture 14 Example 2 • Let’s consider: 4 4 4 f f f f = f = ------- + 2 ---------------- + ------4 22 4 x x y y 4 2 2 • Draw a molecule diagram for the 2nd order central difference formulation. 4 2 2 f f • Obtain ------- by finding ------- ------- 4 2 2 x x x 4 2 2 f f ------- = ------- ------- 4 2 2 x x x 4 2 f 1 ------- = ------- -------- f i + 1 j – 2 f i j + f i – 1 j 4 2 2 x x x p. 14.7 CE 30125 - Lecture 14 4 2 2 2 f 1 ------- = -------- ------- f i + 1 j – 2 ------- f i j + ------- f i – 1 j 4 2 2 2 2 x x x x x 4 f 1 1 ------- = -------- -------- f i + 2 j – 2 f i + 1 j + f i j 4 2 2 x x x 2 – -------- f i + 1 j – 2 f i j + f i – 1 j 2 x 1 + -------- f i j – 2 f i – 1 j + f i – 2 j 2 x 4 f 1 ------- = -------- f i – 2 j – 4 f i – 1 j + 6 f i j – 4 f i + 1 j + f i + 2 j 4 4 x x 1 Dx4 1 -4 6 p. 14.8 -4 1 CE 30125 - Lecture 14 • Similarly: 4 f 1 ------- = -------- f i j – 2 – 4 f i j – 1 + 6 f i j – 4 f i j + 1 + f i j + 2 4 4 dy y 1 -4 1 Dy4 6 -4 1 p. 14.9 CE 30125 - Lecture 14 • Evaluation of the mixed derivative: 4 2 2 f f ---------------- = ------- ------- 22 2 x 2 x y y 4 2 f 1 ---------------- = ------- -------- f i – 1 j – 2 f i j + f i + 1 j 22 2 2 x y y x 4 f 1 1 ---------------- = -------- -------- f i – 1 j – 1 – 2 f i – 1 j + f i – 1 j + 1 22 2 2 x y x y 2 – -------- f i j – 1 – 2 f i j + f i j + 1 2 y 1 + -------- f i + 1 j – 1 – 2 f i + 1 j + f i + 1 j + 1 2 y p. 14.10 CE 30125 - Lecture 14 4 f 1 ---------------- = ----------------- f i – 1 j – 1 – 2 f i – 1 j + f i – 1 j + 1 22 2 2 x y x y – 2 f i j – 1 + 4 f i j – 2 f i j + 1 + f i + 1 j – 1 – 2 f i + 1 j + f i + 1 j • This then produces the following module 1 1 Dx2 Dy2 -2 1 -2 4 -2 1 -2 1 p. 14.11 CE 30125 - Lecture 14 • We can also obtain this module as follows: ¶ 2f ¶x2 = ¶ 2f ¶y2 1 Dx2 = [1 -2 1] 1 1 Dy2 -2 1 • Therefore 1 -2 1 -2 4 -2 1 -2 1 1 ¶2 ¶ 2f ¶y2 ¶x2 = 1 Dx2 Dy2 -2 x 1 -2 1= 1 Dx2 Dy2 1 p. 14.12 CE 30125 - Lecture 14 4 • To obtain f , we must add up modules: 4 4 4 f f f f = ------- + 2 ---------------- + ------4 22 4 x x y y 4 • If x = y = h then: 1 2 1 h4 1 -8 2 -8 20 -8 2 -8 2 1 p. 14.13 1 ...
View Full Document

## This note was uploaded on 03/02/2012 for the course CE 30125 taught by Professor Westerink,j during the Fall '08 term at Notre Dame.

Ask a homework question - tutors are online