10 34 Numerical Methods Applied to Chemical Engineering Professor William H Green Lecture 19 Boundary Value Problems BVPs Lecture 2 Finite Differences df dx df dx f x o x f x o x O x 2 2 x f x o x f x o O x x x0 x0 Relatively good accuracy better convergence ONE SIDED upwind differencing The error leads to numerical stability but is a mathematical trick Adds in error Deff Dtrue V x x 2 and Pelocal eff 2 Still wrong because artificially increased V2 v V S 0 i 1 2 i i 1 x 2 linear v i 1 i f x 0 x linear f x1 M 0 f 1 M 0 f 2 linear or nonlinear f x 2 0 0 0 0 approx to differential operators Newton s Method F 0 J F f 1 Newton update J M 0 f 2 0 Cite as William Green Jr course materials for 10 34 Numerical Methods Applied to Chemical Engineering Fall 2006 MIT OpenCourseWare http ocw mit edu Massachusetts Institute of Technology Downloaded on DD Month YYYY Example Rectangular Duct With Incompressible Flow Rectangular duct with incompressible fluid being pulled by gravity V2vz x y g No slip at walls vz boundaries 0 xi y i n 2 2 x 2 y 2 n i 1 N y j v z x1 y1 v z x1 y 2 v z x1 y N y v x y z 2 1 Ny y y x Nx x 4 3 2 1 Ny 1 1 1 Figure 1 Rectangular duct with incompressible flow NxNy points Interior v z xi 1 y j 2v z xi y j v z xi 1 y j x 2 v z xi y j 1 2v z xi y j v z xi y j 1 y 2 Rows of M look like this 10 34 Numerical Methods Applied to Chemical Engineering Prof William Green Lecture 19 Page 2 of 4 Cite as William Green Jr course materials for 10 34 Numerical Methods Applied to Chemical Engineering Fall 2006 MIT OpenCourseWare http ocw mit edu Massachusetts Institute of Technology Downloaded on DD Month YYYY 1 1 1 1 000 2 M 0 2 2 2 x y y 2 x M g 1 1 00 00 00 2 2 x y M b Shown in MATLAB function makeAforLaplacian Nx Ny Xmax Ymax Non sparse A n n 1 1 y 2 Sparse format mvec k n Ymax vec k n 1 A vec k 1 y 2 Nx MATLAB for Sparse Matrix Nx 20 Ny 30 Xmax 40 Ymax 10 A sparse makeA sparse Nx Ny Xmax Ymax b zeros Nx Ny 1 unknown vector b b 1 phi A sparse b check A sparse phi check 400 ans 1 0 bbig 1e7 b phi A sparse bbig check A sparse phi ans 1e7 How do know if correct V shaped reshape phi Ny Nx surf V shaped Makes a beautiful plot of the solution Adding Convection Peclet number Pe vL D Pelocal vx x D 10 34 Numerical Methods Applied to Chemical Engineering Prof William Green Lecture 19 Page 3 of 4 Cite as William Green Jr course materials for 10 34 Numerical Methods Applied to Chemical Engineering Fall 2006 MIT OpenCourseWare http ocw mit edu Massachusetts Institute of Technology Downloaded on DD Month YYYY V v DV2 S 0 v x 2 D 2 S 0 vx x x x v x S 1 v x x D x D D x Recall from ODE discussion t t 2 numerical stability of explicit solvers v x stuff D x vx D x 2 x 2 vx D Pe local 2 Achieve Pelocal 2 by making x smaller This leads to stiffness Difficulties when implicit solving Use adaptive meshing with Gear predictor corrector Deff Dtrue v x x 2 f x xD f x0 x f x0 O x x Pe local 2 Method of lines for flow only in x direction D 2 x x y y z 2 x y z x y y z 2 vx D 2 D x x y 2 vx PDE ODE works only if vy vz negligible Pelocal 2 Equations like this for all discrete z and y values in mesh 10 34 Numerical Methods Applied to Chemical Engineering Prof William Green Lecture 19 Page 4 of 4 Cite as William Green Jr course materials for 10 34 Numerical Methods Applied to Chemical Engineering Fall 2006 MIT OpenCourseWare http ocw mit edu Massachusetts Institute of Technology Downloaded on DD Month YYYY
View Full Document
Unlocking...