Written midterm - Solution

From Process Model Formulation and Solution

Jump to: navigation, search
Date: 18 October 2010
Nuvola mimetypes pdf.png (PDF) Questions
Nuvola mimetypes pdf.png (PDF) Solutions by Ali, Elliot and Kevin

Special instructions

Question 1 [11]

Consider the following 3 reactions taking place in a liquid-based system: a continuously stirred tank reactor (CSTR).

  • \({\sf A} \stackrel{r_1}{\rightarrow} {\sf 2B}\), where \(r_1 = k_1 C_{\sf A}\)
  • \({\sf A} \displaystyle \mathop{\rightleftharpoons}_{r_3}^{r_2} {\sf C}\), where \(r_2=k_2 C_{\sf A}^{1.5}\) and \(r_3 = k_3 C_{\sf C}^2\)
  • \({\sf 2B} \stackrel{r_4}{\rightarrow} {\sf 3D + C}\), where \(r_4 = k_4 C_{\sf B}^2\)

Derive the equations that can be solved for the steady state concentrations of \(\sf A, B, C\) and \(\sf D\). You may assume that species \(\sf A\) is fed to the reactor in a single stream, flowing in at \(Q \text{m}^3/\text{s}\), with a concentration of \(C_{\sf A}^{\text{in}}\). Please state all other assumptions that you make while answering the question.

Note: please do not simplify your equations.

Solution

ASSUMPTIONS AND DIAGRAM [3 marks]

  • 1 mark for a proper diagram
  • 1 mark for each strong assumption
  • Additional assumptions may offset lack of diagram
  • Marks were removed for poor or incorrect assumptions on a case by case basis

A diagram of the process is provided below:

../_images/MidTerm_Q11545.png

The following is a list of appropriate assumptions for performing the required mass balances:

  • The reactor is operating at a constant volume (i.e. \(Q_{in} = Q_{out} = Q\))
  • Mixture physical properties are constant and temperature independent
  • Reactor is perfectly mixed
  • Reactor is sealed (i.e. no vapour losses)

BALANCES [8 marks = 2 marks each]

  • Marks removed for incomplete or incorrect balances

  • All 4 mol balances start from this relationship:

    \[\displaystyle \frac{dn_{i}}{dt} = \sum(n_{i,in}) - \sum(n_{i,\text{out}}) + \text{Generation} - \text{Consumption}\]

Balance on A

\[\begin{split}\begin{array}{rl} \displaystyle \frac{d(V C_{\sf A})}{dt} &= Q C_{\sf A,in} - Q C_{\sf A} + (V k_{3} C_{\sf C}^{2}) - (V k_{1} C_{\sf A} + V k_{2} C_{\sf A}^{1.5}) \\ \\ \displaystyle \frac{d C_{\sf A}}{dt} &= \frac{Q}{V}(C_{\sf A,in} - C_{\sf A}) + k_{3} C_{\sf C}^{2} - k_{1} C_{\sf A} - k_{2} C_{\sf A}^{1.5} \\ \\ \displaystyle (0) &= \frac{Q}{V}(C_{\sf A,in} - C_{\sf A}) + k_{3} C_{\sf C}^{2} - k_{1} C_{\sf A} - k_{2} C_{\sf A}^{1.5}\end{array}\end{split}\]
\[\]

Balance on B

\[\begin{split}\begin{array}{rl} \displaystyle \frac{d(V C_{\sf B})}{dt} &= (0) - Q C_{\sf B} + (V 2 k_{1} C_{\sf A}) - (V 2 k_{4} C_{\sf B}^{2}) \\ \\ \displaystyle \frac{d C_{\sf B}}{dt} &= - \frac{Q}{V} C_{\sf B} + 2 k_{1} C_{\sf A} - 2 k_{4} C_{\sf B}^{2} \\ \\ \displaystyle (0) &= - \frac{Q}{V} C_{\sf B} + 2 k_{1} C_{\sf A} - 2 k_{4} C_{\sf B}^{2}\end{array}\end{split}\]

Balance on C

\[\begin{split}\begin{array}{rl} \displaystyle \frac{d(V C_{\sf C})}{dt} &= (0) - Q C_{\sf C} + (V k_{2} C_{\sf A}^{1.5} + V k_{4} C_{\sf B}^{2}) - (V k_{3} C_{\sf C}^{2}) \\ \\ \displaystyle \frac{d C_{\sf C}}{dt} &= - \frac{Q}{V} C_{\sf C} + k_{2} C_{\sf A}^{1.5} + k_{4} C_{\sf B}^{2} - k_{3} C_{\sf C}^{2} \\ \\ \displaystyle (0) &= - \frac{Q}{V} C_{\sf C} + k_{2} C_{\sf A}^{1.5} + k_{4} C_{\sf B}^{2} - k_{3} C_{\sf C}^{2}\end{array}\end{split}\]

Balance on D

\[\begin{split}\begin{array}{rl} \displaystyle \frac{d(V C_{\sf D})}{dt} &= (0) - Q C_{\sf D} + (V 3 k_{4} C_{\sf B}^{2}) - (0) \\ \\ \displaystyle \frac{d C_{\sf C}}{dt} &= - \frac{Q}{V} C_{\sf D} + V 3 k_{4} C_{\sf B}^{2} \\ \\ \displaystyle (0) &= - \frac{Q}{V} C_{\sf D} + 3 k_{4} C_{\sf B}^{2}\end{array}\end{split}\]

Question 2 [5]

Consider the system in question 1 again, but modified now to be a semi-batch system - material only enters the reactor, but nothing leaves. Continue on from question 1, using any equations derived there and any assumptions stated there, and derive the dynamic balances only for species \(C_{\sf A}\) and \(C_{\sf D}\).

Solution

BALANCES [5 marks = 2.5 marks each]

  • Since the majority of the equation derivation for this question was taken from Question 1 marking was much harsher for missing the key differences that made this question distinct
  • 1 mark for each equation was removed (i.e. resulting in a 3/5 all else considered) if no acknowledgment was made that volume is no longer constant. This included either not writing this fact explicitly or writing the V term outside of the concentration derivative without performing proper chain rule expansion
  • 1 mark for each equation was removed (i.e. resulting in a 3/5 all else considered) if the outlet terms were not removed
  • Additional marks were lost for general errors made in the model derivation

To change the system to a semi-batch model we need to remove the outlet terms and account for the changes in volume. In other words, the volume is now a function of time, and cannot simply be removed from the derivative: in the equations below use the fact that \(V = V(t)\)

Overall balance

\[\begin{split}\begin{array}{rl} \displaystyle \frac{dM}{dt} = \sum(M_{in}) - \sum(M_{out}) = \displaystyle \frac{d(\rho V)}{dt} &= \rho Q_{in} - (0) \\ \displaystyle \frac{dV}{dt} &= Q_{in} = Q\end{array}\end{split}\]
\[\]

Balance on A

\[\begin{split}\begin{array}{rl} \displaystyle \frac{dn_{\sf A}}{dt} &= \sum(n_{A,in}) - \sum(n_{A,\text{out}}) + \text{Generation} - \text{Consumption} \\ \\ \displaystyle \frac{d(V C_{\sf A})}{dt} &= Q C_{\sf A,in} - (0) + (V k_{3} C_{\sf C}^{2}) - (V k_{1} C_{\sf A} + V k_{2} C_{\sf A}^{1.5}) \\ \\ \displaystyle V\frac{dC_{\sf A}}{dt} + C_{\sf A}\frac{dV}{dt} &= Q C_{\sf A,in} + V k_{3} C_{\sf C}^{2} - V k_{1} C_{\sf A} - V k_{2} C_{\sf A}^{1.5} \\ \\ \displaystyle V\frac{dC_{\sf A}}{dt} + (Q) C_{\sf A} &= Q C_{\sf A,in} + V k_{3} C_{\sf C}^{2} - V k_{1} C_{\sf A} - V k_{2} C_{\sf A}^{1.5} \\ \\ \displaystyle \frac{dC_{\sf A}}{dt} &= \frac{Q}{V}(C_{\sf A,in}-C_{\sf A}) + k_{3} C_{\sf C}^{2} - k_{1} C_{\sf A} - k_{2} C_{\sf A}^{1.5}\end{array}\end{split}\]

Balance on D

\[\begin{split}\begin{array}{rl} \displaystyle \frac{dn_{\sf D}}{dt} &= \sum(n_{D,in}) - \sum(n_{D,\text{out}}) + \text{Generation} - \text{Consumption} \\ \\ \displaystyle \frac{d(V C_{\sf D})}{dt} &= (0) - (0) + (V 3 k_{4} C_{\sf B}^{2}) - (0) \\ \\ \displaystyle V\frac{dC_{\sf D}}{dt} + C_{\sf D}\frac{dV}{dt} &= V 3 k_{4} C_{\sf B}^{2} \\ \\ \displaystyle V\frac{dC_{\sf D}}{dt} + (Q) C_{\sf D} &= V 3 k_{4} C_{\sf B}^{2} \\ \\ \displaystyle \frac{dC_{\sf D}}{dt} &= - \frac{Q}{V} C_{\sf D} + 3 k_{4} C_{\sf B}^{2}\end{array}\end{split}\]

Question 3 [2]

Represent the decimal number, -1.0, in an 8-bit word that uses 1 bit for the sign, 3 bits for the signed exponent and the remaining bits for the significand. Normalization must be used for the significand and only zero or one entries can used in each bit position.

Solution

  • 0.5 was awarded for getting the sign bit correct
  • 0.75 was awarded for getting the exponent bits correct
  • 0.75 was awarded for getting the mantissa bits correct
  • In the case where the logic was correctly explained but the value was not normalized, 1.5 points were awarded
  • In a few cases it was noticed that the logic was correct and the normalization was correct but the exponents were written backwards (i.e. in the form "sign, \(2^{0}\), \(2^{1}\)" as opposed to the correct form "sign, \(2^{1}\), \(2^{0}\)"). This was likely the fault of the TA, who gave an incorrect explanation of how the exponents should be written in one of the tutorials. In these specific instances where it was obvious this had happened, full marks were awarded and an explanation of the error was given

Normalization requires that the mantissa have a magnitude between 1 and 1/b (i.e. the first bit is equal to 1). To convert -1.0 to a normalized 8-bit binary number with a 1-bit sign, 3-bit exponent, and 4-bit mantissa we must first realize that \(-1.0 = -2^{0}\). This means that -1.0 is directly representable in binary form. To ensure the mantissa is normalized we simply shift the exponent over by 1 value. This is the same as saying \(-1.0 = -2^{1}2^{-1}\). The second term is 0.5, which is a value between 1 and 1/2 = 0.5. Therefore if we take the term \(2^{1}\) as the exponent term and \(2^{-1}\) as the mantissa then the 8-bit representation of -1.0 is:

\[\underbrace{1}_{\text{sign}}\underbrace{001}_{\text{exponent}}\underbrace{1000}_{\text{mantissa}}\]

Question 4 [4 = 2 + 1 + 1]

4.1 A linearized system of equations, \(Ax = b\), has been constructed for a very high accuracy model of a distillation column. There are at most 12,000 equations in the system. What is the size, in megabytes, required to store \(A\) at double precision?

4.2 Can this matrix be stored in 1 gigabyte of RAM?

4.3 The matrix \(A\) is sparse (i.e. consists mostly of zeros). The number of non-zero elements is about 16,000. How much RAM, in megabytes, would be required to only store the non-zero entries?

Solution

4.1 Having 12,000 equations implies that there are also 12,000 unknowns in the system. The linear system will then have \(12000 \times 12000\) coefficients to be stored in the matrix \(A\). Because we work in double precision, each coefficient (entry) requires 8 bytes (or 64 bits) of memory. Given the conversion factor of 1024 to convert from bytes to kilobytes and also from kilobytes to megabytes, the total memory is obtained as follows:

\(12000 \times 12000 \times 8 \frac{\text{bytes}}{\text{entry}} \times \frac{\text{kilobyte}}{1024 \,\text{bytes}} \times \frac{\text{megabyte}}{1024 \,\text{kilobytes}}\) = 1098.6 megabytes.

4.2 No, the matrix cannot be stored in 1 gigabyte of RAM, since 1 gigabyte of RAM is 1024 Mb.

4.3 Now We only store the 16,000 non-zero entries instead of the entire \(12000 \times 12000\) entries: \(16000 \times 8 \frac{\text{bytes}}{\text{entry}} \times \frac{\text{kilobyte}}{1024 \,\text{bytes}} \times \frac{\text{megabyte}}{1024\, \text{kilobytes}}\) = 0.122 megabytes. It is interesting to see that a much smaller RAM is required in this case.

Aside: Of course we would need to store indicies corresponding to the non-zero entries as well to fully reconstruct \(A\), but that look-up table would still require much less storage than 1099 Mb required from part 4.1.

Good to know: Sparse matrices occur frequently in engineering applications (why? consider the tray column examples you have solved before). In linear algebra, there are a variaty of techniques that take advantage of the sparsity to imporve the efficiency and storage requirements of solving large engineering problems.

Question 5 [11 = 2 + 2 + 2 + 5]

This questions considers a simple model of a 3-stage absorber (a similar model was used in assignment 2 in the course, but it is not exactly the same as the model used here).

An illustration of the system, and the steady-state equations for system can be shown to be:

../_images/absorber-column-midterm1545.png

\[\begin{split}y_F &= 0.5\\\frac{1}{\beta} y_F - (\delta+1)x_1 + \delta x_2 &= 0 \\x_1 - (\delta+1)x_2 + \delta x_3 &= 0 \\x_2 - (\delta+1)x_3 + \delta x_F &= 0 \\x_F &= 0.1\end{split}\]

where \(\beta\) is a coefficient, assumed constant throughout the absorber tower, that relates the liquid phase composition, \(x_n\), to the gas-phase composition, \(y_n = \beta x_n\), assuming of course that equilibrium is achieved in each stage.

The \(\delta\) coefficient is a dimensionless number defined as a function of the molar gas and liquid flows in the column, and \(\beta\), so that \(\delta = \displaystyle \frac{L}{G \beta}\)

5.1 Write the given steady-state equations in the form \(A{\bf x} = b\) where \({\bf x} = \left[y_F, x_1, x_2, x_3, x_F\right]\). Report the \(A\) matrix and \(b\) vector.

5.2 What condition(s) must be satisfied so that matrix \(A\) is diagonally dominant?

5.3 You decide to use the Gauss-Seidel method to solve this system of equations. Also, you are given that \(L/G = 1.5\), and \(\beta = 0.8\). Is this method guaranteed to converge for these coefficient values?

5.4 Perform one iteration of the Gauss-Seidel method, starting from a suitable initial guess that you believe will converge in fewer iterations than simply using the default guess of \({\bf x} = \left[y_F, x_1, x_2, x_3, x_F\right] = [0, 0, 0, 0, 0]\). Use \(L/G = 1.5\), and \(\beta = 0.8\) in your matrix, and briefly explain your choice for the initial guess.

Solution

5.1

\[\begin{split}A = \left(\begin{array}{ccccc} 1 & 0 & 0 & 0 & 0\\ \displaystyle \frac{1}{\beta} & -(\delta+1) & \delta & 0 & 0\\ 0 & 1 & -(\delta+1) & \delta & 0\\ 0 & 0 & 1 & -(\delta+1) & \delta\\ 0 & 0 & 0 & 0 & 1\\\end{array}\right) \hspace{2cm}b = \left(\begin{array}{c} 0.5\\ 0\\ 0\\ 0\\ 0.1 \end{array}\right)\end{split}\]

5.2 Rows 1 and 5 already meet the criteria for diagonal dominance. Rows 3 and 4 meet the first criterion for diagonal dominance, in that \(\| \delta + 1 \| \geq \| \delta + 1 \|\). However row 2 must satisfy the criterion that \(\| \delta + 1 \| \geq \| \frac{1}{\beta} + \delta \|\) which simplifies to \(\beta \geq 1\) (using the fact that \(\delta\) and \(\beta\) are guaranteed to always be positive quantities: why?). So the only criterion required for diagonal dominance for this system is that \(\beta \geq 1\).

5.3 Both the Gauss-Seidel method, and Jacobi method are guaranteed to converge if the system is diagonally dominant. Since \(\beta < 1.0\) in our case, the system is not diagonally dominant, as shown in the previous question. However, it might still converge, since diagonal dominance is only a sufficient criterion.

5.4

[2 points for initial guess (IG)]

[3 pts for calculations]

A good initial guess is any guess where the \(x\)-values have concentrations between the feed and exit conditions. In this system the entry concentration of impurity in the liquid phase is 0.1. The impurity is being transferred from the gas to the liquid phase, so the liquid leaving each tray should have an increasing quantity of impurity, or mathematically: \(x_F = 0.1 < x_3 < x_2 < x_1\). The upper bound on these concentrations is expected to be \(y_F = 0.5\), although depending on the VLE, it could be higher, but unlikely.

Initial guesses for \(y_F = 0.5\) and \(x_F = 0.1\) must be used, because they are set from the initial conditions given in the problem statement.

So a good guess for \({\bf x}^{(0)} is \left[y_F = 0.5, x_1 = 0.4, x_2 = 0.3, x_3 = 0.2, x_F = 0.1\right]\), or similar.

Using this guess to solve for the first Gauss-Seidel iteration. There is no need to run the iterations for \(y_F\) and \(x_F\) as they are trivially solved.

\[\begin{split}x_1^{(1)} &= \frac{-0.5/0.8 -1.875 \times 0.3}{-2.875} = 0.413 \\x_2^{(1)} &= \frac{-0.413 -1.875 \times 0.2}{-2.875} = 0.274 \\x_3^{(1)} &= \frac{-0.274 -1.875 \times 0.1}{-2.875} = 0.161\end{split}\]

Out of interest, the actual solution: \(x = [0.5, \,\, 0.358, \,\, 0.216, \,\, 0.140, \,\, 0.1]\)

Question 6 [5 = 4 + 1]

6.1 When implementing either the Gauss-Seidel method, or the Jacobi method to solve any system of equations, \(A{\bf x} = b\), you can experience trouble with convergence. What are 2 options you can implement to try obtain convergence with these methods? Clearly explain what each option does to try achieve convergence.

6.2 The Gauss elimination process to solve the system of equations, \(A{\bf x} = b\) uses partial pivoting. Please give a reason why this partial pivoting process is performed.

Solution

6.1 One option is to use relaxation, with \(0 \le \omega \le 1\) in the equation \(x^{(k+1)} = \omega x^{(k+1)} + (1-\omega)x^{(k)}\), to avoid taking too large a step with each iteration. This reduction in step size prevents overshoot and achieves convergence by approaching the solution more gradually.

Another option is to interchange rows in the \(A\) matrix to try and achieve diagonal dominance, which is a sufficient condition for convergence (i.e. if \(A\) is diagonally dominant, then we are guaranteed to converge).

An alternative, though less systematic option, is to choose a different initial guess and hope for the best. The other two methods mentioned above should be used instead, because they will likely work. Choosing initial guesses close to the expected solution is very difficult for large-scale systems (big \(A\) matrices).

6.2 Pivoting eliminates zeros on the diagonal line (to prevent division by zero); it also reduces round-off error, since the pivot element (the diagonal element) is the divisor in the elimination process. It is not correct to say that pivoting in Gauss Elimination is used to achieve diagonal dominance, since diagonal dominance is only an issue for iterative methods (e.g Jacobi or Gauss-Seidel method). Gauss elimination will always converge, if a solution exists and if round-off error does not accumulate.

Question 7 [2]

In solving the equation, \(f(x)=0\) for a single variable, \(x\), how many steps of the bisection method are necessary to guarantee the solution is within an interval of width \(\varepsilon = 2 \times 10^{-6}\), starting with an interval that is 10 units wide?

Solution

In each bisection, the interval of search is shrunk by half. If we start from the interval \([a,b]\), we know that the solution is within \(\displaystyle\frac{b-a}{2}\) after we do the first bisection. After the second bisection, the solution is guaranteed to be within an interval of \(\displaystyle\frac{b-a}{2^2}\). Similarly, after \(n\) bisections, the solution is guaranteed to be within an interval of \(\displaystyle\frac{b-a}{2^n}\).

Now if we would like the solution interval to be within a given \(\varepsilon\), the number of bisections \(n\) can be obtained as follows:

\[\displaystyle\frac{b-a}{2^n}\le \varepsilon\]

On solving for \(n\):

\[\begin{split}n > \log_2\displaystyle\frac{b-a}{\varepsilon}\end{split}\]
\[\]

We use the above equation to see how many bisections we need given the width of the inital interval \(b-a=10\), and \(\varepsilon = 2 \times 10^{-6}\).

\(n > \log_2 \left(\displaystyle \frac{10}{2\times 10^{-6}} \right)=\log_2 \left({5\times 10^6}\right)\)

Math refresher: Computing logarithm in an arbitrary base \(b\): \(\displaystyle \log_b {x} = \frac{\log_a{x}}{\log_a{b}}\).

Therefore, \(\displaystyle\log_2\displaystyle ({5\times 10^6})=\frac{\log_{10} ({5\times 10^6})}{\log_{10} 2}=22.2\).

\(n>22.2\rightarrow n=\) 23 steps must be performed.

Question 8 [5]

Consider the modelling of a jacketed CSTR, fed with a single inlet stream. Under some fairly straightforward assumptions, one can show that the steady state temperature of the fluid leaving the tank is given by:

../_images/CSTR2_1feed_jacket1545.png

\[\begin{split}\frac{F^{\rm in}}{V}[T^{\rm in}-T] - \frac{UA_s}{\rho\,c_p\,V}[T - T_j] + \frac{2\,k_0\,(-\Delta H_r)}{\rho\,c_p}\,C_{\sf A}^2\,e^{\displaystyle -\frac{E_a}{RT}} &= 0\end{split}\]

After substituting in relevant values for the constant physical properties, and fixing the value of \(C_{\sf A}\), the equation can be reduced to:

\[\begin{split}2.6 - 1.45 T + 5 \times 10^{5} e ^{-\tfrac{2000}{T}} &= 0\end{split}\]

Please perform 2 iterations of the Newton-Raphson algorithm for finding the roots of a nonlinear equation. A reasonable starting guess for \(T^{(0)}\) is the same temperature as the inlet stream: i.e. \(T^{(0)} = T^{\rm in} = 290 {\rm K}\). Note: you do not need to derive the energy-balance equation above.

Solution

We write the Newton-Raphson method to solve for the unknown temperature \(T\) as:

\[T_{n+1} = T_n -\frac{f(T_n)}{f'(T_n)}\]

where \(f(T_n)\) and \(f'(T_n)\) are evaluated as follows:

\[\begin{split}f(T) &= 2.6 - 1.45 T + 5 \times 10^{5} e ^{-\tfrac{2000}{T}} \\f'(T) &= -1.45 - 5 \times 10^5 \times \left(-\frac{2000}{T^2}\right) e ^{-\tfrac{2000}{T}}\end{split}\]
  • \(T^{(0)} = 290.0\) K
  • \(f(290) = 87.73\), and that \(f'(290) = 10.57\), so \(\Delta T = \displaystyle -\frac{f(290)}{f'(290)} = \frac{87.73}{10.57}\).
  • \(T^{(1)} = T^{(0)} + \Delta T = 290.0 - 8.296 = 281.7\) K
  • \(f(281.7) = 6.79\), and that \(f'(281.7) = 8.95\), so \(\Delta T = \displaystyle -\frac{f(281.7)}{f'(281.7)} = \frac{6.79}{8.95}\).
  • \(T^{(2)} = T^{(1)} + \Delta T = 281.7 - 0.76 = 280.9\) K

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox