This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Partial Differential Equations (cont.) ChBE 521 Applied Mathematics November 19, 2008 Time dependence Last time, recall that we solved the onedimensional steadystate problem (Poisson equation), Lu = f, where L = d 2 dx 2 , using both finite differences and collocation. Although this is not a PDE by definition (no time depen dence), weve demonstrated that we can discretize space and obtain a numerical approximation to the solution by linearizing the spatial operator into a matrix equation. That is, weve gone from Lu = d 2 u dx 2 = f Au = f, where (given that the 1D domain is discretized into an Npoint grid), A is an N N matrix and u and f are N 1 vectors. We can now use this as the framework to solve the timedependent problem. 1 Going back to the original PDE for diffusion u t = D 2 u x 2 , we recognize that spatial operator L = D 2 x 2 on the right hand side of the equation can be linearized into matrix form as in the previous problem, as long as we can discretize the domain. So again, using the finite difference method (FDM), we can convert the problem to u t = D 2 u x 2 = Lu u t = Au, where the latter is a matrix equation u = Au. ( A is N N and u is N 1.) We can solve this problem either by solving u ( t ) = u (0)exp( At ) , using the matrix exponential, or by the various numerical methods (explicit Euler, implicit Euler, RungeKutta, etc...) weve discussed to solve ODEs. MATLAB has an extensive library of functions for solving ODEs. For most situations, the following builtin ODE solvers are useful/sufficient. ode15s: stiff, 1st5th order implicit, low to medium accuracy. ode23s: nonstiff, 2nd/3rd order explicit RungeKuttaFehlberg, low accuracy (but may be more stable than ode15s), ode45: nonstiff, 4th/5th order explicit RungeKuttaFehlberg, medium accuracy. Time stepping can also be implemented manually, which we will discuss later. Boundary conditions Let us now demonstrate how to implement various boundary conditions to a numerical PDE solution using the 1D diffusion example, u t = D 2 u x 2 . Dirichlet BCs (Fixed Boundary Condition) e.g. u (0) = u , u (1) = u. Given a domain discretized by N = 5 nodes, we know that nodes 1 and 5 represent boundary nodes, while 24 are the interior nodes. From the boundary conditions we have u 1 = u and u 5 = u . Given these are fixed in value, we know u 1 = u 5 = 0. Thus it suffices to determine the evolution of the interior node values. For the interior nodes, we know the spatial operator D 2 u x 2 can be numerically represented using finite differences. Nothing is different in the interior, so u 2 = D 2 ( u 1 2 u 2 + u 3 ) , u 3 = D 2 ( u 2 2 u 3 + u 4 ) , u 4 = D 2 ( u 3 2 u 4 + u 5 ) ....
View
Full
Document
 Spring '10
 ChrisRao

Click to edit the document details