Download presentation

Presentation is loading. Please wait.

Published byEmilia Judson Modified over 2 years ago

1
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

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

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

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

5
Water storage Water tower P&ID Mathematical Description: Change=input-output

6
How to solve this set of equations? Hand calculation Software calculation using Mathematica for example Often not possible for “real” systems Even if possible, sometimes not useful 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 solutionNumerical solution

7
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

8
What if your feed varies in a non-functional way? Time (hours) feed 01.0 0.51.1 11.3 1.51.4 21.2 2.50.9 30.8 3.51.1 Numerical integration!

9
Numerical ODE solving time 0 0.1 Time step=0.1 Tank depth (h) True solution 10 Slope: F-k 1 v 1 (10) Euler’s method! Numerical approx

10
Numerical ODE solving time 0 0.1 Time step=0.1 Tank depth (h) 10 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

11
Numerical ODE solving time 0 0.1 Time step=0.1 Tank depth (h) 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 6.0x10 3023 Numerical error! Time step=0.01

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

13
Numerical ODE solving time 0 0.1 Time step=0.1 Tank depth (h) 10 4th order Runge-Kutta Where Euler’s method

14
Numerical ODE solving time 0 0.1 Time step=0.1 Tank depth (h) 10 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

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

16
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

Similar presentations

OK

Predicting Landing Solutions for a Rocket in a Two- Body System Spring 2014 · Honors Professor Thorp · C++

Predicting Landing Solutions for a Rocket in a Two- Body System Spring 2014 · Honors Professor Thorp · C++

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on credit default swaps explained Ppt on computer malwares bytes Ppt on chapter 3 atoms and molecules ppt Ppt on pricing policy pdf Ppt on science and technology advantages and disadvantages Ppt on software configuration management Ppt on wireless communication network Ppt on principles of peace building quotes Ppt on power grid Ppt on waves tides and ocean currents powerpoint