Interacting Tanks - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Applications and Example Worksheets : Science and Engineering : applications/InteractingTanks

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:

A11:A25:A32:

Diameter, length, and roughness of the pipe:

Dia0.3:L100:e0.001:

Density and viscosity of the liquid:

ρ1000:μ0.001:

Gravitational constant:

g9.81:

Momentum Balance

Friction Factor

frictionprocQlocal Rey&comma;fL&comma;fT&colon;   if  typeQ&comma;numeric then      Rey4 Q ρevalf&pi; Dia &mu;&colon;      fL64Rey&colon;      fT11.8log106.9Rey&plus;e3.7Dia1.112&colon;      if Rey&gt;0 and  Rey<2000 then          return fL&colon;      elif Rey2000 and Rey<4000 then         return fL&plus;fTfLRey200040002000      elif Rey4000 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;tH1t&equals;Q1tA1&colon;

The rate of change of liquid height in Tank 2:

height2&DifferentialD;&DifferentialD;tH2t&equals;Q1tQ2tA2&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;tQ1t&equals;&pi;Dia2gH1t4L&pi;Dia2gH2t4L2frictionabsQ1tabsQ1tQ1t&pi;Dia3&colon;

momentumBalance2&DifferentialD;&DifferentialD;tQ2t&equals;πDia2gH2t4LπDia2gH3t4L2frictionabsQ2tabsQ2tQ2tπDia3&colon;

The initial conditions:

initialConditionsQ10&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

resdsolveheight1&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;

H1subsres&comma;H1t&colon;H2subsres&comma;H2t&colon;H3subsres&comma;H3t&colon;Q1:=subsres&comma;Q1t&colon;Q2subsres&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;