This is an example of using Athena to solve a simple isothermal batch reactor mass balance.
We can certainly solve this analytically, but using Athena for a simple problem helps
demonstrate the various steps involved in the solutions.
So first we use file and open to create a new.
Do that, we have a choice, we're going to solve just ordinary differential equations,
and hit OK, so now we want to type in some comments.
So we're going to do, for convenience just cut and paste, so styrene-butadiene co-polymerization,
isothermal batch reactor, the exclamation mark in front of the statements means that
they're comments, they're going to be ignored by the calculation.
First step in Athena is to indicate which variables we're going to use, and make sure
they're available for the calculation for the program, so the rate constant k, the concentration
of styrene, the concentration of butadiene, we want them to be real variables, not integer
variables, and then we're going to put in the numerical value of k.
Of course CS and CB are going to be changing.
Next is if we hit F11, it asks for initial conditions.
So the way Athena works is that it uses U as the dependent variables, t as the independent
variable, and so the initial conditions, which are also calculated in the notes, are as follows.
So not a stoichiometric ratio, and so U(1) means the concentration of CS, so we might
want to put a comment here that U(1) is identical to CS, and U(2) is identical to CB.
If we hit F11 again, it asks us to actually put in the equations.
So the equation is the derivative in this case of U(1) with respect to time is equal
to our rate expression.
So Athena uses F to correspond to the right side of the differential equation, so minus
the rate constant times the concentration of S times the concentration of B, and then
the derivative for the change in the concentration of component B, butadiene, would be, so F(2)
is equal to the derivative, so the stoichiometry is different, 3.2 times the rate constant
times CS and times CB.
And again, we could put a comment in that F(1) equals derivative of U(1) with respect
to t, correspondingly for F(2).
So this is all we need to solve the problem.
Well, we need to do a couple other things first.
We want to save the program, so copolymerization and save that, and then we want to hit F12.
So we've been hitting F11 to get the little headings if you'd like, so hit F12, we do
a couple of things under the general information, we indicate number of equations, 2, we see
pure differential equations, there's no algebraic equations in this case, so this matrix E if
you'd like, there's a 1 in front of the derivative.
We also want to go to solution history, to dependent variables U(1) and U(2), because
what we can do, 1 to make the program work and to make it easy, instead of using U in
the rate expressions, we want to use CS and CB the way we've written it, so if we click
use variable names in the calculations, then this CS and CB here is going to relate them
to U(1) and U(2).
So we should be finished.
Let's save everything, and now we have to compile, and no errors.
It would tell us things like parentheses don't match, missing statements and so forth.
We hit the execute, and then we go to this third button in the row which is to do the
calculation.
It gives us table output, but we can put the icon for graph, and because we used that solution
history, so let's make U(1) the same as CS and U(2) the same as CB, then we can look
at the concentrations, and something is wrong in our calculation.
CS is decreasing, CB is increasing, and there's not much change.
So let's go back to our program, and there's a couple of things we need to do.
one, I left out the minus sign here, that's important.
So I have to save again.
The other thing is if we hit F12 again, we notice that integration starts at 0 and goes
to 1, but we want to go to 10, 10 hours I believe in this case, so click yes, so we
have it saved, we have to now compile again, everything is okay, build the execution program,
that's okay, run the program.
Again, the graphical icon, and if we hold down the control button, we can select two
things.
Now the behavior is more like what we expect, that the concentrations are decreasing with
time, since these are both reactants, and we're making a polymer.
We could, and it might make sense if I hit F12 again and said suppose we ran this for
a longer time, so instead of 10, let's make it 60.
So number of output points, let's increase that number, just the number that's in the
plot, but it doesn't affect the error and number of steps it has to take.
So everything is the same, I should be able to run again, look at the graphical output,
and plot CS and CB, and now we can see we have more data points of course, and we're
getting down to very low concentrations for CS.
And we could certainly go back, just hit graph, and just look at CS concentration and see
how much it's decreasing.
So this example, a simple example of using Athena that allows us to solve differential
equations relatively easily.