diff options
Diffstat (limited to 'Concepts_of_Thermodynamics/Chapter14.ipynb')
-rwxr-xr-x | Concepts_of_Thermodynamics/Chapter14.ipynb | 216 |
1 files changed, 216 insertions, 0 deletions
diff --git a/Concepts_of_Thermodynamics/Chapter14.ipynb b/Concepts_of_Thermodynamics/Chapter14.ipynb new file mode 100755 index 00000000..3c8834de --- /dev/null +++ b/Concepts_of_Thermodynamics/Chapter14.ipynb @@ -0,0 +1,216 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 14 - Equilibrium and the third law"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - Pg 372"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the equlibrium constant\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "n1=0.95\n",
+ "n2=0.05\n",
+ "n3=0.025\n",
+ "P=147 #psia\n",
+ "pa=14.7 #psia\n",
+ "#calculations\n",
+ "n=n1+n2+n3\n",
+ "p1=n1/n *P/pa\n",
+ "p2=n2/n *P/pa\n",
+ "p3=n3/n *P/pa\n",
+ "Kp1= p1/(p2*math.pow(p3,0.5))\n",
+ "Kp2= p1*p1 /(p2*p2 *p3)\n",
+ "#results\n",
+ "print '%s %.1f' %(\"In case 1, Equilibrium constant = \",Kp1)\n",
+ "print '%s %.1f' %(\"\\n In case 2, Equilibrium constant = \",Kp2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "In case 1, Equilibrium constant = 38.5\n",
+ "\n",
+ " In case 2, Equilibrium constant = 1480.1\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - Pg 373"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the degree of dissociation\n",
+ "#Initialization of variables\n",
+ "kp=5. \n",
+ "import numpy\n",
+ "from numpy import roots\n",
+ "#calculations\n",
+ "vec=numpy.roots([24,0, 3,-2])\n",
+ "x=vec[2]\n",
+ "vec2=numpy.roots([249,0,3,-2])\n",
+ "y=vec2[2]\n",
+ "#results\n",
+ "print '%s %.2f' %(\"\\n degree of dissociation = \",x)\n",
+ "print '%s %.2f' %(\"\\n If pressure =10 . degree of dissociation =\",y)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " degree of dissociation = 0.34\n",
+ "\n",
+ " If pressure =10 . degree of dissociation = 0.18\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stderr",
+ "text": [
+ "-c:12: ComplexWarning: Casting complex values to real discards the imaginary part\n",
+ "-c:13: ComplexWarning: Casting complex values to real discards the imaginary part\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - Pg 373"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the degree of dissociation\n",
+ "#Initialization of variables\n",
+ "k=5.\n",
+ "import numpy\n",
+ "from numpy import roots\n",
+ "#calculations\n",
+ "p=[k*k-1, k-5*k*k,7*k*k, -3*k*k]\n",
+ "vec=roots(p)\n",
+ "x=vec[2]\n",
+ "#results\n",
+ "print '%s %.2f' %(\"degree of dissociation = \",x)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "degree of dissociation = 0.78\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4 - Pg 395"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the work done in all the cases\n",
+ "import math\n",
+ "#Initialization of variables\n",
+ "T=77+460. #R\n",
+ "x1=0.21\n",
+ "x2=1-x1\n",
+ "G=-169557 #Btu/mole\n",
+ "n1=1\n",
+ "n2=3.76\n",
+ "R0=1.986\n",
+ "v=0.0885\n",
+ "pi=14.7\n",
+ "J=778.\n",
+ "#calculations\n",
+ "dg1=-n1*R0*T*math.log(x1)\n",
+ "dg2=-n2*R0*T*math.log(x2)\n",
+ "dg=dg1+dg2\n",
+ "dG=dg+G\n",
+ "W=-dG\n",
+ "W2=-G\n",
+ "p=0.0004 #atm\n",
+ "G1=-n1*R0*T*math.log(1./p)\n",
+ "W3= -(dg1+G+G1)\n",
+ "dgf=v*pi*144/J\n",
+ "#results\n",
+ "print '%s %d %s' %(\"In case 1,Work done =\",W,\"Btu/mole C\")\n",
+ "print '%s %d %s' %(\"\\n In case 2,Work done =\",W2,\"Btu/mole C\")\n",
+ "print '%s %d %s' %(\"\\n In case 3,Work done =\",W3,\"Btu/mole C\")\n",
+ "print '%s %.2f %s' %(\"\\n In case 4,Work done =\",dgf,\" Btu/mole C\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "In case 1,Work done = 166947 Btu/mole C\n",
+ "\n",
+ " In case 2,Work done = 169557 Btu/mole C\n",
+ "\n",
+ " In case 3,Work done = 176236 Btu/mole C\n",
+ "\n",
+ " In case 4,Work done = 0.24 Btu/mole C\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |