Skip to content

Commit

Permalink
Removed spanish files... Added new english files.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorge-ramirez-upm committed Jun 9, 2023
1 parent 57a934e commit 8efe4d7
Show file tree
Hide file tree
Showing 67 changed files with 3,551 additions and 2,113 deletions.
292 changes: 292 additions & 0 deletions 01_MassBalances/MassBalances.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<figure>\n",
" <a href=\"http://www.upm.es\">\n",
" <img style=\"float: right;\" src=\"images/UPMLogo.png\" width=\"100\">\n",
" </a>\n",
"</figure>\n",
"\n",
"<b><font size=\"6\">Chemical Processes</font></b>\n",
"\n",
"<b><font size=\"6\">Mass Balance with Chemical Reaction</font></b>\n",
"\n",
"© **Salvador León**, **[Universidad Politécnica de Madrid](http://www.upm.es)**, 2022"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This <i>notebook</i> contains two simple examples related to Mass Balances with Chemical Reaction.\n",
"\n",
"First, the concepts of conversion, extent of reaction, selectivity and yield will be discussed for the case of a process with more than one chemical reaction.\n",
"\n",
"Next, there is a simple simulator of a process with recirculation and purge, which allows to analyze how the purge/recirculation established in the process affects different process variables.\n",
"\n",
"Execute the following code to load the necessary libraries (select the cell and press `Shift + Enter`). "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from balances import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXAMPLE 1 - Calculation of conversion, extent of reaction, selectivity and yield\n",
"\n",
"Consider a chemical process for obtaining a product B from a reactant A. In this process two chemical reactions take place:\n",
"\n",
"$$ \\color{purple} A \\rightarrow 2 \\color{green} B $$\n",
"\n",
"$$ \\color{purple} A \\rightarrow \\color{red} C$$\n",
"\n",
"This is a process with two parallel reactions, in which <span style=\"color:purple\">A is the limiting reactant</span>; <span style=\"color:green\">B is the desired product</span>; and <span style=\"color:red\">C is the undesired product</span>.\n",
"\n",
"A can be fed pure, or it can be accompanied by B, C, or the inert substance D.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The parameters describing the <u>progress of the reactions</u> are:\n",
"\n",
"#### Conversion\n",
"Conversion refers to the consumption of the limiting reactant. In this example, it refers to <span style=\"color:purple\">reactant A</span>:\n",
"\n",
"$$X = \\frac{\\color{purple}{F_{A,input} - F_{A,output}}}{\\color{purple}{F_{A,input}}}$$\n",
"\n",
"Note that the conversion only refers to the reactant consumption, but does not give information on how much of this consumption is produced in one or the other reaction.\n",
"\n",
"#### Extent of reaction\n",
"The two reactions have a corresponding extent of reaction, $\\xi_1$ y $\\xi_2$. Since <span style=\"color:purple\">A</span> is involved in both reactions, it is more convenient to refer to the degrees of progress in terms of the products <span style=\"color:green\">B</span> and <span style=\"color:red\">C</span>, each involved in a single reaction:\n",
"\n",
"$$\\xi_1 = \\frac{\\color{green}{F_{B,output} - F_{B,input}}}{\\color{green}{\\nu_{B}}} = \\frac{\\color{green}{F_{B,output} - F_{B,input}}}{2}$$\n",
"\n",
"$$\\xi_2 = \\frac{\\color{red}{F_{C,output} - F_{C,input}}}{\\color{red}{\\nu_{C}}} = \\frac{\\color{red}{F_{C,output} - F_{C,input}}}{1}$$\n",
"\n",
"\n",
"The parameters describing the <u>effectiveness of the process</u> are:\n",
"\n",
"#### Selectivity\n",
"Selectivity is defined as:\n",
"\n",
"$$\\textrm{Selectivity} = \\frac{\\textrm{mole of reactant converted into desired product}}{\\textrm{mole of reactant consumed}}$$\n",
"\n",
"It is important to take into account the stoichiometric coefficients of the species involved.\n",
"\n",
"In the present example, the selectivity can be expressed in terms of the <span style=\"color:purple\">reactant A</span>:\n",
"\n",
"$$S = \\frac{0.5 \\times (\\color{green}{F_{B,output} - F_{B,input}})}{\\color{purple}{F_{A,input} - F_{A,output}}}$$\n",
"Where it is taken into account that for each mole of <span style=\"color:purple\">A</span> consumed in the desired reaction, two mole of <span style=\"color:green\">B</span> are formed.\n",
"\n",
"Alternatively, the extents of reaction can be considered (including the stoichiometric coefficients of <span style=\"color:purple\">A</span> in each reaction, which in this case are equal to 1):\n",
"\n",
"$$S = \\frac{\\color{green}{\\xi_1}}{\\color{green}{\\xi_1} + \\color{red}{\\xi_2}}$$\n",
"\n",
"#### Yield\n",
"Yield has two equivalent definitions:\n",
"$$\\textrm{Yield} = \\frac{\\textrm{mole of desired product formed}}{\\textrm{maximum number of mole of desired product that can be formed}}$$\n",
"\n",
"$$\\textrm{Yield} = \\frac{\\textrm{mole of reactant converted into desired product}}{\\textrm{mole of reactant fed}}$$\n",
"\n",
"In this example, the first definition remains as follows:\n",
"\n",
"$$\\eta = \\frac{\\color{green}{F_{B,output} - F_{B,input}}}{2 \\times \\color{purple}{F_{A,input}}}$$\n",
"\n",
"Where again, we take into account the relation between the stoichiometric coefficients of <span style=\"color:purple\">A</span> and <span style=\"color:green\">B</span>.\n",
"\n",
"Similarly, the second definition remains as follows:\n",
"\n",
"$$\\eta = \\frac{0.5 \\times (\\color{green}{F_{B,output} - F_{B,input}})}{\\color{purple}{F_{A,input}}}$$\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Interactive module instructions\n",
"<i>The following code cell contains a small routine that performs the calculation of the extent of reaction, conversion, selectivity and yield parameters of the process described in this example.\n",
" \n",
"o use the module, the code cell must be executed (\"Run\" button in the top menu). Next, the values for the input flow rates of ractants, products, and inert species D, and the desired output flow rates of reactants and desired product are selected (using the sliders or by typing manually); note that the output quantities of C and D are not specified, since the module performs the corresponding calculation. Once the desired values have been specified, press the \"Run Interact\" button that will have appeared.\n",
" \n",
"The module performs the calculation of the parameters and displays them on the screen.</i>"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3af5c84133fe4316b07965429850781b",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=5.0, description='F_Ain', max=10.0, min=0.1), FloatSlider(value=0.0, d…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display(w)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Practice\n",
"\n",
"<i>PRACTICE WITH THE FOLLOWING COMBINATIONS OF INLETS AND OUTLETS, AND COMPARE THE CALCULATED RESULT WITH THE ONE OBTAINED BY THE SUBROUTINE:\n",
" \n",
"(1) <u>Input</u>: 5 mol/h of <span style=\"color:purple\">A</span> - <u>Output</u>: 1 mol/h of <span style=\"color:purple\">A</span> + 6 mol/h of <span style=\"color:green\">B</span> \n",
"\n",
"(2) <u>Input</u>: 10 mol/h of <span style=\"color:purple\">A</span> + 2 mol/h of <span style=\"color:green\">B</span> - <u>Output</u>: 2 mol/h of <span style=\"color:purple\">A</span> + 14 mol/h of <span style=\"color:green\">B</span>\n",
"\n",
"(3) <u>Input</u>: 10 mol/h of <span style=\"color:purple\">A</span> + 5 mol/h of <span style=\"color:green\">B</span> + 2 mol/h of <span style=\"color:red\">C</span> - <u>Output</u>: 1 mol/h of <span style=\"color:purple\">A</span> + 19 mol/h of <span style=\"color:green\">B</span>\n",
"\n",
"(4) <u>Input</u>: 10 mol/h of <span style=\"color:purple\">A</span> + 8 mol/h of <span style=\"color:green\">B</span> + 4 mol/h of <span style=\"color:red\">C</span> - <u>Output</u>: 3 mol/h of <span style=\"color:purple\">A</span> + 16 mol/h of <span style=\"color:green\">B</span>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### EXAMPLE 2 - Process with recirculation and purge\n",
"\n",
"The attached schematic shows a recombination process of CO and H$_2$ to produce methanol by the following reaction:\n",
"$$CO + 2 H_2 \\rightarrow CH_3OH$$\n",
"\n",
"<img src=\"images/esquema_recirculacion_0.png\" alt=\"FlowDiagram\" width=\"800\"/>\n",
"\n",
"All compositions are in molar percent. CH$_4$, which does not participate in the reaction, enters the process. The fresh feed flow rate (<span style=\"color:orange\">stream 1</span>) is 100 mol/h. The step conversion of CO (limiting reactant) is 18%. The process includes a recirculation and a purge stream to maintain the methane concentration at the separator outlet at 3.2% molar and to avoid hydrogen accumulation.\n",
"\n",
"In this example, we will consider how the value of the purge flow rate affects the other parameters of the material balance."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"The definitions of conversion in a process with recicurculation are as follows:\n",
"\n",
"$$\\color{blue}{\\textrm{Step conversion}} = \\frac{\\color{purple}{\\textrm{reactor inlet flow of reactant}}-{\\color{magenta}{\\textrm{reactor outlet flow of reactant}}}}{\\color{purple}{\\textrm{reactor inlet flow of reactant}}}$$\n",
"\n",
"$$\\color{red}{\\textrm{Overall conversion}} = \\frac{\\color{orange}{\\textrm{process inlet flow of reactant}}-{\\color{green}{\\textrm{process outlet flow of reactant}}}}{\\color{orange}{\\textrm{process inlet flow of reactant}}}$$\n",
"\n",
"In this example, the limiting reactant is CO. Therefore, these definitions remain as follows:\n",
"\n",
"$$\\color{blue}{X_{step}} = \\frac{\\color{purple}{F_{2,CO}}-\\color{magenta}{F_{3,CO}}}{\\color{purple}{F_{2,CO}}} $$\n",
"\n",
"$$\\color{red}{X_{overall}} = \\frac{\\color{orange}{F_{1,CO}}-\\color{green}{F_{6,CO}}}{\\color{orange}{F_{1,CO}}} $$\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Interactive module instructions\n",
"<i>The following code cell contains a small routine that performs the material balance of the process described in this example.\n",
" \n",
"To use the module, the code cell must be executed (\"Run\" button in the top menu). Then, the desired value of the purge flow rate is selected (using the sliders or by typing manually). Once the desired value has been entered, press the \"Run Interact\" button that will have appeared.\n",
" \n",
"The module first verifies that the purge flow rate value remains within the limits of the process (not low enough to exhaust all the limiting reactant, nor high enough so that the overall conversion is less than the step conversion). Then, the resolution of the mass balance and the calculation of the overall conversion is performed (imposing as a restriction that the step conversion remains constant). The display shows the value of the overall conversion and other parameters of the mass balance.</i>"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Indicate the purge flow rate\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a1b3a3d72f4a42a3870d6ce68dcba27f",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=6.25, description='Purge', max=82.4, min=2.6), Button(description='Run…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"print(\"Indicate the purge flow rate\")\n",
"display(w2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Practice\n",
"\n",
"<i>PRACTICE WITH DIFFERENT VALUES OF THE PURGE FLOW RATE AND OBSERVE THE RESULTING PARAMETER VALUES.\n",
" \n",
"* What happens when working with a higher or lower purge flow rate?\n",
"* How is the effectiveness of the process affected? What parameter(s) reflect this?\n",
"* An increase in the reactor inlet flow requires an increase in the volume of the reactor and separation equipment to process that increased flow, with the consequent increase in both installation and operating costs.\n",
"* In many chemical reactions, a decrease in reactant concentration translates into a decrease in step conversion (in other words, the reactor needs to be upgraded in order to maintain step conversion)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit 8efe4d7

Please sign in to comment.