import math
#calculate Displacement thickness and Momentum thickness
delta=0.6; ## mm
delta1=delta/3.;
theta=2./15*delta;
print'%s %.1f %s'%("Displacement thickness =",delta1,"mm")
print'%s %.2f %s'%("Momentum thickness =",theta,"mm")
import math
#Evaluate the constants A and B
import numpy
from numpy import linalg
import scipy
from scipy import integrate
## To determine the values of a1 & a2 following conditions must be satisfied
## Condition I - When n=0, u/um=0
## Condition II - When n=1, u/um=a1+a2=1
## Condition III - When n=1, d(u/um)/dn = a1+2a2=0
## By satisfying these conditions, we have
## a1+a2=1;
## a1+2a2=0;
A=([[1,1],[1,2]]);
B=([[1],[0]]);
X=numpy.linalg.inv(A)*B;
a1=X[0];
a2=X[1];
print("a1=",a1[0])
print("a2=",a1[1])
print("Evaluate the constants A and B")
## A = integrate('(1-f(n))*f(n)','n',0,1)
def function(n):
fun=(1-(2*n-n**2))*(2*n-n**2)
return fun
A=scipy.integrate.quad(function,0,1)
print("A = ",A[0],"")
## B = differentiation of (2*n-n^2) at n=0, we get
B=2;
print("B =",B,"")
import math
#Evaluate the constants A and B
import numpy
from numpy import linalg
import scipy
from scipy import integrate
## To determine the values of a1 & a2 following conditions must be satisfied
## Condition I - When n=0, u/um=0
## Condition II - When n=1, u/um=a1+a2=1
## Condition III - When n=1, d(u/um)/dn = a1+2a2=0
## By satisfying these conditions, we have
## a1+a2=1;
## a1+2a2=0;
A=([[1,1],[1,2]]);
B=([[1],[0]]);
X=numpy.linalg.inv(A)*B;
a1=X[0];
a2=X[1];
print("a1=",a1[0])
print("a2=",a1[1])
print("Evaluate the constants A and B")
## A = integrate('(1-f(n))*f(n)','n',0,1)
def function(n):
fun=(1-(2*n-n**2))*(2*n-n**2)
return fun
A=scipy.integrate.quad(function,0,1)
print("A = ",A[0],"")
## B = differentiation of (2*n-n^2) at n=0, we get
B=2;
print("B =",B,"")
import math
#calculate the velocity of the airstream and frictional drag of the plat
v=1.5*10**(-5); ## m^2/s
Re_t=5.*10**5;
x_t=1.2; ## m
rho=1.21; ## kg/m^3
u_m=v*Re_t/x_t;
print'%s %.2f %s'%("the velocity of the airstream =",u_m,"m/s")
theta=0.646*x_t/math.sqrt(Re_t);
F=rho*u_m**2*theta;
D_F=2.*F*x_t;
print'%s %.3f %s'%("the frictional drag of the plate, D_F =",D_F,"N")
import math
#calculate the boundary layer thickness at the rear of the train and the frictional drag acting on the train and the power required to overcome the frictional drag
u_m = 50.; ## m/s or 180 km/h
v=1.5*10**(-5); ## m^2/s
l=100.; ## m
rho=1.2; ## kg/m^3
b=8.3; ## m
delta = 0.37*(v/u_m)**(1/5.)*l**(4/5.);
print'%s %.3f %s'%("the boundary layer thickness at the rear of the train =",delta,"m")
Re_l = u_m*l/v;
C_F=0.074*(Re_l)**(-1/5.);
F=0.037*rho*u_m**2*l*Re_l**(-1/5.);
D_F = F*b;
print'%s %.4f %s'%("the frictional drag acting on the train, D_F =",D_F,"N")
P=D_F*u_m;
print'%s %.1f %s'%("the power required to overcome the frictional drag =",P/1000,"kW")
import math
#calculate the proportion of the plate occupied by the laminar boundary layer and the skin friction coefficient CF evaluated at the trailing edge
Re_t=5.*10**5;
Re_l=5.*10**6;
r1=Re_t/Re_l; ## r1=x_t/l
r2=1-36.9*(1./Re_t)**(3/8.); ## r2=x_0/x_t
r=r1*r2; ## r=x_0/l;
print'%s %.2f %s'%("the proportion of the plate occupied by the laminar boundary layer =",r*100,"%")
C_F = 0.074/Re_l**(1/5.)*(1-r)**(4/5.);
print'%s %.4f %s'%("the skin friction coefficient CF evaluated at the trailing edge =",C_F,"")