Interacting Tanks - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Interacting Tanks

Introduction

This worksheet models liquid flow between three tanks connected by two pipes (the first pipe connecting Tank 1 and 2, and the second pipe connecting Tank 2 and 3).

The flow is opposed by pipe friction, and the level of liquid in each tank oscillates to an equilibrium.  Differential equations that describe the dynamic change in liquid height in each tank and a momentum balance are solved numerically.

 > $\mathrm{restart};$

Physical Parameters

The cross-sectional area of the tanks:

 > ${A}_{1}≔1:$${A}_{2}≔5:{A}_{3}≔2:\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}$

Diameter, length, and roughness of the pipe:

 > $\mathrm{Dia}≔0.3:$$L≔100:$$e≔0.001:\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}$

Density and viscosity of the liquid:

 > $\mathrm{ρ}≔1000:$$\mathrm{μ}≔0.001:\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}$

Gravitational constant:

 > $g≔9.81:$

Momentum Balance

Friction Factor

 >

Differential Equations

The rate of change of liquid height in Tank 1:

 > ${\mathrm{height}}_{1}≔\frac{ⅆ}{ⅆt}{H}_{1}\left(t\right)=-\frac{{Q}_{1}\left(t\right)}{{A}_{1}}:\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}$

The rate of change of liquid height in Tank 2:

 > ${\mathrm{height}}_{2}≔\frac{ⅆ}{ⅆt}{H}_{2}\left(t\right)=\frac{{Q}_{1}\left(t\right)-{Q}_{2}\left(t\right)}{{A}_{2}}:\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}$

The rate of change of liquid height in Tank 3:

 >

A momentum balance:

 > ${\mathrm{momentumBalance}}_{1}≔\frac{ⅆ}{ⅆt}{Q}_{1}\left(t\right)=\frac{\mathrm{π}{\mathrm{Dia}}^{2}g{H}_{1}\left(t\right)}{4L}-\frac{\mathrm{π}{\mathrm{Dia}}^{2}g{H}_{2}\left(t\right)}{4L}-\frac{2\cdot \mathrm{friction}\left(\mathrm{abs}\left({Q}_{1}\left(t\right)\right)\right)\mathrm{abs}\left({Q}_{1}\left(t\right)\right)\cdot {Q}_{1}\left(t\right)}{\mathrm{π}{\mathrm{Dia}}^{3}}:\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}$
 > ${\mathrm{momentumBalance}}_{2}≔\frac{ⅆ}{ⅆt}{Q}_{2}\left(t\right)=\frac{\mathrm{\pi }{\mathrm{Dia}}^{2}g{H}_{2}\left(t\right)}{4L}-\frac{\mathrm{\pi }{\mathrm{Dia}}^{2}g{H}_{3}\left(t\right)}{4L}-\frac{2\cdot \mathrm{friction}\left(\mathrm{abs}\left({Q}_{2}\left(t\right)\right)\right)\mathrm{abs}\left({Q}_{2}\left(t\right)\right)\cdot {Q}_{2}\left(t\right)}{\mathrm{\pi }{\mathrm{Dia}}^{3}}:$

The initial conditions:

 >

Numerical Solution of Governing Equations

 >
 > ${H}_{1}≔\mathrm{subs}\left(\mathrm{res},{H}_{1}\left(t\right)\right):$${H}_{2}≔\mathrm{subs}\left(\mathrm{res},{H}_{2}\left(t\right)\right):{H}_{3}≔\mathrm{subs}\left(\mathrm{res},{H}_{3}\left(t\right)\right):$${Q}_{1}:=\mathrm{subs}\left(\mathrm{res},{Q}_{1}\left(t\right)\right):{Q}_{2}≔\mathrm{subs}\left(\mathrm{res},{Q}_{2}\left(t\right)\right):$

Results

 >
 >