#Calculate first derivative and second derivative of the fluid flow
# variables
y_fd2=0.4336 #m
y_fd1=0.4375 #m
delta_yfd=y_fd2-y_fd1 #m
x_fd2=0.75 #m
x=0.5 #m
delta_xfd=x_fd2-x #m
y_bd2=0.4375 #m
y_bd1=0.2461 #m
delta_ybd=y_bd2-y_bd1 #m
x_bd1=0.25 #m
delta_xbd=x-x_bd1 #m
# calculation
#Let D denote d/dx and D2 denote d^2/dx^2
Dy_fd=delta_yfd/delta_xfd #dimentionless
Dy_bd=delta_ybd/delta_xbd #dimentionless
Dy=(Dy_fd+Dy_bd)/2 #dimentionless
D2y=(Dy_fd-Dy_bd)/delta_xfd #dimentionless
# result
print "The first derivative of fluid flow is %f\n"%Dy
print "The second derivative of fluid flow is %.3f"%D2y
#Calculate the grid velocities
# variables
v=1.077*10**(-5) #ft^2/s
t=2. #sec
dy=0.01 #ft
w=v*t/dy**2 #dimentionless
#Let Vij represent velocity through the i,j grid
V00=5. #ft/s
V10=5. #ft/s
V01=0. #ft/s
V02=0. #ft/s
V12=0. #ft/s
# calculation
V11=V01+w*(V00-2*V01+V02) #ft/s
V21=V11+w*(V10-2*V11+V12) #ft/s
V13=0. #ft/s
V22=V12+w*(V11-2*V12+V13) #ft/s
# result
print "The grid velocity for 2,1 is %.3f ft/s\n"%V21
print "The grid velocity for 2,2 is %.3f ft/s\n"%V22