# Variables
deltax = 0.1; #[m] - thickness of copper block
T2 = 100.; #[degC] - temp on one side of copper block
T1 = 0.; #[degC] - temp on other side of the copper block
k = 380.; #[W/mK] - thermal conductivity
# Calculations
# using the formula (q/A)*deltax = -k*(T2-T1)
g = -k*(T2-T1)/deltax;
g1 = (g/(4.184*10000));
# Results
print " The steady state heat flux across the copper block is q/A = %.1e W/m**2 \
\n or in alternate units is q/A = %.1f cal/cm*sec"%(g,g1);
# Variables
dely = 0.1; #[m] - distance between two parralel plates
delUx = 0.3; #[m/sec] - velocity of a plate
mu = 0.001; #[kg/m*sec] - viscosity
# Calculations
# using the formula tauyx = F/A = -mu*(delUx/dely)
tauyx = -mu*(delUx/dely);
# Results
print "The momentum flux and the the force per unit area, \nwhich are the same thing \
is tauyx = F/A = %.3f N/m**2"%(tauyx);
# Variables
tauyx = -0.003; #[N/m**2] - momentum flux
dely = 0.1; #[m] - distance between two parallel plates
mu = 0.01; #[kg/m*sec] - viscosity
# Calculations
# using the formula tauyx = F/A = -mu*(delUx/dely)
delUx = -((tauyx*dely)/mu)*100;
# Results
print " Velocity of the top plate is deltaUx = %d cm/sec"%(delUx);
import math
# Variables
d = 0.0013; #[m] - diameter of the tube
delx = 1.; #[m] - length of the glass tube
T2 = 110.6; #[degC] - temperature on one end of the rod
T1 = 0.; #[degC] - temperature on other side of the rod
k = 0.86; #[W/m*K] - thermal conductivity
Hf = 333.5; #[J/g] - heat of fusion of ice
# Calculations
# (a)using the equation (q/A) = -k*(delt/delx)
A = (math.pi*d**2)/4;
q = A*(-k*(T2-T1)/delx);
# Results
print "a) the heat flow is q = %.2e J/sec"%(q);
# (b) dividing the total heat transfer in 30minutes by the amount of heat required to melt 1g of ice
a = abs((q*30*60)/333.5);
print "b) the amount or grams of ice melted in 30 minutes is %.1e g"%(a);
import math
from scipy.integrate import quad
# Variables
d = 1.2*10**-2; #[m] - diameter of the hole
Ca1 = 0.083; #[kmol/m**3]
Ca2 = 0.; #[kmol/m**3]
L = 0.04; #[m] - thickness of the iron piece
Dab = 1.56*10**-3; #[m**2/sec] - diffusion coefficient of CO2
A = (math.pi*d**2)/4; #area
# Calculations
# (a)using the formula (Na/)A = (Ja/A) = -Dab(delCa/delx)
def f0(Ca):
return 1
intdCa = quad(f0,Ca2,Ca1)[0]
def f1(x):
return 1
intdx = quad(f1,0,0.04)[0]
g = (intdCa/intdx)*Dab;
# Results
print "a) The molar flux with respect to stationary coordinates is Na/A) = %.3e kmol/m**2*sec"%(g);
# using the formula na/A = (Na/A)*Ma
Ma = 44.01; #[kg/mol] - molcular weight of co2
na = (intdCa/intdx)*Dab*Ma*A*(3600/0.4539);
print "b) The mass flow rate is %.3f lb/hr"%(na);
# Variables
T = 30+273.15; #[K] temperature
pA = 3.; #[atm] partial pressure of the component A
R = 0.082057; #[atm*m**3*/kmol*K] gas constant
# Calculation and Results
# (a) using the equation Ca = n/V = pA/(R*T)
Cco2 = pA/(R*T);
Cco2 = Cco2*(44.01);
print " a) The concentarion of Co2 entering is %.2f kg/m**3"%(Cco2);
# (b) using the same equation as above
pN2 = (0.79)*3; #[atm] partial pressure of mitrogen(as nitrogen is 79% in air)
R = 0.7302; #[atm*ft**3*lb/mol*R] - gas constant
T = T*(1.8); #[R] temperature
CN2 = pN2/(R*T);
print " b) The concentration of N2 entering is %.2e lb mol/ft**3"%(CN2);
# (c) using the same equation as above
nt = 6.;
nCo2 = 4.;
nO2 = 2.*(0.21);
nN2 = 2.*(0.79);
yCo2 = nCo2/nt;
yO2 = nO2/nt;
yN2 = nN2/nt;
R = 82.057; #[atm*cm**3/mol*K] - gas constant
T = 30+273.15; #[K] - temperature
pCo2 = 3*yCo2;
Cco2 = pCo2/(R*T);
print " c) The concentartion of Co2 in the exit is %.2e mol/cm**3"%(Cco2);
# (d) using the same equation as above
R = 8.3143; #[kPa*m**3/kmol*K] - gas constant
pO2 = 3*(yO2)*(101.325); #[kPa] - partial pressure
CO2 = pO2/(R*T);
print " d) The concentration of O2 in the exit stream is %.2e kmol/m**3"%(CO2);
import math
# Variables
delx = 0.3-0; #[m] - length
d = 0.05-0; #[m] - diameter
A = (math.pi*d**2)/4; #[m**2] - area;
R = 8.314*10**3; #[N*m/kmol*K] - gas constant
xco1 = 0.15; # mole prcent of co in one tank
xco2 = 0.; # mole percent of co in other tank
p2 = 1.; #[atm] - pressure in one tank
p1 = p2; #[atm] - pressure in other tank
D = 0.164*10**-4; #[m**2/sec] - diffusion coefficient
T = 298.15; #[K] - temperature
# Calculations
# using the formula (Na/A) = (Ja/A) = -D*(delca/delx) = -(D/R*T)*(delpa/delx);
delpa = (p2*xco2-p1*xco1)*10**5; #[N/m**2] - pressure difference
Na = -((D*A)/(R*T))*(delpa/delx);
# Results
print "The initial rate of mass transfer of co2 is %.1e kmol/sec"%(Na);
print "In order for the pressure to remain at 1 atm, a diffusion of air must occur which is in the opposite\
direction \nand equal to %.1e kmol/sec"%(Na);
# Variables
# given
A = 5.; #[m**2] - area of the plates
Ft = 0.083 #[N] - force on the top plate
Fb = -0.027; #[N] - force on the bottom plate
ut = -0.3; #[m/sec] - velocity of the top plate
ub = 0.1; #[m/sec] - velocity of the bottom plate
dely = 0.01; #[m]
delux = ut-ub; #[m/sec]
# Calculations
# using the formula tauyx = F/A = -mu(delux/dely)
tauyx = (Ft-Fb)/A;
mu = tauyx/(-delux/dely); #[Ns/m**2]
mu = mu*10**3; #[cP]
# Results
print " The viscosity of toulene in centipose is %.2f cP"%(mu);
# Variables
po = 1.; #[atm] - pressure
p = 2.; #[atm] - pressure
To = 0+273.15; #[K] - temperature
T = 75+273.15; #[K] - temperature
Do = 0.219*10**-4; #[m**2/sec];
n = 1.75;
# Calculations
# usin the formula D = Do*(po/p)*(T/To)**n
D = Do*(po/p)*(T/To)**n;
# Results
print "The diffusion coefficient of water vapour in air at %d atm and %d degC is \nD \
= %.3e m**2/sec"%(p,T-273.15,D);
from scipy.optimize import fsolve
import math
# Variables
# given
T = 53+273.15; #[K] - temperature
mu1 = 1.91*10**-5;
mu2 = 2.10*10**-5;
T1 = 313.15; #[K] - temperature
T2 = 347.15; #[K] - temperature
# Calculations
# for air
# using linear interpolation of the values in table 2.2
def f(a):
return math.log(mu1/a)/math.log(T1);
def g(a):
return math.log(mu2)-math.log(a)-f(a)*math.log(T2);
a1 = 10**-7;
A = fsolve(g,a1)
B = f(A);
# using the formula ln(mu) = lnA+Bln(t)
mu = math.e**(math.log(A)+B*math.log(T))*10**3; #[cP]
# Results
print " the viscosity of air at %d degC is %.4f cP"%(T-273.15,mu);
# similarly for water
BdivR = 1646;
A = 3.336*10**-8;
mu = A*math.e**(BdivR/T)*10**5 #[cP]
print " the viscosity of water at %d degC is %.3f cP"%(T-273.15,mu);