HP Forums

Full Version: HP-42S - Time to drain a horizontal cylindrical tank
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

One of the new programs in the software library (Thanks, Don, for pointing them out to us) is a small HP-42S program that calculates the volume of a horizontal cylindrical tank, given its current fluid level, by Ken Delsnider:

http://www.hpmuseum.org/software/42tankv.htm

Perhaps the following could be a companion program to it, but some discussion is required. Years ago at work my chief, also an electrical engineer, gave me a book on Fluid Mechanics and asked me to try to solve this problem. I had not been an outstanding student in that discipline (quite the contrary!), but after an hour or so I managed to find a formula (by following a solved example for a vertical tank in the book). I tested it with a 20-liter water bottle and a small piece of a plastic pen body as a nozzle and it worked. I guess it may work for diesel oil as well (that was the fluid in the original problem) given its low viscosity, but I don't know what discrepancy one could expect when using the formula below. The constant in line 21 has to be recalculated for British units.

Formula

t = 4*L*(sqrt((D - h2)^3) - sqrt((D - h1)^3))/(3*S*c*sqrt(2*g))
where
 t = time do drain from upper to lower level [s]
L = length of the tank [m]
D = diameter of the tank [m]
h1 = upper level of fluid [m]
h2 = lower level of fluid [m]
S = cross-sectional area of the nozzle [m^2]
g = acceleration of gravity [m/s^2]
c = nozzle coefficient (dimensionless)

Gerson.

---------------------------------------------------------------------------------------------
TIME TO DRAIN A HORIZONTAL CYLINDRICAL TANK FROM AN INITIAL LEVEL TO A FINAL LEVEL OF STORAGE

00 { 103-Byte Prgm }
01>LBL "T2MT"
02 MVAR "DIA"
03 MVAR "HT"
04 MVAR "HTF"
05 MVAR "LEN"
06 MVAR "NDIA"
07 MVAR "NC"
08 MVAR "T"
09 RCL "DIA"
10 RCL- "HTF"
11 3
12 Y^X
13 SQRT
14 RCL "DIA"
15 RCL- "HT"
16 3
17 Y^X
18 SQRT
19 -
20 RCL× "LEN"
21 383330.627104 ; (8/15)*10^7/(pi*sqrt(2*9.80665))
22 ×
23 RCL "NDIA"
24 X^2
25 RCL× "NC"
26 ÷
27 RCL- "T"
28 END

DIA = Diameter [m]
HT = Initial level of storage [m]
HTF = Final level of storage [m]
LEN = Length of tank [m]
NDIA = Nozzle diameter [mm]
NC = Nozzle constant (*)
T = Time [s]

(*) The nozzle constant is a dimensionless constant
related to the ratio of the length and diameter
of the nozzle, according to the following table:
       |  NC
-------------
l<d | 0.62
l=2d | 0.82
l=3d | 0.82
l=12d | 0.76
l=24d | 0.73
l=48d | 0.63
l=60d | 0.60
l=100d | 0.50
The formula doesn't take the fluid viscosity into account. This works for water and other low viscosity fluids.

Example:

Given the following data, calculate the time to empty a horizontal cylindrical water tank.

 DIA = Diameter                   1.488 m 
HT = Initial level of storage 0.177 m
HTF = Final level of storage 0.000 m
LEN = Length of tank 2.988 m
NDIA = Nozzle diameter 50.800 mm
NC = Nozzle constant (*) 0.620


Shift SOLVER T2MT
1.488 DIA
0.177 HT
0 HFT
2.988 LEN
50.8 NDIA
0.62 NC
\/ T --> 224.808926919 seconds

3600 / Shift CONVERT ->HMS --> 00h 03m 45s
---------------------------------------------------------------------------------------------

As far as the TANK program goes, I've had a similar program in my library for several years.

Making use of stack and recall arithmetic, and avoiding the "R" variable, it is considerably shorter than the one in the software lib: (OK I cheated a little with shorter variable names as well ;-)

 { 49-Byte Prgm }
*LBL "TANK"
MVAR "H"
MVAR "V"
MVAR "D"
MVAR "L"
RCL "D"
X^2
LASTX
2
/
RCL- "H"
LASTX
/
ACOS
STO+ ST X
ENTER
SIN
-
*
8
/
RCL* "L"
RCL- "V"
END

Cheers, Werner

Edited: 3 Mar 2012, 7:51 a.m.

In my original problem I used this formula, derived from yours:

V = L*(D^2*ACOS(1 - 2*H/D)/4 + (H - D/2)*sqrt(H*(D - H))) 
It has the advantage of using only one transcendental function, but it's longer.

The following uses your formula and is slightly shorter, but takes up four more bytes:

00 { 53-Byte Prgm }
01>LBL "TANK"
02 MVAR "L"
03 MVAR "D"
04 MVAR "H"
05 MVAR "V"
06 1
07 RCL "H"
08 STO+ ST X
09 RCL÷ "D"
10 -
11 ACOS
12 STO+ ST X
13 SIN
14 RCL- ST L
15 RCL× "D"
16 RCL× "D"
17 RCL× "L"
18 8
19 ÷
20 RCL+ "V"
21 END

L*D^2*(SIN(2*ACOS(1 - 2*H/D)) - 2*ACOS(1 - 2*H/D))/8 + V = 0

Cheers,

Gerson.