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

More math ahead friends.

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 .

The results are given below, for a radius of 10 meters, 10^-6 meters initial fluid level, and = 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, , and dividing by (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:

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

It is here we are in a quandary. We know from physical intuition that 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, , 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.

Substituting in our values gives us:

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, .

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

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

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 = 19.99 meters (remember, our radius was 10 meters, so 2R = 20), = 0.1 m^2, and = 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.**