PGE 310: Formulation and Solution of Geosystems Engineering Problems Dr. Matthew T. Balhoff Spring 2011 Notes Adapted from: Chapra, S., Canale, R. “Numerical Methods for Engineers”, Mc-Graw Hill Co. (2010) Rectenwald, G. “Numerical Methods with MATLAB”Prentice-Hall (2000) Gilat, A., Subramaniam, V. “Numerical Methods for Engineers and Scientists” John Wiley and Sons Inc. (2011)
About Me Education/Research Experience –B.S. Chemical Engineering, Louisiana State University 2000 –Ph.D. Chemical Engineering, Louisiana State University 2005 –ICES Postdoctoral Fellow (CSM), UT-Austin –Assistant Professor, UT-Austin Research Interests –Flow and transport in porous media –Non-Newtonian flow –Pore-scale and Multi-scale modeling –NUMERICAL METHODS +=
What’s a Numerical Method ? Many math problems cannot be solved analytically (exactly) Numerical methods are approximate techniques Real-life problems in science and engineering require these numerical techniques Real world problems can take hours, days, or years to solve. A well written computer program (in MATLAB for example) can do it much faster.
Example 1: Roots of Equations A root of an equation is the value that results in a “zero” of the function Q: Find the root of the following quadratic equation
Example 1: Roots of Equations A root of an equation is the value that results in a “zero” of the function Q: Find the root of the following quadratic equation A: The quadratic formula is an EXACT method for solving the roots of a quadratic equation Answer can be found by plugging in a, b, and c.
Example 1. Roots of Equations Ideal gas law doesn’t always apply:
Example 1. Roots of Equations Ideal gas law doesn’t always apply: In petroleum engineering, we deal with gases far from ideal (P=50 bar, T=473K) Methane
Example 1. Roots of Equations Ideal gas law doesn’t always apply: In petroleum engineering, we deal with gases far from ideal (P=50 bar, T=473K) So how do we find the root of this function, where the quadratic equation doesn’t apply? (R= cm 3 -bar/mol-K) Methane
Example 1: Ideas? What would be a good guess, if we needed a “ballpark” figure?
Example 1: Ideas? What would be a good guess, if we needed a “ballpark” figure? How can we get very close to the “exact” solution by performing very few calculations?
Example 1: Ideas? What would be a good guess, if we needed a “ballpark” figure? How can we get very close to the “exact” solution by performing very few calculations?
Root ~ 755 Could have plotted points
Example 2. Differentiation Derivative: “the slope of the line tangent to the curve”. But we seem to forget about that once we learn some fancy tricks to find the derivative Q: What is the derivative (dy/dx) at x = 1?
Example 2. Differentiation Derivative: “the slope of the line tangent to the curve”. But we seem to forget about that once we learn some fancy tricks to find the derivative Q: What is the derivative (dydx) at x = 1? But how do we find the derivative of a really complicated function – or one that isn’t described by an equation?
dy/dx = slope = -2
Example 3: Integration Integral: The area under the curve But then we learned some fancy tricks in Calculus Find the Integral:
Example 3: Integration Integral: The area under the curve But then we learned some fancy tricks in Calculus Find the Integral: These “tricks” don’t always work in the real world and we need APPROXIMATE methods
w 1 = 1/4 H 1 = y(0) Area 1 = H 1 *w 1 Add areas of triangles to approximate area under the curve Area 2 = H 2 *w 2
w 1 = 1/4 H 1 = y(0) Area 1 = H 1 *w 1 Add areas of triangles to approximate area under the curve Area 2 = H 2 *w 2 Some error
We get a better answer by using more rectangles
Compare Answers 4 Rectangles: Area = Rectangles: Area= Rectangles: Area = ,000,000 Rectangles = Actual = 4/3
Great. Now what’s the computer for? Numerical methods can require lots of computational effort –Root solving method may take lots of iterations before it converges –We might have to differentiate millions of equations –We might need thousands of little rectangles Computers can solve these problems a lot faster if we program them right We’ll have to learn some programming (in Matlab) before moving on to learning advanced numerical techniques Matlab isn’t hard, it just requires PRACTICE. Don’t get intimidated