Modeling Basics: 4. Numerical ODE Solving In Excel 5. Solving ODEs in Mathematica

Similar documents
Three-Tank Experiment

Lecture 17: Ordinary Differential Equation II. First Order (continued)

CHAPTER 1 INTRODUCTION TO NUMERICAL METHOD

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Feedback Basics. David M. Auslander Mechanical Engineering University of California at Berkeley. copyright 1998, D.M. Auslander

ENGI9496 Lecture Notes State-Space Equation Generation

A First Course on Kinetics and Reaction Engineering Supplemental Unit S5. Solving Initial Value Differential Equations

Chapter 9b: Numerical Methods for Calculus and Differential Equations. Initial-Value Problems Euler Method Time-Step Independence MATLAB ODE Solvers

Physics 584 Computational Methods

Initial value problems for ordinary differential equations

Scientific Computing with Case Studies SIAM Press, Lecture Notes for Unit V Solution of

Mathematical Modeling of Chemical Processes. Aisha Osman Mohamed Ahmed Department of Chemical Engineering Faculty of Engineering, Red Sea University

CHAPTER 3 : MATHEMATICAL MODELLING PRINCIPLES

Solution: (a) Before opening the parachute, the differential equation is given by: dv dt. = v. v(0) = 0

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Section 7.4 Runge-Kutta Methods

Solution: (a) Before opening the parachute, the differential equation is given by: dv dt. = v. v(0) = 0

Popping tags means. How long will it take to cool the trunnion? Physical Examples. ), a dt

Numerical Solution of Differential Equations

Use of Differential Equations In Modeling and Simulation of CSTR

APPLICATIONS OF FD APPROXIMATIONS FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS

SYMBOLIC AND NUMERICAL COMPUTING FOR CHEMICAL KINETIC REACTION SCHEMES

Simple ODE Solvers - Derivation

Chap. 20: Initial-Value Problems

Ordinary Differential Equations. Monday, October 10, 11

MTH 103 Group Activity Problems (W1B) Name: Types of Functions and Their Rates of Change Section 1.4 part 1 (due April 6)

MA/CS 615 Spring 2019 Homework #2

Modeling and Experimentation: Compound Pendulum

Solving Models With Off-The-Shelf Software. Example Of Potential Pitfalls Associated With The Use And Abuse Of Default Parameter Settings

Chabot College Fall Course Outline for Mathematics 25 COMPUTATIONAL METHODS FOR ENGINEERS AND SCIENTISTS

STATE VARIABLE (SV) SYSTEMS

Solving ODEs Euler Method & RK2/4

Oakwood City School District Grade Eight Mathematics. Grade Eight Mathematics

Computational Techniques Prof. Dr. Niket Kaisare Department of Chemical Engineering Indian Institute of Technology, Madras

Chemical Engineering 374

Differential Equations Demos Table of Contents (ToC):

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Focus Questions: 3-1: Describe how objects speed up and slow down 3-2: Describes how objects change direction

Dennis Bricker Dept of Mechanical & Industrial Engineering The University of Iowa. Forecasting demand 02/06/03 page 1 of 34

Inputs (F) State variable (Q) Outputs (F)

Chapter 6 - Ordinary Differential Equations

Three Body Problem using High-Order Runge-Kutta Interpolation

Using Spreadsheets to Teach Engineering Problem Solving: Differential and Integral Equations

Ordinary differential equations - Initial value problems

Chapter 3 Numerical Methods

Solving Bateman Equation for Xenon Transient Analysis Using Numerical Methods

Ordinary Differential Equations

Calculus for the Life Sciences

Multistep Methods for IVPs. t 0 < t < T

Lecture 8: Calculus and Differential Equations

Lecture 8: Calculus and Differential Equations

Solution: In standard form (i.e. y + P (t)y = Q(t)) we have y t y = cos(t)

Logistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations

Numerical Methods - Boundary Value Problems for ODEs

Numerical Algorithms for ODEs/DAEs (Transient Analysis)

(A) Opening Problem Newton s Law of Cooling

Modeling & Simulation 2018 Lecture 12. Simulations

Maple in Differential Equations

AA214B: NUMERICAL METHODS FOR COMPRESSIBLE FLOWS

What are Numerical Methods? (1/3)

Ordinary Differential Equations (ode)

ChE 344 Winter 2013 Final Exam + Solution. Open Course Textbook Only Closed everything else (i.e., Notes, In-Class Problems and Home Problems

The Chemical Kinetics Time Step a detailed lecture. Andrew Conley ACOM Division

Introduction to Modelling and Simulation

CHAPTER 10: Numerical Methods for DAEs

CHAPTER 13: FEEDBACK PERFORMANCE

Describing the Relationship between Two Variables

INTRODUCTION TO COMPUTER METHODS FOR O.D.E.

Integration of Differential Equations

Matrix Reduction Techniques for Ordinary Differential Equations in Chemical Systems

What we ll do: Lecture 21. Ordinary Differential Equations (ODEs) Differential Equations. Ordinary Differential Equations

Basic Procedures for Common Problems

ODE Runge-Kutta methods

Theoretical Models of Chemical Processes

NovaChem Laboratories, Inc

Remark on the Sensitivity of Simulated Solutions of the Nonlinear Dynamical System to the Used Numerical Method

Model based control design

Dynamic Systems. Simulation of. with MATLAB and Simulink. Harold Klee. Randal Allen SECOND EDITION. CRC Press. Taylor & Francis Group

Ordinary Differential Equations (ODE)

Robotics 1 Inverse kinematics

Math 128A Spring 2003 Week 12 Solutions

Variable Step Size Differential Equation Solvers

4.4 Computing π, ln 2 and e

Physically Based Modeling: Principles and Practice Differential Equation Basics

1. Consider the initial value problem: find y(t) such that. y = y 2 t, y(0) = 1.

Second Order Linear Equations

Numerical method for approximating the solution of an IVP. Euler Algorithm (the simplest approximation method)

Physically Based Modeling Differential Equation Basics

Chapter 4: Numerical Methods for Common Mathematical Problems

Factorial ANOVA. More than one categorical explanatory variable. See last slide for copyright information 1

It can be derived from the Michaelis Menten equation as follows: invert and multiply with V max : Rearrange: Isolate v:

CHAPTER 80 NUMERICAL METHODS FOR FIRST-ORDER DIFFERENTIAL EQUATIONS

Outline Calculus for the Life Sciences II. Pollution in a Lake 1. Introduction. Lecture Notes Numerical Methods for Differential Equations

Process Modelling, Identification, and Control

Automation in Complex Systems MIE090

Reactor Design within Excel Enabled by Rigorous Physical Properties and an Advanced Numerical Computation Package

FORTRAN 77 Lesson 7. Reese Haywood Ayan Paul

WILEY. Differential Equations with MATLAB (Third Edition) Brian R. Hunt Ronald L. Lipsman John E. Osborn Jonathan M. Rosenberg

Consistency and Convergence

Computational Physics (6810): Session 8

Transcription:

Modeling Basics: 4. Numerical ODE Solving In Excel 5. Solving ODEs in Mathematica By Peter Woolf University of Michigan Michigan Chemical Process Dynamics and Controls Open Textbook version 1.0 Creative commons

Case study: water storage Water is vitally important for industry, agriculture, domestic consumption. 12.1x10 10 m 3 3.6x10 10 m 3 29.1x10 10 m 3 Data from http://www.newton.dep.anl.gov/askasci/gen01/gen01629.htm

12.1x10 10 m 3 3.6x10 10 m 3 29.1x10 10 m 3 Data from http://www.newton.dep.anl.gov/askasci/gen01/gen01629.htm

Key Question: Have you stored enough water? 12.1x10 10 m 3 3.6x10 10 m 3 29.1x10 10 m 3 Data from http://www.newton.dep.anl.gov/askasci/gen01/gen01629.htm

Water storage Water tower P&ID Mathematical Description: Change=input-output dh dt = F " k 1 v 1 h h[0] =10

How to solve this set of equations? dh dt = F " k 1 v 1 h h[0] =10 Numerical solution Integrate with software such as Excel or Mathematica (or many others) Integration can be tricky Need to know all parameters Can be computationally demanding Analytical solution Hand calculation Software calculation using Mathematica for example Often not possible for real systems Even if possible, sometimes not useful

Mathematica Syntax DSolve[ {eqn1, eqn2..},{y1,y2,..},t] Analytical solver NDSolve[{eqn1, eqn2..},{y1,y2,..},t] Numerical solver Plot[{f1,f2},{t,0,tmax}] Plotter See lecture7.mathematica.nb

Time (hours) 0 0.5 1 1.5 2 2.5 3 3.5 What if your feed varies in a non-functional way? feed 1.0 1.1 1.3 1.4 1.2 0.9 Numerical integration! 0.8 1.1

Numerical ODE solving dh dt = F " k 1v 1 h h[0] =10 True solution Numerical approx Tank depth (h) Slope: F-k 1 v 1 (10) dh dt " #h #t = h $ h i+1 i #t = F $ k 1 v 1 h h i+1 = h i + "t F # k 1 v 1 h [ ] 10 0 0.1 time Time step=0.1 Euler s method!

Numerical ODE Tank depth (h) solving Slope: F-k 1 v 1 (10) Notes on Euler s method: Perfect fit for linear systems Works well for nonlinear systems if the time step is small (everything is locally linear) If time step is too large can explode Small time steps mean slow calculations 10 0 0.1 time Time step=0.1

Numerical 6.0x10 3023 ODE Tank depth (h) Numerical error! solving Notes on Euler s method: Perfect fit for linear systems Works well for nonlinear systems if the time step is small (everything is locally linear) If time step is too large can explode Small time steps mean slow calculations 10 0 0.1 time Time step=0.1 Time step=0.01

Numerical ODE Tank depth (h) solving Runge-Kutta methods! Is there a way we could use a larger time step but retain accuracy? h i+1 = h i + "t slopes [ ] Solution: take some sort of weighted average of slopes at intermediate points to estimate the next value. 10 0 0.1 time Time step=0.1

Numerical ODE solving h i+1 = h i + "t slopes [ ] 4th order Runge-Kutta slopes = 1 [ 6 k 1 + 2k 2 + 2k 3 + k 4 ] Tank depth (h) 10 0 0.1 time Time step=0.1 Where k 1 = f (0,h o ) Euler s method k 2 = f (0 + "t /2,h o + k 1 "t /2) k 3 = f (0 + "t /2,h o + k 2 "t /2) k 4 = f (0 + "t,h o + k 3 "t)

Numerical ODE Tank depth (h) 10 solving 0 0.1 time Time step=0.1 h i+1 = h i + "t slopes [ ] Why stop at 4th order? 5th order is similar but with different weightings Upsides: 1) Larger step sizes possible 2) Can be more stable 3) Often more computationally efficient Downsides: 1) Complex to implement 2) Similar accuracy can often be achieved using Euler s method which is easy to implement

Key Question: Have you stored enough water? 12.1x10 10 m 3 See lecture7.excel.xls 3.6x10 10 m 3 29.1x10 10 m 3 Data from http://www.newton.dep.anl.gov/askasci/gen01/gen01629.htm

Take home messages Numerical simulation of differential equations can help you model very complex systems Sometimes slower, simpler method are better as your time is often more valuable than a computers Analytical results can be helpful in restricted cases.. Use Mathematica to handle the algebra