Chapter8-Diffusion in Solids

Ex1-pg180

In [1]:
## calculate the rate at which hydrogen escapes through the walls of the steel tank
import math
t = 5. ## thickness in mm
c = 10. ## concentration
D = 1e-9 ## diffusion coefficient
print("\n Example 8.1")
j  = D*c/(t*1e-3)
print'%s %.2e %s '%("\n Outward flux is ",j," kg m^-2 s^-1")
 Example 8.1

 Outward flux is  2.00e-06  kg m^-2 s^-1 

Ex2-pg186

In [3]:
## Calculate maximum time till which material can be kept at 550 degree Celsius
import math
D_0 = 0.24e-4 ## diffusion coefficient
Q = 121e3
R = 8.314## Universal gas constant
T = 550. ## temperature in Celsius
k = 0.2 ## thickness of pure Al sheet in mm
d = 0.1 ## penetration depth in mm
c_x = 0.4 ## concentration in percentage
A  = 2. ## Constant in percentage
B = 2.## Constant in percentage
print("\n Example 8.2")
x = d-k
D_cu_al = D_0*math.exp(-Q/(R*(T+273.))) 
k = (A-c_x)/B
if k ==0.8:
    z = 0.9 ## from table
t = (x*1e-3)**2/(z**2.*4.*D_cu_al)## time in sec

print'%s %.2f %s  %.2f %s'%("\n Material can be kept at",T," degree Celsius for nearly",t/60," minute")## answer in book is 100 min
 Example 8.2

 Material can be kept at 550.00  degree Celsius for nearly  102.58  minute

Ex3-pg188

In [7]:
## Calculate minimum depth up to which post machining is to be done
import math
D_0 = 0.7e-4 ## diffusion coefficient
Q = 157. ## Energy in kJ mol**-1, considered from table 8.2
R = 8.314## Universal gas constant
T = 950. ## temperature in Celsius
c2 = 0.8 ## concentration in percentage
cs = 0. ## concentration in percentage
c_x = 0.6## concentration in percentage
t = 4. ## time in hours
a = 1. ##let
print("\n Example 8.3")
A = cs
B = c2-cs 
D = D_0*math.exp(-Q*1e3/(R*(T+273.)))
k = math.exp(((A-c_x)/B))*-1.
if k >0.7 :
    if k<0.712 :
           z = 0.81 ## from table
    
z=0.81
x = z*2.*math.sqrt(D*t*3600.)

print'%s %.2f %s '%("\n Depth up to which machining is required is nearly ",x*1e3," mm")
## numerical value of answer in book is 0.75
 Example 8.3

 Depth up to which machining is required is nearly  0.72  mm 

Ex4-pg189

In [8]:
## Calculate time required to get required boron concentration
import math
D = 4e-17 ## diffusion coefficient
c1 = 0.
cs = 3e26
c_x = 1e23 ## number of atoms
x = 2e-6 ## depth in m
print("\n Example 8.4")
A = cs
B = cs - c1
k = (A-c_x)/B
if k >0.99966 :
    if k< 0.9997 :
        z = 2.55 ## from table
    
z=2.55
t = x**2./(z**2.*4.*D)## time in sec

print'%s %.2f %s '%("\n Time required to get required boron concentration is ",t," sec")## answer in book is 3845 sec
 Example 8.4

 Time required to get required boron concentration is  3844.68  sec 

Ex5-pg194

In [9]:
## Calculate ratio of cross sectional areas
import math
r = 10. ## radius in mm
t = 4. ## thickness in angstrom
print("\n Example 8.5")
r = 2.*math.pi*r*1e-3*t*1e-10/(math.pi*(r*1e-3)**2.)
print'%s %.2e %s '%("\n Ratio of cross sectional areas is  ",r,"")
 Example 8.5

 Ratio of cross sectional areas is   8.00e-08