Application Center - Maplesoft

App Preview:

Interacting Tank Reservoirs

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Image 

Interacting Tank Reservoirs 

 

Samir Khan 

Adept Scientific plc 

Introduction 

This worksheet models the draining of liquid from one tank into into another tank through a connecting pipe.  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. 

 

Image 

> restart; 1
 

Physical Parameters 

Cross-sectional area of tanks 

> A1 := 1; -1A2 := .5; -1
 

Diameter, length, and relative roughness of pipe 

> Dia := .3; -1L := 100; -1e := 0.1e-1; -1
 

Density and viscosity of liquid 

> rho := 1000; -1mu := 0.1e-2; -1
 

Gravitational constant 

> g := 9.81; -1
 

Governing Equations and Their Solution 

Friction Factor 

The following procedure gives the friction factor as a function of the flowrate.  If the flowrate is turbulent (i.e., the Reynolds number is greater than 2300), it uses the Swamee and Jain approximation to the Colebrook equation, or the standard equation for the friction factor in laminar flow otherwise. 

> fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
fric := proc (Q) local Rey; if not type(Q, numeric) then ('procname')(Q) else Rey := 4*Q*rho/(mu*evalf(Pi)*Dia); if Rey < 2300 then if Rey <> 0 then 64/Rey else 0 end if else 1.325/(ln(e/(3.7*Dia)+5.7...
 

Differential Equations 

The rate of change of liquid height in Tank 1 

> eq1 := diff(H1(t), t) = -Q(t)/A1; -1
 

The rate of change of liquid height in Tank 2 

> eq2 := diff(H2(t), t) = Q(t)/A2; -1
 

A momentum balance 

> eq3 := diff(Q(t), t) = Pi*Dia^2*g*H1(t)*`/`(4*L)-Pi*Dia^2*g*H2(t)*`/`(4*L)-2*fric(abs(Q(t)))*Q(t)*abs(Q(t))/(Pi*Dia^3); -1
 

Initial Conditions 

> ic := Q(0) = 0, H1(0) = 1.5, H2(0) = 1.2; -1
 

Numerical Solution of Governing Equations 

> res := dsolve({ic, eq3, eq1, eq2}, {Q(t), H1(t), H2(t)}, numeric, output = listprocedure, known = fric); -1
 

> H1 := subs(res, H1(t)); -1H2 := subs(res, H2(t)); -1Q := subs(res, Q(t)); -1
 

Results 

> plot([H1(t), H2(t)], t = 0 .. 200, legend = ([
plot([H1(t), H2(t)], t = 0 .. 200, legend = ([
 

Plot
 

> plot([Q(t), H1(t), t = 0 .. 200], labels = ([
 

Plot
 

References 

Chemical Engineering Dynamics, Ingham et al., Wiley-VCH, 2000. 

 

Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.