1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 7 : Diffusion in Solids"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 7.1 Page No : 207"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"time required for carburization in 142.8 min\n"
]
}
],
"source": [
"\n",
"import math \n",
"from scipy.special import erfinv\n",
"\n",
"# Variables\n",
"D = 1.28*10**(-11);\t\t\t#diffusion coefficient of carbon in given steel in m2/s\n",
"c_s = 0.9;\t\t\t#Surface concentration of diffusion element in the surface\n",
"c_o = 0.2;\t\t\t#Initial uniform concentration of the element in the solid\n",
"c_x = 0.4;\t\t\t#Concentration of the diffusing element at a distance x from thesurface\n",
"x = 0.5*10**(-3);\t\t\t#depth from the surface in m\n",
"\n",
"# Calculation\n",
"#(c_s-c_x)/(c_s-c_o) = erf(x/(2*(D*t)**(1/2)))\n",
"t = (x/(2*erfinv((c_s-c_x)/(c_s-c_o))*D**(1./2)))**2;\t\t\t#time required for carburization(in sec)\n",
"\n",
"# Results\n",
"print 'time required for carburization in %.1f min'%(t/60)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 7.2 Page No : 208"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" C1 = 0.0\n",
"time required to get a boron content of 1023 atoms per m3 at a depth of 2 micro meter is = 3845 sec\n"
]
}
],
"source": [
"\t\t\t\n",
"import math \n",
"from scipy.special import erfinv\n",
"\n",
"# Variables\n",
"D = 4*10**(-17);\t\t\t#diffusion coefficient of carbon in given steel in m2/s\n",
"c_s = 3*10**26;\t\t\t#Surface concentration of boron atoms in the surface\n",
"c_1 = 0;\t\t\t#Initial uniform concentration of the element in the solid\n",
"c_x = 10**23;\t\t\t#Concentration of the diffusing element at a distance x from thesurface\n",
"x = 2*10**(-6);\t\t\t#depth from the surface in m\n",
"\n",
"# Calculation and Results\n",
"#(c_s-c_x)/(c_s-c_1) = erf(x/(2*(D*t)**(1/2)))\n",
"a = (erfinv((c_s-c_x)/(c_s-c_1)));\n",
"print ' C1 = ',a\n",
"t = (x**2/(D*4*(2.55)**2));\t\t\t#time required to get a boron content of 1023 atoms per m3 at a depth of 2 micro meter\n",
"print 'time required to get a boron content of 1023 atoms per m3 at a depth of 2 micro meter is = %.0f sec'%t\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 7.3 Page No : 208"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"activation energy = 2.93e-19 J\n",
"constant of the equation = 2.68e-04 m2/s\n",
"diffusion coefficient at 500°C = 3.27e-16 m2/s\n"
]
}
],
"source": [
"\n",
"import math \n",
"\n",
"# Variables\n",
"t_1 = 736.;\t\t\t#Temperature in °C\n",
"t_2 = 782.;\t\t\t#Temperature in °C\n",
"T_1 = t_1+273;\t\t\t#Temperature in K\n",
"T_2 = t_2+273;\t\t\t#Temperature in K\n",
"D_1 = 2.*10**(-13);\t\t\t#Coefficient of diffusion at T_1 (in m2/s)\n",
"D_2 = 5.*10**(-13);\t\t\t#Coefficient of diffusion at T_2 (in m2/s)\n",
"k = 1.38*10**(-23);\t\t\t#in J/K\n",
"\n",
"# Calculation and Results\n",
"#math.log(d_1) = math.log(d_o)-E/(k*T_1)\n",
"#math.log(d_2) = math.log(d_o)-E/(k*T_2)\n",
"E = (math.log(D_1)-math.log(D_2))/((1/(k*T_1))-(1/(k*T_2)));\t\t\t#\n",
"print 'activation energy = %.2e J'%-E\n",
"D_o = 2.*10**(-13)/math.exp(E/(k*T_1));\n",
"print 'constant of the equation = %.2e m2/s'%D_o\n",
"t_4 = 500.;\t\t\t#Temperature in °C\n",
"T_4 = t_4+273;\t\t\t#Temperature in °K\n",
"D_4 = D_o*math.exp(E/(k*T_4));\t\t\t#diffusion coefficient at 500°C\n",
"print 'diffusion coefficient at 500°C = %.2e m2/s'%D_4\n",
"\n",
"# rounding off error"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 7.4 Page No : 210"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Time at 500*C that will produce the same diffusion as in 600*C in 110.4 Hours\n"
]
}
],
"source": [
"\t\t\t\n",
"import math \n",
"\n",
"# Variables\n",
"D_500 = 4.8*10**(-14);\t\t\t#Diffusion coefficient for copper in aluminimum at 500*C(in m**2/s)\n",
"D_600 = 5.3*10**(-13);\t\t\t#Diffusion coefficient for copper in aluminimum at 600*C(in m**2/s)\n",
"t_600 = 10;\t\t\t#time of diffussion at 600*C(in Hours)\n",
"\n",
"# Calculation\n",
"#D_500*t_500 = D_600*t_600\n",
"t_500 = D_600*t_600/D_500;\t\t\t#time of diffussion at 500*C\n",
"\n",
"# Results\n",
"print 'Time at 500*C that will produce the same diffusion as in 600*C in %.1f Hours'%t_500\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|