summaryrefslogtreecommitdiff
path: root/Thermodynamics:_From_concepts_to_applications/Chapter8_3.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Thermodynamics:_From_concepts_to_applications/Chapter8_3.ipynb')
-rwxr-xr-xThermodynamics:_From_concepts_to_applications/Chapter8_3.ipynb354
1 files changed, 354 insertions, 0 deletions
diff --git a/Thermodynamics:_From_concepts_to_applications/Chapter8_3.ipynb b/Thermodynamics:_From_concepts_to_applications/Chapter8_3.ipynb
new file mode 100755
index 00000000..47114c69
--- /dev/null
+++ b/Thermodynamics:_From_concepts_to_applications/Chapter8_3.ipynb
@@ -0,0 +1,354 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:9c8ef7403d1e4089b03a877df55583eac7aa3f196537402cb7dc0697b6d5bbe7"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter8-Entropy"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example1 pg- 168"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate and entropy of ice and environment and universe\n",
+ "##initialisation of variables\n",
+ "m= 2 ##kg\n",
+ "dh= 333.39 ##kg/h\n",
+ "T= 0 ##C\n",
+ "T1= 20 ##C\n",
+ "##CALCULATIONS\n",
+ "Q12= m*dh\n",
+ "dS= Q12/(273.15+T)\n",
+ "dSenvir= -Q12/(273.15+T1)\n",
+ "dStotal= dS+dSenvir\n",
+ "##RESULTS\n",
+ "print'%s %.3f %s'%(' entropy of ice =',dS,'kJ/K')\n",
+ "print'%s %.3f %s'%('entropy of environment =',dSenvir,'kJ/K')\n",
+ "print'%s %.3f %s'%('entropy of universe =',dStotal,'kJ/K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " entropy of ice = 2.441 kJ/K\n",
+ "entropy of environment = -2.275 kJ/K\n",
+ "entropy of universe = 0.167 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example2-pg169"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate change in entropy in system and environment and entropy\n",
+ "##initialisation of variables\n",
+ "Q= 666.78 ##kJ\n",
+ "T= 0 ##C\n",
+ "Th= 20. ##C\n",
+ "##CALCULATIONS\n",
+ "Ssys= Q/(273.15+T)\n",
+ "Qh= Q*((273.15+Th)/(273.15+T))\n",
+ "Senvir= -Qh/(273.15+Th)\n",
+ "Stotal= Ssys+Senvir\n",
+ "##RESULTS\n",
+ "print'%s %.4f %s'%('change in entropy in sysytem =',Ssys,' kJ/K')\n",
+ "print'%s %.4f %s'%('change in entropy in environment =',Senvir,'kJ/K')\n",
+ "print'%s %.f %s'%('total change in entropy =',Stotal,'kJ/K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "change in entropy in sysytem = 2.4411 kJ/K\n",
+ "change in entropy in environment = -2.4411 kJ/K\n",
+ "total change in entropy = 0 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example3-pg171\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate change in entropy\n",
+ "##initialisation of variables\n",
+ "S1= 6.2872 ##J/kg K\n",
+ "S2= 5.8712 ##J/kg K\n",
+ "m= 18 ##kg\n",
+ "##CALCULATIONS\n",
+ "S= m*(S1-S2)\n",
+ "##RESULTS\n",
+ "print'%s %.3f %s'%(' change in entropy =',S,'kJ/K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " change in entropy = 7.488 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example4-pg 171"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate change in entropy\n",
+ "##initialisation of variables\n",
+ "S2= 5.8328 ##kJ/kg\n",
+ "S1= 5.8712 ##kJ/kg\n",
+ "##CALCULATIONS\n",
+ "S= S2-S1\n",
+ "##RESULTS\n",
+ "print'%s %.5f %s'%('change in entropy = ',S,'kJ/K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "change in entropy = -0.03840 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example5-pg172"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate enthalpy and change in entropy\n",
+ "##initialisation of variables\n",
+ "m= 0.1 ##kg\n",
+ "p= 3 ##bar\n",
+ "p1= 10 ##bar\n",
+ "h1= 2964.3 ##kJ/kg\n",
+ "v1=0.2378\n",
+ "s2= 7.1619 ##kJ/k\n",
+ "s1= 6.9641 ##kJ/k\n",
+ "##CALCULATIONS\n",
+ "h2= h1+(p-p1)*math.pow(10,5)*v1*math.pow(10,-3)\n",
+ "S= m*(s2-s1)\n",
+ "##RESULTS\n",
+ "print'%s %.1f %s'%(' enthalpy =',h2,'kJ/kg')\n",
+ "print'%s %.5f %s'%('change in entropy =',S,'kJ/K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " enthalpy = 2797.8 kJ/kg\n",
+ "change in entropy = 0.01978 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example6-pg 174"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate final pressure and change in entropy\n",
+ "import math\n",
+ "##initialisation of variables\n",
+ "p1= 5. ##bar\n",
+ "V1= 0.4 ##m^2\n",
+ "V2= 1.2 ##m^3\n",
+ "R= 8.314 ##J/mol K\n",
+ "M= 28.##gms\n",
+ "T1= 80.##C\n",
+ "##CALCULATIONS\n",
+ "p2= p1*(V1/V2)\n",
+ "S= R*math.log(V2/V1)/M\n",
+ "S1= S*p1*V1*100/((R/M)*(273.15+T1))\n",
+ "##RESULTS\n",
+ "print'%s %.3f %s'%(' final pressure =',p2,'bar')\n",
+ "print'%s %.4f %s'% ('change in entropy =',S1,'kJ/kg K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " final pressure = 1.667 bar\n",
+ "change in entropy = 0.6222 kJ/kg K\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example7-pg 175"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#calculate heat and change in entropy of system and change in entropy of enironment\n",
+ "##initialisation of variables\n",
+ "R= 8.314 ##J/mol K\n",
+ "M= 29. ##gms\n",
+ "T= 400. ##K\n",
+ "p2= 1.6 ##bar\n",
+ "p1= 1. ##bar\n",
+ "Tenvir= 300. ##K\n",
+ "##CALCULATIONS\n",
+ "q= R*T*math.log(p2/p1)/M\n",
+ "S= -R*math.log(p2/p1)/M\n",
+ "Senvir= q/Tenvir\n",
+ "##RESULTS\n",
+ "print'%s %.1f %s'%('heat =',q,'kJ/kg')\n",
+ "print'%s %.4f %s'%('change in entropy of system=',S,'kJ/kg K')\n",
+ "print'%s %.4f %s'%('change in entropy of environment=',Senvir,'kJ/kg K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "heat = 53.9 kJ/kg\n",
+ "change in entropy of system= -0.1347 kJ/kg K\n",
+ "change in entropy of environment= 0.1797 kJ/kg K\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8-pg176"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "##initialisation of variables\n",
+ "m1= 5 ##kg\n",
+ "c1= 1.26 ##kJ/kg K\n",
+ "m2= 20 ##kg\n",
+ "c2= 4.19 ##kJ/kg K\n",
+ "T1= 95 ##C\n",
+ "T2= 25 ##C\n",
+ "##CALCULATIONS\n",
+ "T= (m1*c1*T1+m2*c2*T2)/(m1*c1+m2*c2)\n",
+ "S1= m1*c1*math.log((273.15+T)/(273.15+T1))\n",
+ "S2= m2*c2*math.log((273.15+T)/(273.15+T2))\n",
+ "S= S1+S2\n",
+ "##RESULTS\n",
+ "print'%s %.2f %s'% (' change in entropy of billet =',S1,' kJ/K')\n",
+ "print'%s %.2f %s'% (' change in entropy of water= ',S2,' kJ/kg K')\n",
+ "print'%s %.2f %s'% (' change in entropy of water=',S,' kJ/kg K')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " change in entropy of billet = -1.23 kJ/K\n",
+ " change in entropy of water= 1.36 kJ/kg K\n",
+ " change in entropy of water= 0.14 kJ/kg K\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file