from __future__ import division
import math
#Initializing the variables
x = 120; #Theta
r = 1;
v0 = 0.5;
q = 2;
theta =120;
#Calculations
Vr = v0*r*math.cos(math.radians(theta)) +q/(2*math.pi)
Vth = -v0*math.sin(math.radians(theta))
V = (Vr**2+Vth**2)**0.5;
alpha = math.atan(abs(Vth/Vr));
bet = x-alpha*180/math.pi;
print "Fluid Velocity(m/s) :",round(V,3)
print "Beta (Degree) :",round(bet,2)
print "Alpha (Degree) :",round(alpha*180/math.pi,2)
from __future__ import division
import math
from scipy.optimize import fsolve
import sympy
from sympy import RootOf, I, Symbol
#Initializing the variables
q = 10;
def shi(x,y):
Z = (q/2/math.pi)*(math.atan(y/(x-1))-math.atan(y/(x+1))) - 25*y;
return Z
h = 0.0000001;
Vinf = 25;
x=Symbol('x')
#Calculations
#f = lambda x : x**2 - 2/(5*math.pi) -1
result = [RootOf(x**2- 2/(5*math.pi) -1,i) for i in (0,1)]
root1=round(result[0],3)
root2=round(result[1],3)
l = abs(abs(root1)+abs(root2));
Ymax = 0.047;
width = 2*Ymax;
Vx = (shi(1-h,1)-shi(1-h,1-h))/h; # At x=1 the function atan is not defined hence taking x a little smaller.
Vy = -1*(shi(1-2*h,1)-shi(1-h,1))/h; # At x=1 the function atan is not defined hence taking x a little smaller.
V = (Vx**2+Vy**2)**0.5;
rho = Symbol('rho')
dP = rho/2*round((V**2 - Vinf**2),2); #difference in pressure
print "Pressure Difference (N/m2) :",dP
print "Velocity (m/s) :",round(V,2)
print "Length of Rankine Body(m) :",l
print "Width of Rankine Body (m) :",width
from __future__ import division
import math #Example 7.4
#Initializing the variables
a = 0.02;
r = 0.05;
V0 = 1;
x = 135; # Theta
def shi(r,x):
Z = V0*math.sin(math.radians(x))*(r-((a**2)/r));
return Z
h = 0.0001;
#Calculations
Vr = 57*(shi(r,x+h)-shi(r,x))/(r*h);
Vx = -1*(shi(r+h,x)-shi(r,x))/h;
print "Radial Velocity (m/s) :",round(Vr,3)
print "Normal component of velocity (m/s):",round(Vx,3)
from __future__ import division
import math
#Initializing the variables
rho = 1000;
r = 2;
psi = 2*math.log(r);
#Calculations
y = psi/math.log(r); # y = GammaC / 2*pi
v = y/r;
dPbydr = rho*v**2/r;
print "Pressuer Gradient (N/m3 ) :",dPbydr