Software for integrating ODEs

From Introduction to Reactor Design: 3K4
Revision as of 20:24, 22 February 2013 by Kevin Dunn (talk | contribs)
Jump to navigation Jump to search


Consider the pair of differential equations (covered in a class on 11 February:

<rst> .. math::

\dfrac{dX}{dW} &= \dfrac{-r_A'}{F_{A0}} \\ \dfrac{dy}{dW} &= -\dfrac{\alpha}{2y}\left(1 + \varepsilon X\right)

Some terminology (recap from your pre-requisite math courses)

* The independent variable is \(W\) * The two dependent variables (variables being integrated with respect to the independent variable) are \(X\) and \(y\)

Since there are two dependent variables, we require initial conditions for each variable. In this case:

* :math:`X(0) = 0.0` * :math:`y(0) = 1.0`

We also need to specify initial **and final conditions** for the independent variable:

* :math:`W` initially is 0.0 at the reactor entrance * :math:`W` finally is 20.0 kg at the reactor exit

But there are a few other unknowns we must first specify:

* :math:`r_A' = -k' \dfrac{(1-X)y}{(1+\varepsilon*X)}` * :math:`q = \dfrac{(1 + \varepsilon*X)}{y}` * :math:`F_{A0} = 0.1362\,\text{mol.s}^{-1}` * :math:`k' = 0.0074\,\text{mol.s}^{-1}\text{.(kg catalyst)}^{-1}` * :math:`\alpha = 0.0367\,\text{kg}^{-1}` * :math:`\varepsilon = -0.15`



Mac computers

  • Start the built-in Mac program called Terminal
  • Type the following commands:
# first install "easy install" 
sudo easy_install ipython
sudo easy_install readline
sudo easy_install numpy
# Download and install "gfortran-4.2.3.dmg"
sudo easy_install scipy

and you should some something like:

Kevins-MacBook-Pro:~ kevin$ ipython
Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: