>> In a separate screencast, I described how to solve this chemical equilibrium problem
where we have more than one reaction taking place.
You solve it using Gibbs minimization.
And what I want to discuss here is the spreadsheet that we use for this calculation.
The spreadsheet is available on LearnChemE.com.
And so let's -- I'm going to pause and switch over to the spreadsheet.
So I point out the spreadsheet tries to give details on how to use it,
so notice the input values are in green.
We input the temperature and the pressure on the left side here.
And we input the number of moles that are involved in the reaction.
In this case, one mole water and one mole methane.
And then, we make guesses.
So let's do that because right now I'm showing the answer.
But let me pause and put in guesses.
So I've guessed that the outlet number of moles is one for each of the five components.
And therefore, we calculate the mole fractions, and we use these mole fractions as well
as the number of moles in calculating the Gibbs free energy, the total Gibbs free energy
for the mixture as a sum of the partial molar Gibbs free energy.
This value, -101.15, is what we're going to minimize using solver.
And we minimize it with the constraints that are shown here, namely that the number
of carbon atoms that are coming in, which, because we have one mole of methane,
is one mole of carbon atoms, one mole of water, one mole of oxygen atoms.
And because one mole of water plus one mole of methane is six moles of hydrogen atoms,
the constraints that we enter in the solver is
that carbon atoms leaving should be equal to carbon atoms entering.
Likewise for hydrogen and oxygen.
So this is the difference.
This is what we want to get as close to zero as possible when we solve
to minimize the Gibbs free energy.
So the spreadsheet has, as you see on the right, details explaining how to use the spreadsheet.
It lists the formation reactions.
What's below are the heat capacity values, the delta Gs, and the delta Hs that are used
to calculate these change in Gibbs free energy at standard conditions
but at the temperature of interest.
So if I now go to Data, pick Solver, now, I've already entered the value that I want
to minimize, minimizing the Gibbs free energy, the total Gibbs free energy.
And I'm doing it by changing these five cells for the moles leaving.
And subject to the three constraints --
the three constraints are the number of carbon atoms coming in and leaving has to be the same,
and the same for hydrogen and oxygen.
And then, I check this box here to make the only constraint variables non-negative.
In other words, I want a solution where the number of moles is positive.
That's the only physically meaningful --
so if I hit Solve, you'll notice it says it encountered an error.
So let's look at what happens.
It gives a negative value, and that's an error because we said that positive.
And so this can happen depending on what our initial conditions are.
If I now -- let's try .5.
So I just changed this to .5 and make this my new initial guess,
and just repeat this procedure for solver, now it found the solution.
And, indeed, this is the correct solution.
So which values we pick for our starting conditions definitely affect whether we're going
to reach the solution.
But I found that usually it's the CO2 that ends up being negative
if I pick a bad starting condition.
So I pick good starting conditions, it approaches this solution in one iteration.
But using solver a second time seems to be very effective at arising at a solution.
So you can see the spreadsheet contains the equations used.
Here is the total Gibbs free energy we're calculating, the, of course, the atom balances,
the heat of formation, which includes heat capacity terms and the Gibbs free energy
of formation, both being calculated as the function of temperature.
And then, here I've copied the solution, number of moles out the mole fraction,
and then I've listed the mole fraction from this website, a chemical equilibrium calculator.
And you'll notice the numbers are pretty close, so a few percent difference.
And this corresponds to which values of heat capacity are used.
The spreadsheet uses values from a textbook.
Depending on which value since they differ from one location to another in source,
we're going to get slightly different results, particularly when we're doing this integration
of the heat capacities over y temperature range from 298 to 950, in this case.
And that's why these small differences exist.
So the big advantage of the spreadsheet where we're doing Gibbs energy minimization instead
of using extensive reactions, we can now add another component, say methanol,
use the same approach, add in heat capacity values and heats of formation at 298,
heat reaction 298, to calculate the changing Gibbs free energy at standard conditions.
And then, make guesses for initial number of moles
of methanol and calculate the mole fraction.
And include now this minimization, the value for Gibbs free energy,
the partial molar Gibbs free energy for methanol.
Then, it can solve where now we're considering essentially three reactions that can take place,
but we don't have to know the specific reactions.
We're just going to add in the component.
In a physical situation, what this means is if we have a different catalyst,
we have different species that can form.
So if I put in methanol, then I'm going to get some mole fraction of methanol,
but I can ignore that in many reactors because methanol doesn't form
because we don't have an appropriate catalyst to form it.