2016 Che 151 Homework 5

  • Upload
    dan-mc

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

  • 8/19/2019 2016 Che 151 Homework 5

    1/2

    ChE 151: Process Simulation and Mathematical Techniques for

    Chemical EngineersProf. Davis

    Spring 2016 Homework 5: 30 points totalDue 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 solvingIVPs 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) You’re working as a process engineer for a pharmaceutical company and you’rein 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:

     A B→  

    One day you notice there’s a slow periodic disturbance in the temperature in the reactor. Youcheck 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:

    3 1 0 3

    0 0, 4 10 , 5000 , 3.06 /act 

     E 

    act  A   RT 

     A A A

     E dC kC k e C k s K C mol m

    dt R

    −−

    = − = − = × = =  

    A.  (6 points) Write your own algorithm in Matlab which implements Euler’s method tosolve 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 everyoneto 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

  • 8/19/2019 2016 Che 151 Homework 5

    2/2

    not run on my machine as a single *.m file, you will not get full credit. Don’t 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 ofyour 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 Euler’s 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 chemicalengineering numerically