0

Im working in some Euler Equations about Draining a Conical Tank but I'm having problem when I plot the simulation.

enter image description here

My intention is reduce the radius of the tank while time increases. I want to delete the first blue line after the first cycle, but I don't know how :(

this is the code:

import matplotlib.pyplot as plt
import numpy as np

Hi=0.5
hf=0
r=0.003
ang=8*np.pi/180
teta=np.tan(ang)**2

dt=1
g=9.8
t=0
t1=0
h=Hi
h2=0
R=np.tan(ang)*h
R1=np.tan(ang)*

Vh=[h]
Vt=[t]
Rt=[R]

f1 = plt.figure(1)

plot1=plt.plot([R-r,0,2*R,R+r,R-r],[0,Hi,Hi,0,0],"k")
plot1=line=plt.plot([0,2*R],[h,h],"b")
plt.grid()
plt.ylabel("ALtura del agua")

while h>0 and R>0:
h=((5*((2*g)**(1/2))*r**2)/(-2*teta*((Hi**(3/2)))))*dt+h
R=(np.tan(ang)*h)
t=t+dt

plot1=line=plt.plot([R1-R,R1+R],[h,h],"b")

Vh.append(h)
Vt.append(t)
Rt.append(R)

line[0].set_ydata([h])

plt.pause(1/24)
plt.title("Tiempo = "+str(t))
eyllanesc
  • 235,170
  • 19
  • 170
  • 241

1 Answers1

0

Try this to delete the last line:

if h <= 0:
    h = 0

Vh.append(h)
Vt.append(t)
Rt.append(R)
line[0].set_ydata([h])
plt.pause(1/24)
plt.title("Tiempo = " + str(t))

Tell me if it was useful. Greetings

AleBuo
  • 195
  • 1
  • 9