From c7fe425ef3c5e8804f2f5de3d8fffedf5e2f1131 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Tue, 7 Apr 2015 15:58:05 +0530 Subject: added books --- Engineering_Thermodynamics/ch7.ipynb | 576 +++++++++++++++++++++++++++++++++++ 1 file changed, 576 insertions(+) create mode 100755 Engineering_Thermodynamics/ch7.ipynb (limited to 'Engineering_Thermodynamics/ch7.ipynb') diff --git a/Engineering_Thermodynamics/ch7.ipynb b/Engineering_Thermodynamics/ch7.ipynb new file mode 100755 index 00000000..09b2856d --- /dev/null +++ b/Engineering_Thermodynamics/ch7.ipynb @@ -0,0 +1,576 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f22779b8fff9ea06914fd530daf547f36c0e2d7163616b6b2b466ab75a676e0a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 : Entropy" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.1 Page No : 185" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "T1 = 37.+273;\n", + "T2 = 35.+273;\n", + "m = 1.;\n", + "cv = 4.187;\n", + "\n", + "# Calculation\n", + "S = m*cv*math.log(T1/T2); \t\t\t# S = S2-S1\n", + "\n", + "# Results\n", + "print \"Change in the entropy of the water is %.4f KJ/K\"%S\n", + "\n", + "# note : answer is accurate. please check." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in the entropy of the water is 0.0271 KJ/K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.2 Page No : 186" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Part (a)\n", + "T1 = 273.;\n", + "T2 = 373.;\n", + "m = 1. ;\n", + "cv = 4.187;\n", + "\n", + "# Calculation and Results\n", + "Ss = m*cv*math.log(T2/T1); \t\t\t# S = S2-S1\n", + "Q = m*cv*(T2-T1);\n", + "Sr = -(Q/T2);\n", + "S = Ss+Sr;\n", + "\n", + "print \"The entropy change of the universe is %.3f kJ/K\"%S\n", + "\n", + "# Part (b)\n", + "T3 = 323.;\n", + "Sw = m*cv*(math.log(T3/T1)+math.log(T2/T3));\n", + "Sr1 = -m*cv*(T3-T1)/T3;\n", + "Sr2 = -m*cv*(T2-T3)/T2;\n", + "Su = Sw+Sr1+Sr2;\n", + "print \"The entropy change of the universe is %.3f kJ/K\"%Su\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The entropy change of the universe is 0.184 kJ/K\n", + "The entropy change of the universe is 0.097 kJ/K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.3 Page No : 187" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "# Variables\n", + "# Part (a)\n", + "m = 1.;\n", + "T1 = -5.+273;\n", + "T2 = 20.+273;\n", + "T0 = 0.+273;\n", + "cp = 2.093;\n", + "cv = 4.187;\n", + "lf = 333.3;\n", + "\n", + "# Calculation\n", + "Q = m*cp*(T0-T1)+1*333.3+m*cv*(T2-T0);\n", + "Sa = -Q/T2;\n", + "Ss1 = m*cp*math.log(T0/T1);\n", + "Ss2 = lf/T0;\n", + "Ss3 = m*cv*math.log(T2/T0);\n", + "St = Ss1+Ss2+Ss3;\n", + "Su = St+Sa;\n", + "\n", + "# Results\n", + "print \"The entropy change of the universe is %.4f kJ/K\"%Su\n", + "\n", + "# Part (b)\n", + "S = 1.5549; \t\t\t# S = S4-S1\n", + "Wmin = T2*(S)-Q;\n", + "print \"The minimum risk required is %.1f kJ\"%Wmin\n", + "\n", + "# rounding off error. please check." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The entropy change of the universe is 0.0965 kJ/K\n", + "The minimum risk required is 28.1 kJ\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.5 Page No : 190" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "Vo = 8.4;\n", + "Vh = 14.;\n", + "n1 = Vo/22.4; \n", + "n2 = Vh/22.4;\n", + "R = 8.31;\n", + "\n", + "# Calculation\n", + "x1 = n1/(n1+n2);\n", + "x2 = n2/(n1+n2);\n", + "S = -R*(n1*math.log(x1)+n2*math.log(x2));\n", + "\n", + "# Results\n", + "print \"Entropy change for the process is %.2f J/K\"%S\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entropy change for the process is 5.50 J/K\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.8 Page No : 192" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from hornerc import horner\n", + "import sys\n", + "\n", + "# Variables\n", + "#T = poly(0,'T'); \t\t\t# T = Tf\n", + "Tf_ = [700,-2] #700-2*T; \t\t\t# Tf_ = Tf'\n", + "\n", + "# Calculation\n", + "# Bisection method to solve for the polynomial\n", + "def Temperature(a,b,f):\n", + " N = 100.;\n", + " eps = 1e-5;\n", + " if((f(a)*f(b))>0):\n", + " print ('no root possible f(a)*f(b)>0');\n", + " sys.exit(0);\n", + "\n", + " if(abs(f(a))0):\n", + " c = (a+b)/2\n", + " if(abs(f(c))0):\n", + " print ('no root possible f(a)*f(b)>0');\n", + " sys.exit(0);\n", + "\n", + " if(abs(f(a))0):\n", + " c = (a+b)/2\n", + " if(abs(f(c))