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
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Appendix D"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 2"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Change in gibbs free energy at 298K : 457.179 KJ\n",
"Change in gibbs free energy at 298K : 271.04 KJ\n"
]
}
],
"source": [
"# -*- coding: utf8 -*-\n",
"from __future__ import division\n",
"#Example: 16.2\n",
"'''Determine the value of \u0002G0 for the reaction 2H2O \u0003\u0004 2H2 + O2 at 25◦C and at 2000 K,\n",
"with the water in the gaseous phase.'''\n",
"\n",
"#Keys:\n",
"#1-H2\n",
"#2-O2\n",
"#3-H2O\n",
"\n",
"#Variable Declaration: \n",
"def dG(T1,Hf1,Hf2,Hf3,Sf1,Sf2,sf3):\n",
"\tdH = 2*Hf1+Hf2-2*Hf3\t#Change in enthalpy in kJ\n",
"\tdS = 2*Sf1+Sf2-2*sf3 \t#Change in entropy in J/K\n",
"\tdG = dH-T1*dS/1000\t#change n gibbs free energy in kJ\n",
"\treturn dG\n",
"\n",
"#Results:\n",
"print 'Change in gibbs free energy at 298K :',round(dG(298,0, 0, -241.826, 130.678,205.148,188.834),3),\"KJ\"\n",
"print 'Change in gibbs free energy at 298K :',round(dG(2000,52.942, 59.176, -241.826+72.788,188.419,268.748,264.769),3),\"KJ\"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 3"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Equilibrium constant at 298K: -184.51\n",
"Equilibrium constant at 2000K: -16.299\n"
]
}
],
"source": [
"# -*- coding: utf8 -*-\n",
"from __future__ import division\n",
"#Example: 16.3\n",
"'''Determine the equilibrium constant K, expressed as ln K, for the reaction 2H2O <--->\n",
"2H2 + O2 at 25◦C and at 2000 K.'''\n",
"\n",
"#Variable Declaration: \n",
"dG1 = -457.166\t\t\t#change in gibbs free energy at temp 298 K from example2 in kJ\n",
"dG2 = -271.040\t\t\t#change in gibbs free energy at temp 2000 K from example2 n kJ\n",
"T1 = 298\t\t\t\t#K\n",
"T2 = 2000\t\t\t\t#K\n",
"R = 8.3145\t\t\t\t#gas constant\n",
"\n",
"#Calculations:\n",
"K1 = dG1*1000/(R*T1)\n",
"K2 = dG2*1000/(R*T2)\n",
"\n",
"#Results:\n",
"print 'Equilibrium constant at 298K: ',round(K1,2)\n",
"print 'Equilibrium constant at 2000K: ',round(K2,3)"
]
}
],
"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
}
|