Difference between revisions of "Written midterm - Solution"

From Process Model Formulation and Solution: 3E4
Jump to navigation Jump to search
m (Created page with "{{OtherSidebar | due_dates = 18 October 2010 | dates_alt_text = Date | questions_PDF = Midterm-ChE3E4-2010.pdf | questions_text_alt = Questions | solutions_PDF = Midterm-ChE3E4-...")
 
m
Line 91: Line 91:


.. math::
.. math::
\begin{array}{rl}
\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}
\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}


*Balance on B*
*Balance on B*
Line 101: Line 97:
.. math::
.. math::
\begin{array}{rl}
\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}
\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}


*Balance on C*
*Balance on C*
Line 111: Line 103:
.. math::
.. math::
\begin{array}{rl}
\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}
\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}


*Balance on D*
*Balance on D*
Line 121: Line 109:
.. math::
.. math::
\begin{array}{rl}
\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}
\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}




Line 148: Line 132:


.. math::
.. math::
\begin{array}{rl}
\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}
\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}


*Balance on A*
*Balance on A*
Line 157: Line 138:
.. math::
.. math::
\begin{array}{rl}
\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}
\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}


*Balance on D*
*Balance on D*
Line 169: Line 144:
.. math::
.. math::
\begin{array}{rl}
\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}
\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}




Line 240: Line 209:
.. math::
.. math::


y_F &= 0.5\\
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
\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
where :math:`\beta` is a coefficient, assumed constant throughout the absorber tower, that relates the liquid phase composition, :math:`x_n`, to the gas-phase composition, :math:`y_n = \beta x_n`, assuming of course that equilibrium is achieved in each stage.  
where :math:`\beta` is a coefficient, assumed constant throughout the absorber tower, that relates the liquid phase composition, :math:`x_n`, to the gas-phase composition, :math:`y_n = \beta x_n`, assuming of course that equilibrium is achieved in each stage.  
Line 265: Line 230:
.. math::
.. math::
A = \left(  
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)
\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)




Line 301: Line 257:
.. math::
.. math::
x_1^{(1)} &= \frac{-0.5/0.8 -1.875 \times 0.3}{-2.875} = 0.413 \\
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
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


Out of interest, the actual solution: :math:`x =  [0.5, \,\, 0.358, \,\,  0.216, \,\, 0.140, \,\, 0.1]`
Out of interest, the actual solution: :math:`x =  [0.5, \,\, 0.358, \,\,  0.216, \,\, 0.140, \,\, 0.1]`
Line 394: Line 348:
.. math::
.. math::
f(T) &= 2.6 - 1.45 T + 5 \times 10^{5} e ^{-\tfrac{2000}{T}}  \\
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}}
f'(T) &= -1.45 - 5 \times 10^5 \times \left(-\frac{2000}{T^2}\right)  e ^{-\tfrac{2000}{T}}


* :math:`T^{(0)} = 290.0` K
* :math:`T^{(0)} = 290.0` K

Revision as of 09:03, 16 September 2018

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

<rst> <rst-options: 'toc' = False/> <rst-options: 'reset-figures' = False/>

.. rubric:: Special instructions

- You may bring in any printed materials to the final; **any** textbooks, **any** papers, *etc*. - You may use any calculator during the test. - You may not use a cellphone as a calculator. Nor may you use any other communication device (web, email, chat, etc) during the test. - You may not use any type of computer. - You may answer the questions in any order in the answer booklet. - The test covers all material taught so far in the course. - Make sure that you provide explanations with your calculations. - If you are not sure about the meaning of a problem, please write out your interpretation and follow through with the calculation. - If you are short of time, please write what you would have done in this test, if you had more time. - There are a total of **45 marks** available.

.. raw:: latex

   \pagestyle{plain}
   \vspace*{0.2cm}

\hrule \vspace*{0.2cm} Solutions by: Ali (Q4, Q7, Q8), Elliot (Q1, Q2, Q3), and Kevin (Q5, Q6) \newpage


.. Chemical engineering modelling [16] .. Roundoff and computer representation [6] .. Linear algebraic equations [16] .. Taylor-series expansion [4] .. Non-linear equation solution [8]

Question 1 [11]

===

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

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

Derive the equations that can be solved for the steady state concentrations of :math:`\sf A, B, C` and :math:`\sf D`. You may assume that species :math:`\sf A` is fed to the reactor in a single stream, flowing in at :math:`Q \text{m}^3/\text{s}`, with a concentration of :math:`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:

.. figure:: images/MidTerm_Q1.png :scale: 40 :align: center

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

  • The reactor is operating at a constant volume (i.e. :math:`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:

.. math::

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


  • Balance on A*

.. math:: \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}

  • Balance on B*

.. math::

\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}

  • Balance on C*

.. math::

\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}

  • Balance on D*

.. math::

\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}


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** :math:`C_{\sf A}` **and** :math:`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 :math:`V = V(t)`

  • Overall balance*

.. math:: \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}

  • Balance on A*

.. math::

\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}

  • Balance on D*

.. math::

\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}


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, :math:`2^{0}`, :math:`2^{1}`" as opposed to the correct form "sign, :math:`2^{1}`, :math:`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 :math:`-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 :math:`-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 :math:`2^{1}` as the exponent term and :math:`2^{-1}` as the mantissa then the 8-bit representation of -1.0 is:

.. math::

\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, :math:`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 :math:`A` at double precision?
    • 4.2** Can this matrix be stored in 1 gigabyte of RAM?
    • 4.3** The matrix :math:`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 :math:`12000 \times 12000` coefficients to be stored in the matrix :math:`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:
math:`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 :math:`12000 \times 12000` entries: :math:`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 :math:`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.

.. raw:: latex

\newpage

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:

.. figure:: images/absorber-column-midterm.png :scale: 30 :align: center

.. math::

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

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

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

    • 5.1** Write the given steady-state equations in the form :math:`A{\bf x} = b` where :math:`{\bf x} = \left[y_F, x_1, x_2, x_3, x_F\right]`. Report the :math:`A` matrix and :math:`b` vector.
    • 5.2** What condition(s) must be satisfied so that matrix :math:`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 :math:`L/G = 1.5`, and :math:`\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 :math:`{\bf x} = \left[y_F, x_1, x_2, x_3, x_F\right] = [0, 0, 0, 0, 0]`. Use :math:`L/G = 1.5`, and :math:`\beta = 0.8` in your matrix, and briefly explain your choice for the initial guess.

Solution


    • 5.1**

.. math::

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)


.. sidebar:: Grading

Stating the general conditions for diagonal dominance for any matrix :math:`A` would have got you full marks for question 5.2, because the question could also have been interpreted that way. However you would need to do the calculations shown here either in question 5.2 or 5.3.

    • 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 :math:`\| \delta + 1 \| \geq \| \delta + 1 \|`. However row 2 must satisfy the criterion that :math:`\| \delta + 1 \| \geq \| \frac{1}{\beta} + \delta \|` which simplifies to :math:`\beta \geq 1` (using the fact that :math:`\delta` and :math:`\beta` are guaranteed to always be positive quantities: *why*?). So the only criterion required for diagonal dominance *for this system* is that :math:`\beta \geq 1`.
    • 5.3** Both the Gauss-Seidel method, and Jacobi method are guaranteed to converge if the system is diagonally dominant. Since :math:`\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 :math:`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: :math:`x_F = 0.1 < x_3 < x_2 < x_1`. The upper bound on these concentrations is expected to be :math:`y_F = 0.5`, although depending on the VLE, it could be higher, but unlikely.

Initial guesses for :math:`y_F = 0.5` and :math:`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 :math:`{\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 :math:`y_F` and :math:`x_F` as they are trivially solved.

.. math::

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

Out of interest, the actual solution: :math:`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, :math:`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, :math:`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 :math:`0 \le \omega \le 1` in the equation :math:`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 :math:`A` matrix to try and achieve diagonal dominance, which is a sufficient condition for convergence (i.e. if :math:`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 :math:`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, :math:`f(x)=0` for a single variable, :math:`x`, how many steps of the bisection method are necessary to guarantee the solution is within an interval of width :math:`\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 :math:`[a,b]`, we know that the solution is within :math:`\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 :math:`\displaystyle\frac{b-a}{2^2}`. Similarly, after :math:`n` bisections, the solution is guaranteed to be within an interval of :math:`\displaystyle\frac{b-a}{2^n}`.

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

.. math::

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

On solving for :math:`n`:

.. math:: n > \log_2\displaystyle\frac{b-a}{\varepsilon}

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

math:`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 :math:`b`: :math:`\displaystyle \log_b {x} = \frac{\log_a{x}}{\log_a{b}}`.

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

math:`n>22.2\rightarrow n=` **23 steps** must be performed.

.. raw:: latex

\newpage

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:

.. figure:: images/CSTR2_1feed_jacket.png :scale: 76 :align: center

.. math::

\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

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

.. math::

2.6 - 1.45 T + 5 \times 10^{5} e ^{-\tfrac{2000}{T}} &= 0

Please perform 2 iterations of the Newton-Raphson algorithm for finding the roots of a nonlinear equation. A reasonable starting guess for :math:`T^{(0)}` is the same temperature as the inlet stream: i.e. :math:`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 :math:`T` as:

.. math::

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

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

.. math::

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}}

  • :math:`T^{(0)} = 290.0` K
  • :math:`f(290) = 87.73`, and that :math:`f'(290) = 10.57`, so :math:`\Delta T = \displaystyle -\frac{f(290)}{f'(290)} = \frac{87.73}{10.57}`.
  • :math:`T^{(1)} = T^{(0)} + \Delta T = 290.0 - 8.296 = 281.7` K
  • :math:`f(281.7) = 6.79`, and that :math:`f'(281.7) = 8.95`, so :math:`\Delta T = \displaystyle -\frac{f(281.7)}{f'(281.7)} = \frac{6.79}{8.95}`.
  • :math:`T^{(2)} = T^{(1)} + \Delta T = 281.7 - 0.76 = 280.9` K

.. raw:: latex

\vspace{0.5cm} \hrule \begin{center}END\end{center} </rst>