Download Finite Difference Method (FDM) for Solving Ordinary and Partial Differential Equations - P and more Lab Reports Materials science in PDF only on Docsity! 4/25/2002 1 MAT E 460 ENGINEERING COMPUTATION LABORATORY FINITE DIFFERENCES Prof. Antonios Zavaliangos LeBow 441, x2078, azavalia@coe.drexel.edu 4/25/2002 2 What is the Finite Difference Method (FDM) • Finite difference method is actually a set of techniques for the numerical solution of ordinary and partial differential equations. •It is “lighter” mathematically wrt finite elements •It is “easy” to implement computationally •It has problems with complex geometry... 4/25/2002 5 Finite Difference Method A alternative is based on the FDM. Discretize the length L by using N (equi-spaced) points. Approximate the derivatives: Write the governing equation using the above approximations for each of the n-2 inner points c1 c2 c3 … cn-1 cn 2 11 2 2 1111 2 2 x ccc dx cd x cc x cc x cc dx dc iii iiiiii δ δδδ −+ −++− +−≈ −≈−≈−≈ 0121 ... 0121 0121 0 2 2 12 432 321 11 2 11 = ++− + = ++− + = ++− + =−++− −− −+−+ nnn iiiii c D xv c D xv c c D xv c D xv c c D xv c D xv c x cc D v x ccc δδ δδ δδ δδ 4/25/2002 6 PDE-Non-steady state If non-steady-state then the governing equation is: where c(x,t) is a function of both position and time. Initial condition (IC) c(x,0)=A0(x) BC: c(0,t)=B0(t), c(L)=BL(t) How do we solve this problem: Discretization along two axes - time and x. dt dc dx cd D = 2 2 4/25/2002 7 PDE-FDM x t 0 1 2 … i …. n 0 1 2 . . . j . . . m δx δt t cc x ccc D jijijijiji δδ ,1, 2 ,1,,1 2 −= +− +−+ BC IC 2 1 2 < x tD δ δ Stability condition o/w problems... If I know i-1, i, i+1 at j I can determine i at j+1 4/25/2002 10 Parabolic PDE x t 0 1 2 … i …. n 0 1 2 . . . j . . . m δx δt t cc x ccc D jijijijiji δδ 1,1, 2 ,1,,1 2 −+−+ −= +− BC IC dt dc dx cd a = 2 2 2 t cc x ccc a jijijijiji δδ ,1, 2 1,11,1,12 2 −= +− ++−+++ Euler Forward Euler Backward Other methods exist... 4/25/2002 11 Elliptic PDE x y 0 1 2 … i …. n 0 1 2 . . . j . . . m δx δy ji jijijijijiji f y ccc x ccc ,2 1,,1, 2 ,1,,1 22 = +− + +− −−−+ δδ BC ),( 2 2 2 2 yxf dy cd dx cd =+ e.g., steady state diffusion in 2-D (n-2).(m-2) equations with (n-2).(m-2) unknowns 4/25/2002 12 Hyperbolic PDE x t 0 1 2 … i …. n 0 1 2 . . . j . . . m δx δt 11 2 1,,1, 2 ,1,,12 or 2 2 −+ −+ −+ −= +− = = +− jjj jijiji jijiji t ccc x ccc a ccAc δ δ BC IC 2 2 2 2 2 dt cd dx cd a = In other words we need results from 2 previous steps to go further. Needs an explicit step to start )()0,( )()0,( 0 0 xjx dt dc xcxc = =