BVPs Coding Boundary Conditions Non-Uniform Grid Scaling Using FEMLAB®10.34, Numerical Methods Applied to Chemical Engineering Professor William H. Green Lecture #21: TA Tutorial on BVPs, FEMLAB®. BVPs What methods to use for each situation: • 1D o Finite Differences o ODE’s x x 2nd order: Î Two 1st order 1st order: Æ Shooting • 2D Rxnfast portion of reaction with adaptive time stepping Capture the fast o Finite Differences Figure 1. Boundary layer. o Method of Lines Stiff o Non-uniform grid • 3D o Finite Element o Finite Volume Generally use commercial code Figure 2. Adaptive time stepping. Coding Boundary Conditions Linear: A·x = b = 0 state variables at grid points BC: x1,j = 1 ⎟⎟⎠⎞⎜⎜⎝⎛Δ−−−≅xdxdjjjj243,3,2,1,1θθθθ 1 for 0,1=jdxdθ ⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟⎜⎜%%%%%%%0⎥⎢⎟⎠⎞⎜⎜⎜⎜⎜⎜⎜⎜⎜⎜⎜⎝⎛%%%%%%%%%%%%%%%%%%%%%%%%000⎦⎤⎢⎢⎢⎢⎣⎡yxNNjixxx,,1,1#⎥⎥⎥⎥⎥⎥⎥⎢=⎥⎥⎢⎢⎥⎦⎤⎢⎢⎢⎣⎡⎥⎥⎥⎥⎦⎤⎢⎢⎢⎢⎣⎡⎥⎥⎥⎦⎤⎢⎢⎢⎣⎡−⎥⎥⎥⎥⎦⎤⎢⎢⎢⎢⎣=⎥⎥⎥⎥⎦⎢⎢⎢⎢⎣⎡⎥⎥⎥⎥⎦⎢⎢⎣031341111,31,21,12,11,1#"##xxxx⎡⎤⎤⎡x⎢1⎢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].Nonlinear use fsolve BC: x1,j = 1 x1,j – 1 = 0 {set to zero} Non-Uniform Grid Throw out all original equations x f p(x) = ΣfiLi(x) Li(x) = ∏≠=⎥⎦⎤⎢⎣⎡−−Nikkkikxxxx0 polynomial between three points Figure 3. A graph of a polynomial fit of three points. ))(())(())(())(())(())(()(231321332123123121321xxxxxxxxfxxxxxxxxfxxxxxxxxfxf−−−−+−−−−+−−−−= 2xdxdf: differentiate the above expression f(x) and evaluate at x2. ()()()()()()()()231312332121322312132122xxxxxxfxxxxxxxfxxxxxxfdxdfx−−−+−−−−+−−−= ()()()()()()231333212231211222222xxxxfxxxxfxxxxfdxfdx−−+−−+−−= MatLAB Equation: *nonuniform_example* } huge jump Figure 4. Graph of a function that is steep in the beginning. 10.34, Numerical Methods Applied to Chemical Engineering Lecture 21 Prof. William Green 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].Scaling ()213222322222222210 choose ,10 if so1010)/(−−−−===⇒∂∂=∂∂⎟⎟⎠⎞⎜⎜⎝⎛+∂∂⎟⎟⎠⎞⎜⎜⎝⎛+∂∂⎟⎟⎠⎞⎜⎜⎝⎛=∂∂==−+⎥⎦⎤⎢⎣⎡∂∂+∂∂=∂∂yzzdyYCZCRvLZCLvDYCbvDLZCbyYLzZKCCCkyCzCDzCvAAzAzAzAABBAAAAzδδδ z y bL Figure 5. Diagram of pipe flow with reaction and diffusion. CAo } divide into 100 Figure 6. Non-uniform grid. y (b-δ) Figure 7. Division of problem into δ and (b-δ) regions. 22910zCzCAA∂∂=∂∂− 10.34, Numerical Methods Applied to Chemical Engineering Lecture 21 Prof. William Green 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].Problem 1 Using FEMLAB® * space dimension: axial symmetry 2D 0.03 18 axis/grid setting: rmin = -0.01 rmax = 0.06 10.34, Numerical Methods Applied to Chemical Engineering Lecture 21 Prof. William Green 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]. zmin = -1 zmax = 20 Figure 8. Diagram of FEMLAB Example. Subdomain settings: r = 0.001(r-(r/0.05)^2) Boundary settings: mesh mode puts in finite elements. Solve the problem. DONE IN UNDER 3
View Full Document