Vous êtes sur la page 1sur 2

ChE 151: Process Simulation and Mathematical Techniques for

Chemical Engineers
Prof. Davis

Spring 2016 Homework 5: 30 points total

Due Thursday, March 31st (at the beginning of class)
1. (9 points) Answer the following in 2-3 sentences (3 points each):
A. What is a stiff differential equation and why is it bad? (See section 5.8 of the book.)
B. Explain the primary difference between single step and multistep methods for solving
IVPs numerically.
C. How can predictor-corrector methods be better than single-step methods for solving
IVPs? In what way are they worse?
2. (21 points) Youre working as a process engineer for a pharmaceutical company and youre
in charge of a batch reactor. The reactor, which is supposed to operate isothermally at 320 K,
makes a certain isomer of a drug from a racemic mixture:


One day you notice theres a slow periodic disturbance in the temperature in the reactor. You
check your controller data and the reactor temperature (T) seems to be following a regular
pattern. You plot the data and you were able to fit the curve with a periodic function; the
equation T = 1cos(2t) + 320, where 1 = 60 K and 2 = /120 s-1 seemed to fit it okay.
Assuming the reaction is first order and elementary, the design equation for the batch reactor is:

dC A
kC A =
k0 e RT C A , k0 =
4 103

s 1 ,

5000 K , C A0 =
3.06 mol / m3

A. (6 points) Write your own algorithm in Matlab which implements Eulers method to
solve numerically for CA(t). I want a code that solves THIS PROBLEM, not a general
problem; you should be able to run the algorithm in one *.m file without declaring an
anonymous function or making/using any subroutines. State the step size you picked
(and state why you picked it) on your hard copy submission of your code. The batch runs
for 30 minutes; the output of the code should be the concentration of B (not A) at 30
minutes, since you care about making B. Code with not enough comments is bad code.
B. (6 points) Modify your Euler code from part A. so that it solves the problem for CA(t)
using the Runge-Kutta order 4 method as well. Call the vector of guesses RK and not
w (the guesses from the old code should be called Euler). No need to write a
separate file; calculate this answer in the same loop as the Euler answer. I want everyone
to write their own *.m file named LastnameFirstnameEulerRK.m which solves the
problem using both methods and submit it electronically to Moodle. If your code does

not run on my machine as a single *.m file, you will not get full credit. Dont forget to
submit a screen shot of your command window with the output, CB(30 min).
C. (3 points) Note in your submission (on your paper, not in the comments of your code) the
primary differences between RK4 and Euler.
D. (3 points) Run your algorithm for step sizes of 1 second, 10 seconds, and 1 minute. Make
a table of the results at t = 30 minutes for Euler and RK for each of the three cases. Also
plot the concentration of A for each step size and submit a copy of your plot.
E. (3 points) Comment on the differences between your plots in part D. and what they imply
for the accuracy of the two methods in 2-3 sentences, i.e. how much error is there in each
approximation method for different h values?
3. (0 points) List the number of hours you spent on work for this class for this week, not
counting time spent in class. Approximate to the nearest half hour. Put it on the very top of
your homework, under your name and the names of your other group members like this:
Name 1
Name 2
Name 3 (if applicable)
Hours spent on 151 this week: 5.5 hours
Objectives addressed on this assignment:

Identify the general type of numerical method needed to solve a problem (IVP, system of
NLEs, etc.)
Explain what Eulers method is and how it relates to solving ODEs
Give bounds on the error in the solution to a problem using a numerical method
Write an algorithm to solve a chemical reactor design IVP using a Runge-Kutta method
Effectively implement algorithms in Matlab to solve various problems from chemical
engineering numerically