{ "cells": [ { "cell_type": "markdown", "id": "8aa72181-e022-4adc-90b2-1a034b7f2a44", "metadata": {}, "source": [ "# Stoichiometry - Part 2" ] }, { "cell_type": "markdown", "id": "b7481870-19c1-4eb6-9565-555fc54fd640", "metadata": {}, "source": [ "## **Goal**: \n", "The aim of this lesson is to help you design functions to create stoichiometric tables in Python.\n", "\n", "Here, an example of how to create a stoichiometric table for an equalmolar reaction is provided.\n", "Afterwards, a few exercises are provided, so you can try to write your own functions, making them as much generalizable as possible.\n", "It's a good idea, once you have a working solution, to test the functions of different parameters to see if the results are still correct!\n", "\n", "**Remember**, the provided solution is is only **one of the many possible solutions**, so please do try to re-write the function yourself, optimize it and make it more generalizable." ] }, { "cell_type": "markdown", "id": "6d072e55-6af0-4fc8-b6a0-47e292d15796", "metadata": {}, "source": [ "## **Motivation**: \n", "Writing these functions in Python might look like a lot of (manual) work, since the tables are populated by strings. \n", "\n", "However, if you manage to create the functions for the different types of systems, then you can reuse them and just change the initial parameters provided!\n", "\n", "This will also (hopefully) help you thinking carefully about the conditions and the assumptions given (e.g. is the reaction isothermal? Is there a volume change?), since you will have to choose the specific function based on that. In our experience, this is something that students often struggle with, so we hope to provide a tool that helps you taking into account all of this!" ] }, { "cell_type": "markdown", "id": "a485833d-ac9f-4cf6-be78-be283553d792", "metadata": {}, "source": [ "### **Example 1:**\n", "\n", "A company is about to start the production of B, this happens by the catalytic reaction:\n", "$A → B$\n", "\n", "The feed stream consists of $1 kmol/m^3$ A and $0.01 kmol/m^3$ B, this is done at a rate of $120 m^3/min$. \n", "The reaction rate can be written as an elementary reaction and is carried out isothermally in the liquid phase. The reaction rate constant k is $0.18 \\cdot 10^{-3}m^3 \\cdot mol^{-1} \\cdot s^{-1}$\n", "1) Draw up a stoichiometric table for the equation (here one possible solution is provided below):" ] }, { "cell_type": "code", "execution_count": 11, "id": "d3b0204c-daa2-4e54-b081-ef1ea8135ae5", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | species | \n", "F_j0 | \n", "change | \n", "F_j | \n", "C_j | \n", "
---|---|---|---|---|---|
0 | \n", "A | \n", "F_A0 | \n", "-F_A0*X | \n", "F_A0*(1-X) | \n", "C_A0*(1-X) | \n", "
1 | \n", "B | \n", "0.01*F_A0 | \n", "0.01*F_A0*X | \n", "F_A0*(0.01+X) | \n", "C_A0*(0.01+X) | \n", "
2 | \n", "T | \n", "1.01*F_A0 | \n", "0 | \n", "1.01*F_A0 | \n", "None | \n", "