import math
# Heating of water in a tube by Steam
# Variables
id_ = 0.025 #Internal diameter[m]
Tin = 15. #Initial temp[degree Celcius]
m_ = 0.3 #Flow rate[kg/s]
h = 800./1000 #avg heat transfer coefficient[W/m**2.degree Celcius]
Tf = 115. #Final temp of water[degree Celcius]
Ts = 120. #[degree Celcius]
Hs = 2203. #Heat of condensation of steam at 120 degree Celcius[kJ/kg]
Tavg = (Tin+Tf)/2 #[degree Celcius]
Cp = 4187. #Sp Heat of water at Tavg[J/kg.degree Celcius]
# Calculations and Results
Q_ = m_*Cp*(Tf-Tin)/1000 #[kW]
print "The rate of heat transfer is",Q_,"kW"
del_Tf = Ts-Tf #[degree Celcius]
del_Tin = Ts-Tin #[degree Celcius]
ln_del_T = (del_Tf-del_Tin)/(math.log(del_Tf/del_Tin)) #[degree Celcius]
print "Logrithmic Mean temperature difference is",ln_del_T,"degree Celcius"
A = Q_/(h*ln_del_T) #[m**2]
print "Heat Transfer surface area is",A,"m**2"
l = A/(math.pi*id_) #[m]
print "Required tube length is",round(l),"m"
import math
# Pressure Drop in a tube
# Variables
Tw = 5 #Temperature of water[degree Celcius]
#Properties of water at Tw
rho = 999.9 #[kg/m**3]
mu = 1.519*10**(-3) #Vismath.cosity[kg/m.s]
d = 0.003 #diameter[m]
l = 10 #length[m]
v_avg = 0.9 #Average flow velocity[m/s]
# Calculations and Results
Re = (rho*v_avg*d)/mu;
print "The reynolds number is ",Re
f = 64/math.ceil(Re);
print "Friction factor is",f
del_P = f*l*rho*(v_avg**2)/(2*d) #[N/m**2]
print "The Pressure drop is ",del_P/1000,"kPa"
V = v_avg*(math.pi*(d**2))/4 #[m**3/s]
print "Volumetric flow rate is",V,"m**3/s"
W_pump = V*del_P #[W]
print "Mechanical Power Input of",W_pump,"W"
print ("is needed to overcome the frictional losses in the flow due to viscosity")
import math
# Flow of Oil in a Pipeline through a Lake
# Variables
Ts = 0 #Temp of lake[degree Celcius]
Ti = 20 #Temp of oil[degree Celcius]
d = 0.3 #Diameter[m]
l = 200 #length of pipe[m]
#At 20 degree Celcius
rho = 888.1 #[kg/m**3]
nu = 9.429*10**(-4) #Kinematic vismath.cosity[m**2/s]
k = 0.145 #[W/m.degree Celcius]
Cp = 1880 #[J/kg.degree Celcius]
Pr = 10863 #Prandtl Number
v_avg = 2 #[m/s]
# Calculations and Results
Re = v_avg*d/nu;
print "The Reynolds number is",Re
Lt = 0.05*Re*Pr*d #[m]
print "The thermal entry length is",Lt,"m"
Nu = 3.66+((0.065*(d/l)*Re*Pr)/(1+(0.04*(((d/l)*Re*Pr)**(2./3)))));
h = (k*Nu)/d #[W/m**2.degree Celcius]
As = math.pi*d*l #[m**2]
m_ = rho*math.pi*((d/2)**2)*v_avg #[kg/s]
Te = Ts-((Ts-Ti)*math.exp((-h*As)/(m_*Cp))) #[degree Celcius]
print "Exit temperature of oil is",Te,"degree Celcius"
#Solution(b):-
ln_del_T = (Ti-Te)/(math.log((Ts-Te)/(Ts-Ti))) #[degree Celcius]
print "The logrithmic mean temperature difference is",ln_del_T,"degree Celcius"
Q = h*As*ln_del_T #[W]
print "The rate of heat loss from the oil are",Q,"W"
#Solution(c)
f = 64/Re #Friction factor is
del_P = l*rho*(v_avg**2)/(2*d) #[N/m**2]
print (del_P);
W_pump = m_*del_P/rho #[kW]
print "We need a ",W_pump/1000,"pump just to overcome the friction in the pipe as the oil flows"
import math
# Pressure Drop in a Water tube
# Variables
Tw = 15 #temp of water while entering[degree Celcius]
rho = 999.1 #[kg/m**3]
mu = 1.138*10**(-3) #Vismath.cosity[kg/m.s]
id_ = 0.05 #Internal diameter[m]
V = 5.5*10**(-3) #Flow rate[m**3/s]
l = 60 #length of tube[m]
e = 0.002*10**(-3) #[m]
#Solution:-
v = V/(math.pi*(id_**2)*(1./4)) #Mean Velocity[m/s]
Re = rho*v*id_/mu;
print "Reynolds Number is",Re
#Flow is turbulent
r = e/id_ #Relative roughness of the tube
def fric(fac):
Func[0] = (1/(fac[0]**(1./2)))+(2*math.log((0.00004/3.7)+(2.51/(122900*fac[0]**(1./2)))));
#print "Friction Factor is",xs
#del_P = xs*l*rho*(v**2)/(2*id_) #[kPa]
#print "The pressure drop is",del_P,"Pa"
W_pump = V*del_P #[W]
print "The required poer input tp overcome the frictional losses in the tube is",W_pump,"W"
import math
# Heating of water by Resismath.tance Heaters in a tube
# Variables
Ti = 15 #Initial Temp[degree Celcius]
Tf = 65 #Final Temp[degree Celcius]
d = 0.03 #Internal diameter[m]
l = 5 #length[m]
V = 10.*10**(-3) #flow rate of water[m**3/s]
Tavg = (Ti+Tf)/2 #[degree Celcius]
#Properties of water at Tavg
rho = 992.1 #[kg/m**3]
Cp = 4170 #[J/kg.degree Celcius]
k = 0.631 #[W/m.degree Celcius]
nu = 0.658*10**(-6) #[m**2/s]
Pr = 4.32 #Prandtl Number
# Calculations and Results
Ac = math.pi*(d**2)*(1./4) #[m**2]
As = math.pi*d*l #[m**2]
m_ = rho*V*(1./60) #[kg/s]
Q_ = m_*Cp*(Tf-Ti)/1000 #[kW]
print "The power rating of the heater is",Q_,"kW"
qs = Q_/As #[kW/m**2]
print "Heat flux is",qs,"kW/m**2"
v_avg = V/(Ac*60) #[m/s]
Re = v_avg*d/nu #[Reynolds Number]
Lt = 10*d #Entry length [m]
Nu = 0.023*(Re**(0.8))*(Pr**(0.4));
print "The nussel number is",Nu
h = k*Nu/d #[W/m**2]
Ts = Tf+(qs*1000/h) #[degree Celcius]
print "The surface temperature of the pipe at the exit becomes",round(Ts),"degree Celcius"
import math
# Heat Loss from the ducts of a Heating System
# Variables
Ti = 80 #Inlet temp[degree Celcius]
A = 0.2*0.2 #Area of cross section[m**2]
l = 8 #Length of tube[m]
V = 0.15 #[m**3/s]
Td = 60 #Temperature of duct[degree Celcius]
#Properties of air at inlet conditions
rho = 0.9994 #[kg/m**3]
Cp = 1008 #[J/kg.degree Celcius]
k = 0.02953 #[W/m.degree Celcius]
nu = 2.097*10**(-5) #[m**2/s]
Pr = 0.7154 #Prandtl number
# Calculations and Results
Dh = 4*A/(4*0.2) #Hydraulic Diameter[m]
v_avg = V/A #[m/s]
Re = v_avg*Dh/nu;
print "Reynolds number is",Re
Lt = 10*Dh #Entry length
Nu = 0.023*(Re**(0.8))*(Pr**(0.3));
h = Nu*k/Dh #[W/m**2.degree Celcius]
As = 4*0.2*l #[m**2]
m_ = rho*V #[kg/s]
Te = Td-((Td-Ti)*math.exp((-h*As)/(m_*Cp))) #[degree Celcius]
print "The exit temperature of air is",Te,"degree Celcius"
ln_delT = (Ti-Te)/(math.log((Td-Te)/(Td-Ti))) #[degree Celcius]
Q = h*As*ln_delT #[W]
print "The math.logrithmic mean temperature difference and the rate of heat loss from the air are" \
,ln_delT,"degree Celcius","and",round(Q),"W","respectively"
import math
# Non-isothermal fully developed Friction in the Transition Region
# Variables
q = 8 #Wall heat flux[kW/m**2]
xm = 0.34 #Mass fraction
d = 0.0158 #Inside diameter[m]
V = 1.32*10**(-4) #Flow rate[m**3/s]
Pr = 11.6 #Prandtl Number
nu = 1.39*10**(-6) #[m**2/s]
p = 1.14 #(mu_b/mu_s)i.e. ratio of vismath.cosities of two subsmath.tances
Gr = 60800 #Grashof number
# Calculations and Results
Ac = math.pi*(d**2)*(1./4) #[m**2]
Re = (V/Ac)*d/nu;
print "Reynolds number is",Re
#For bell mouth inlet shape
Cf1 = ((1+((round(Re)/5340)**(-0.099)))**(-6.32))*(p**(-2.58-0.42*(60.800**(-0.41))*(11.6**0.265)));
print "For bell mouth inlet friction coefficient is",Cf1
#For square edged inlet Case
Cf2 = (0.0791/(Re**(0.25)))*(p**(-0.25));
print "For square edged inlet case coefficient of friction is",Cf2
import math
# Heat transfer in the Transition Region
# Variables
xm = 0.6 #mass fraction of glycol
V = 2.6*10**(-4) #Flow rate[m**3/s]
d = 0.0158 #inside diameter[m]
Gr = 51770 #grashof number
Pr = 29.2 #Prandtl number
nu = 3.12*10**(-6) #[m**2/s]
p = 1.77 #mu_t/mu_s
q = 90 #A particular loctaion x with x/d = q
# Calculations and Results
Ac = math.pi*(d**2)/4;
Re = (V/Ac)*d/nu;
print "Reynolds Number is",Re
#Value of Re lies in transition Region
Nu_lam = 1.24*(((Re*Pr/q)+(0.025*((Gr*Pr)**(0.75))))**(1./3))*(p**(0.14));
Nu_tur = 0.023*(Re**(0.8))*(Pr**0.385)*(q**(-0.0054))*(p**(0.14));
#(a)
Nu_tran_a = Nu_lam+((math.exp((1766-Re)/276)+(Nu_tur**(-0.955)))**(-0.955));
print "(a) Nusselt number for re-entrant inlet is",Nu_tran_a
Nu_tran_b = Nu_lam+((math.exp((2617-Re)/207)+(Nu_tur**(-0.950)))**(-0.950));
print "(b) Nusselt number for square edged inlet is",Nu_tran_b
Nu_tran_c = Nu_lam+((math.exp((6628-Re)/237)+(Nu_tur**(-0.980)))**(-0.980));
print "(c) Nusselt number for bell mouth inlet is",Nu_tran_c