import math
#Operating Conditions
h = 400.; #[W/m^2.K] Heat Convection coefficient
k = 20.; #[W/m.K] Thermal Conductivity of Blade
c = 400.; #[J/kg.K] Specific Heat
rho = 8500.; #[kg/m^3] Density
Ti = 25+273.; #[K] Temp of Air
Tsurr = 200+273.; #[K] Temp of Gas Stream
TimeConstt = 1; #[sec]
#calculations
#From Eqn 5.7
D = 6*h*TimeConstt/(rho*c);
Lc = D/6.;
Bi = h*Lc/k;
#From eqn 5.5 for time to reach
T = 199+273.; #[K] Required temperature
t = rho*D*c*2.30*math.log10((Ti-Tsurr)/(T-Tsurr))/(h*6.);
#results
print '%s %.2e %s' %("\n\n Junction Diameter needed for a time constant of 1 s = ",D," m")
print '%s %.2f %s' %("\n\n Time Required to reach 199degC in a gas stream =",t," sec ");
#END
import math
#Operating Conditions
h = 400; #[W/m^2.K] Heat Convection coefficient
k = 20; #[W/m.K] Thermal Conductivity of Blade
c = 400; #[J/kg.K] Specific Heat
e = .9; #Absorptivity
rho = 8500; #[kg/m^3] Density
Ti = 25+273; #[K] Temp of Air
Tsurr = 400+273; #[K] Temp of duct wall
Tg = 200+273; #[K] Temp of Gas Stream
TimeConstt = 1; #[sec]
stfncnstt=5.67*math.pow(10,(-8)); # [W/m^2.K^4] - Stefan Boltzmann Constant
#calculations and results
#From Eqn 5.7
D = 6*h*TimeConstt/(rho*c);
As = math.pi*D*D;
V = math.pi*D*D*D/6;
#Balancing Energy on thermocouple Junction
#Newton Raphson method for 4th order eqn
T=500;
#After newton raphson method
T=490.7
print '%s %.2f %s' %("\n (a) Steady State Temperature of junction =",T-273,"degC\n");
#Using Eqn 5.15 and Integrating the ODE
# Integration of the differential equation
# dT/dt=-A*[h*(T-Tg)+e*stefncnstt*(T^4-Tsurr^4)]/(rho*V*c) , T(0)=25+273, and finds the minimum time t such that T(t)=217.7+273.15
T0=25+273;ng=1;
rd=4.98
print '%s %.2f %s' %("\n (b) Time Required for thermocouple to reach a temp that is within 1 degc of its steady-state value = ",rd," s\n");
#END
#Variable Initialization
import math
#Operating Conditions
ho = 40; #[W/m^2.K] Heat Convection coefficient
hc = 10; #[W/m^2.K] Heat Convection coefficient
k = 177; #[W/m.K] Thermal Conductivity
e = .8; #Absorptivity
L = 3*math.pow(10,-3) /2.; #[m] Metre
Ti = 25+273; #[K] Temp of Aluminium
Tsurro = 175+273; #[K] Temp of duct wall heating
Tsurrc = 25+273; #[K] Temp of duct wall
Tit = 37+273; #[K] Temp at cooling
Tc = 150+273; #[K] Temp critical
stfncnstt=5.67*math.pow(10,(-8)); # [W/m^2.K^4] - Stefan Boltzmann Constant
p = 2770; #[kg/m^3] density of aluminium
c = 875; #[J/kg.K] Specific Heat
#calculations and results
#To assess the validity of the lumped capacitance approximation
Bih = ho*L/k;
Bic = hc*L/k;
print '%s %.1f %s %.1f' %("\n Lumped capacitance approximation is valid as Bih =",Bih," and Bic = ",Bic);
#Eqn 1.9
hro = e*stfncnstt*(Tc+Tsurro)*(Tc*Tc+Tsurro*Tsurro);
hrc = e*stfncnstt*(Tc+Tsurrc)*(Tc*Tc+Tsurrc*Tsurrc);
print '%s %.1f %s %.1f %s' %("\n Since The values of hro = %",hro," and hrc =",hrc,"are comparable to those of ho and hc ");
# Integration of the differential equation
# dy/dt=-1/(p*c*L)*[ho*(y-Tsurro)+e*stfncnstt*(y^4 - Tsurro^4)] , y(0)=Ti, and finds the minimum time t such that y(t)=150 degC
te = 423.07
tc=123.07
#From equation 5.15 and solving the two step process using integration
Ty0=Ti;
tt=564
# solution of integration of the differential equation
# dy/dt=-1/(p*c*L)*[hc*(y-Tsurrc)+e*stfncnstt*(y^4 - Tsurrc^4)] , y(rd(1))=Ty(43), and finds the minimum time t such that y(t)=37 degC=Tit
t20=te;
print '%s %d %s' %("\n\n Total time for the two-step process is t =",tt+te,"s");
print '%s %d %s %d %s' %("with intermediate times of tc =",tc," s and te =",te,"s.");
#END
import math
#Operating Conditions
h = 500; #[W/m^2.K] Heat Convection coefficientat inner surface
k = 63.9; #[W/m.K] Thermal Conductivity
rho = 7832; #[kg/m^3] Density
c = 434; #[J/kg.K] Specific Heat
alpha = 18.8*math.pow(10,-6);#[m^2/s]
L = 40.*math.pow(10,-3); #[m] Metre
Ti = -20+273; #[K] Initial Temp
Tsurr = 60+273; #[K] Temp of oil
t = 8*60 ; #[sec] time
D = 1 ; #[m] Diameter of pipe
#calculations
#Using eqn 5.10 and 5.12
Bi = h*L/k;
Fo = alpha*t/(L*L);
#From Table 5.1 at this Bi
C1 = 1.047;
eta = 0.531;
theta0=C1*math.exp(-eta*eta*Fo);
T = Tsurr+theta0*(Ti-Tsurr);
#Using eqn 5.40b
x=1;
theta = theta0*math.cos(eta);
Tl = Tsurr + (Ti-Tsurr)*theta;
q = h*(Tl - Tsurr);
#Using Eqn 5.44, 5.46 and Vol per unit length V = pi*D*L
Q = (1-(math.sin(eta)/eta)*theta0)*rho*c*math.pi*D*L*(Ti-Tsurr);
#results
print '%s %.2f %s' %("\n (a) After 8 min Biot number =",Bi," and");
print '%s %.2f' %("\n \n Fourier Numer =",Fo)
print '%s %.2f %s' %("\n\n (b) Temperature of exterior pipe surface after 8 min = ",T-273,"degC")
print '%s %.2f %s' %("\n\n (c) Heat Flux to the wall at 8 min = ",q,"W/m^2")
print '%s %.2e %s' %("\n\n (d) Energy transferred to pipe per unit length after 8 min =",Q," J/m")
#END
import math
#Operating Conditions
ha = 10.; #[W/m^2.K] Heat Convection coefficientat air
hw = 6000.; #[W/m^2.K] Heat Convection coefficientat water
k = 20.; #[W/m.K] Thermal Conductivity
rho = 3000.; #[kg/m^3] Density
c = 1000.; #[J/kg.K] Specific Heat
alpha = 6.66*math.pow(10,-6); #[m^2/s]
Tiw = 335+273.; #[K] Initial Temp
Tia = 400+273.; #[K] Initial Temp
Tsurr = 20+273.; #[K] Temp of surrounding
T = 50+273.; #[K] Temp of center
ro = .005; #[m] radius of sphere
#calculations
#Using eqn 5.10 and
Lc = ro/3.;
Bi = ha*Lc/k;
ta = rho*ro*c*2.30*(math.log10((Tia-Tsurr)/(Tiw-Tsurr)))/(3*ha);
#From Table 5.1 at this Bi
C1 = 1.367;
eta = 1.8;
Fo = -1*2.30*math.log10((T-Tsurr)/((Tiw-Tsurr)*C1))/(eta*eta);
tw = Fo*ro*ro/alpha;
#results
print '%s %.1f %s' %("\n (a) Time required to accomplish desired cooling in air ta =",ta," s")
print '%s %.2f %s' %("\n\n (b) Time required to accomplish desired cooling in water bath tw =",tw,"s");
#END
import math
k = .52; #[W/m.K] Thermal Conductivity
rho = 2050; #[kg/m^3] Density
c = 1840; #[J/kg.K] Specific Heat
Ti = 20+273.; #[K] Initial Temp
Ts = -15+273.; #[K] Temp of surrounding
T = 0+273.; #[K] Temp at depth xm after 60 days
t = 60*24*3600.; #[sec] time perod
#calculations
alpha = k/(rho*c); #[m^2/s]
#Using eqn 5.57
xm = math.erfc((T-Ts)/(Ti-Ts)) *2*math.pow((alpha*t),.5);
#results
print '%s %.2f %s' %("\n Depth at which after 60 days soil freeze =",xm," m");
print '%s' %("The answer given in textbook is wrong. Please check using a calculator.");
#END
import math
#Operating Conditions
k = .5; #[W/m.K] Thermal Conductivity Healthy Tissue
kappa = .02*math.pow(10,3);#[m] extinction coefficient
p = .05; # reflectivity of skin
D = .005; #[m] Laser beam Dia
rho = 989.1 ; #[kg/m^3] Density
c = 4180 ; #[J/kg.K] Specific Heat
Tb = 37+273; #[K] Temp of healthy tissue
Dt = .003 ; #[m] Dia of tissue
d = .02 ; #[m] depth beneath the skin
Ttss = 55+273 ; #[K] Steady State Temperature
Tb = 37+273 ; #[K] Body Temperature
Tt = 52+273 ; #[K] Tissue Temperature
q = .170 ; #[W]
#calculations
#Case 12 of Table 4.1
q = 2*math.pi*k*Dt*(Ttss-Tb);
#Energy Balancing
P = q*(D*D)*math.exp(kappa*d)/((1-p)*Dt*Dt);
#Using Eqn 5.14
t = rho*(math.pi*Dt*Dt*Dt/6.)*c*(Tt-Tb)/q;
alpha=k/(rho*c);
Fo = 10.3;
#Using Eqn 5.68
t2 = Fo*Dt*Dt/(4*alpha);
#results
print '%s %.2f %s' %("\n (a) Heat transferred from the tumor to maintain its surface temperature at Ttss = 55 degC is ",q,"W");
print '%s %.2f %s' %("\n\n (b) Laser power needed to sustain the tumor surface temperautre at Ttss = 55 degC is", P,"W")
print '%s %.2f %s' %(" \n\n (c) Time for tumor to reach Tt = 52 degC when heat transfer to the surrounding tissue is neglected is",t,"sec")
print '%s %.2f %s' %(" \n\n (d) Time for tumor to reach Tt = 52 degC when Heat transfer to thesurrounding tissue is considered and teh thermal mass of tumor is neglected is",t2,"sec");
#END
import numpy
import math
from numpy import linalg
#Operating Conditions
k = 1.11 ; #[W/m.K] Thermal Conductivity
rho = 3100; #[kg/m^3] Density
c = 820 ; #[J/kg.K] Specific Heat
#Dimensions of Strip
w = 100*math.pow(10,-6); #[m] Width
L = .0035 ; #[m] Long
d = 3000*math.pow(10,-10); #[m] Thickness
delq = 3.5*math.pow(10,-3); #[W] heating Rate
delT1 =1.37 ; #[K] Temperature 1
f1 = 2*math.pi ; #[rad/s] Frequency 1
delT2 =.71 ; #[K] Temperature 2
f2 = 200*math.pi; #[rad/s] Frequency 2
#calculations
A = ([[delT1, -delq/(L*math.pi)],
[delT2, -delq/(L*math.pi)]]) ;
C= ([[delq*-2.30*math.log10(f1/2.)/(2*L*math.pi)],
[delq*-2.30*math.log10(f2/2.)/(2*L*math.pi)]]) ;
B = numpy.linalg.solve (A,C);
alpha = k/(rho*c);
delp = ([math.pow((alpha/f1),.5), math.pow((alpha/f2),.5)]);
#results
print '%s %.2f %s %.2f %s' %("\n C2 = ",B[1],"k =",B[0]," W/m.K ")
print '%s %.2e %s %.2e %s' %("\n\n Thermal Penetration depths are",delp[0]," m and ",delp[1],"m at frequency 2*pi rad/s and 200*pi rad/s");
#END
import math
#Operating Conditions
L = .01; #[m] Metre
Tsurr = 250+273.; #[K] Temperature
h = 1100; #[W/m^2.K] Heat Convective Coefficient
q1 = math.pow(10,7); #[W/m^3] Volumetric Rate
q2 = 2*math.pow(10,7); #[W/m^3] Volumetric Rate
k = 30; #[W/m.K] Conductivity
a = 5*math.pow(10,-6); #[m^2/s]
#calculations
delx = L/5.; #Space increment for numerical solution
Bi = h*delx/k; #Biot Number
#By using stability criterion for Fourier Number
Fo = 1/(2*(1+Bi));
#By definition
t = Fo*delx*delx/a;
#results
print '%s %.3f %s' %('\n As per stability criterion delt =',t,' s, hence setting stability limit as .3 s.')
#END
import math
#Operating Conditions
a
delx = .075; #[m] Metre
T = 20+273.; #[K] Temperature
q = 3*math.pow(10,5); #[W/m^3] Volumetric Rate
#From Table A.1 copper 300 K
k = 401; #[W/m.K] Conductivity
a = 117*math.pow(10,-6); #[m^2/s]
#calculations and results
#By using stability criterion reducing further Fourier Number
Fo = 1./2.;
#By definition
delt = Fo*delx*delx/a;
#From calculations,
T11=125.19
T12=48.1
print '%s %.2f %s %.1f %s' %('\n Hence after 2 min, the surface and the desirde interior temperature T0 =',T11,' degC and T2 =',T12,'degC');
#By using stability criterion reducing further Fourier Number
Fo = 1/4;
#By definition
delt = Fo*delx*delx/a;
#From calculations
T21=118.86
T22=44.4
print '%s %.2f %s %.1f %s' %('\n Hence after 2 min, the surface and the desirde interior temperature T0 = ',T21,'degC and T2 =',T22,'degC')
#(c) Approximating slab as semi-infinte medium
Tc = T -273 + 2*q*math.pow((a*t/math.pi),.5) /k;
t=120. #s
#At interior point x=0.15 m
x =.15; #[metre]
#Analytical Expression
Tc2 = T -273 + 2*q*math.pow((a*t/math.pi),.5) /k*math.exp(-x*x/(4*a*t))-q*x/k*(1-math.erf(.15/(2*math.sqrt(a*t))));
print '%s %.1f %s' %(' \n\n (c) Approximating slab as a semi infinte medium, Analytical epression yields \n At surface after 120 seconds = ,',Tc,'degC')
print '%s %.1f %s' %('\n At x=.15 m after 120 seconds = ',Tc2,'degC');
#END