from sympy import symbols,diff,pi
#Variable Initialisation
x, y,z,c,u,eta,delt,U=symbols("x y z c u delt U eta")
#Calculation
u=sin(U*pi*y/2*delt) #Given equation 1
#Let us take a=(du/dy)
a=diff(u,y,2) #differentiating
#At y=0,u=U sin(0),
b=a.subs(y,0) #Substituting 0 for y
print "(a)(d**2u/dy**2)=",b
#At y=delt,u=U sin(pi/2)
b=a.subs(y,pi/2) #Substituting pi/2 for y
print "(d**2u/dy**2)=",b,"not equal to 0"
print "Hence all essential and one desirable boundary condition are satisfied"
u=U*(1+eta-2*eta**2) #Given equation 2
#Let us take a=(du/dy)
u=u.subs(eta,y/delt)
a=diff(u,y,2) #differentiating
#At y=0,u=U sin(0),
b=a.subs(y,0) #Substituting 0 for y
print "(b)(d**2u/dy**2)=",b,"not equal to 0"
#At y=delt,u=0
b=a.subs(y,delt) #Substituting delt for y
print "(d**2u/dy**2)=",b,"not equal to 0"
print "Hence this is not a proper locality distribution in a laminar boundary layer"
import math
#variable initialisation
U=6 #free stream velocity in m/s
L=45 #length in cm
v=0.9 #kinematic viscosity in stoke
rho=0.925 #relative density of oil
B=15 #Width of plate in cm
#Calculation
L=L/100 #converting into m
v=0.9/10000 #1 stoke=(10^-4) m^2/s
rho=rho*1000
B=B/100 #Converting into m
Re_L=(U*L)/v #calculating reynolds number
#Since Re_L is less than Re(crit)=5.0E5,the boundary layer is laminar
#Using Blasius' results
#del/x=5.0/math.sqrt(Rex)
x=0.45 #At the trailing edge
delta_L=round(((5.0*L)/math.sqrt(Re_L))*100,1)#Boundary layer thickness
print "delta_L=",delta_L,"cm"
#tau_L=(rho*U**2/2)*(Cf*L),wheren Cf=(0.664/math.sqrt(Re_L))
tau_L=round(((rho*(U**2))/2)*(0.664/math.sqrt(Re_L)),1)
print "tau_L=",tau_L,"N/m^2" #shear stress at the trailing edge
#F_D=C_Df*(L.B)*rho*U**2/2 where,C_Df=1.328/math.sqrt(Re_L)
C_Df=1.328/(math.sqrt(Re_L))
F_D=round(C_Df*(L*B)*(rho*(U**2))/2,3) #Drag on one side of the plate
print "F_D=",F_D,"N"
F_2D=2*F_D #on both sides of the plate
print "F_2D=",round(F_2D,2),"N"
import math
#variable initialisation
x=1.25 #At the centre of plate
U=1.5 #free stream velocity in m/s
v=0.0001 #kinematic viscosity in stoke
rho=0.8*1000 #relative density of oil
B=2 #Width of plate in m
#Calculation
#(a)At the centre of plate
Re_x=(x*U)/v
#This is less than Re(crit)=5E5 and hence boundary layer is laminar
#del/x=5.0/math.sqrt(\Re_x)
delta_m=round((5.0*x)/(math.sqrt(Re_x))*100,2)
print "delta_m=",delta_m,"cm"
C_f=0.664/math.sqrt(Re_x) #local friction coefficient
tau_0m=round(C_f*(rho*(U**2))/2,3) #shear stress
print "tau_m=",tau_0m,"N/m^2"
x=L=2.5 #(b)At the trailing edge
Re_L=(L*U)/v
#This is less than Re(crit)=5E5 and hence boundary layer is laminar
delta_L=round(5.0*L/(math.sqrt(Re_L))*100,2)
print "delta_L=",delta_L,"cm"
C_f=0.664/math.sqrt(Re_L) #local friction coefficient
tau_0L=round(C_f*(rho*(U**2))/2,3) #shear stress
print "tau_0L=",tau_0L,"N/m^2"
#F=C_Df*area*(rho*(U**2)/2 #(c)Total force
C_Df=1.328/(math.sqrt(Re_L))
area=2*L*B
F=C_Df*area*(rho*(U**2))/2
print "F=",round(F,2),"N"
P=F*U
print "P=",round(P,2),"W"
import math
#variable initialisation
U=3.0 #Velocity in m/s
v=1.45E-5 #velocity of air in m^2/s
rho_a=1.2 #density in kg/m^3
Re=5E+5 #critical reynolds number
w=1.5 #width in m
#solution
L=round((Re*v)/U,3) #Maximum Length of plate
print "L=",L,"m"
C_df=(1.328)/(math.sqrt(Re)) #length of plate in a laminar sublayer
F_D=C_df*(w*L)*((2*(U**2))/2) #Drag force in one side of the plate
print "F_D=",round(F_D/100*60,5),"N"
import math
#variable initialisation
U=2 #free stream velocity in m/s
L=20 #length in m
v=1*(1/1000000) #kinematic viscosity in stoke
Re_crit=5*100000 #critical Reynolds number
rho=998 #Relative density
#Calculation
Re_L=U*L/v
#The boundary layer is turbulent at the trailing edge.
#(i)Taking the critical reynolds number
x_crit=(Re_crit)*v/U
print "x_crit",int(x_crit*100),"cm"
#Laminate boundary layer exists in the first 25cm of the plate
delta_c=5.0*x_crit/(math.sqrt(Re_crit))*1000
print "delta_c=",round(delta_c,3),"mm"
#At the trailing edge,as reynolds numbere is >E7,the thickness is obtained by putting,
x=L=20
Re_x=U*L/v
delta_t=(0.22*x)/((Re_x)**(1/6))*100
print "delta_t=",round(delta_t,1),"cm"
#(iii)shear stress coefficient
C_f=0.370/(log(Re_x,10))**(2.58)
tau_0=C_f*(rho*(U**2))/2
print "tau_0=",round(tau_0,2),"Pa"
import math
#variable initialisation
mu=1.8E-6 #viscosity in poise
rho=1.22 #relative density
U=1.75 #free stream velocity in m/s
L=5 #Length in m
B=1.8 #width in m
#Calculation
mu=(mu)*10 #in Poise
v=mu/rho #calculating kinematic viscosity in stoke
Re_L=U*L/v #Reynolds number
#(i)For laminar boundary layer:
C_DF=1.328/(math.sqrt(Re_L)) #Drag Coefficient
area=B*L
F_D=C_DF*area*(rho*(U**2)/2)
print "F_D=",round(F_D,3),"N"
#(ii)For turbulent boundary layer:
#since Re_L is between 5E5 and E7,the 1/7 th power law is applicable.
C_DF=0.074/((Re_L)**(1/5)) #Drag coefficient
area=B*L
F_D=C_DF*area*(rho*(U**2)/2) #Drag force on one side of the plate
print "F_D=",round(F_D,4),"N"
import math
#variable initialisation
U=1.5 #velocity in m/s
L=35 #Length in m
mu=0.001 #viscosity in Pa.s
rho=1025 #relative density in kg/m^3
b=10 #breadth in m
ep=0.002 #roughness height in m
#Calculation
v=mu/rho #calculating velocity
ReL=(U*L)/v #Reynolds number
#The flow is turbulent in the boundary layer.
C_Df=round((0.455/(log(ReL,10))**(2.58))-(1700/ReL),5) #Drag coefficient
area=b*L #area
F_D=int(C_Df*area*((rho*U**2)/2))#drag force on the bottom of the barge
print "F_D=",F_D,"N"
s=L/ep
C_Df=1/((1.89+1.62*(log(s,10)))**(2.5)) #For a rough flat boundary
F_D=int(C_Df*area*((rho*U**2)/2)) #Drag force
print "F_D=",F_D,"N"
#variable initialisation
V=20 #velocity in km/h
L=6 #length in m
rho=1.2 #relative density in kg/m^3
v=1.5E-5 #kinematic viscosity in stoke
B=1 #Breadth in m
#Calculation
U=round(V*1000/3600,2) #Wind velocity
Re_L=U*L/(v) #Reynolds number
#The boundary layer is turbulent and the drag coefficient is corresponding to the power law,
C_DF=round((0.074/(Re_L)**(1/5))-(1700/(Re_L)),6)
area=B*L
F_D=round(C_DF*area*(rho*(U**2))/2,4)
print "F_D=",F_D,"N"
#The turbulent boundary layer thickness at trailing edge:
x=L=6 #in m
delta=round(L*(0.3773/(Re_L**(1/5)))*100,2)
print "delta=",delta,"cm"
#variable initialisation
U=3 #free stream velocity in m/s
L=3 #Length in m
v=1E-6 #kinematic viscosity in stoke
rho=998 #Relative density in kg/m^3
area=3.50 #area in m^2
Total=70 #total measured drag in N
#Calculation
Re_L=U*L/v
#The boundary layer is turbulent
C_DF=(0.074/(Re_L**(1/5)))-(1700/Re_L) #Drag coefficient
F_D=round(C_DF*area*(rho*(U**2))/2,1)
print "F_D=",F_D,"N"
#total measured drag=skin friction drag+wave drag
F_DW=Total-F_D
print "F_DW=",F_DW,"N"
#variable initialisation
U=5 #velocity in m/s
L=10 #Length in m
mu=0.0018 #viscosity in Pa.s
rho=1020 #relative density in kg/m^3
b=2 #breadth in m
ep=0.005 #roughness height in m
#Calculation
ReL=(U*L*rho)/mu #Reynolds number
#The flow is turbulent in the boundary layer.
area=b*L*2 #area
s=L/ep
C_Df=1/((1.89+1.62*(log(s,10)))**(2.5)) #For a rough flat boundary
F_D=int(C_Df*area*((rho*U**2)/2)) #Drag force
P=(F_D*U)/1000
print "P=",round(P,1),"kW"
#variable initialisation
Up=10 #speed of prototype
Lm=1 #length of model
Lp=30 #length of prototype
area=1600 #wetted area
rho=1025 #relative density
mu=1.07E-3 #dynamic viscosity in Pa.s
Tm=20 #total measured drag
rho_r=1 #relative density
Lr=(1/30) #ratio of model
#Calculation
#two drage:surface,wave.m for model and p for prototype
#Froude number
Um=round(Up*(math.sqrt(Lm/Lp)),3)
Am=round(area*((Lm/Lp)**2),3)
Lm=100*(Lm/Lp)
Lp=100
ReLP=((rho*Up*Lp)/mu) #Reynolds number
ReLM=rho*Um*Lm/mu
#The boundary is turbulent
C_Dfm=(0.074/(ReLM**(1/5)))-(1700/ReLM)
Fsm=C_Dfm*Am*((rho*(Um**2))/2) #surface resistance
Fwm=Tm-Fsm
#Fwm is modelled by Froude's law,
Fwp=round(Fwm/(rho_r*(Lr**3))/1000,1) #wave drag
C_Dfp=round((0.455/(log(ReLP,10))**(2.58))-(1700/ReLP),5) #Drag coefficient
Fsp=round(C_Dfp*area*((rho*(Up**2))/2)/1000,1)
Fp=Fwp+Fsp #Total prototype drag
print "Fp=",round(Fp,0),"kN"