# Variables
ro2 = 0.21; #Ratio of O2 in the mixture
rn2 = 0.79; #Ratio of N2 in the mixture
T = (25+273); #Temperature of container in degree C
p = 1; #Total pressure in atm
# Calculations
Co2 = (ro2*10**5)/(8314*T); #Molar concentration of O2 in K.mol/m**3
Cn2 = (rn2*10**5)/(8314*T); #Molar concentration of N2 in K.mol/m**3
po2 = (32*Co2); #Mass density in kg/m**3
pn2 = (28*Cn2); #Mass density in kg/m**3
p = (po2+pn2); #Overall mass density in kg/m**3
mo2 = (po2/p); #Mass fraction of O2
mn2 = (pn2/p); #Mass fraction of N2
M = (ro2*32)+(rn2*28); #Average molecular weight
# Results
print 'Molar concentration of O2 is %3.4f K.mol/m**3 \n \
Molar concentration of N2 is %3.3f K.mol/m**3 \n \
Mass density of O2 is %3.3f kg/m**3 \n \
Mass density of N2 is %3.3f kg/m**3 \n \
Mole fraction of O2 is %3.2f \n \
Mole fraction of N2 is %3.2f \n \
Mass fraction of O2 is %3.3f \n \
Mass fraction of N2 is %3.3f \n \
Average molecular weight is %3.2f'%(Co2,Cn2,po2,pn2,ro2,rn2,mo2,mn2,M)
# Variables
yh2 = 0.4; #Mole fraction og H2
yo2 = 0.6; #Mole fraction of O2
vh2 = 1; #velocity of H2 in m/s
vo2 = 0; #velocity of O2 in m/s
# Calculations
V = (yh2*vh2)+(yo2*vo2); #Molar average velocity in m/s
M = (yh2*2)+(yo2*32); #Molecular weight of the mixture
mh2 = (yh2*2)/M; #Mass fraction of H2
mo2 = (yo2*32)/M; #Mass fraction of O2
v = (mh2*vh2)+(mo2*vo2); #Mass average velocity in m/s
x1 = (mh2*vh2); #Mass flux
x2 = (mo2*vo2); #Mass flux
y1 = (v*vh2); #Molar flux
y2 = (yo2*vo2); #Molar flux
jh2 = (mh2*(vh2-v)); #Mass diffusion flux
jo2 = (mo2*(vo2-v)); #Mass diffusion flux
Jh2 = (yh2*(vh2-V)); #Molar diffusion flux
Jo2 = (yo2*(vo2-V)); #Molar diffusion flux
# Results
print 'Molar average velocity is %3.1f m/s \n \
Mass average velocity is %3.2f m/s \n \
Mass flux of H2 when it is stationary is %3.2fp kg/m2.s3 \n \
Mass flux of O2 when it is stationary is %3.0f kg/m**2.s \n \
Molar flux of H2 when it is stationary is %3.2fC k.mol/m**2.s \n \
Molar flux of O2 when it is stationary is %3.0f k.mol/m**2.s \n \
Mass diffusion flux of H2 across a surface moving with mass average velocity is %3.4fp kg/m**2.s \n \
Mass diffusion flux of O2 across a surface moving with mass average velocity is %3.4fp kg/m**2.s \n \
Molar diffusion flux across a surface moving with molar average velociy for H2 is %3.2fC k.mol/m**2.s \n \
Molar diffusion flux across a surface moving with molar average velociy for O2\
is %3.2fC k.mol/m**2.s'%(V,v,x1,x2,y1,y2,jh2,jo2,Jh2,Jo2)
# Variables
t = 0.001; #Thickness of the membrane in m
CA1 = 0.02; #Concentration of helium in the membrane at inner surface in k.mol/m**3
CA2 = 0.005; #Concentration of helium in the membrane at outer surface in k.mol/m**3
DAB = 10**-9; #Binary diffusion coefficient in m**2/s
# Calculations
NAx = ((DAB*(CA1-CA2))/t)/10**-9; #Diffusion flux of helium through the plastic in k.mol/sm**2 *10**-9
# Results
print 'Diffusion flux of helium through the plastic is %3.0f*10**-9 k.mol/sm**2'%(NAx)
# Variables
T = 273+25; #Temperature of Helium gas in K
p = 4; #Pressure of helium gas in bar
Di = 0.1; #Inner diamter of wall in m
Do = 0.003; #Outer diamter of wall in m
DAB = (0.4*10**-13); #Binary diffusion coefficient in m**2/s
S = (0.45*10**-3); #S value for differentiation
# Calculations
A = (3.14*Di**2); #Area in m**2
V = (3.14*Di**3)/6; #Volume in m**3
R = 0.08316 #Gas consmath.tant in m**3 bar/kmol.K
d = ((-6*R*T*DAB*S*p)/(Do*Di))/10**-11; #Decrease of pressure with time in bar/s*10**-11
# Results
print 'Initial rate of leakage for the system is provided by the decrease of pressure \
with time which is %3.2f*10**-11 bar/s'%(d)
import math
# Variables
po2 = 2; #Pressure of O2 in bar
Di = 0.025; #inside diamter of the pipe in m
L = 0.0025; #Wall thickness in m
a = (0.21*10**-2); #Diffusivity of O2 in m**2/s
S = (3.12*10**-3); #Solubility of O2 in k.mol/m**3.bar
DAB = (0.21*10**-9); #Binary diffusion coefficient in m**2/s
# Calculations
CAi = (S*po2); #Concentration of O2 on inside surface in kmol/m**3
RmA = ((math.log((Di+(2*L))/Di))/(2*3.14*DAB)); #Diffusion resismath.tance in sm**2
Loss = (CAi/RmA)/10**-11; #Loss of O2 by diffusion per meter length of pipe *10**-11
# Results
print 'Loss of O2 by diffusion per meter length of pipe is %3.2f*10**-11 kmol/s'%(Loss)
# Variables
p = 1; #Pressure of system in atm
T = 25+273; #Temperature of system in K
pco2 = (190./760); #Partial pressure of CO2 at one end in atm
pco2o = (95./760); #Partial pressure of CO2 at other end in atm
DAB = (0.16*10**-4); #Binary diffusion coefficient in m**2/s from Table 13.3
R = 0.08205 #Gas constant in m**3 atm/kmol.K
# Calculations
NAx = (DAB*(pco2-pco2o))/(R*T*p); #Equimolar counter diffusion in kmol/m**2s
M = (NAx*3.14*(0.05**2/4)*3600); #Mass transfer rate in kmol/h
MCO2 = (M*44)/10**-5; #Mass flow rate of CO2 in kg/h *10**-5
Mair = (29*-M)/10**-5; #Mass flow rate of air in kg/h *10**-5
# Results
print 'Mass transfer rate of CO2 is %3.2f*10**-5 kg/h Mass transfer rate of air is %3.2f*10**-5 kg/h'%(MCO2,Mair)
import math
# Variables
T = 27+273; #Temperature of water in K
D = 0.02; #Diameter of the tube in m
L = 0.4; #Length of the tube in m
DAB = (0.26*10**-4); #Diffusion coefficient in m**2/s
# Calculations
p = 1.0132; #Atmospheric pressure in bar
pA1 = 0.03531; #Vapour pressure in bar
m = ((p*10**5*3.14*(D/2)**2*18*DAB)/(8316*T*L))*(1000*3600)*math.log(p/(p-pA1)); #Diffusion rate of water in gram per hour
# Results
print 'Diffusion rate of water is %3.4f gram per hour'%(m)
import math
# Variables
T = 25+273; #Temperature of water in K
D = 0.02; #Diameter of the tube in m
L = 0.08; #Length of the tube in m
m = (8.54*10**-4); #Diffusion coefficient in kg/h
# Calculations
p = 1.0132; #Atmospheric pressure in bar
pA1 = 0.03165; #Vapour pressure in bar
DAB = (((m/3600)*8316*T*L)/(p*10**5*3.14*(D/2)**2*18*math.log(p/(p-pA1))*10**2))/10**-4; #Diffusion coefficient of water in m**2/s *10**-4
# Calculations
print 'Diffusion coefficient of water is %3.3f*10**-4 m**2/s'%(DAB)
# Variables
CAs = 0.02; #Carbon mole fraction
CAo = 0.004; #Content of steel
CA = 0.012; #Percet of depth
d = 0.001; #Depth in m
H = (6*10**-10); #Diffusivity of carbon in m**2/s
# Calculations
X = (CA-CAs)/(CAo-CAs); #Calculation for erf function
n = 0.48; #erf(n) = 0.5; n = 0.48
t = ((d/(n*2.))**2/(3600.*H))*3600; #Time required to elevate the carbon content of steel in s
# Results
print 'Time required to elevate the carbon content of steel is %3.2f s'%(t)
# note : rounding error.