{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "*This notebook contains course material from [CBE30338](https://jckantor.github.io/CBE30338)\n", "by Jeffrey Kantor (jeff at nd.edu); the content is available [on Github](https://github.com/jckantor/CBE30338.git).\n", "The text is released under the [CC-BY-NC-ND-4.0 license](https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode),\n", "and code is released under the [MIT license](https://opensource.org/licenses/MIT).*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Second Order Models](http://nbviewer.jupyter.org/github/jckantor/CBE30338/blob/master/notebooks/03.06-Second-Order-Models.ipynb) | [Contents](toc.ipynb) | [Manometer Models and Dynamics](http://nbviewer.jupyter.org/github/jckantor/CBE30338/blob/master/notebooks/03.08-Manometer-Models-and-Dynamics.ipynb) >
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Interacting Tanks"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Problem Statement\n",
"\n",
"The following diagram shows a pair of interacting tanks.\n",
"\n",
"![Image of a two interacting tanks](figures/InteractingTanks.png)\n",
"\n",
"Assume the pressure driven flow into and out of the tanks is linearly proportional to tank levels. The steady state flowrate through the tanks is 3 cubic ft per minute, the steady state heights are 7 and 3 feet, respectively, and a constant cross-sectional area 5 sq. ft. The equations are written as\n",
"\n",
"$$\\begin{align*}\n",
"\\frac{dh_1}{dt} & = \\frac{F_0}{A_1} - \\frac{\\beta_1}{A_1}\\left(h_1-h_2\\right) \\\\\n",
"\\frac{dh_2}{dt} & = \\frac{\\beta_1}{A_2}\\left(h_1-h_2\\right) - \\frac{\\beta_2}{A_2}h_2\n",
"\\end{align*}$$\n",
"\n",
"**a.** Use the problem data to determine values for all constants in the model equations.\n",
"\n",
"**b.** Construct a Phython simulation using `odeint`, and show a plot of the tank levels as function of time starting with an initial condition $h_1(0)=6$ and $h_2(0)$ = 5. Is this an overdamped or underdamped system."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Solution"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Part a. \n",
"\n",
"The parameters that need to be determined are $\\beta_1$ and $\\beta_2$. At steady state all of the flows must be identical and\n",
"\n",
"$$\\begin{align*}\n",
"0 & = F_0 - \\beta_1(h_1 - h_2) \\\\\n",
"0 & = \\beta_1(h_1 - h_2) - \\beta_2h_2 \n",
"\\end{align*}$$\n",
"\n",
"Substituting problem data,\n",
"\n",
"$$\\beta_1 = \\frac{F_0}{h_1-h_2} = \\frac{3\\text{ cu.ft./min}}{4\\text{ ft}} = 0.75\\text{ sq.ft./min}$$ \n",
"\n",
"$$\\beta_2 = \\frac{\\beta_1(h_1 - h_2)}{h_2} = \\frac{3\\text{ cu.ft./min}}{3\\text{ ft}} = 1.0\\text{ sq.ft./min}$$ "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Part b.\n",
"\n",
"The next step is perform a simulation from a specified initial condition. "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
" "
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3",
"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": 2
}