summaryrefslogtreecommitdiff
path: root/Chemical_Engineering_Thermodynamics/ch7_2.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Chemical_Engineering_Thermodynamics/ch7_2.ipynb')
-rw-r--r--Chemical_Engineering_Thermodynamics/ch7_2.ipynb1575
1 files changed, 1575 insertions, 0 deletions
diff --git a/Chemical_Engineering_Thermodynamics/ch7_2.ipynb b/Chemical_Engineering_Thermodynamics/ch7_2.ipynb
new file mode 100644
index 00000000..11e9b4cd
--- /dev/null
+++ b/Chemical_Engineering_Thermodynamics/ch7_2.ipynb
@@ -0,0 +1,1575 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 7 : Thermodynamic property relations of pure substance"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.6 Page Number : 241"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Estimation of entropy change\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "\n",
+ "# Variables\n",
+ "P_1 = 1;\t\t\t#[MPa] - Initial pressure\n",
+ "P_2 = 1.4;\t\t\t#[MPa] - Final pressure\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t#We know that\n",
+ "\t\t\t# dS = (Cp/T)*dT - (dV/dT)*dP\n",
+ "\t\t\t# Along an isothermal path,integration of above expression between states 1 and 2 yields\n",
+ "\t\t\t# S_2 - S_1 = - integral((dV/dT)*dP)_P\n",
+ "\t\t\t# An estimate can be made by assuming that (dV/dT)_P remains constant over the range of pressure from P_1 to P_2 and evaluating the derivative at average pressure of 1.2 MPa\n",
+ "P_avg = P_2;\n",
+ "\t\t\t# S_2 - S_1 = -integral((dV/dT)*dP)_Pavg*(P_2 - P_1)\n",
+ "\t\t\t# (dV/dT)_P=1.2MPa = ((V_350 - V_250)/(350 - 250))\n",
+ "dV_dT = (0.2345 - 0.19234)/100;\t\t\t#[m**(3)/kg-K]\n",
+ "\t\t\t#Therefore\n",
+ "delta_S = -dV_dT*(P_2 - P_1)*1000;\t\t\t#[kJ/kg-K] - Entropy change\n",
+ "\n",
+ "# Results\n",
+ "print \"The change in entropy is given by S_2-S_1 = %f kJ/kg-K\"%(delta_S);\n",
+ "\n",
+ "\t\t\t#Let us compare this tabulated values. At 1MPA and 300 C, S_1 = 7.1229 kJ/kg-K. At 1.4 MPa and 300 C, S_2 = 6.9534 kJ/kg-K. \n",
+ "\t\t\t#Therefore S_2 - S_1 = -0.1695 kJ/kg-K\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The change in entropy is given by S_2-S_1 = -0.168640 kJ/kg-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.7 Page Number : 241"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determination of work done\n",
+ "\n",
+ "import math \n",
+ "from scipy.integrate import quad \n",
+ "\t\t\t\n",
+ "# Variables\n",
+ "T = 25. + 273.15;\t\t\t#[K] - Temperature of the surrounding\n",
+ "P_1 = 1.;\t\t\t#[atm] - Initial pressure\n",
+ "P_2 = 1000.;\t\t\t#[atm] - Final pressure\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t# V = 18.066 - 7.15*10**(-4)*P + 4.6*10**(-8)*P**(2) where, V is in 'cm**(3)/mol' and P is in 'atm\n",
+ "\t\t\t# (dV/dT)_P = 0.0045 + 1.4*10**(-6)*P ;\t\t\t#cm**(3)/mol-K\n",
+ "\n",
+ "\t\t\t# The work done by 1 mol is given by W = integral(P*dV)\n",
+ "\t\t\t# Differentiating both sides of the expression for V, we get\n",
+ "\t\t\t# dV = -7.15*10**(-4)*dP + 9.2*10**(-8)*(P*dP) \n",
+ "\t\t\t# P*dV = -7.15*10**(-4)*P*dP + 9.2*10**(-8)*(P**(2)*dP)\n",
+ "\n",
+ "\t\t\t# The work done is given by\n",
+ "\n",
+ "def f58(P): \n",
+ "\t return -7.15*10**(-4)*P + 9.2*10**(-8)*(P**(2))\n",
+ "\n",
+ "W = quad(f58,P_1,P_2)[0];\t\t\t#[atm-cm**(3)[0]\n",
+ "\n",
+ "W = W*101325*10**(-6);\t\t\t#[J/mol]\n",
+ "\n",
+ "print \"The necessary work to compress water from 1 atm to 1000 atm is %f J/mol\"%(W);\n",
+ "\n",
+ "\t\t\t#Let us calculate the amount of heat transfer\n",
+ "\t\t\t# q = integral(T*dS)\n",
+ "\t\t\t# dS = ((ds/dT)_P)*dT + ((dS/dP)_T)*dP\n",
+ "\t\t\t# Since the temperature is constant the first term is zero and\n",
+ "\t\t\t# dS = ((dS/dP)_T)*dP = -((dV/dT)_P)*dP\n",
+ "\t\t\t# Thus, q = integral(T*dS) = T*(integral(dS)) ( as temperature is constant )\n",
+ "\t\t\t# or, q = -T*(integral((dV/dT)_P)*dP)\n",
+ "\n",
+ "\t\t\t# Thus the heat transfer is given by\n",
+ "\n",
+ "def f59(P): \n",
+ "\t return 0.0045+1.4*10**(-6)*P\n",
+ "\n",
+ "q = -T* quad(f59,P_1,P_2)[0];\t\t\t#[atm-cm**(3)[0]\n",
+ "\n",
+ "q = q*101325*10**(-6);\t\t\t#[J/mol]\n",
+ "\n",
+ "\t\t\t# q - W = delta_U\n",
+ "\t\t\t# Thus delta_U is given by\n",
+ "delta_U = q - W;\t\t\t#[J/mol]\n",
+ "\n",
+ "print \"The change in internal energy is %f J/mol\"%(delta_U);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The necessary work to compress water from 1 atm to 1000 atm is -33.116351 J/mol\n",
+ "The change in internal energy is -123.839936 J/mol\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.12 Page Number : 247"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Evaluation of beta and K for nitrogen gas\n",
+ "\n",
+ "from scipy.optimize import fsolve \n",
+ "\n",
+ "\n",
+ "# Variables\n",
+ "T = 25+273.15;\t\t\t#[K] - Temperature\n",
+ "P = 1;\t\t\t#[atm] - Pressure\n",
+ "P = P*101325;\t\t\t#[Pa]\n",
+ "Tc = 126.2;\t\t\t#[K] - Critical temperature\n",
+ "Pc = 34;\t\t\t#[bar] - Critical pressure\n",
+ "Pc = Pc*10**(5);\t\t\t#[Pa]\n",
+ "R=8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
+ "\n",
+ "a = (27*R**(2)*Tc**(2)/(64*Pc));\t\t\t#[Pa-m**(6)/mol**(2)]\n",
+ "b = (R*Tc)/(8*Pc);\t\t\t#[m**(3)/mol]\n",
+ "\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t# the cubic form of van der Walls equation of state is\n",
+ "\t\t\t# V**(3)-(b+(R*T)/P)*V**(2)+(a/P)*V-(a*b)/P=0\n",
+ "\t\t\t#Solving the cubic equation\n",
+ "def f(V): \n",
+ "\t return V**(3)-(b+(R*T)/P)*V**(2)+(a/P)*V-(a*b)/P\n",
+ "V = fsolve(f,1)\n",
+ "\t\t\t#The above equation has 1 real and 2 imaginary roots. We consider only real root.\n",
+ "\n",
+ "Beta = R/((P*V)-(a/V)+((2*a*b)/V**(2)));\t\t\t#[K**(-1)]\n",
+ "\n",
+ "K_t = (V-b)/((P*V)-(a/V)+((2*a*b)/V**(2)));\t\t\t#[Pa**(-1)]\n",
+ "K_t = K_t*101325;\t\t\t#[atm**(-1)]\n",
+ "\n",
+ "print \" Beta\\t = \\t %f K**-1)\"%(Beta);\n",
+ "print \" K_t\\t = \\t %f atm**-1)\"%(K_t);\n",
+ "\n",
+ "\t\t\t#For ideal gas, Beta = 1/T = 0.0033354 K**(-1) and K_t = 1/P = 1 atm**(-1)\n",
+ "\t\t\t# So results obtained are convergent with those obtained assuming ideal gas.\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Beta\t = \t 0.003364 K**-1)\n",
+ " K_t\t = \t 1.000672 atm**-1)\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.13 Page Number : 248"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of temperature change and entropy change of water\n",
+ "\n",
+ "# Variables\n",
+ "T = 45+273.15;\t\t\t#[K]\n",
+ "P_1 = 10;\t\t\t#[kPa] - Initial pressure\n",
+ "P_2 = 8600;\t\t\t#[kPa] - Final pressure\n",
+ "V = 1010;\t\t\t#[cm**(3)/kg] - Specific volume for saturated liquid water at 45 C\n",
+ "V = V*10**(-6);\t\t\t#[m**(3)/kg]\n",
+ "\t\t\t# Beta = (1/V)*(dV/dT)_P\n",
+ "Beta = 4.25*10**(-4);\t\t\t#[k**(-1)]\n",
+ "Cp = 4.178;\t\t\t#[kJ/kg-K] - Specific heat at constant pressure\n",
+ "eff = 0.75;\t\t\t# Efficiency of the pump\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t#(1)\n",
+ "\t\t\t#when efficiency of the pump is 100% , W = -delta_Hs\n",
+ "\t\t\t# Now delta_H = T*dS + V*dP, therefore under isentropic conditions, dH = V*dP\n",
+ "\t\t\t# Since the fluid is liquid, therefore the specific volume can be taken to be constant and integrating the above equaton we get\n",
+ "\t\t\t# delta_Hs = V*dP\n",
+ "delta_Hs = V*(P_2 - P_1);\t\t\t#[kJ/kg]\n",
+ "\n",
+ "\t\t\t#Actual pumps are not isentropic and therefore not 100% efficient. Therefore actual work done by the pump is given by\n",
+ "W = -delta_Hs/eff;\t\t\t#[kJ/kg]\n",
+ "\n",
+ "print \" 1).The work done by the pump is %f kJ/kg\"%(W);\n",
+ "\n",
+ "\t\t\t#(2)\n",
+ "\t\t\t# We know that dH = Cp*dT + (1 - Beta*T)*V*dP\n",
+ "\t\t\t# Beta and V are weak functions of pressure in the case of liquids.\n",
+ "\t\t\t# Integrating the above equation we get\n",
+ "\t\t\t# delta_H = Cp*delta_T + (1 - Beta*T)*V*(delta_P)\n",
+ "\t\t\t# Now from energy balance delta_H = q - W . But q = 0. Therefore,\n",
+ "delta_H = -W;\t\t\t#[kJ/kg]\n",
+ "\t\t\t# Solving for delta_T\n",
+ "delta_T = (delta_H - (1 - Beta*T)*V*(P_2-P_1))/Cp;\n",
+ "\n",
+ "print \" 2).The temperature of water change by delta_T = %f K\"%(delta_T);\n",
+ "\n",
+ "\t\t\t#(3)\n",
+ "T_1 = T;\t\t\t#[K]\n",
+ "T_2 = T + delta_T;\t\t\t#[K]\n",
+ "\t\t\t# dS = (Cp/T)*dT - Beta*V*dP\n",
+ "\t\t\t# Beta and V are weak functions of pressure in the case of liquids. Integrating the above equation we get\n",
+ "delta_S = Cp*math.log(T_2/T_1) - Beta*V*(P_2-P_1);\t\t\t#[kJ/kg-K]\n",
+ "\n",
+ "print \" 3).The entropy change of water is given by delta_S = %f kJ/kg-K\"%(delta_S);"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " 1).The work done by the pump is -11.567867 kJ/kg\n",
+ " 2).The temperature of water change by delta_T = 0.972970 K\n",
+ " 3).The entropy change of water is given by delta_S = 0.009070 kJ/kg-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.14 Page Number : 249"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Estimation of change in entropy and enthalpy\n",
+ "\n",
+ "# Variables\n",
+ "T = 270;\t\t\t#[K]\n",
+ "P_1 = 381;\t\t\t#[kPa] - Initial pressure\n",
+ "P_2 = 1200;\t\t\t#[kPa] - Final pressure\n",
+ "V_liq = 1.55*10**(-3);\t\t\t#[m**(3)/kg] - Specific volume for saturated water in liquid phase at 270 C\n",
+ "Beta = 2.095*10**(-3);\t\t\t#[K**(-1)]\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t#dH = Cp*dT + [V - T*(dV/dT)_P]*dP\n",
+ "\t\t\t# dS = (Cp/T)*dT - ((dV/dT)_P)*dP\n",
+ "\t\t\t# Since isothermal conditions are maintained we get\n",
+ "\t\t\t# dH = [V - T*(dV/dT)_P]*dP = V*(1 - Beta*T)*dP\n",
+ "\t\t\t# For the liquid assuming V and Beta to remain constant during pressure change, and since temperature is constant we get\n",
+ "delta_H = V_liq*(1 - Beta*T)*(P_2 - P_1);\t\t\t#[kJ/kg]\n",
+ "\n",
+ "print \"The enthalpy change is given by delta_H = %f kJ/kg\"%(delta_H);\n",
+ "\n",
+ "\t\t\t# Under isothermal conditions \n",
+ "\t\t\t# dS = -((dV/dT)_P)*dP = -Beta*V_liq*dP\n",
+ "\t\t\t# If Beta*V is assumed to remain constant during pressure change we get\n",
+ "delta_S = -Beta*V_liq*(P_2-P_1);\t\t\t#[kJ/kg-K]\n",
+ "\n",
+ "print \"The entropy change is given by delta_S = %e kJ/kg-K\"%(delta_S);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The enthalpy change is given by delta_H = 0.551386 kJ/kg\n",
+ "The entropy change is given by delta_S = -2.659498e-03 kJ/kg-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.15 Page Number : 249"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of percentage change in volume\n",
+ "\n",
+ "# Variables\n",
+ "T_1 = 0;\t\t\t#[C] - Initial tempetaure\n",
+ "T_2 = 100;\t\t\t#[C] - Final temperature\n",
+ "\t\t\t# Beta = 1.0414*10**(-3) + 1.5672*10**(-6)*T + 5.148*10**(-8)*T**(2), where T is in C\n",
+ "\t\t\t# At constant pressure (1/V)*(dV/dT) = Beta\n",
+ "\t\t\t# or, d(math.log(V)) = Beta*dT\n",
+ "\t\t\t# Integrating we get math.log(V_2/V_1) = integral(Beta*dT) from limit T_1 to T_2\n",
+ "\n",
+ "# Calculations and Results\n",
+ "def f62(T): \n",
+ "\t return 1.0414*10**(-3)+1.5672*10**(-6)*T+5.148*10**(-8)*T**(2)\n",
+ "\n",
+ "integral = quad(f62,T_1,T_2)[0]\n",
+ "\n",
+ "\n",
+ "\t\t\t# math.log(V_2/V_1) = integral\n",
+ "\t\t\t# (V_2/V_1) = exp(integral)\n",
+ "\t\t\t# (V_2 - V_1)/V_1 = change = exp(integral) - 1;\n",
+ "change = math.exp(integral) - 1;\n",
+ "per_change = 100*change;\n",
+ "\n",
+ "print \"The percentage change in volume = %f %%\"%(per_change);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The percentage change in volume = 13.784486 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.16 Page Number : 250"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determination of enthalpy and entropy change\n",
+ "\n",
+ "# Variables\n",
+ "T_1 = 25 + 273.15;\t\t\t#[C] - Initial tempetaure\n",
+ "T_2 = 50 + 273.15;\t\t\t#[C] - Final temperature\n",
+ "P_1 = 1;\t\t\t#[bar] - Initial pressure\n",
+ "P_2 = 1000;\t\t\t#[bar] - Final pressure\n",
+ "\n",
+ "Cp_T1_P1 = 75.305;\t\t\t#[J/mol-K]\n",
+ "Cp_T2_P1 = 75.314;\t\t\t#[J/mol-K]\n",
+ "V_T1_P1 = 18.071;\t\t\t#[cm**(3)/mol]\n",
+ "V_T1_P2 = 18.012;\t\t\t#[cm**(3)/mol]\n",
+ "V_T2_P1 = 18.234;\t\t\t#[cm**(3)/mol]\n",
+ "V_T2_P2 = 18.174;\t\t\t#[cm**(3)/mol]\n",
+ "Beta_T1_P1 = 256*10**(-6);\t\t\t#[K**(-1)]\n",
+ "Beta_T1_P2 = 366*10**(-6);\t\t\t#[K**(-1)]\n",
+ "Beta_T2_P1 = 458*10**(-6);\t\t\t#[K**(-1)]\n",
+ "Beta_T2_P2 = 568*10**(-6);\t\t\t#[K**(-1)]\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t# The entropy change is given by\n",
+ "\t\t\t# dS = (Cp/T)*dT - ((dV/dT)_P)*dP\n",
+ "\t\t\t# The mean Cp between 25 and 50 C is \n",
+ "Cp_mean = (Cp_T1_P1 + Cp_T1_P1)/2;\t\t\t#[J/mol-K]\n",
+ "\n",
+ "\n",
+ "\t\t\t# (dV/dT)_P=1bar = (V_T2_P1 - V_T1_P1)/(50 - 25)\n",
+ "dV_dT_P1 = ((V_T2_P1 - V_T1_P1)/(50 - 25))*10**(-6);\t\t\t#[m**(-3)/mol-K]\n",
+ "dV_dT_P2 = ((V_T2_P2 - V_T1_P2)/(50 - 25))*10**(-6);\t\t\t#[m**(-3)/mol-K]\n",
+ "\t\t\t# The mean value of (dV/dT)_P between 1 and 1000 bar is\n",
+ "dV_dT_mean = (dV_dT_P1 + dV_dT_P2)/2;\t\t\t#[m**(-3)/mol-K]\n",
+ "delta_S = Cp_mean*math.log(T_2/T_1) - dV_dT_mean*(P_2 - P_1)*10**(5);\t\t\t#[J/mol-K]\n",
+ "\n",
+ "print \" The value of entropy change is given by delta_S = %f J/mol-K\"%(delta_S);\n",
+ "\n",
+ "\t\t\t# Now let us determine the enthalpy change. We know that\n",
+ "\t\t\t# dH = Cp*dT + [V - T*(dV/dT)_P]*dP\n",
+ "\t\t\t# [V - T*(dV/dT)_P] = (V - T*V*Beta) = val (say)\n",
+ "\t\t\t# At state 1\n",
+ "val_1 = ((V_T1_P1)*10**(-6))*(1 - (T_1)*(Beta_T1_P1));\t\t\t#[m**(3)/mol]\n",
+ "\t\t\t# At state 2\n",
+ "val_2 = ((V_T2_P2)*10**(-6))*(1 - (T_2)*(Beta_T2_P2));\t\t\t#[m**(3)/mol]\n",
+ "val_mean = (val_1 + val_2)/2;\t\t\t#[m**(3)/mol]\n",
+ "\n",
+ "delta_H = Cp_mean*(T_2 - T_1) + val_mean*(P_2-P_1)*10**(5);\t\t\t#[J/mol]\n",
+ "\n",
+ "print \" The value of enthalpy change is given by delta_H = %f J/mol\"%(delta_H);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The value of entropy change is given by delta_S = 5.414201 J/mol-K\n",
+ " The value of enthalpy change is given by delta_H = 3457.542629 J/mol\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.22 Page Number : 256"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Calculation of volume expansivity and isothermal compressibility\n",
+ "\n",
+ "# Variables\n",
+ "T = 100 + 273.15;\t\t\t#[K]\n",
+ "P = 10;\t\t\t#[MPa]\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t# The volume expansivity is defined as \n",
+ "\t\t\t# Beta = (1/V)*(del V/del T)_P = (1/V)*(dV/dT)_P\n",
+ "\t\t\t# From compressed liquid water tables at 100 C and 10 MPa,\n",
+ "V = 0.0010385;\t\t\t#[m(3)/kg]\n",
+ "Beta = (1/V)*((0.0010549 - 0.0010245)/(120 - 80));\t\t\t#[K**(-1)] \t\t\t# The values are obtained from the steam table as reported in the book.\n",
+ "\n",
+ "print \"The value of volume expansivity is Beta = %e K**-1)\"%(Beta);\n",
+ "\n",
+ "\t\t\t#Isothermal compressibility is defined as\n",
+ "\t\t\t# K_t = -(1/V)*(del V/del T)_T = -(1/V)*(dV/dT)_T\n",
+ "K_t = -(1/V)*((0.0010361 - 0.0010410)/(15 - 5));\t\t\t#[MPa**(-1)] \t\t\t# The values are obtained from the steam table as reported in the book.\n",
+ "\n",
+ "K_t = K_t*10**(-3);\t\t\t#[kPa]\n",
+ "\n",
+ "print \"The value of isothermal compressibility is K_t = %e kPa**-1)\"%(K_t);\n",
+ "\n",
+ "\t\t\t# Cp - Cv = (T*V*(Beta**(2)))/K_t\n",
+ "R = (T*V*(Beta**(2)))/K_t;\t\t\t#[kJ/kg-K]\n",
+ "\n",
+ "print \"The value of the difference between Cp and Cv is Cp-Cv = %f kJ/kg-K\"%(R);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of volume expansivity is Beta = 7.318247e-04 K**-1)\n",
+ "The value of isothermal compressibility is K_t = 4.718344e-07 kPa**-1)\n",
+ "The value of the difference between Cp and Cv is Cp-Cv = 0.439860 kJ/kg-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.23 Page Number : 257"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Estimation of specific heat capacity\n",
+ "\n",
+ "# Variables\n",
+ "T = 300 + 273.15;\t\t\t#[K]\n",
+ "P = 4;\t\t\t#[MPa] \n",
+ "\n",
+ "# Calculations and Results\n",
+ "Cp_0 = 7.7 + 0.04594*10**(-2)*T + 0.2521*10**(-5)*T**(2) - 0.8587*10**(-9)*T**(3);\t\t\t#[cal/mol-K]\n",
+ "Cp_0 = (Cp_0*4.186)/18.015;\t\t\t#[kJ/kg-K]\n",
+ "\n",
+ "\t\t\t# Cp(T,P) = Cp_0(T,P=0) - T*integral((del**2 V/del T**(2))_P)*dP from limit 0 to P\n",
+ "\t\t\t# Cp = Cp_0 - T*((del**2 V/del T**2)_Pavg)*(P_2 - P_1)\n",
+ "\n",
+ "P_avg = (0+4)/2;\t\t\t#[MPa]\n",
+ "\n",
+ "\t\t\t#Using finite difference we get (del**2 V/del T**(2)) = ((V_(T+delta T) - 2*V_T + V_(T-delta T))/(delta_T**(2))\n",
+ "\t\t\t#(del**2 V/del T**(2))_Pavg = (V_(350 C) + V_(250 C) - 2*V_(300 C))/(delta_T**(2)) = del_2 (say)\n",
+ "del_2 = (0.13857 + 0.11144 - 2*0.12547)/(50**(2));\t\t\t#[m**(3)/kg-K**2] \t\t\t# The values are obtained from the steam table as reported in the book.\n",
+ "\n",
+ "\n",
+ "Cp = Cp_0 - T*del_2*4000;\t\t\t#[kJ/kg-K]\n",
+ "\n",
+ "print \" The value of constant pressure specific heat capacity is Cp = %f kJ/kg-K\"%(Cp);\n",
+ "\n",
+ "\t\t\t# At P = 4 MPa\n",
+ "\t\t\t# Cp = (del H/del T)_P = (H_350 C - H_250 C)/(350 - 250.4)\n",
+ "\t\t\t# Cp = (3092.5 - 2801.4)/(350 - 250.4) = 2.923 [kJ/kg-K]\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The value of constant pressure specific heat capacity is Cp = 2.858079 kJ/kg-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.24 Page Number : 257"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Estimation of specific heat capacity\n",
+ "\n",
+ "# Variables\n",
+ "T = 300 + 273.15;\t\t\t#[K]\n",
+ "P = 2.0;\t\t\t#[MPa]\n",
+ "\n",
+ "\t\t\t# At 2 MPa and 250 C \n",
+ "H_1 = 2902.5;\t\t\t#[kJ/kg]\n",
+ "\t\t\t# At 2 MPa and 350 C \n",
+ "H_2 = 3137.0;\t\t\t#[kJ/kg]\n",
+ "\n",
+ "# Calculations\n",
+ "Cp = (H_2 - H_1)/(350 - 250);\t\t\t#[kJ/kg-K]\n",
+ "\n",
+ "# Results\n",
+ "print \" The value of constant pressure specific heat capacity is Cp = %f kJ/kg-K\"%(Cp);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The value of constant pressure specific heat capacity is Cp = 2.345000 kJ/kg-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.25 Page Number : 258"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of volume expansivity and isothermal compressibility\n",
+ "\n",
+ "# Variables\n",
+ "T = 80 + 273.15;\t\t\t#[K]\n",
+ "P = 10;\t\t\t#[MPa] \n",
+ "\n",
+ "V_1 = 0.0010245;\t\t\t#[m**(3)/kg]\n",
+ "\t\t\t# At 60 C and 10 MPa\n",
+ "V_2 = 0.0010127;\t\t\t#[m**(3)/kg]\n",
+ "\t\t\t# At 100 C and 10 MPa\n",
+ "V_3 = 0.0010385;\t\t\t#[m**(3)/kg]\n",
+ "\n",
+ "# Calculations and Results\n",
+ "Beta = (1/V_1)*((V_3 - V_2)/(100 - 60));\t\t\t#[K**(-1)]\n",
+ "\n",
+ "print \"The value of volume expansivity is Beta = %e K**-1)\"%(Beta);\n",
+ "\n",
+ "\t\t\t#Isothermal compressibility is given by\n",
+ "\t\t\t# K_t = -(1/V)*(del V/del P)_T\n",
+ "\n",
+ "\t\t\t# Temperature is kept fixed at 80 C and different pressures are taken to calculate (del V/del P)_T\n",
+ "\t\t\t# At 80 C and 5 MPa\n",
+ "V_4 = 0.0010268;\t\t\t#[m**(3)/kg]\n",
+ "\t\t\t# At 80 C and 10 MPa\n",
+ "V_5 = 0.0010245;\t\t\t#[m**(3)/kg]\n",
+ "\t\t\t# At 80 C and 15 MPa\n",
+ "V_6 = 0.0010222;\t\t\t#[m**(3)/kg]\n",
+ "\n",
+ "\t\t\t# K_t = -(1/V)*(del V/del T)_P\n",
+ "K_t = -(1/V_1)*((V_4 - V_6)/(5 - 15));\t\t\t#[MPa**(-1)]\n",
+ "K_t = K_t*10**(-6);\t\t\t#[Pa**(-1)]\n",
+ "\n",
+ "print \"The value of isothermal compressibility is K_t = %e Pa**-1)\"%(K_t);\n",
+ "\n",
+ "\t\t\t# Cp - Cv = (T*V*(Beta**(2)))/K_t\n",
+ "R = (T*V_1*(Beta**(2)))/K_t;\t\t\t#[J/kg-K]\n",
+ "\n",
+ "print \"The value of the difference between Cp and Cv is Cp-Cv = %f J/kg-K\"%(R);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of volume expansivity is Beta = 6.295754e-04 K**-1)\n",
+ "The value of isothermal compressibility is K_t = 4.489995e-10 Pa**-1)\n",
+ "The value of the difference between Cp and Cv is Cp-Cv = 319.389628 J/kg-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.26 Page Number : 260"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of mean Joule Thomson coefficient\n",
+ "\n",
+ "# Variables\n",
+ "P_1 = 150;\t\t\t#[bar]\n",
+ "P_2 = 1;\t\t\t#[bar]\n",
+ "\n",
+ "T_1 = 300;\t\t\t#[K]\n",
+ "T_2 = 260;\t\t\t#[K]\n",
+ "T_3 = 280;\t\t\t#[K]\n",
+ "T_4 = 200;\t\t\t#[K]\n",
+ "T_5 = 120;\t\t\t#[K]\n",
+ "T_6 = 140;\t\t\t#[K]\n",
+ "\n",
+ "H_P1_T1 = 271.8;\t\t\t#[kJ/kg]\n",
+ "H_P2_T2 = 260.0;\t\t\t#[kJ/kg] \n",
+ "H_P2_T3 = 280.2;\t\t\t#[kJ/kg]\n",
+ "H_P1_T4 = 129.2;\t\t\t#[kJ/kg]\n",
+ "H_P2_T5 = 118.8;\t\t\t#[kJ/kg]\n",
+ "H_P2_T6 = 139.1;\t\t\t#[kJ/kg]\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t#(a)\n",
+ "\t\t\t# During the Joule-Thomson expansion the enthalpy should remain constant\n",
+ "\t\t\t# Therefore at 1 bar the exit temperature is such that enthalpy is 271.8 kJ/kg\n",
+ "\t\t\t# The temperature at which enthalpy is 271.8 kJ/kg is given by,\n",
+ "T_new = ((H_P1_T1 - H_P2_T2)/(H_P2_T3 - H_P2_T2))*(T_3 - T_2) + T_2;\t\t\t#[K]\n",
+ "\n",
+ "\t\t\t# Therefore Joule-Thomson coefficient is given by,\n",
+ "meu = (T_1 - T_new)/(P_1 - P_2);\t\t\t#[K/bar]\n",
+ "\n",
+ "print \" a).The value of Joule-Thomson coefficient for initial T = 300 K) is %f J/bar\"%(meu);\n",
+ "\n",
+ "\t\t\t#(b)\n",
+ "\t\t\t# During the Joule-Thomson expansion the enthalpy should remain constant\n",
+ "\t\t\t# Therefore at 1 bar the exit temperature is such that enthalpy is 129.2 kJ/kg\n",
+ "\t\t\t# The temperature at which enthalpy is 129.2 kJ/kg is given by,\n",
+ "T_new_prime = ((H_P1_T4 - H_P2_T5)/(H_P2_T6 - H_P2_T5))*(T_6 - T_5) + T_5;\t\t\t#[K]\n",
+ "\n",
+ "\t\t\t# Therefore Joule-Thomson coefficient is given by,\n",
+ "meu_prime = (T_4 - T_new_prime)/(P_1 - P_2);\t\t\t#[K/bar]\n",
+ "\n",
+ "print \" b).The value of Joule-Thomson coefficient for initial T = 200 K) is %f J/bar\"%(meu_prime);\n",
+ "\n",
+ "\t\t\t# Therefore the Joule-Thomson coefficient is higher for low initial temperatures and therefore the drop in temperature is more.\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " a).The value of Joule-Thomson coefficient for initial T = 300 K) is 0.190046 J/bar\n",
+ " b).The value of Joule-Thomson coefficient for initial T = 200 K) is 0.468146 J/bar\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.27 Page Number : 261"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Estimation of Joule Thomson coefficient\n",
+ "\n",
+ "# Variables\n",
+ "T = 300;\t\t\t#[K] - Temperature\n",
+ "P = 5;\t\t\t#[atm] - Pressure\n",
+ "P = P*101325;\t\t\t#[Pa]\n",
+ "Cp_0 = 35.78;\t\t\t#[J/mol-K] - Smath.tan(math.radiansard specific heat capacity at constant pressure\n",
+ "B = -50;\t\t\t#[cm**(3)/mol]\n",
+ "B = B*10**(-6);\t\t\t#[m**(3)/mol]\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t# (dB/dT) = 1.0 = dB_dT (say)\n",
+ "dB_dT = 1.0;\t\t\t#[cm**(3)/mol-K]\n",
+ "dB_dT = dB_dT*10**(-6);\t\t\t#[m**(3)/mol-K]\n",
+ "\n",
+ "\t\t\t# (d**2 B/d T**2) = -0.01 = dB_dT_2 (say)\n",
+ "dB_dT_2 = -0.01;\t\t\t#[cm**(3)/mol-K**(2)]\n",
+ "dB_dT_2 = dB_dT_2*10**(-6);\t\t\t#[m**(3)/mol-K**(2)]\n",
+ "\n",
+ "Cp = Cp_0 - P*T*(dB_dT_2);\t\t\t#[[J/mol-K]] - Specific heat capacity at constant pressure\n",
+ "\n",
+ "\t\t\t#Therefore Joule-Thomson coefficient is given by,\n",
+ "meu = (1/Cp)*(-B + T*dB_dT);\t\t\t#[K/Pa]\n",
+ "meu = meu*10**(5);\t\t\t#[K/bar]\n",
+ "\n",
+ "# Results\n",
+ "print \" c).The value of Joule-Thomson coefficient is %f K/bar\"%(meu);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " c).The value of Joule-Thomson coefficient is 0.938341 K/bar\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.30 Page Number : 267"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of pressure\n",
+ "\n",
+ "# Variables\n",
+ "den_liq = 13690.;\t\t\t#[kg/m**(3)] - Density of liquid mercury\n",
+ "den_solid = 14190.;\t\t\t#[kg/m**(3)] - Density of solid mercury\n",
+ "mp = -38.87;\t\t\t#[C] - Melting point of mercury at pressure of 1 bar\n",
+ "mp = mp + 273.15;\t\t\t#[K]\n",
+ "T_req = 0.;\t\t\t#[C] - Required temperature to which the melting point is to be raised\n",
+ "T_req = T_req + 273.15;\t\t\t#[K]\n",
+ "H_fus = 11.62;\t\t\t#[kJ/kg] - Latent heat of fusion of mercury\n",
+ "\n",
+ "# Calculations\n",
+ "V_liq = (1/den_liq);\t\t\t#[m**(3)/kg] - Specific volume of liquid mercury\n",
+ "\n",
+ "V_solid = (1/den_solid);\t\t\t#[m**(3)/kg] - Specific volume of solid mercury\n",
+ "\n",
+ "\t\t\t# (delta P/delta T) = ((P - 1)*100)/(T_req - mp)\n",
+ "\t\t\t# delta H/(T*delta V) = (H_liq - H_solid)/(T*(V_liq - V_solid)) = del (say)\n",
+ "d = (H_fus)/(mp*(V_liq - V_solid));\t\t\t#[kPa/K] - delta H/(T*delta V)\n",
+ "\n",
+ "\t\t\t#Equating the two sides and then solving we get\n",
+ "P = (d*(T_req - mp))/100 + 1;\t\t\t#[bar]\n",
+ "\n",
+ "# Results\n",
+ "print \" The required pressure should be %f bar\"%(P);\n",
+ "\n",
+ "# answers are correct but vary from book because of rouding error. please calculate manually."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The required pressure should be 7491.335878 bar\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.31 Page Number : 268"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of enthalpy change and entropy change\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t#(1)\n",
+ "\t\t\t# At 1 bar\n",
+ "\t\t\t# Considering the data given at pressure 1 and 1000 bar, we have\n",
+ "delta_H_fus_1 = ((1000-1)*10**(5)*(273.15-22.6)*3.97*10**(-6))/(14.8+22.6);\t\t\t#[J/mol]\n",
+ "delta_S_fus_1 = delta_H_fus_1/(273.15-22.6);\t\t\t#[J/mol-K]\n",
+ "\n",
+ "print \" 1).The delta_H_fus at 1 bar is %f J/mol\"%(delta_H_fus_1);\n",
+ "print \" The delta_S_fus at 1 bar is %f J/mol-K\"%(delta_S_fus_1);\n",
+ "\n",
+ "\t\t\t#(2)\n",
+ "\t\t\t# At 6000 bar\n",
+ "T_mean = (128.8+173.6)/2;\t\t\t#[C] - Mean temperature\n",
+ "T_mean = T_mean + 273.15;\t\t\t#[K]\n",
+ "delta_V_fus_mean = (1.12+1.55)/2;\t\t\t#[cm**(3)/mol]\n",
+ "\n",
+ "\t\t\t# Consider the data at pressure of 5000 and 7000 bar we get,\n",
+ "delta_H_fus_2 = ((7000-5000)*10**(5)*(T_mean*delta_V_fus_mean*10**(-6)))/(173.6-128.8);\t\t\t#[J/mol]\n",
+ "delta_S_fus_2 = delta_H_fus_2/T_mean;\t\t\t#[J/mol-K]\n",
+ "\n",
+ "print \" 2).The delta_H_fus at 6000 bar is %f J/mol\"%(delta_H_fus_2);\n",
+ "print \" The delta_S_fus at 6000 bar is %f J/mol-K\"%(delta_S_fus_2);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " 1).The delta_H_fus at 1 bar is 2656.921969 J/mol\n",
+ " The delta_S_fus at 1 bar is 10.604358 J/mol-K\n",
+ " 2).The delta_H_fus at 6000 bar is 2529.050223 J/mol\n",
+ " The delta_S_fus at 6000 bar is 5.959821 J/mol-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.32 Page Number : 268"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Estimation of ratio of temperature change and pressure change\n",
+ "\n",
+ "# Variables\n",
+ "H_fus = 80;\t\t\t#[cal/g] - Heat of fusion at 0 C and 1 atm pressure\n",
+ "T = 0+273.15;\t\t\t#[K] - Temperature\n",
+ "vol_ratio = 1.091;\t\t\t# Ratio of the specific volume of ice and water.\n",
+ "sp_vol = 0.001;\t\t\t#[m**(3)/kg] - Specific volume of saturated liquid water.\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t# The clapeyron equation can be written as\n",
+ "\t\t\t# (dP/dT)_sat = T*delta V_LS/(delta H_LS) = (T*(V_ice - V_water))/(H_ice - H_water)\n",
+ "dP_dT = (T*(vol_ratio - 1)*10**(-3))/(-H_fus*4.186);\t\t\t#[K/kPa]\n",
+ "\n",
+ "# Results\n",
+ "print \"The value of dT/dP)_sat is %e K/kPa\"%(dP_dT);\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of dT/dP)_sat is -7.422554e-05 K/kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.33 Page Number : 268"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determination of boiling point of water\n",
+ "\n",
+ "# Variables\n",
+ "P = 2;\t\t\t#[atm] - Surrounding pressure\n",
+ "bp_water = 100 + 273.15;\t\t\t#[K] - Boiling point of water at 1 atm pressure\n",
+ "delta_H_vap = 2257;\t\t\t#[kJ/kg] - Enthalpy of vaporization\n",
+ "delta_H_vap = delta_H_vap*18.015;\t\t\t#[J/mol]\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t# The clapeyron equation is given by\n",
+ "\t\t\t# math.log(P_2_sat/P_1_sat) = (-delta H_vap/R)*(1/T_2 - 1/T_1)\n",
+ "P_1_sat = 1;\t\t\t#[atm]\n",
+ "P_2_sat = P;\n",
+ "T_1 = bp_water;\n",
+ "\n",
+ "\t\t\t# Solving the above equation\n",
+ "T_2 = 1/((math.log(P_2_sat/P_1_sat))/(-delta_H_vap/R) + (1/T_1));\t\t\t#[K]\n",
+ "T_2 = T_2 - 273.15;\t\t\t#[C]\n",
+ "\n",
+ "# Results\n",
+ "print \" The boiling point of water at a pressure of 2 atm is %f C\"%(T_2);\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The boiling point of water at a pressure of 2 atm is 120.836990 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.34 Page Number : 269"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of enthalpy and entropy of vaporization of water\n",
+ "\n",
+ "# Variables\n",
+ "T_1 = 0.01 +273.15;\t\t\t#[K]\n",
+ "T_2 = 1 + 273.15;\t\t\t#[K]\n",
+ "P_sat_1 = 0.611;\t\t\t#[kPa] - P_sat at temperature T_1\n",
+ "P_sat_2 = 0.657;\t\t\t#[kPa] - P_sat at temperature T_2\n",
+ "Mol_wt = 18.015;\t\t\t#[g/mol] - Molecular weight of water\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
+ "\n",
+ "# Calculations and Results \n",
+ " # The clapeyron equation is given by\n",
+ "\t\t\t# math.log(P_sat_2/P_sat_1) = (-delta H_LV/R)*(1/T_2 - 1/T_1)\n",
+ "\n",
+ "\t\t\t# Solving the above equation\n",
+ "delta_H = -(math.log(P_sat_2/P_sat_1)/(1/T_2 - 1/T_1))*R;\t\t\t#[J/mol]\n",
+ "delta_H = delta_H/Mol_wt;\t\t\t#[kJ/kg]\n",
+ "\n",
+ "print \" The enthalpy of vaporization is %f kJ/kg\"%(delta_H);\n",
+ "\n",
+ "\t\t\t# Entropy of vaporization is given by\n",
+ "S_vap = delta_H/T_2;\t\t\t#[kJ/kg-K]\n",
+ "print \" The entropy of vaporization is %f kJ/kg-K\"%(S_vap);"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The enthalpy of vaporization is 2533.991278 kJ/kg\n",
+ " The entropy of vaporization is 9.243083 kJ/kg-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.35 Page Number : 269"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Estimation of heat of vaporization of water\n",
+ "\n",
+ "# Variables\n",
+ "T = 100. + 273.15;\t\t\t#[K]\n",
+ "\t\t\t# (dT/dP)_sat = (1/27.12) K/mm\n",
+ "dT_dP = (1/27.12);\t\t\t#[K/mm]\n",
+ "dT_dP = dT_dP*(760./101325);\t\t\t#[K/Pa]\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t# The clapeyron equation is given by\n",
+ "\t\t\t# (dP/dT)_sat = (-delta H_LV)/(T*delta V_LV)\n",
+ "\t\t\t# delta H_LV = T*delta V_LV*(dP/dT)_sat\n",
+ "\n",
+ "\t\t\t# (dP/dT)_sat = 1/(dT/dP)_sat\n",
+ "dP_dT = 1/dT_dP;\t\t\t#[Pa/K]\n",
+ "\n",
+ "\t\t\t# From saturated steam table at 100 C\n",
+ "V_vap = 1.6729;\t\t\t#[m**(3)/kg]\n",
+ "V_liq = 0.001044;\t\t\t#[m**(3)/kg]\n",
+ "delta_V = V_vap - V_liq;\t\t\t#[m**(3)/kg]\n",
+ "\n",
+ "\t\t\t# Therefore delta_H_LV is given by\n",
+ "delta_H_LV = T*delta_V*(dP_dT);\t\t\t#[J/kg]\n",
+ "delta_H_LV = delta_H_LV*10**(-3);\t\t\t#[kJ/kg]\n",
+ "\n",
+ "# Results\n",
+ "print \" The heat of vaporization of water is %f kJ/kg\"%(delta_H_LV);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The heat of vaporization of water is 2255.667174 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.36 Page Number : 270"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of latent heat of vaporization\n",
+ "\n",
+ "# Variables\n",
+ "T_1 = 100 + 273.15;\t\t\t#[K]\n",
+ "P_1 = 1.01325;\t\t\t#[bar]\n",
+ "T_2 = 98 + 273.15;\t\t\t#[K]\n",
+ "P_2 = 0.943;\t\t\t#[bar]\n",
+ "V_vap = 1.789;\t\t\t#[m**(3)] - Volume in vapour phase\n",
+ "vessel_vol = 1.673;\t\t\t#[m**(3)] - Volume of the vessel\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t# The total volume remains constant as the walls are rigid. At 98 C we get\n",
+ "\t\t\t# vessel_vol = V_liq*(1 - x) + V_vap*x\n",
+ "\t\t\t# Since V_liq is negligible as compared to V_vap, therefore\n",
+ "x = vessel_vol/V_vap;\n",
+ "\n",
+ "\t\t\t# The quantity is given by x = m_vap/(m_liq + m_vap)\n",
+ "\t\t\t# Since (m_liq + m_vap) = 1, therefore at 98 C saturated vapour is x and saturated liquid is (1 - x)\n",
+ "m_vap = x;\t\t\t#[kg] - Mass of saturated vapour\n",
+ "m_liq = (1 - x);\t\t\t#[kg] - Mass of saturated liquid\n",
+ "\n",
+ "print \" The amount of vapour condensed is %f kg\"%(m_liq);\n",
+ "\n",
+ "\t\t\t# The clapeyron equation is given by\n",
+ "\t\t\t# math.log(P_2_sat/P_1_sat) = (-delta H_LV/R)*(1/T_2 - 1/T_1)\n",
+ "\n",
+ "\t\t\t# Solving the above equation\n",
+ "delta_H = -(math.log(P_2/P_1)/(1/T_2 - 1/T_1))*R;\n",
+ "delta_H = delta_H/18.015;\t\t\t#[kJ/kg]\n",
+ "\n",
+ "print \" The latent heat of vaporization is %f kJ/kg\"%(delta_H);\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The amount of vapour condensed is 0.064841 kg\n",
+ " The latent heat of vaporization is 2296.240786 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.37 Page Number : 270"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determination of temperature dependence\n",
+ "from scipy.integrate import quad \n",
+ "from scipy.optimize import *\n",
+ "\n",
+ "\n",
+ "# Variables\n",
+ "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n",
+ "delta_H_gas = -52.23;\t\t\t#[kcal/mol] - Enthalpy of formation of C2H5OH(gas)\n",
+ "delta_H_liq = -66.35;\t\t\t#[kcal/mol] - Enthalpy of formation of C2H5OH(liq)\n",
+ "\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t# For ethanol(g) [T is in K and Cp_0 in cal/mol-K]\n",
+ "\t\t\t# Cp_0 = 4.75 + 5.006*10**(-2)*T - 2.479*10**(-5)*T**(2) + 4.79*10**(-9)*T**(3)\n",
+ "\n",
+ "\t\t\t# For ethanol(l) [T is in K and Cp_0 in cal/mol-K]\n",
+ "\t\t\t# Cp_0 = 67.29 - 0.343*T - 6.94*10**(-4)*T**(2)\n",
+ "\n",
+ "\t\t\t# The vaporization of a liquid can be written as C2H5OH(liq) - C2H5OH(gas)\n",
+ "\t\t\t# Since the pressure is 1 atm therefore the smath.tan(math.radiansard data can be used\n",
+ "delta_H_298 = delta_H_gas - delta_H_liq;\t\t\t#[kcal/mol]\n",
+ "delta_H_298 = delta_H_298*1000;\t\t\t#[cal/mol]\n",
+ "delta_a = 4.75 - 67.29;\n",
+ "delta_b = 5.006*10**(-2) - (-0.343);\n",
+ "delta_c = -2.479*10**(-5) - 6.94*10**(-4);\n",
+ "delta_d = 4.79*10**(-9);\n",
+ "\n",
+ "\t\t\t# The smath.tan(math.radiansard enthalpy of vaporization at a temperature T is given by\n",
+ "\n",
+ "def f31(T): \n",
+ "\t return delta_a + delta_b*T + delta_c*T**(2) + delta_d*T**(3)\n",
+ "\n",
+ "\t\t\t# delta_H_T = delta_H_298 + quad(f31,T_1,T)[0]\n",
+ "\n",
+ "\n",
+ "\t\t\t# Therefore the smath.tan(math.radiansard enthalpy of vaporization at a temperature T = 283 K is given by\n",
+ "T_2 = 283;\t\t\t#[K]\n",
+ "\n",
+ "def f32(T): \n",
+ "\t return delta_a+delta_b*T+delta_c*T**(2)+delta_d*T**(3)\n",
+ "\n",
+ "delta_H_283 = delta_H_298 + quad(f32,T_1,T_2)[0]\n",
+ "\n",
+ "\n",
+ "\t\t\t# Therefore the smath.tan(math.radiansard enthalpy of vaporization at a temperature T = 348 K is given by\n",
+ "T_3 = 348;\t\t\t#[K]\n",
+ "\n",
+ "def f33(T): \n",
+ "\t return delta_a+delta_b*T+delta_c*T**(2)+delta_d*T**(3)\n",
+ "\n",
+ "delta_H_348 = delta_H_298 + quad(f33,T_1,T_3)[0]\n",
+ "\n",
+ "\n",
+ "print \" The value of enthalpy of vaporization at 283 K is %f cal/mol\"%(delta_H_283);\n",
+ "print \" The value of enthalpy of vaporization at 298.15 K is %f cal/mol\"%(delta_H_298);\n",
+ "print \" The value of enthalpy of vaporization at 348 K is %f cal/mol\"%(delta_H_348);\n",
+ "print \" Therefore Standard enthalpy of vaporization decrease with the increase in temperature\";\n",
+ "\n",
+ "\t\t\t# Solving the above equatio manually we get,\n",
+ "\t\t\t# delta_H_vap = 1.1975*10**(-9)*T**(4) - 2.396*10**(-4)*T**(3) + 0.1965*T**(2) - 62.54*T + 21639.54 \n",
+ "\t\t\t# Solving for 'T' at which 'delta_H_vap' = 0\n",
+ "def f(T): \n",
+ "\t return 1.1975*10**(-9)*T**(4)-2.396*10**(-4)*T**(3)+0.1965*T**(2)-62.54*T + 21639.54\n",
+ "T_0 = fsolve(f,500)\n",
+ "\n",
+ "\t\t\t# We know that at critical point (critical temperature and critical pressure) the enthalpy of vaporization is zero.\n",
+ "\t\t\t# Here we have made the smath.tan(math.radiansard enthalpy of vaporization equal to zero which is at smath.tan(math.radiansard pressure of 1 atm.\n",
+ "\t\t\t# Therefore following conclusions can be drawn\n",
+ "print \" The temperature obtained by equating smath.tan(math.radiansard enthalpy of vaporization equal to zero is %f K\"%(T_0);\n",
+ "print \" But the critical temperature of ethanol is 513.9 K , which is far from the temperature obtained above\"\n",
+ "print \" Therefore the temperature obtained by equating smath.tan(math.radiansard enthalpy of vaporization equal to zero is not the critical temperature\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The value of enthalpy of vaporization at 283 K is 14255.030925 cal/mol\n",
+ " The value of enthalpy of vaporization at 298.15 K is 14120.000000 cal/mol\n",
+ " The value of enthalpy of vaporization at 348 K is 13593.385895 cal/mol\n",
+ " Therefore Standard enthalpy of vaporization decrease with the increase in temperature\n",
+ " The temperature obtained by equating smath.tan(math.radiansard enthalpy of vaporization equal to zero is 635.058887 K\n",
+ " But the critical temperature of ethanol is 513.9 K , which is far from the temperature obtained above\n",
+ " Therefore the temperature obtained by equating smath.tan(math.radiansard enthalpy of vaporization equal to zero is not the critical temperature\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.38 Page Number : 276"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Calculation of fugacity of water\n",
+ "\n",
+ "# Variables\n",
+ "T = 300 + 273.15;\t\t\t#[K] - Temperature\n",
+ "P = 9000;\t\t\t#[kPa] - Pressure\n",
+ "P_sat = 8592.7;\t\t\t#[kPa] - Vapour pressure of saturated water at 300 C\n",
+ "f_sat = 6738.9;\t\t\t#[kPa] - Fugacity of saturated water at 300 C\n",
+ "V_liq = 25.28;\t\t\t#[cm**(3)/mol] - Molar volume of water in liquid phase\n",
+ "V_liq = V_liq*10**(-6);\t\t\t# [m**(3)/mol]\n",
+ "V_vap = 391.1;\t\t\t#[cm**(3)/mol] - Molar volume of water in vapour phase\n",
+ "V_vap = V_vap*10**(-6);\t\t\t# [m**(3)/mol]\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
+ "\n",
+ "# Calculations\n",
+ "\t\t\t# At 300 C and 9000 kPa water is a compressed liquid and its fugacity is given by\n",
+ "\t\t\t# f = f_sat*exp[V_liq*(P - P_sat)/R*T]\n",
+ "fugacity = f_sat*math.exp((V_liq*(P - P_sat)*1000)/(R*T));\n",
+ "\n",
+ "# Results\n",
+ "print \" The fugacity of water at 9000 kPa is %f kPa\"%(fugacity);\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The fugacity of water at 9000 kPa is 6753.477111 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.39 Page Number : 276"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Estimation of fugacity of saturated steam\n",
+ "\n",
+ "# Variables\n",
+ "T = 200 + 273.15;\t\t\t#[K] - Temperature\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
+ "\n",
+ "\t\t\t# From steam table at 200 C as reported in the book\n",
+ "P_sat = 1.5538;\t\t\t#[MPa] - Vapour pressure of saturated steam\n",
+ "H_vap = 2793.2;\t\t\t#[kJ/kg] - Enthalpy of saturated steam in vapour phase\n",
+ "S_vap = 6.4323;\t\t\t#[kJ/kg-K] - Entropy of saturated steam in vapour phase\n",
+ "\n",
+ "# Calculations\n",
+ "G_sat = H_vap - T*S_vap;\t\t\t#[kJ/kg] - Gibbs free energy\n",
+ "G_sat = G_sat*18.015;\t\t\t#[J/mol]\n",
+ "\n",
+ "\t\t\t# Now let us calculate the Gibbs free energy at the lowest pressure available in superheated steam tables at 200 C\n",
+ "\t\t\t# At 200 C and 0.01 MPa as reported in the book\n",
+ "H = 2879.5;\t\t\t#[kJ/kg] - Enthalpy\n",
+ "S = 8.9038;\t\t\t#[kJ/kg-K] - Entropy\n",
+ "G_ig = H - T*S;\t\t\t#[kJ/kg] - Gibbs free energy\n",
+ "G_ig = G_ig*18.015;\t\t\t#[J/mol]\n",
+ "\n",
+ "\t\t\t# Integrating from ideal gas state at 200 C and 0.01 MPa to saturated vapour at 200 C we get\n",
+ "\t\t\t# G_sat - G_ig = R*T*math.log(f_sat/f_ig)\n",
+ "\n",
+ "\t\t\t# Under the ideal gas condition the pressure is small therefore f_ig = P = 0.01 MPa\n",
+ "f_ig = 0.01;\t\t\t#[MPa]\n",
+ "\n",
+ "\t\t\t# Solving the above equation\n",
+ "f_sat = f_ig*(math.exp((G_sat - G_ig)/(R*T)));\t\t\t#[MPa]\n",
+ "\n",
+ "# Results\n",
+ "print \" The fugacity of saturated steam at 200 C is %f MPa\"%(f_sat);\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The fugacity of saturated steam at 200 C is 1.426074 MPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.40 Page Number : 277"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Estimation of fugacity of steam\n",
+ "\n",
+ "# Variables\n",
+ "T = 320 + 273.15;\t\t\t#[K]\n",
+ "P_1 = 70;\t\t\t#[bar]\n",
+ "P_2 = 170;\t\t\t#[bar]\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
+ "\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t#(a)\n",
+ "\t\t\t# dG = R*T*dmath.log(f)\n",
+ "\t\t\t# G - G_ig = R*T*math.log(f/f_ig)\n",
+ "\n",
+ "\t\t\t# From steam table the low pressure that is available is 1 kPa.\n",
+ "f_ig = 1;\t\t\t#[kPa] - Assuming ideal gas behaviour at such low pressure\n",
+ "\n",
+ "\t\t\t# At 1 kPa (under saturated conditions)\n",
+ "P_sat = 112.891;\t\t\t#[bar]\n",
+ "\t\t\t# Therefore at both 1 kPa and 70 bar the stem is superheated and byond a pressure of 112.891 bar it is compressed liquid.\n",
+ "\n",
+ "\t\t\t# For superheated steam table at 1 kPa and 320 C, as repoted in the book\n",
+ "H_1 = 3117.08;\t\t\t#[kJ/kg] - Enthalpy\n",
+ "S_1 = 10.41232;\t\t\t#[kJ/kg-K] - Entropy\n",
+ "\n",
+ "\t\t\t# For superheated steam table at 70 bar and 320 C, as repoted in the book\n",
+ "H_2 = 2916.92;\t\t\t#[kJ/kg] - Enthalpy\n",
+ "S_2 = 6.0651;\t\t\t#[kJ/kg-K] - Entropy\n",
+ "\n",
+ "\t\t\t# At 70 bar and 320 C,\n",
+ "G = H_2 - T*S_2;\t\t\t#[kJ/kg] - Gibbs free energy\n",
+ "\t\t\t# At 1 kPa and 320 C\n",
+ "G_ig = H_1 - T*S_1;\t\t\t#[kJ/kg] - Gibbs free energy\n",
+ "\n",
+ "\t\t\t# math.log(f/f_ig) = (G - G_ig)/(R*T)\n",
+ "f = f_ig*(math.exp((G - G_ig)*18/(R*T)));\t\t\t#[kPa]\n",
+ "f = f*10**(-2);\t\t\t#[bar]\n",
+ "\n",
+ "\t\t\t# At 70 bar\n",
+ "phi = f/P_1;\n",
+ "\n",
+ "print \" a).The fugacity of steam at 320 C and 70 bar is %f bar\"%(f);\n",
+ "print \" The fugacity coefficient at 320 C and 70 bar is phi = %f\"%(phi);\n",
+ "\n",
+ "\t\t\t#(b)\n",
+ "\t\t\t# Now consider saturated steam at 320 C. We have\n",
+ "P_sat = 112.891;\t\t\t#[bar]\n",
+ "V_liquid = 1.5;\t\t\t#[cm**(3)/mol] - Molar vlume of saturated liquid\n",
+ "V_liquid = V_liquid*10**(-6);\t\t\t#[m**(3)/mol]\n",
+ "V_vapour = 15.48;\t\t\t#[cm**(3)/mol] - Molar vlume of saturated vapour\n",
+ "U_liqid = 1445.7;\t\t\t#[Kj/kg] - Internal energy of satuarted liquid\n",
+ "U_vapour = 2528.9;\t\t\t#[kJ/kg] - Internal energy of satuarted vapour\n",
+ "H_liquid = 1462.6;\t\t\t#[kJ/kg] - Enthalpy of saturated liquid\n",
+ "H_vapour = 2703.7;\t\t\t#[kJ/kg] - Enthalpy of saturated vapour\n",
+ "S_liquid = 3.45;\t\t\t#[kJ/kg-K] - Entropy of saturated liquid\n",
+ "S_vapour = 5.5423;\t\t\t#[kJ/kg-K] - Entropy of saturated vapour\n",
+ "\n",
+ "\t\t\t# Now let us calculate Gibbs free energy of saturated liquid and saturated vapour\n",
+ "G_liquid = H_liquid - T*S_liquid;\t\t\t#[kJ/kg]\n",
+ "G_vapour = H_vapour - T*S_vapour;\t\t\t#[kJ/kg]\n",
+ "\t\t\t# Note that under saturated conditions\n",
+ "\t\t\t# G_sat = G_liquid = G_vapour\n",
+ "G_sat = G_liquid;\t\t\t#[kJ/kg]\n",
+ "\n",
+ "\t\t\t# math.log(f_sat/f_ig) = (G_sat - G_ig)/(R*T)\n",
+ "f_sat = f_ig*(math.exp((G_sat - G_ig)*18/(R*T)));\t\t\t#[kPa]\n",
+ "f_sat = f_sat*10**(-2);\t\t\t#[bar]\n",
+ "\n",
+ "phi_sat = f_sat/P_sat;\n",
+ "\n",
+ "\t\t\t# And now the fugacity is to be determined at 320 C and P = 170 bar. We know the following relation for compressed liquid.\n",
+ "\t\t\t# f_CL = f_sat*exp(V_liquid*(P-P_sat)/(R*T))\n",
+ "f_CL = f_sat*math.exp(V_liquid*18*(P_2-P_sat)*10**(5)/(R*T));\t\t\t#[bar]\n",
+ "\n",
+ "\t\t\t# Therefore the fugacity coefficient at 170 bar and 320 C is given by\n",
+ "phi_2 = f_CL/P_2;\n",
+ "\n",
+ "print \" b).The fugacity of steam at 320 C and 170 bar is %f bar\"%(f_CL);\n",
+ "print \" The fugacity coefficient at 320 C and 170 bar is phi = %f\"%(phi_2);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " a).The fugacity of steam at 320 C and 70 bar is 58.913361 bar\n",
+ " The fugacity coefficient at 320 C and 70 bar is phi = 0.841619\n",
+ " b).The fugacity of steam at 320 C and 170 bar is 86.552966 bar\n",
+ " The fugacity coefficient at 320 C and 170 bar is phi = 0.509135\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.41 Page Number : 278"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determination of fugacities at two states\n",
+ "\n",
+ "# Variables\n",
+ "T = 300 + 273.15;\t\t\t#[K]\n",
+ "P_1 = 12500*10**(3);\t\t\t#[Pa]\n",
+ "P_2 = 8581*10**(3);\t\t\t#[Pa]\n",
+ "P_3 = 300*10**(3);\t\t\t#[Pa]\n",
+ "V_liq = 1.404;\t\t\t#[cm**(3)/g] - Specific volume of liquid\n",
+ "V_liq = (V_liq/10**(6))*18.015;\t\t\t#[m**(3)/mol]\n",
+ "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
+ "\n",
+ "# Calculations and Results\n",
+ "\t\t\t# state 1: 300 C, 12500 kPa\n",
+ "\t\t\t# state 2: 300 C, 8581 kPa\n",
+ "\t\t\t# state 3: 300 C, 300 kPa\n",
+ "\n",
+ "\t\t\t# From state 1 to state 2 the system is liquid water and if the molar volume of liquid is assumed costant we can write\n",
+ "\t\t\t# G_2 - G_1 = V_liq*(P_2 - P_1)\n",
+ "\t\t\t# G_2 - G_1 = R*Tmath.log(f_2/f_1)\n",
+ "\t\t\t# Comparing the above two equations we get\n",
+ "\t\t\t# (f_2/f_1) = exp((V_liq*(P_2 - P_1)/(R*T))\n",
+ "f2_f1 = math.exp((V_liq*(P_2 - P_1)/(R*T))); \t\t\t# (f_2/f_1) = f2_f1 (say)\n",
+ "\n",
+ "\t\t\t# In state 2 the fugacity of liquid is same as that of saturated vapour and for the vapour phase change from state 2 to 3 the fugacity ratio is calculated using \n",
+ "\t\t\t# G_3 - G_2 = R*Tmath.log(f_3/f_2)\n",
+ "\n",
+ "\t\t\t# At 300 C, 8581 kPa \n",
+ "H_liq_2 = 2749.0;\t\t\t#[kJ/kg]\n",
+ "S_vap_2 = 5.7045;\t\t\t#[kJ/kg-K]\n",
+ "G_vap_2 = -520.53;\t\t\t#[kJ/kg]\n",
+ "G_vap_2 = G_vap_2*18.015;\t\t\t#[J/mol]\n",
+ "\n",
+ "\t\t\t# At 300 C, 300 kPa \n",
+ "H_3 = 3069.3;\t\t\t#[kJ/kg]\n",
+ "S_3 = 7.7022;\t\t\t#[kJ/kg-K]\n",
+ "G_3 = -1345.22;\t\t\t#[kJ/kg]\n",
+ "G_3 = G_3*18.015;\t\t\t#[J/mol]\n",
+ "\n",
+ "\t\t\t# Substituting and solving the equation G_3 - G_2 = R*Tmath.log(f_3/f_2)\n",
+ "f3_f2 = math.exp((G_3 - G_vap_2)/(R*T));\t\t\t# (f_3/f_2) = f3_f2 (say)\n",
+ "\n",
+ "\t\t\t# (f_3/f_1) = (f_3/f_2)*(f_2/f_1)\n",
+ "f3_f1 = f3_f2*f2_f1;\n",
+ "\n",
+ "print \" The ratio of fugacity in the final state to that in the initial state is given by f3/f2 = %f\"%(f3_f2);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The ratio of fugacity in the final state to that in the initial state is given by f3/f2 = 0.044255\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file