# Refilled Leaking container ODE

1. Feb 6, 2010

### SidVicious

I have to set up a differential equation for a leaking cylindrical container that is being refilled at a constant rate. Its leaking from the bottom, refilled from the top, and starts empty.
Wondered if someone could check if what i have done so far is right..?
h=height of water
A=cylinder cross section
a=hole cross section
v=speed of water out = Sqrt(2gh) using Torricelliâ€™s Law
b=rate of water going in

Rate of change of volume dV/dt= -av+b = A*dh/dt
Sub in v = Sqrt(2gh):
A*dh/dt=-a*sqrt(2gh)+b -----> dh/dt = (-a*Sqrt(2gh)+b)/A

Any errors?!
Thanks!

2. Feb 7, 2010

### torquil

Seems fine to me. As long as the formula for v is correct.

Torquil

3. Feb 7, 2010

### SidVicious

Thanks Torquil.
I have to solve this using Eulers method:
yn+1 = yn + hf(xn,yn)
xn+1 = xn + h
where h is a step in x, to be chosen.
y=height of water(original h)
x=t
f(x,y) = dh/dt

As there is no t on the rhs of the differential equation will this formula work?

n=o : yn=0(t=o)=0
n=1 : yn=1 = (yn=0) + h((-a*Sqrt(2g(yn=0))+b)/A)
n=2 : yn=2 = (yn=0) + h((-a*Sqrt(2g(yn=0))+b)/A) + h((-a*Sqrt(2g(yn=1))+b)/A)
etc..

I want to make a plot of y against x (height water vs time) at the end, can i do that using this method as there is no t on rhs...?!

Thanks again!

4. Feb 7, 2010

### torquil

Yes that seems correct. To plot the height vs time, plot the points y_n vs h*x_n, for all values of n. Try doing everything for various small values of h to determine if the result has converged. Maybe you can even perform the integral analytically and get an exact result to compare with your computer simulation.

Torquil

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook