Interacting Tanks - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

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.

 

> 

restart;

Physical Parameters

The cross-sectional area of the tanks:

> 

A1≔1:A2≔5:A3≔2:

Diameter, length, and roughness of the pipe:

> 

Dia≔0.3:L≔100:e≔0.001:

Density and viscosity of the liquid:

> 

ρ≔1000:μ≔0.001:

Gravitational constant:

> 

g≔9.81:

Momentum Balance

Friction Factor

> 

friction≔procQlocal Rey&comma;fL&comma;fT&colon;   if  typeQ&comma;numeric then      Rey≔4 Q ρevalf&pi; Dia &mu;&colon;      fL≔64Rey&colon;      fT≔11.8⁢log106.9Rey&plus;e3.7⁢Dia1.112&colon;      if Rey&gt;0 and  Rey<2000 then          return fL&colon;      elif Rey≥2000 and Rey<4000 then         return fL&plus;fT−fL⋅Rey−20004000−2000      elif Rey≥4000 then         return fT      else          return 0      end if&semi;   else      return &apos;friction&apos;Q   end ifend proc&colon;

Differential Equations

The rate of change of liquid height in Tank 1:

> 

height1≔&DifferentialD;&DifferentialD;t⁢H1t&equals;−Q1tA1&colon;

The rate of change of liquid height in Tank 2:

> 

height2≔&DifferentialD;&DifferentialD;t⁢H2t&equals;Q1t−Q2tA2&colon;

The rate of change of liquid height in Tank 3:

> 

height3≔&DifferentialD;&DifferentialD; t H3t&equals;Q2tA3&colon;

A momentum balance:

> 

momentumBalance1≔&DifferentialD;&DifferentialD;t⁢Q1t&equals;&pi;⁢Dia2⁢g⁢H1t4⁢L−&pi;⁢Dia2⁢g⁢H2t4⁢L−2⋅frictionabsQ1t⁢absQ1t⋅Q1t&pi;⁢Dia3&colon;

> 

momentumBalance2≔&DifferentialD;&DifferentialD;t⁢Q2t&equals;π⁢Dia2⁢g⁢H2t4⁢L−π⁢Dia2⁢g⁢H3t4⁢L−2⋅frictionabsQ2t⁢absQ2t⋅Q2tπ⁢Dia3&colon;

The initial conditions:

> 

initialConditions≔Q10&equals;0&comma;Q20&equals;0&comma; H10&equals;1.5&comma;H20&equals;1.2&comma;H30&equals;2&colon;

Numerical Solution of Governing Equations

> 

res≔dsolveheight1&comma;height2&comma;height3&comma;momentumBalance1&comma;momentumBalance2&comma;initialConditions&comma;                        H1t&comma;H2t&comma;H3t&comma;Q1t&comma;Q2t&comma;                         numeric&comma;output&equals;listprocedure&comma;known&equals;friction&colon;

> 

H1≔subsres&comma;H1t&colon;H2≔subsres&comma;H2t&colon;H3≔subsres&comma;H3t&colon;Q1:=subsres&comma;Q1t&colon;Q2≔subsres&comma;Q2t&colon;

Results

> 

plotH1t&comma;H2t&comma;H3t&comma;t&equals;0..200&comma;                                 legend&equals;Level in Reservoir 1&comma; Level in Reservoir 2&comma;Level in Reservoir 3&comma;                                 labels&equals;Time&comma; Liquid Height&comma;                                 labeldirections&equals;horizontal&comma;vertical&comma;                                labelfont&equals;Calibri&comma;                                titlefont&equals;Calibri&comma;16&comma;bold&comma;                                background&equals;ColorTools:-ColorRGB&comma;218&sol;255&comma;223&sol;255&comma;225&sol;255&comma;                                legendstyle&equals;font&equals;Calibri&comma;                                axis&equals;gridlines&equals;color&equals;ColorTools:-ColorRGB&comma;1&comma;1&comma;1&comma;                               size&equals;1000&comma;400&semi;

>