>> Here we're given temperature and pressure, and we start with a mole methane, a mole water.
And then, we let the system go to equilibrium.
And which equilibrium we reach depends
on whcih molecules we consider to be involved in reactions.
Here we're going to assume carbon monoxide, carbon dioxide, and hydrogen can form.
And we want to use the temperature-dependent heat capacities to calculate heats of reaction
and then calculate Gibbs free energy of, in this case,
formation of each of these species as a function of temperature.
So there's two ways you can solve this type of problem.
One, you can write down two reactions.
So let me just write them down.
And if you were to use this approach, we would have an extent of reaction for each reaction.
And we set the equilibrium constant equal to fugacities ratios, or for ideal gases,
which is what we're assuming here, partial pressures.
And when we have more than one reaction, it gets messier, if you like, more difficult.
The other approach is to minimize the Gibbs free energy and not specify which reactions occur,
but just specify which species can form.
Now, this approach was demonstrated in another screencast
for just the second reaction here, the water-gas shift reaction.
And what I want to do here is show how we do this when we have more than one reaction.
By the fact, we compared to water-gas shift, we have one more species --
namely, methane -- that can form.
And what we're going to do is minimize the Gibbs free energy, the total Gibbs free energy.
So the number of moles times Gibbs free energy per mole for this mixture,
which is the sum of the moles of each species times their partial molar Gibbs free energy.
And that is equal to the [inaudible] Gibbs free energy of formation of each species.
And then, RT log of the mole fraction times the pressure.
We can write it this way because we're assuming ideal gases.
And fugacities just become partial pressures.
So this is what we want to minimize.
We have to account for the fact that the number of carbon atoms and moles of carbon,
if you like, moles of oxygen and hydrogen change, so we're going to have a constraint.
We're going to use spreadsheet and solver to do the minimization with the constraint
that the number of carbon atoms coming
into our reactor is the number of carbon atoms coming out.
And likewise, the same for the other two atoms.
So when we use solver, we'll use the constraint option to select these.
We also will check the box that says Make All Constraint Variable Non-Negative.
So in the solver, there's a box, and we're doing
that because we want the number of moles of these species.
That's what we're going to be solving for.
In other words, we're going to say, how do we vary the number of moles at equilibrium in order
to minimize this Gibbs free energy?
Well, let me show you the result.
We run that minimization in spreadsheet, then I'll briefly show the spreadsheet.
So here are the equilibrium solutions.
We calculate the number of moles at equilibrium.
Remember, we start with one mole of methane, one mole of water.
So this column is the number of moles at equilibrium.
This is the mole fraction.
The total number of moles is almost three for these particular conditions.
And then, what I've done just too as a check on this spreadsheet,
I compared to an online calculator.
And the reference to this is given in the spreadsheet.
To see if we're getting pretty similar values.
Indeed, they differ most about three percent or so, and that difference is exactly
which heat capacity term we'd use to try
and represent the heat capacity over this temperature range.
It's going to give us slightly different answers.
And so this confirms that, indeed, spreadsheet is doing what we think it's doing.
Let's look at the spreadsheet briefly.
So here is a copy of part of the spreadsheet.
This column, we enter our starting number of moles.
These are the values that we adjust with solver in order to minimize the Gibbs free energy.
Notice we're minimizing nG divided by RT.
That's pretty arbitrary, but we decided that's convenient in making it dimensionless.
And we calculate, as I showed, each of the partial molar Gibbs free energy that add
up to give us that total Gibbs free energy.
Over here are the constraints -- number of moles of carbon coming in, hydrogen, oxygen.
And then, indeed, we set that difference, which is here, as constraints in solver.
And indeed, we get very close to zero using solver.
The rest of the spreadsheet has the heat capacity data.
The heats of formation, therefore,
calculates these Gibbs free energy formation at the temperature 950 Kelvin.
So the big advantage of using this Gibbs free energy minimization is
that we can do the calculation.
We have five reactions.
We add two more species.
The calculation doesn't become more complicated.
We just have another value or two that we add to the Gibbs free energy.
And if we have other elements, we add those also.
And we use the exact same approach,
whereas we get more reactions solving those equilibrium expressions with multiple extents
of reactions gets much more complicated.