Description: In the article which centers on athena login, the author talks about an example of using Athena to solve a simple isothermal batch reactor mass balance. This complements the numerical solutions through providing a tutorial on the use of Athena Studio for numerical solutions.
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.
First we use file and open to create a new. Do that, we have a choice, we’re going to solve ordinary differential equations, and hit OK, now we type in some comments. For convenience we’re going to cut and paste.
Styrene-butadiene co-polymerization, isothermal batch reactor, the exclamation mark in front of the statements mean 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, make sure they’re available for the calculation for the program.
The rate constant k, the concentration of styrene, the concentration of butadiene, we want them to be real variables, not integer variables, we’re going to put in the numerical value of k. CS and CB are going to be changing.
Next is if we hit F11, it asks for initial conditions. The way Athena works is that it uses U as the dependent variables, T as the independent variable, the initial conditions, which are also calculated in the notes, are as follows.
Not a stoichiometric ratio, U1 means the concentration of CS, we might want to put a comment here that U1 is identical to CS, U2 is identical to CB. If we hit F11 again, it asks us to put in the equations. The equation is the derivative in this case of U1 with respect to time which is equal to our rate expression.
Athena uses F to correspond to the right side of the differential equation, 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.
F2 is equal to the derivative, so the stoichiometry is different, 3.2 times the rate constant times CS and times CB. We could put a comment in that F1 equals derivative of U1 with respect to T, correspondingly for F2.
This is all we need to solve the problem. We need to do a couple of other things first. We need to save the program, find copolymerization and save that, then we need to hit F12. We’ve been hitting F11 to get the little headings if you’d like.
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 equation in this case, this matrix is E if you’d like, there’s a 1 in front of the derivative.
We also need to go to solution history to dependent variables U1 and U2, because we can make the program work and make it easy, instead of using U in the rate expressions, we want to use CS and CB the way we’ve written it.
If we click use variable names in the calculations, then this CS and CB are going to relate them to U1 and U2. Let’s save everything, we have to compile, there are no errors. It would tell us things like parentheses don’t match, missing statements and so forth.
We hit the execute, 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, because we used that solution history, let’s make U1 the same as CS and U2 the same as CB.
Then we can look at the concentrations, something is wrong in our calculation. CS is decreasing, CB is increasing, there’s not much change. Let’s go back to our program, there are a couple of things we need to do.
I left out the minus sign here, that’s important. 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 hours in this case, click yes, we have it saved, we have to compile again.
Everything is okay, build the execution program, run the program. Click the graphical icon, if we hold down the control button, we can select two things. Now the behavior is more like what we expect, the concentrations are decreasing with time, since these are both reactants and we’re making a polymer.
It might make sense if I hit F12 again and suppose we ran this for a longer time, instead of 10, let’s make it 60. Let’s increase that number of output points, it doesn’t affect the error and number of steps it has to take.
Everything is the same, I should be able to run again, look at the graphical output, plot CS and CB, now we have more data points, we’re getting down to low concentrations for CS. We could certainly go back, hit graph, look at CS concentration and see how much it’s decreasing. This simple example of using Athena allows us to solve differential equations relatively easily.