JOHN: I'm gonna demonstrate how
we can use the spreadsheet to solve
ordinary differential equations for mass balances
for a plug flow reactor, so we're looking at a reaction
of A plus B goes to products
gas phase reaction and given a rate expression.
So Langmuir Hinshelwood type rate expression
for a catalytic reaction.
And the mass balances are written in terms of
the molar flow rate.
So FA is a molar flow rate.
And the rate that A is used up is the same
rate that B is used up.
So two equations are almost identical.
I've written now the mass balances
in terms of volumetric flow rate
and concentration because there's no mole change,
there's no temperature change for an isothermal reactor.
So there's no volumetric flow rate change
makes the equation a little easier to solve,
we certainly would not have to do it this way,
we could do it instead in terms of molar flow rates
and use ideal gas law,
like account for the volumetric flow rate change,
but we wanna simplify it as much as possible.
So we can see how to solve
the differential equations in Excel.
So I've indicated on the left the values of constants,
use the ideal gas law,
to relate the concentration inlet CA zero
in terms of the mole fraction entering
and the pressure over the gas constant and temperature.
Now the approach to solve these is to step along,
take small steps and calculate the difference,
the differential as a difference.
And so we're gonna calculate the concentration
and step in plus one as the concentration
as a previous step,
plus this term that has K one,
K two, K three and K four in it.
And K one, K two, K three and K four
are shown here.
These are there Runge-Kutta terms for fourth order.
And this really works quite well in Excel.
One constraint is we're using a fixed step size.
And because of this, if the equations through stiff,
we would not be able to solve them this way.
But for a large number problems, this works quite well.
So what I've done in the spreadsheet
is input some information, so
I won't have to type it during the screencast.
But let me point out a couple things.
So I've listed
the various parameters.
And then I've listed their value on the right,
using a step size of 0.05
and a volume of 20,
I've yet listed the units also it's a good practice
to get into to make it easy
when you look at the spreadsheet the later time.
And then the output is going to be here.
So when we finish the solution,
the answers I've set have to appear here.
And then on the right is the approach we're going to use.
So at the beginning the inlet of the reactor
where volume zero,
CB and CB, are CA zero and CB zero values we calculate here.
So I put them in
to these cells and then the idea's
our first step, we're gonna calculate a new CA based on
CA zero and a new CB based on CB zero.
And then we're gonna step along.
So you notice I put down a couple steps.
What I wanna do now is just
I'll stop,
I'm gonna do this all the way up until we get to 20.
So let me pause and do that.
So you can see I stopped when the volume is 20
it's cell four...
In 406.
Let's go back.
So what I've typed in K one
is the equation.
Let's go back and look at it the equation here.
So K one for that first cell for K one
is gonna be K times CA zero CB zero
divided by again terms in terms of CA and CB zero.
So if you look at the equation,
and notice I've named the cells
so let me go back and point out what I've done here,
each of these cells, like the value is two for pressure,
but notice the name is up here for pressure.
And I've named all of them by selecting
the two columns going to formulas.
Create from selection,
and then I've selected click the left column.
I won't this again, since I've already done it,
if I click Okay then it named each of these cells.
So it named this one CA zero.
And then that makes it easier in my calculation,
you'll notice I have up here in the formula,
I have K,
KA, KB and V zero,
and then S six is
the concentration of A
and T six the concentration B at the inlet,
well, then I've entered likewise,
for K two the formula that's in the yellow area on the left,
and K three and K four.
And then I can calculate concentration of A,
and I'm calculating it by using the formula,
CA n plus one and CA n plus K one
plus two K two etc,
where when I calculate CA one,
I use CA zero value that I know so I'm always
calculating based on the value that I know
at the beginning of the step,
so here's CA
is S six CA zero plus the
K terms
times the step size, divided by six.
And likewise for CB.
Well then what I've done
to solve the differential equation is just copy.
So I can just copy this.
Again, I won't do this while you're watching screens,
I'll copy this all the way down to
the volume of 20 cubic centimeter,
so let me pause and do that.
And so the values for CA and CB in yellow,
am gonna step through to 20 cubic centimeters.
Those are the values am interest in those would be the exit
concentrations from the plug flow reactor.
Well on the spreadsheet, they're also calculated here.
Now of course, I can change the flow rate,
and it gives me new values
solves the differential equation.
Let's go back to our original value.
Or I could create a data table and
data table are described elsewhere
to calculate these exit concentration,
a bunch of flow rates,
but the idea is using Excel we can relatively easily
solve these ordinary differential equations
for a plug flow reactor.