Python. 3 Computations in Science and Engineering. Matlab post. In this post we derive the equations needed to find the equilibrium composition of a reacting mixture. We use the method of direct minimization of the Gibbs free energy of the reacting mixture. The Gibbs free energy of a mixture is defined as where is the chemical potential of species , and it is temperature and pressure dependent, and is the number of moles of species . We define the chemical potential as , where is the Gibbs energy in a standard state, and is the activity of species if the pressure and temperature are not at standard state conditions. Download the free trial version below to get started. Double-click the downloaded file to install the software.
![]() If a reaction is occurring, then the number of moles of each species are related to each other through the reaction extent and stoichiometric coefficients: . Note that the reaction extent has units of moles. Combining these three equations and expanding the terms leads to. The first term is simply the initial Gibbs free energy that is present before any reaction begins, and it is a constant. It is difficult to evaluate, so we will move it to the left side of the equation in the next step, because it does not matter what its value is since it is a constant. The second term is related to the Gibbs free energy of reaction: . With these observations we rewrite the equation as. Now, we have an equation that allows us to compute the change in Gibbs free energy as a function of the reaction extent, initial number of moles of each species, and the activities of each species. This difference in Gibbs free energy has no natural scale, and depends on the size of the system, i. It is desirable to avoid this, so we now rescale the equation by the total initial moles present, and define a new variable , which is dimensionless. This leads to. where is the initial mole fraction of species present. The mole fractions are intensive properties that do not depend on the system size. Finally, we need to address . For an ideal gas, we know that , where the numerator is the partial pressure of species computed from the mole fraction of species times the total pressure. To get the mole fraction we note. This finally leads us to an equation that we can evaluate as a function of reaction extent. Rawlings and Ekerdt which is further normalized by a factor of . This additional scaling makes the quantities dimensionless, and makes the quantity have a magnitude of order unity, but otherwise has no effect on the shape of the graph. Finally, if we know the initial mole fractions, the initial total pressure, the Gibbs energy of reaction, and the stoichiometric coefficients, we can plot the scaled reacting mixture energy as a function of reaction extent. At equilibrium, this energy will be a minimum. We consider the example in Rawlings and Ekerdt where isobutane (I) reacts with 1- butene (B) to form 2,2,3- trimethylpentane (P). The reaction occurs at a total pressure of 2. K, with equal molar amounts of I and B. The standard Gibbs free energy of reaction at 4. K is - 3. 7. 2 kcal/mol. Compute the equilibrium composition. P = 2. 50. 00. 0 # Pa. P0 = 1. 00. 00. 0 # Pa, approximately 1 atm. T = 4. 00 # KGrxn = - 1. J/molyi. 0 = 0. 5; yb. Gwigglewiggle(extentp). Grxn * extentp. sum_nu_j = np. R * T * x. 1 * np. P / P0). return diffg. There are bounds on how large can be. Recall that , and that . Thus, , and the maximum value that can have is therefore where . When there are multiple species, you need the smallest to avoid getting negative mole numbers. Gwigglewiggle(epsilonp)). Gwigglewiggle'). plt. Runtime. Warning: divide by zero encountered in log. Runtime. Warning: invalid value encountered in multiply. Line. 2D object at 0x. Text object at 0x. Text object at 0x. Now we simply minimize our Gwigglewiggle function. Based on the figure above, the miminum is near 0. Gwigglewiggle, 0. Gwigglewiggle(epsilonp_eq)], 'ro'). Line. 2D object at 0x. To compute equilibrium mole fractions we do this. We can express the equilibrium constant like this : , and compute it with a single line of code. K = np. exp(- Grxn/R/T). K from delta G ',K). K as ratio of mole fractions ',yp / (yi * yb) * P0 / P). P / P0)**nu_j)). K from delta G 1. K as ratio of mole fractions 1. These results are very close, and only disagree because of the default tolerance used in identifying the minimum of our function. You could tighten the tolerances by setting options to the fminbnd function.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |