summaryrefslogtreecommitdiff
path: root/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch4.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch4.ipynb')
-rw-r--r--A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch4.ipynb960
1 files changed, 960 insertions, 0 deletions
diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch4.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch4.ipynb
new file mode 100644
index 00000000..75c3c01e
--- /dev/null
+++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch4.ipynb
@@ -0,0 +1,960 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4 : Second Law of Thermodynamics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.1, Page no:90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To calculate the maximum efficiency\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "T1 = 700.; \t\t\t#temperature of heat source(K)\n",
+ "T2 = 300.; \t\t\t#temperature of heat sink(K)\n",
+ "\n",
+ "# Calculations\n",
+ "#To calculate the maximum efficiency\n",
+ "eff=((T1-T2)/T1); \t\t\t#efficiency of a heat engine\n",
+ "\n",
+ "# Results\n",
+ "print 'Maximum efficiency of heat engine is %f'%eff\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum efficiency of heat engine is 0.571429\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.2, Page no:90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To determine minimum amount of work done and heat given to surrounding\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "m = 1.; \t\t\t#mass of water(kg)\n",
+ "T1 = 300.; \t\t\t#temperature of surrounding(K)\n",
+ "T2 = 273.; \t\t\t#temperature of water(K)\n",
+ "Hf = 334.11; \t\t\t#latent heat of fusion of ice(kJ/kg)\n",
+ "\n",
+ "# Calculations and Results\n",
+ "#To determine minimum amount of work and heat given upto surrounding\n",
+ "#(a)\n",
+ "Q2 = m*Hf; \t\t\t#heat absobed at temperature T2\n",
+ "W = ((Q2*(T1-T2))/T2); \t\t\t#minimumm amount of work required\n",
+ "print 'Minimum amount of work required is %f kJ'%W\n",
+ " \n",
+ "#(b)\n",
+ "#Q1 is the heat given up the surrounding\n",
+ "Q1 = W+Q2;\n",
+ "print 'Heat given upto surrounding is %f kJ'%Q1\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Minimum amount of work required is 33.043846 kJ\n",
+ "Heat given upto surrounding is 367.153846 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.3, Page no:90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To determine efficiency of proposed engine\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "P_out = 4.5; \t\t\t#output power(hp)\n",
+ "P_in = 6.25; \t\t\t#input power(kW)\n",
+ "T1 = 1000.; \t\t\t#source temperature(K)\n",
+ "T2 = 500.; \t\t\t#sink temperature(K)\n",
+ "\n",
+ "# Calculations and Results\n",
+ "#To determine efficiency of proposed engine \n",
+ "ep = ((P_out*745.7)/(P_in*1000)); \t\t\t#proposed efficiency\n",
+ "print 'Efficiency of proposed engine is %f'%ep\n",
+ "\n",
+ "em = ((T1-T2)/T1); \t\t\t#maximum efficiency\n",
+ "print 'The maximum efficieny is %f'%em\n",
+ "print 'Hence the claim of the proposed engine is impossible'\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Efficiency of proposed engine is 0.536904\n",
+ "The maximum efficieny is 0.500000\n",
+ "Hence the claim of the proposed engine is impossible\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.4, Page no:93"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To calculate entropy of evaporation\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "P = 500.; \t\t\t#pressure of dry saturated steam(kPa)\n",
+ "\n",
+ "#From steam tables\n",
+ "Hv = 2106.; \t\t\t#latent heat of vaporisation(kJ/kg)\n",
+ "T = 425.; \t\t\t#saturation temperature(K)\n",
+ " \n",
+ "# Calculations \n",
+ "#To calculate the entropy of evaporation\n",
+ "#By equation 4.25 (Page no. 93)\n",
+ "Sv = (Hv/T); \t\t\t#entropy change accompanying vaporisation\n",
+ "\n",
+ "# Results\n",
+ "print 'Entropy of evaporation is %f kJ/kg K'%Sv\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Entropy of evaporation is 4.955294 kJ/kg K\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.5, Page no:94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To determine change in entropy\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "m = 2.; \t\t\t#mass of gas(kg)\n",
+ "T1 = 277.; \t\t\t#initial temperature(K)\n",
+ "T2 = 368.; \t\t\t#final temperature(K)\n",
+ "Cv = 1.42; \t\t\t#specific geat at constant volume(kJ/kg K)\n",
+ "\n",
+ "# Calculations\n",
+ "import math\n",
+ "#Using equation 4.31 (Page no. 94)\n",
+ "S = (m*Cv*math.log(T2/T1)); \t\t\t#change in entropy(kJ/K)\n",
+ "\n",
+ "# Results\n",
+ "print 'Change in entropy is %f kJ/K'%S\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Change in entropy is 0.806746 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.6, Page no:94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To calculate the entropy change\n",
+ "\n",
+ "#Given:\n",
+ "T = 300.; \t\t\t#temperature in K\n",
+ "P1 = 10.; \t\t\t#initial pressure(bar)\n",
+ "P2 = 1.; \t\t\t#final pressure(bar)\n",
+ "R = 8.314; \t\t\t#ieal gas constant\n",
+ "\n",
+ "# Calculations\n",
+ "import math\n",
+ "#To calculate the entropy change\n",
+ "#Using equation 4.33(Page no. 94)\n",
+ "S = (R*math.log(P1/P2)); \t\t\t#(kJ/kmol K)\n",
+ "\n",
+ "# Results\n",
+ "print 'Entopy change is %f kJ/kmol K'%S\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Entopy change is 19.143692 kJ/kmol K\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.7, Page no:94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To determine change in entropy\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "T1 = 335.; \t\t\t#initial temperature in K\n",
+ "T2 = 300.; \t\t\t#final temperature in K\n",
+ "P1 = 10.; \t\t\t#initial pressure(bar)\n",
+ "P2 = 1.; \t\t\t#final pressure(bar)\n",
+ "Cp = 29.3; \t\t\t#specific heat constant at constant pressure(kJ/kmol K)\n",
+ "R = 8.314; \t\t\t#ideal gas constant\n",
+ "\n",
+ "# Calculations\n",
+ "import math\n",
+ "#To determine change in entropy\n",
+ "#Using equation 4.30 (Page no. 94)\n",
+ "S = ((Cp*math.log(T2/T1))-(R*math.log(P2/P1))); \t\t\t#entropy change(kJ/kmol K)\n",
+ "\n",
+ "# Results\n",
+ "print 'Entropy change in the process is %f kJ/kmol K'%S\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Entropy change in the process is 15.910494 kJ/kmol K\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.8, Page no:95"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To determine the change in entropy\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "m1 = 10.; \t\t\t#mass of water at 375 K (kg)\n",
+ "m2 = 30.; \t\t\t#mass of water at 275 K (kg)\n",
+ "c = 4.2; \t\t\t#specific heat of water (kJ.kg K)\n",
+ "\n",
+ "# Calculations\n",
+ "import math\n",
+ "#To determine the change in entropy\n",
+ "#Let T be the final temperature(K)\n",
+ "T = ((m1*375)+(m2*275))/(m1+m2);\n",
+ "#S1 be change in entropy for hot water\n",
+ "S1 = (m1*c*math.log(T/375)); \t\t\t#[kJ/K]\n",
+ "#S2 be the change in entropy for cold water\n",
+ "S2 = (m2*c*math.log(T/275)); \t\t\t#[kJ/K]\n",
+ "#S be the total entropy change\n",
+ "S = S1+S2; \n",
+ "\n",
+ "# Results\n",
+ "print 'The total entropy change is %f kJ/K'%S\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total entropy change is 1.591404 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.9, Page no:95"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To calculate the total entropy change\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "m1 = 35.; \t\t\t#mass of steel in kg\n",
+ "m2 = 150.; \t\t\t#mass of oil in kg\n",
+ "T1 = 725.; \t\t\t#temperature of steel(K)\n",
+ "T2 = 275.; \t\t\t#temperature of oil(K)\n",
+ "c1 = 0.88; \t\t\t#specific heat of steel (kJ/kg K)\n",
+ "c2 = 2.5; \t\t\t#specific heat of oil(kJ/kg K)\n",
+ "\n",
+ "# Calculations\n",
+ "import math\n",
+ "#To calculate the total entropy change\n",
+ "#Let T be the final temperature\n",
+ "T = (((m1*c1*T1)+(m2*c2*T2))/((m1*c1)+(m2*c2)));\n",
+ "#S1 be the in entropy for steel\n",
+ "S1 = (m1*c1*math.log(T/T1)); \t\t\t#[kJ/K]\n",
+ "#S2 be the change in entropy for oil\n",
+ "S2 = (m2*c2*math.log(T/T2)); \t\t\t#[kJ/K]\n",
+ "#S be the total entropy change\n",
+ "S = S1+S2;\n",
+ "\n",
+ "# Results\n",
+ "print 'The total entropy change is %f kJ/K'%S\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total entropy change is 17.649827 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To calculate entropy of 1 kmole of air\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "n1 = 0.21; \t\t\t#volume % of oxygen in air\n",
+ "n2 = 0.79; \t\t\t#volume % of nitrogen in air\n",
+ "R = 8.314; \t\t\t#ideal gas constant\n",
+ "\n",
+ "# Calculations\n",
+ "import math\n",
+ "#To calculate entropy of 1 kmol of air\n",
+ "#Using equation 4.35 (Page no. 96)\n",
+ "S = (-R*(n1*math.log(n1)+n2*math.log(n2))); \t\t\t#[kJ/kmol K]\n",
+ "\n",
+ "# Results\n",
+ "print 'The total entropy change is %f kJ/kmol K'%S\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total entropy change is 4.273036 kJ/kmol K\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To determine change in entropy for the reaction\n",
+ "\n",
+ "# Variables\n",
+ "H = -2.8318*10**5; \t\t\t#heat of reaction (J/mol)\n",
+ "T = 298.; \t\t\t#temperature of reaction in K\n",
+ "#Absolute entropies for CO, O2, CO2 are (in J/mol K)\n",
+ "S_CO = 198.;\n",
+ "S_O2 = 205.2;\n",
+ "S_CO2 = 213.8;\n",
+ "\n",
+ "# Calculations and Results\n",
+ "# To determine the change in entropy for the reaction\n",
+ "# Referring equation 4.36 (Page no. 96)\n",
+ "S_reactant = S_CO + 0.5*S_O2; \t\t\t#entropy change for reactants\n",
+ "S_product = S_CO2; \t\t\t#entropy change for products\n",
+ "S = S_product-S_reactant; \t\t\t#total entropy change\n",
+ "print 'The total entropy change for the reaction is %f J/mol'%S\n",
+ "print 'Since the reaction is highly irreversible, entropy change cannot be calculated as the ratio of heat of reaction to the temperature'\n",
+ "\n",
+ "#The energy available for useful work is the difference between heat of reaction and entropy energy due to ireversible nature of the process\n",
+ "W_useful = -H+(T*S); \t\t\t#energy available for useful work (J)\n",
+ "print 'Energy available for useful work is %3.2e J'%W_useful\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total entropy change for the reaction is -86.800000 J/mol\n",
+ "Since the reaction is highly irreversible, entropy change cannot be calculated as the ratio of heat of reaction to the temperature\n",
+ "Energy available for useful work is 2.57e+05 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.13"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To calculate change in entropy and check whether the process is reversible\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "H_steam = 2923.5; \t\t\t#enthalpy of superheated steam (kJ/kg)\n",
+ "S_steam = 6.71; \t\t\t#entropy of superheated steam (kJ/kg K)\n",
+ "H_liquid = 845.; \t\t\t#enthalpy of saturated liquid (kJ/kg)\n",
+ "S_liquid = 2.32; \t\t\t#entropy of saturated liquid (kJ/kg K)\n",
+ "T = 300.; \t\t\t#temperature of system (K)\n",
+ "\n",
+ "# Calculations\n",
+ "#To calculate change in entropy and check whether the process is reversible\n",
+ "S_system = S_liquid-S_steam; \t\t\t#change in entropy of steam\n",
+ "\n",
+ "#Let Q be the heat given out during condensation\n",
+ "Q = -(H_liquid-H_steam);\n",
+ "S_surrounding = Q/T; \t\t\t#change in entropy of the surrounding\n",
+ "S_total = S_system+S_surrounding; \t\t\t#total entropy change\n",
+ "\n",
+ "# Results\n",
+ "print 'The total entropy change is %f kJ/kg'%S_total\n",
+ "print 'Since total entropy change is positive,the process is irreversible'\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total entropy change is 2.538333 kJ/kg\n",
+ "Since total entropy change is positive,the process is irreversible\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.14"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To determine the change in entropy of system\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "V = 1.; \t\t\t#volume of each compartment in cubic meters\n",
+ "P_sat = 683.6; \t\t#pressure of saturated steam (kPa)\n",
+ "P_steam = 101.3; \t#pressure of supereated steam (kPa)\n",
+ "T_sat = 437.2; \t\t#temperature of system (K)\n",
+ "\n",
+ "#Referring steam tables\n",
+ "#For saturated steam at pressure 683.6 kPa and temp 437.2 K\n",
+ "H_sat = 2761.; \t\t\t #enthalpy of saturated steam (kJ/kg)\n",
+ "S_sat = 6.7133; \t\t\t#entropy of saturated steam (kJ/kg K)\n",
+ "spvol_sat = 278.9*10**-3; \t#specific volume of saturated steam (cubic m/kg)\n",
+ "U_sat = 2570.4; \t\t\t#specific internal energy of saturated steam (kJ/kg)\n",
+ "\n",
+ "#For superheated steam at 101.3 kPa and 437.2 K\n",
+ "H_steam = 2804.; \t\t\t #enthalpy of superheated steam (kJ/kg)\n",
+ "S_steam = 7.6712; \t\t\t #entropy of superheated steam (kJ/kg K)\n",
+ "spvol_steam = 1976.2*10**-3; \t#specific volume of superheated steam (cubic m /kg)\n",
+ "U_steam = 2603.3; \t\t\t #specific internal energy of superheated steam (kJ/kg)\n",
+ "\n",
+ "\n",
+ "# Calculations\n",
+ "#To determine the change in entropy of system\n",
+ "m_sat = V/spvol_sat; \t\t\t#mass of satureated steam(kg)\n",
+ "m_steam = V/spvol_steam; \t\t#mass of superheated steam (kg)\n",
+ "m_sys = m_sat+m_steam; \t\t\t#mass of system (kg)\n",
+ "spvol_sys = (2.*V)/m_sys; \t\t#specific volume of system (cubic m/kg)\n",
+ "\t\t\t#Since no heat exchange and work interaction occurs so internal energy after mixing remains the same\n",
+ "U1_sat = m_sat*U_sat; \t\t\t #internal energy of saturated steam (kJ)\n",
+ "U1_steam = m_steam*U_steam; \t #internal enegy of superheated steam (kJ)\n",
+ "U_sys = (U1_sat+U1_steam)/m_sys; \t#specific internal energy of system (kJ/kg)\n",
+ "\n",
+ "#Referring steam tables\n",
+ "#At calculated U_sys and spvol_sys\n",
+ "S_sys = 6.9992; \t\t\t #specific entropy of system (kJ/kg K)\n",
+ "Si = ((m_sat*S_sat)+(m_steam*S_steam)); #initial entropy of system (kJ/K)\n",
+ "Sf = (m_sys*S_sys); \t\t\t #final entropy of system (kJ/K)\n",
+ "S = Sf-Si; \t\t\t #change in entropy\n",
+ "\n",
+ "# Results\n",
+ "print 'The change in entropy of the system is %f kJ/K'%S\n",
+ "print 'Since entropy change is positive, the process is irrevresible'\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The change in entropy of the system is 0.685052 kJ/K\n",
+ "Since entropy change is positive, the process is irrevresible\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.15"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To calculate entropy change\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "V = 1.; \t\t\t#volume of each compartment in cubic m\n",
+ "T = 300.; \t\t\t#temperature of ideal gas in 1st compartment (K)\n",
+ "P = 200.; \t\t\t#pressure of ideal gas in 1st compartment (kPa)\n",
+ "R = 8.314; \t\t\t#ideal gas constant\n",
+ "\n",
+ "# Calculations\n",
+ "#To calculate entropy change\n",
+ "#Let n be the number of moles of gas\n",
+ "n = ((P*V)/(R*T));\n",
+ "#Since gas in vessel exchanges no heat and work with surrounding so internal energy remains same\n",
+ "#This implies temperature after mixing is same as that before mixing\n",
+ "\n",
+ "#Final conditions:\n",
+ "Tf = 300.; \t\t\t#final temperature (K)\n",
+ "Vf = 2.; \t\t\t#final volume (cubic m)\n",
+ "Pf = 100.; \t\t\t#final pressure (kPa)\n",
+ "\n",
+ "#Initial conditions:\n",
+ "Ti = 300.; \t\t\t#initial temperature (K)\n",
+ "Vi = 1.; \t\t\t#initial volume (cubic m)\n",
+ "Pi = 200.; \t\t\t#initial pressure (kPa)\n",
+ "import math\n",
+ "#Using equation 4.33 (Page num 94)\n",
+ "S = n*R*math.log(Vf/Vi); \t\t\t#entropy change of system (kJ/K)\n",
+ "#Since entropy of surrounding does not change\n",
+ "S_total = S; \t\t\t#total entropy change\n",
+ "\n",
+ "# Results\n",
+ "print 'The change in total entropy is %f kJ/K'%S_total\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The change in total entropy is 0.462098 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.16"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To calculate entropy change in the process\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "m_oil = 5000.; \t\t\t#mass flow rate of oil (kg/h)\n",
+ "Tin_oil = 500.; \t\t\t#inlet temperature of oil (K)\n",
+ "Tin_water = 295.; \t\t\t#inlet temperature of water (K)\n",
+ "c_oil = 3.2; \t\t\t#specific heat of oil (kJ/kg K)\n",
+ "c_water = 4.2; \t\t\t#specific heat of water (kJ/kg K)\n",
+ "import math\n",
+ "#To calculate entropy change in the process\n",
+ "#Assuming oil is cooled to minimum permissible temperature\n",
+ "Tout_oil = 305.; \t\t\t#exit temperature of oil (K)\n",
+ "Tout_water = 490.; \t\t\t#exit temperature of water (K)\n",
+ "\n",
+ "# Calculations\n",
+ "#Let m_water be the mass flow rate of water\n",
+ "#By enthalpy balance\n",
+ "m_water = ((m_oil*c_oil*(Tin_oil-Tout_oil))/(c_water*(Tout_water-Tin_water))); \t\t\t#(kg/h)\n",
+ "S_oil = m_oil*c_oil*math.log(Tout_oil/Tin_oil); \t\t\t#entropy change of oil (kJ/K)\n",
+ "S_water = m_water*c_water*math.log(Tout_water/Tin_water); \t\t\t#entropy change of water (kJ/K)\n",
+ "S_tot = S_oil+S_water; \t\t\t#total entropy change\n",
+ "\n",
+ "# Results\n",
+ "print 'The total entropy change in the process is %f kJ/K'%S_tot\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total entropy change in the process is 210.139407 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.17"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To calculate loss in capacity of doing work\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "To = 275.; \t\t\t#temperature of quenching oil (K)\n",
+ "\n",
+ "# Calculations\n",
+ "S_steel = -26.25; \t\t\t#change in entropy os casting (kJ/K)\n",
+ "S_oil = 43.90; \t\t\t#change in entropy of oil (kJ/K)\n",
+ "S_tot = S_steel+S_oil; \t\t\t#total entropy change\n",
+ "#Let W be loss in capacity for doing work\n",
+ "W = To*S_tot; \t\t\t#(kJ)\n",
+ "\n",
+ "# Results\n",
+ "print 'The loss in capacity for doing work is %f kJ'%W\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The loss in capacity for doing work is 4853.750000 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.18"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To calculate total change in entropy and available work\n",
+ "\n",
+ "import math\n",
+ "#Given:\n",
+ "m_oil = 5000.; \t\t\t #mass flow rate of hydrocarbon oil (kg/h)\n",
+ "Tin_oil = 425.; \t\t\t#inlet temperature of oil (K)\n",
+ "Tout_oil = 340.; \t\t\t#exit temperature of oil (K)\n",
+ "m_water = 10000.; \t\t\t#mass flow rate of water (kg/h)\n",
+ "Tin_water = 295.; \t\t\t#inlet temperature of water (K)\n",
+ "c_oil = 2.5; \t\t\t #mean specific heat of oil (kJ/kg K)\n",
+ "c_water = 4.2; \t\t\t #mean specific heat of water (kJ/kg K)\n",
+ "\n",
+ "#To determine total change in entropy and available work\n",
+ "\n",
+ "# Calculations and Results\n",
+ "#(a)\n",
+ "#By energy balance\n",
+ "Tout_water = ((m_oil*c_oil*(Tin_oil-Tout_oil))/(m_water*c_water))+295; \t\t\t#exit temperature of water (K)\n",
+ "S_oil = m_oil*c_oil*math.log(Tout_oil/Tin_oil); \t\t\t#change in entropy of oil (kJ/K)\n",
+ "S_water = m_water*c_water*math.log(Tout_water/Tin_water); \t\t\t#change in entropy of water (kJ/K)\n",
+ "S_tot = S_oil+S_water; \t\t\t#total entropy change\n",
+ "print 'The total entropy change is %f kJ/K'%S_tot\n",
+ "\n",
+ "\n",
+ "#(b)\n",
+ "To = 295.; \t\t\t#temperature at which heat is rejected to surrounding (K)\n",
+ "#Let Q be heat given out by the oil on cooling\n",
+ "Q = m_oil*c_oil*(Tin_oil-Tout_oil);\n",
+ "#Heat rejected to the surrounding at To by the Carnot Engine is given by\n",
+ "#Q2 = To(Q/T) = -To*S_oil\n",
+ "Q2 = -To*S_oil; \t\t\t#(kJ)\n",
+ "#Let W be the work output of engine\n",
+ "W = Q-Q2;\n",
+ "print 'The work output of the engine would be %4.3e kJ'%W\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total entropy change is 666.266812 kJ/K\n",
+ "The work output of the engine would be 2.397e+05 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.19"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To calculate the molar entropy of metal\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "T = 10.; \t\t\t#temperature of metal (K)\n",
+ "Cp = 0.45; \t\t\t#molar heat capacity at 10 K (J/mol K)\n",
+ "\n",
+ "# Calculations\n",
+ "#To determine the molar entropy of metal\n",
+ "#Entropy of solid at 10 K is calculated using first integral in equation 4.55 (Page no. 108)\n",
+ "S = Cp/3;\n",
+ "\n",
+ "# Results\n",
+ "print 'Molar entropy of meatl at 10 K is %f J/mol K'%S\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Molar entropy of meatl at 10 K is 0.150000 J/mol K\n"
+ ]
+ }
+ ],
+ "prompt_number": 38
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.20"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# To calculate the absolute entropy of water vapour\n",
+ "\n",
+ "# Variables\n",
+ "#Given:\n",
+ "T = 473.; \t\t\t#temperature at entropy is to be determined (K)\n",
+ "Tf = 273.; \t\t\t#base temperature (K)\n",
+ "Tb = 373.; \t\t\t#boiling temperature (K)\n",
+ "Cpl = 4.2; \t\t\t#avearge heat capacity of water (kJ/kg K)\n",
+ "Cpg = 1.9; \t\t\t#avearge heat capacity of water vapour between 373 K and 473 K\n",
+ "Hv = 2257.; \t\t\t#latent heat of vaporisation at 373 K (kJ/kg)\n",
+ "\n",
+ "# Calculations\n",
+ "import math\n",
+ "S = (Cpl*math.log(Tb/Tf))+(Hv/Tb)+(Cpg*math.log(T/Tb));\n",
+ "\n",
+ "\n",
+ "# Results\n",
+ "print 'Absolute entropy of water vapour at 473 K and 101.3 kPa is %f kJ/kg K'%S\n",
+ "print 'It compares favourably with the value reported in steam tables'\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Absolute entropy of water vapour at 473 K and 101.3 kPa is 7.813068 kJ/kg K\n",
+ "It compares favourably with the value reported in steam tables\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file