import math
# Temperature Rise of Oil is a Journal Bearing
# Variables
k = 0.145 #[W/m.K]
mu = 0.8374 #[kg/m.s]or[N.s/m**2]
T1 = 20 #Temperature of both the plates[degree Celcius]
t = 0.002 #Thickness of oil film between the plates[m]
v = 12 #Velocity with which plates move[m/s]
# Calculations and Results
#Relation between velocity and temperature variation
print ("T(y) = T0+(mu*(v**2)/(2*k))[(y/L)-((y/L)**2)]")
#The location of maximum temperature is determined by setting dT/dy = 0 and solving for y
#(mu*(v**2)/(2*k*L))*(1-(2*y/L)) = 0
L = 1 #Random initialisation of variable L, where L is length of plates
y = L/2.;
#T_max = T(L/2)
T_max = T1+((mu*(v**2)/(2*k))*(((L/2)/L)-(((L/2)**2)/(L**2))));
print "Maximum temperature occurs at mid plane and its value is",T_max,"degree Celcius"
#heat flux q0 = -kdt/dy|y = 0; = -kmu*v**2/(2*k*L)
q0 = -(mu*k*(v**2)/(2*k*t))/1000 #Heat flux from one plate [kW/m**2]
qL = -((k*mu*(v**2))*(1-2)/(2*k*t*1000)) #Heat flux from another plate[kW/m**2]
print "Heat fluxes at the two plates are equal in magnitude but opposite in sign and \
the value of magnitude is",qL,"kW/m**2"
import math
# Finding Convection Coefficient from Drag Measurement
# Variables
#Properties of air
rho = 1.204 #[kg/m**3]
Cp = 1007 #[J/kg.K]
Pr = 0.7309 #Prandtl number
w = 2 #Width of plate[m]
L = 3 #Characteristic length of plate[m]
v = 7 #velocity of air[m/s]
Fd = 0.86 #Total grag force[N]
# Calculations
As = 2*w*L #Since both sides of plate are math.exposed to air flow[m**2]
#For flat plates drag force is equivalent to friction coefficient Cf
Cf = Fd/(rho*As*(v**2)/2);
h = (Cf*rho*v*Cp)/(2*(Pr**(2./3))) #[W/m**2.degree Celcius]
# Results
print "Friction Factor and average heat transfer coefficient are",Cf,"and",h,"W/m**2.degree Celcius","respectively"