# Plot of Fluid Level vs. Time for the Filling of a Spherical Tank

First, we’ll start off with a plot. In this previous post, I derived the differential equation for the fluid height in a spherical tank being filled with a liquid.

I decided to plot the results in MATLAB using the Runge-Kutta solver, for the case of a constant flowrate $\dot q$.

The results are given below, for a radius of 10 meters, 10^-6 meters initial fluid level, and $\dot q$ = 1 m^3/s. The results are plotted over the amount of time it takes to fill the sphere, which can be easily calculated (without even any calculus) by computing the volume of the sphere, $\frac{4}{3}\pi R^3$, and dividing by $\dot q$ (4188 seconds):

# Gravitational Drainage of a Spherical Tank

Suppose we have a spherical tank, which has no inflow, but is draining an outflow out of its bottom due to the pull of gravity. The diagram below illustrates:

Objective: We want to calculate how long it takes to drain a full sphere of fluid, for a given set of initial conditions and physical parameters.

This problem is more complicated, since a second unknown arises due to the conservation of mechanical energy.

We’ll list some further assumptions:

1. We have a spherical tank with a small hole in the top and a hole in the bottom. The cross-sectional area of the bottom hole is known.

2. Due to the hole in the top of the sphere, we can assume that the pressure is equal at the fluid surface and at the bottom exit. The area of the top hole is not relevant to the problem.

3. We will assume inviscid flow that discounts the loss of energy due to viscous fluid effects and the creation of turbulent eddies near the drainage point.

4. We assume the size of the drainage hole is small enough that our tank does not deviate significantly from a spherical shape.

To repeat myself, I have already derived the differential equation for the fluid height as a function of time in this previous post. With some modification, we can derive this same kind of equation for the case of a draining sphere:

$\frac{dh}{dt} = \frac{-A_2v_2}{\pi(2Rh - h^2)}$

Where $A_2$ is the cross-sectional area of the drainage hole, and $v_2$ is the drainage velocity out of the exit.

It is here we are in a quandary. We know from physical intuition that $v_2$ is a function of time, since the liquid should drain more quickly the greater the amount of fluid there is in the tank (and there should be no flow at all if the tank were empty). The fluid level, $h$, is also unknown. We have one equation, but two unknowns. What is the second equation we need?

The answer is that we need to solve Bernoulli’s equation as well at each point in time, in additional to the differential equation for fluid height.

$\frac{1}{2}v_1^2 + gz_1 +\frac{P_1}{\rho} = \frac{1}{2}v_2^2 + gz_2 +\frac{P_2}{\rho}$

Substituting in our values gives us:

$\frac{1}{2}(\frac{dh}{dt})^2+gh=\frac{1}{2}v_2^2$

I eliminated the pressure terms because we have equal pressure everywhere due to the hole in the top of the sphere. The base of the sphere is the reference level for gravitational potential energy. All the other substitutions are straightforward. Thus, we have an algebraic equation for the drainage velocity, $v_2$.

$v_2^2 = (\frac{dh}{dt})^2+2gh$

Thus, in total, we have two equations that need to be solved simultaneously:

(1) A differential equation for the fluid height as a function of time

$\frac{dh}{dt} = \frac{-A_2v_2}{\pi(2Rh - h^2)}$

(2) An algebraic equation for the fluid exit velocity as a function of time

$v_2^2 = (\frac{dh}{dt})^2+2gh$

To solve this problem in MATLAB, one must use ode15s with the mass matrix in order to solve the differential-algebraic equation (DAE) system.

A plot below of the results is given, with an initial fluid height $h$ = 19.99 meters (remember, our radius was 10 meters, so 2R = 20), $A_2$ = 0.1 m^2, and $g$ = 9.81 m/s^2.

We can see that both the fluid velocity and the fluid level go to zero at the same time, which agrees with common sense. It is a coincidence that both terms start at the same value of about 20 despite having different units (using a radius of 50 meters confirms this).

From the plot above, we have calculated that it takes about 3,380 seconds to fully drain a 10-meter radius spherical tank, or about 56 minutes.