# Introduction to Chemical Engineering Processes/Problem considerations with molecular balances
## Degree of Freedom Analysis on Reacting Systems

If we have N different molecules in a system, we can write N mass balances or N mole balances, whether a reaction occurs in the system or not. The only difference is that in a reacting system, we have one additional unknown, the molar extent of reaction, for each reaction taking place in the system. Therefore each reaction taking place in a process will add one degree of freedom to the process.

## Complications

Unfortunately, life is not ideal, and even if we want a single reaction to occur to give us only the desired product, this is either impossible or uneconomical compared to dealing with byproducts, side reactions, equilibrium limitations, and other non-idealities.

### Independent and Dependent Reactions

When you have more than one reaction in a system, you need to make sure that they are independent. The idea of independent reactions is similar to the idea of linear independence in mathematics.
Lets consider the following two general parallel competing reactions:
* $aA+bB\rightarrow cC+dD$
* $a_{2}A+b_{2}B\rightarrow e_{2}E$
We can represent each of the reactions by a vector of the coefficients:
* $V=[{\mbox{ A coeff, B coeff, C coeff, D coeff, E coeff}}]$
* $v_{1}=[-a,-b,c,d,0]$
* $v_{2}=[-a_{2},-b_{2},0,0,e_{2}]$
This site
By definition a set of vectors is only linearly independent if the equation:
$K_{1}*v_{1}+K_{2}*v_{2}=0$
where K1 and K2 are constants only has one solution: $K_{1}=K_{2}=0$.
Lets plug in our vectors:
$K_{1}*[-a,-b,c,d,0]+K_{2}*[-a_{2},-b_{2},0,0,e_{2}]=0$
Since all components must add up to 0, the following system follows:
* $-K_{1}*a-K_{2}*a_{2}=0$
* $-K_{1}*b-K_{2}*b_{2}=0$
* $K_{1}*c+0=0$
* $K_{1}*d+0=0$
* $0+K_{2}*e_{2}=0$
Obviously, the last three equations imply that unless c = d = 0 and e2 = 0, $K_{1}=K_{2}=0$ and thus the reactions are independent.

#### Linearly Dependent Reactions

There is one rule to keep in mind whenever you are checking for reaction dependence or independence, which is summarized in the following box.
Therefore, if the following reaction could occur in the same system as the two above:
$(a+a_{2})A+(b+b_{2})B\rightarrow cC+dD+e_{2}E$
then it would not be possible to analyze all three reactions at once, since this reaction is the sum of the first two. Only two can legitimately be analyzed at the same time.
All degree of freedom analyses in this book assume that the reactions are independent. You should check this by inspection or, for a large number of reactions, with numerical methods.

### Extent of Reaction for Multiple Independent Reactions

When you are setting up extent of reaction in a molecular species balance, you must sure that you set up one for each reaction, and include both in your mole balance. So really, your mole balance will look like this:
$\Sigma n_{A,in}-\Sigma {n_{A},out}+\Sigma a_{k}X_{k}=0$
for all k reactions. In such cases it is generally easier, if possible, to use an atom balance instead due to the difficulty of solving such equations.

### Equilibrium Reactions

In many cases (actually, the majority of them), a given reaction will be reversible, meaning that instead of reacting to completion, it will stop at a certain point and not go any farther. How far the reaction goes is dictated by the value of the equilibrium coefficient. Recall from general chemistry that the equilibrium coefficient for the reaction $aA+bB\rightarrow cC+dD$ is defined as follows:
$K={\frac {C_{C,eq}^{c}*C_{D,eq}^{d}}{C_{A,eq}^{a}*C_{B,eq}^{b}}}$
$C_{i}$
Here [A] is the equilibrium concentration of A, usually expressed in molarity for an aqueous solution or partial pressure for a gas. This equation can be remembered as "products over reactants" .
Usually solids and solvents are omitted by convention, since their concentrations stay approximately constant throughout a reaction. For example, in an aqueous solution, if water reacts, it is left out of the equilibrium expression.
Often, we are interested in obtaining the extent of reaction of an equilibrium reaction when it is in equilibrium. In order to do this, first recall that:
$X={\frac {-\Delta n_{A}}{a}}$
and similar for the other species.

#### Liquid-phase Analysis

Rewriting this in terms of molarity (moles per volume) by dividing by volume, we have:
${\frac {X}{V}}={\frac {[A]_{0}-[A]_{f}}{a}}$
Or, since the final state we're interested in is the equilibrium state,
${\frac {X}{V}}={\frac {[A]_{0}-[A]_{eq}}{a}}$
Solving for the desired equilibrium concentration, we obtain the equation for equilibrium concentration of A in terms of conversion:
$[A]_{eq}=[A]_{0}-{\frac {aX}{V}}$
Similar equations can be written for B, C, and D using the definition of extent of reaction. Plugging in all the equations into the expression for K, we obtain:
$K={\frac {([C]_{0}+{\frac {cX}{V}})^{c}([D]_{0}+{\frac {dX}{V}})^{d}}{([A]_{0}-{\frac {aX}{V}})^{a}([B]_{0}-{\frac {bX}{V}})^{b}}}$
At equilibrium for liquid-phase reactions only
Using this equation, knowing the value of K, the reaction stoichiometry, the initial concentrations, and the volume of the system, the equilibrium extent of reaction can be determined.

#### Gas-phase Analysis

By convention, gas-phase equilibrium constants are given in terms of partial pressures which, for ideal gasses, are related to the mole fraction by the equation:
$P_{A}=y_{A}P$
If A, B, C, and D were all gases, then, the equilibrium constant would look like this:
${\frac {P_{C}^{c}P_{D}^{d}}{P_{A}^{a}P_{B}^{b}}}$
In order to write the gas equilibrium constant in terms of extent of reaction, let us assume for the moment that we are dealing with ideal gases. You may recall from general chemistry that for an ideal gas, we can write the ideal gas law for each species just as validly as we can on the whole gas (for a non-ideal gas, this is in general not true). Since this is true, we can say that:
${\frac {n_{A}}{V}}=[A]={\frac {P_{A}}{RT}}$
Plugging this into the equation for ${\frac {X}{V}}$ above, we obtain:
${\frac {aX}{V}}=[A]-[A]_{eq}={\frac {P_{A0}}{RT}}-{\frac {P_{A,eq}}{RT}}$
Therefore,
$P_{a,eq}=P_{A0}-{\frac {aXRT}{V}}$
Similar equations can be written for the other components. Plugging these into the equilibrium constant expression:
$K={\frac {(P_{C0}+{\frac {cXRT}{V}})^{c}(P_{D0}+{\frac {dXRT}{V}})^{d}}{(P_{A0}-{\frac {aXRT}{V}})^{a}(P_{B0}-{\frac {bXRT}{V}})^{b}}}$
Gas Phase Ideal-Gas Equilibrium Reaction at Equilibrium
Again, if we know we are at equilibrium and we know the equilibrium coefficient (which can often be found in standard tables) we can calculate the extent of reaction.

### Special Notes about Gas Reactions

You need to remember that In a constant-volume, isothermal gas reaction, the total pressure will change as the reaction goes on, unless the same number of moles are created as produced. In order to show that this is true, you only need to write the ideal gas law for the total amount of gas, and realize that the total number of moles in the system changes.
This is why we don't want to use total pressure in the above equations for K, we want to use partial pressures, which we can conveniently write in terms of extent of reaction.

### Inert Species

Notice that all of the above equilibrium equations depend on concentration of the substance, in one form or another. Therefore, if there are species present that don't react, they may still have an effect on the equilibrium because they will decrease the concentrations of the reactants and products. Just make sure you take them into account when you're calculating the concentrations or partial pressures of each species in preparation for plugging into the equilibrium constant.

## Example Reactor Solution using Extent of Reaction and the DOF

Example:
Consider the reaction of Phosphene with oxygen: $4PH_{3}+8O_{2}\rightarrow P_{4}O_{10}+6H_{2}O$
Suppose a 100-kg mixture of 50% $PH_{3}$ and 50% $O_{2}$ by mass enters a reactor in a single stream, and the single exit stream contains 25% $O_{2}$ by mass. Assume that all the reduction in oxygen occurs due to the reaction. How many degrees of freedom does this problem have? If possible, determine mass composition of all the products.
It always helps to draw a flowchart:
There are four independent unknowns: the total mass (mole) flowrate out of the reactor, the concentrations of two of the exiting species (once they are known, the forth can be calculated), and the extent of reaction.
Additionally, we can write four independent equations, one on each reacting substance. Hence, there are 0 DOF and this problem can be solved.
Let's illustrate how to do it for this relatively simple system, which illustrates some very important things to keep in mind.
First, recall that total mass is conserved even in a reacting system. Therefore, we can write that:
${\dot {m}}_{out}={\dot {m}}_{in}=100{\mbox{ kg}}$
Now, since component masses aren't conserved, we need to convert as much as we can into moles so we can apply the extent of reaction.
${\dot {n}}_{PH_{3},in}=0.5*(100{\mbox{ kg}})*{\frac {1{\mbox{ mol}}}{0.034{\mbox{ kg}}}}=1470.6{\mbox{ moles PH}}_{3}{\mbox{ in}}$ ${\dot {n}}_{O_{2},in}=0.5*(100{\mbox{ kg}})*{\frac {1{\mbox{ mol}}}{0.032{\mbox{ kg}}}}=1562.5{\mbox{ moles O}}_{2}{\mbox{ in}}$
${\dot {n}}_{O_{2},out}=0.25*(100{\mbox{ kg}})*{\frac {1{\mbox{ mol}}}{0.032{\mbox{ kg}}}}=781.25{\mbox{ moles O}}_{2}{\mbox{ out}}$
Let's use the mole balance on oxygen to find the extent of reaction, since we know how much enters and how much leaves. Recall that:
$\Sigma {\dot {n}}_{A,in}-\Sigma {\dot {n}}_{A,out}-a*X=0$
where a is the stoichiometric coefficient for A. Plugging in known values, including a = 8 (from the reaction written above), we have:
$1562.5-781.25-8X=0$
Solving gives:
$X=97.66{\mbox{ moles}}$
Now let's apply the mole balances to the other species to find how much of them is present:
* $PH_{3}:1470.6-{\dot {n}}_{PH_{3},out}-4(97.66)=0\rightarrow {\dot {n}}_{PH_{3},out}=1080.0{\mbox{ moles PH}}_{3}$
* $P_{4}H_{1}0:0-{\dot {n}}_{P_{4}O_{10},out}+1(97.66)=0\rightarrow {\dot {n}}_{P_{4}H_{1}0,out}=97.66{\mbox{ moles P}}_{4}O_{10}$ (note it's + instead of - because it's being generated rather than consumed by the reaction)
* $H_{2}O:0-{\dot {n}}_{H_{2}O,out}+6(97.66)=0\rightarrow {\dot {n}}_{H_{2}O,out}=586.0{\mbox{ moles H}}_{2}O$
Finally, the last step we need to do is find the mass of all of these, and divide by the total mass to obtain the mass percents. As a sanity check, all of these plus 25 kg of oxygen should yield 100 kg total.
* Mass $PH_{3}$ out = 1080 moles * 0.034 kg\mole = 36.72 kg
* Mass $P_{4}O_{10}$ out = 97.66 moles * .284 kg\mole = 27.74 kg
* Mass $H_{2}O$ out = 586 moles * 0.018 kg\mole = 10.55 kg
Sanity check: 36,72 + 27.74 + 10.55 + 25 (oxygen) = 100 kg (total), so we're still sane.
Hence, we get:
$36.72\%PH_{3},27.74\%P_{4}H_{10},10.55\%H_{2}O,25\%O_{2}$

## Example Reactor with Equilibrium

Example:
Suppose that you are working in an organic chemistry lab in which 10 kg of compound A is added to 100 kg of a 16% aqueous solution of B (which has a density of 57 lb/ft^3) The following reaction occurs:
$A+2B\leftarrow \rightarrow 3C+D$
A has a molar mass of 25 g/mol and B has a molar mass of 47 g/mol. If the equilibrium constant for this reaction is 187 at 298K, how much of compound C could you obtain from this reaction? Assume that all products and reactants are soluble in water at the design conditions. Adding 10 kg of A to the solution causes the volume to increase by 5 L. Assume that the volume does not change over the course of the reaction.
Solution: First, draw a flowchart of what we're given.
Since all of the species are dissolved in water, we should write the equilibrium constant in terms of molarity:
$K=187={\frac {[C]^{3}[D]}{[A][B]^{2}}}$
We use initial molarities of A and B, while we are given mass percents, so we need to convert.
Let's first find the number of moles of A and B we have initially:
$n_{A0}=10{\mbox{ kg A}}*{\frac {1{\mbox{ mol A}}}{0.025{\mbox{ kg A}}}}=400{\mbox{ mol A}}$
$n_{B0}=100{\mbox{ kg solution}}*{\frac {0.16{\mbox{ kg B}}}{\mbox{kg sln}}}=16{\mbox{ kg B}}*{\frac {1{\mbox{mol B}}}{\mbox{ 0.047 kg B}}}=340.43{\mbox{ mol B}}$
Now, the volume contributed by the 100kg of 16% B solution is:
$V={\frac {m}{\rho }}={\frac {100{\mbox{ kg}}}{57{\frac {lb}{ft^{3}}}*{\frac {1{\mbox{ kg}}}{2.2{\mbox{ lb}}}}*{\frac {1{\mbox{ ft}}^{3}}{28.317{\mbox{ L}}}}}}=109.3{\mbox{ L}}$
Since adding the A contributes 5L to the volume, the volume after the two are mixed is $109.3{\mbox{ L}}+5{\mbox{ L}}=114.3{\mbox{ L}}$.
By definition then, the molarities of A and B before the reaction occurs are:
* $[A]_{0}={\frac {400{\mbox{ moles A}}}{114.3{\mbox{ L}}}}=3.500M$
* $[B]_{0}={\frac {340.42{\mbox{ moles B}}}{114.3{\mbox{ L}}}}=2.978M$
In addition, there is no C or D in the solution initially:
* $[C]_{0}=[D]_{0}=0$
According to the stoichiometry of the reaction, $a=1,b=2,c=3,d=1$. Therefore we now have enough information to solve for the conversion. Plugging all the known values into the equilibrium equation for liquids, the following equation is obtained:
$187={\frac {({\frac {3X}{114.3}})^{3}({\frac {X}{114.3}})}{(3.5-{\frac {X}{114.3}})(2.978-{\frac {2X}{114.3}})^{2}}}$
This equation can be solved using Goalseek or one of the numerical methods in appendix 1 to give:
$X=146.31{\mbox{ moles}}$
Since we seek the amount of compound C that is produced, we have:
* $X={\frac {\Delta n_{C}}{c}}$
* Since $c=3,n_{C0}=0,{\mbox{ and }}X=146.31$, this yields $n_{C}=3*146.31=438.93{\mbox{ moles C}}$