# Homework Help: Water filling a barrel with leakage

1. Nov 6, 2014

### lkmarcum

1. The problem statement, all variables and given/known data
The flow of water into a barrel = 36.8 lb/sec.
The height of the water = h = weight of the water in the barrel/(density of water)(bottom area of barrel)

There is a "leak" at the bottom of the barrel at h = 0. Flow out of the barrel is related to the depth of the water in the barrel. The deeper the water in the barrel the faster it will flow out. For this barrel the water flow out in lb/sec is = 9.2*h.

The area of the barrel is A = 4.60 ft^2. The density of water is p = 62.4 lb/ft^3.

Develop a mathematical model to represent the height of the water in the barrel as a function of time.

2. Relevant equations
I'm given an equation for the theoretical height of the water:
htheo(t) = 4(1-exp(-.032t))
3. The attempt at a solution
I'm drawing a blank on this, unfortunately. I have to develop a model for h(t) to use in a Matlab script to produce a matrix for height values from t = 0 to 250 seconds.

My original thought was to set h = (36.8t - 9.2h)/(density*area) and then solve for h. But of course that resulted in a linear equation with no maximum height of the water. This is obviously incorrect since the water will eventually even out as the leak factor is equal to the incoming water, when h = 4 ft.

I simply cannot wrap my mind around how to set up an equation for this. Any help at all would be greatly appreciated!

2. Nov 6, 2014

### Staff: Mentor

Hi lkmarcum, Welcome to Physics Forums.

Is this implementation meant to be a numerical approximation (simulation), or are you meant to derive the closed form formula? The problem can be modeled by a differential equation which can either be solved symbolically or you can "integrate" it by numerical approximation (either using a built-in solver or by implementing your own numerical integrator).

3. Nov 7, 2014

### lkmarcum

The problem is presented in three parts:

1) Find a way to approximately model the height from t = 1 to 250

2) Find height values over the same time period using the equation for the theoretical height.

3) Plot the data from parts 1 and 2 to give a comparison.

Parts 2 and 3 are no problem. It's finding a way to model the system in Matlab for part 1 that is giving me fits.

4. Nov 7, 2014

### HallsofIvy

QUOTE="lkmarcum, post: 4905241, member: 530041"]1. The problem statement, all variables and given/known data
The flow of water into a barrel = 36.8 lb/sec.
The height of the water = h = weight of the water in the barrel/(density of water)(bottom area of barrel)

There is a "leak" at the bottom of the barrel at h = 0. Flow out of the barrel is related to the depth of the water in the barrel. The deeper the water in the barrel the faster it will flow out. For this barrel the water flow out in lb/sec is = 9.2*h.

The area of the barrel is A = 4.60 ft^2.[/quote]
So the volume when the water is h feet high is 4.60 h cubic feet.

The water is coming in at 36.8 lbs/sec the volume is increasing by 36.8/62.4= 0.590 ft^3/sec.
But water is also going out at 9.2h lbs/sec= (9.2/62.4)h= 0.147h ft^3/sec.

dV/dt is the rate at which the volume of water is changing: dV/dt= 0.590- 0.147h.
Since V= 4.60 h, dV/dt= 4.60 dh/dt= 0.590- 0.147h

5. Nov 7, 2014

### Staff: Mentor

So it looks like you want to create a numerical model, essentially a simulation of the system.

Consider a small time interval (time step) Δt at some instant t during the filling. At time t the current height of the water is h. How much water flows into the barrel during that time interval? How much (approximately) flows out during that interval? At the end of the time interval (new time = t + Δt), what's the new volume of water in the barrel, and thus the new height h?

Starting at t = 0, volume = 0, and h = 0, repeat the above saving values of h and t along the way, until your Δt's sum to 250 seconds. Play with the size of Δt to see how it affects accuracy compared to the theoretical result.

6. Nov 7, 2014

### lkmarcum

gneill - Thank you very much for your help. This definitely got me pointed in the right direction. Now I just need to figure out how to use a "for loop" to execute this in Matlab!

Again, thank you for taking the time!