diff options
Diffstat (limited to 'Introduction_To_Chemical_Engineering_Thermodynamics_by_G._Halder/Ch2.ipynb')
-rwxr-xr-x | Introduction_To_Chemical_Engineering_Thermodynamics_by_G._Halder/Ch2.ipynb | 1274 |
1 files changed, 0 insertions, 1274 deletions
diff --git a/Introduction_To_Chemical_Engineering_Thermodynamics_by_G._Halder/Ch2.ipynb b/Introduction_To_Chemical_Engineering_Thermodynamics_by_G._Halder/Ch2.ipynb deleted file mode 100755 index 9013eed3..00000000 --- a/Introduction_To_Chemical_Engineering_Thermodynamics_by_G._Halder/Ch2.ipynb +++ /dev/null @@ -1,1274 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Chapter 2 - First law of thermodynamics" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.1 Page: 39" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.1 - Page: 39\n", - "\n", - "\n", - "The work done during the process is -9486.67 kJ\n", - "\n" - ] - } - ], - "source": [ - "from __future__ import division\n", - "\n", - "print \"Example: 2.1 - Page: 39\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "#deff('[E] = f1(T)','E = 50 + 25*T + 0.05*T**2')## [J]\n", - "#deff('[Q] = f2(T)','Q = 4000 + 10*T')## [J]\n", - "\n", - "def f1(T):\n", - " E = 50 + 25*T + 0.05*T**2\n", - " return E\n", - "\n", - "def f2(T):\n", - " Q = 4000 + 10*T\n", - " return Q\n", - "Ti = 400## [K]\n", - "Tf = 800## [K]\n", - "#*************#\n", - "\n", - "# From the first law of thermodynamics:\n", - "# W = Q - delta_E\n", - "# W = f2 -f1\n", - "from sympy.mpmath import quad\n", - "W = quad(lambda T:(4000 + 10*T) - (50 + (25*T) + (0.05*T**2)),[Ti,Tf])#\n", - "print \"The work done during the process is %.2f kJ\\n\"%(W/1000)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.2 Page: 40" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.2 - Page: 40\n", - "\n", - "\n", - "The final internal energy of the fluid is 500 kJ\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.2 - Page: 40\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "U1 = 1000## [kJ]\n", - "Q = -600# # [kJ]\n", - "W = -100## [kJ]\n", - "#************#\n", - "\n", - "# The system is considered to be a closed system. No mass transfer takes place across the system. The tank is rigid. \n", - "# So, the kinetic and the potential energies is zero.\n", - "# Therefore:\n", - "# delta_E = delta_U + delta_PE + delta_KE\n", - "# delta_E = delta_U\n", - "# From the first law of thermodynamics:\n", - "# Q = delta_U + W\n", - "# delta_U = Q - W\n", - "# U2 - U1 = Q - W\n", - "U2 = U1 + Q - W## [kJ]\n", - "print \"The final internal energy of the fluid is %d kJ\\n\"%(U2)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.3 Page: 40" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.3 - Page: 40\n", - "\n", - "\n", - "The change in the internal energy of the system would be 1125.99 J/s\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.3 - Page: 40\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "W = -3## [hp]\n", - "Q = -4000## [kJ/h]\n", - "#**************#\n", - "\n", - "# The work done by the stirrer on the system is given by\n", - "W = W*745.7## [W]\n", - "# The amount of heat transferred to the suroundings can be expressed in terms of J/s:\n", - "Q = Q*1000/3600## [J/s]\n", - "# From the first law of thermodynamics:\n", - "# Q = delta_U - W\n", - "delta_U = Q - W## [J/s]\n", - "print \"The change in the internal energy of the system would be %.2f J/s\\n\"%(delta_U)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.4 Page: 41" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.4 - Page: 41\n", - "\n", - "\n", - "The amount of heat transferred from the system to the surroundings during process B-3-A is 95 kJ\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.4 - Page: 41\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "# From Fig. 2.4 (Page: 41)\n", - "# For process A-1-B:\n", - "Q1 = 60## [kJ]\n", - "W1 = 35## [kJ]\n", - "# For process A-2-B:\n", - "W2 = 50## [kJ]\n", - "# For process B-3-A:\n", - "W3 = -70## [kJ]\n", - "#************#\n", - "\n", - "# For process A-1-B:\n", - "# The internal energy of the process A-1-B can be estimated as:\n", - "# Q = delta_U + W\n", - "delta_U = Q1 - W1## [kJ]\n", - "# For process A-2-B:\n", - "Q2 = delta_U + W2## [kJ]\n", - "# For process B-3-A:\n", - "Q3 = -delta_U + W3## [kJ]\n", - "print \"The amount of heat transferred from the system to the surroundings during process B-3-A is %d kJ\\n\"%(-Q3)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.5 Page: 41" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.5 - Page: 41\n", - "\n", - "\n", - "Change in Internal Energy for process 1-2 is 50 kJ\n", - "\n", - "Change in Internal Energy for process 2-3 is 80 kJ\n", - "\n", - "Change in Internal Energy for process 3-1 is -130 kJ\n", - "\n", - "The work done during the adiabatic process is 130 kJ\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.5 - Page: 41\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "# For constant pressure process 1-2:\n", - "W12 = -100## [kJ]\n", - "Q12 = -50## [kJ]\n", - "# For constant volume process 2-3:\n", - "Q23 = 80## [kJ]\n", - "# process 3-1: Adiabatic process\n", - "#**************#\n", - "\n", - "# The internal energy of process 1-2 can be calculated as:\n", - "delta_U12 = Q12 - W12## [kJ]\n", - "print \"Change in Internal Energy for process 1-2 is %d kJ\\n\"%(delta_U12)#\n", - "# For the process 2-3:\n", - "# As the process is constant volume process:\n", - "W23 = 0## [kJ]\n", - "delta_U23 = Q23 - W23## [kJ]\n", - "print \"Change in Internal Energy for process 2-3 is %d kJ\\n\"%(delta_U23)#\n", - "\n", - "# For process 3-1:\n", - "# Since the process is adiabatic, ther is no heat transfer between the system and the surrounding.\n", - "Q31 = 0## [kJ]\n", - "# For a cyclic process, the internal energy change is zero.\n", - "# delta_U12 + delta_U23 + delta_U31 = 0\n", - "delta_U31 = -(delta_U12 + delta_U23)## [kJ]\n", - "# Putting the value of delta_U31:\n", - "W31 = Q31 - delta_U31## [kJ]\n", - "print \"Change in Internal Energy for process 3-1 is %d kJ\\n\"%(delta_U31)#\n", - "print \"The work done during the adiabatic process is %d kJ\\n\"%(W31)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.6 Page: 44" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.6 - Page: 44\n", - "\n", - "\n", - "Change in Internal Energy is 2087.59 kJ\n", - "\n", - "Change in enthalpy is 2257 kJ\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.6 - Page: 44\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "m = 1## [kg]\n", - "Temp = 373## [K]\n", - "P = 101325## [N/square m]\n", - "V_Liquid = 1.04*10**(-3)## [cubic m/kg]\n", - "V_Vapour = 1.673## [cubic m/kg]\n", - "Q = 2257## [kJ]\n", - "#**************#\n", - "\n", - "# Work done due to expansion:\n", - "Wexpansion = P*(V_Vapour - V_Liquid)## [N-m]\n", - "deltaU = Q - Wexpansion/1000## [kJ]\n", - "deltaH = deltaU + Wexpansion/1000## [kJ]\n", - "\n", - "print \"Change in Internal Energy is %.2f kJ\\n\"%(deltaU)#\n", - "print \"Change in enthalpy is %d kJ\\n\"%(deltaH)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.7 Page: 45" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.7 - Page: 45\n", - "\n", - "\n", - "Change in Internal Energy is 26705.16 J\n", - "\n", - "Change in Enthalpy is 29640 J\n", - "\n", - "Amount of Heat supplied is 29640 J\n", - "\n", - "Work done is 2934.84 J\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.7 - Page: 45\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "n = 1## [mol]\n", - "Temp = 353## [K]\n", - "P = 1## [atm]\n", - "Hv = 380## [J/g]\n", - "Mwt = 78## [g/mol]\n", - "R = 8.314## [J/K mol]\n", - "#*************#\n", - "\n", - "Q = Hv*Mwt## [J/mol]\n", - "# Since Vv >> Vl:\n", - "# P*(Vv - Vl) = P*Vv =n*R*Temp\n", - "Wexpansion = n*R*Temp## [J]\n", - "# By first law of thermodynamics:\n", - "deltaU = Q - Wexpansion## [J]\n", - "deltaH = deltaU + Wexpansion## [J]\n", - "\n", - "print \"Change in Internal Energy is %.2f J\\n\"%(deltaU)#\n", - "print \"Change in Enthalpy is %d J\\n\"%(deltaH)#\n", - "print \"Amount of Heat supplied is %d J\\n\"%(Q)#\n", - "print \"Work done is %.2f J\\n\"%(Wexpansion)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.8 Page: 45" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.8 - Page: 45\n", - "\n", - "\n", - "Change in enthalpy is 589.48 cal\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.8 - Page: 45\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "deltaU = 200## [cal]\n", - "Vinit = 10## [L]\n", - "Vfinal = 50## [L]\n", - "#deff('[P] = f(V)','P = 10/V')#\n", - "def f(V):\n", - " P=10/V\n", - " return P\n", - "#**************#\n", - "\n", - "# By definition of enthalpy:\n", - "# deltaQ = deltaU + PdV\n", - "deltaQ = deltaU + quad(f,[Vinit,Vfinal])*24.2## [cal]\n", - "print \"Change in enthalpy is %.2f cal\\n\"%(deltaQ)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.9 Page: 48" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.9 - Page: 48\n", - "\n", - "\n", - "Rise in Temperature is 58.67 K\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.9 - Page: 48\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "m_water = 1## [kg]\n", - "Cv = 4.18## [kJ/kg K]\n", - "m_stirrer = 40## [kg]\n", - "h = 25## [m]\n", - "g = 9.81## [m/square s]\n", - "#***************#\n", - "\n", - "# Since the system is thermally insulated:\n", - "# Q = 0\n", - "# From the first law of thermodynamics:\n", - "# dQ = dE + dW\n", - "# As E = U + Ek +Ep and Ek = Ep = 0\n", - "# dQ = dU + dW\n", - "dT = g*h/Cv## [K]\n", - "print \"Rise in Temperature is %.2f K\\n\"%(dT)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.10 Page: 53" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.10 - Page: 53\n", - "\n", - "\n", - "The final temperature is 753.6 K\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.10 - Page: 53\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "T1 = 300## [K]\n", - "V1 = 30## [L]\n", - "V2 = 3## [L]\n", - "Cv = 5## [cal/mol]\n", - "R = 2## [cal/K mol]\n", - "#*************#\n", - "\n", - "Cp = Cv + R## [cal/mol]\n", - "gama = Cp/Cv#\n", - "# The relation between temperature and volume of ideal gas undergoing adiabatic change is given by:\n", - "# (T2/T1) = (V1/V2)**(gama - 1)\n", - "T2 = T1 * (V1/V2)**(gama - 1)## [K]\n", - "print \"The final temperature is %.1f K\\n\"%(T2)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.11 Page: 53" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.11 - Page: 53\n", - "\n", - "\n", - "The final volme is 7.44 L\n", - "\n", - "The final temperature is 226.80 K\n", - "\n", - "Adiabatic work done is 35.72 L-atm\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.11 - Page: 53\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "n = 2## [mol]\n", - "T1 = 293## [K]\n", - "P1 = 15##[atm]\n", - "P2 = 5## [atm]\n", - "Cp = 8.58## [cal/degree mol]\n", - "#**************#\n", - "\n", - "R = 2## [cal/degree mol]\n", - "Cv = Cp - R## [cal /degree mol]\n", - "gama = Cp/Cv#\n", - "R = 0.082## [L atm/degree K]\n", - "# Since the gas is ideal:\n", - "V1 = n*R*T1/P1## [L]\n", - "# Under adiabatic conditions:\n", - "# (V2/V1) = (P1/P2)**(1/gama)\n", - "V2 = V1*(P1/P2)**(1/gama)## [L]\n", - "print \"The final volme is %.2f L\\n\"%(V2)#\n", - "\n", - "# To determine the final temperature:\n", - "# (T2/T1) = (V1/V2)**(gama - 1)#\n", - "T2 = T1*(V1/V2)**(gama - 1)## [K]\n", - "print \"The final temperature is %.2f K\\n\"%(T2)#\n", - "\n", - "# Adiabatic Work done can be calculated as:\n", - "W = (P1*V1 - P2*V2)/(gama - 1)#\n", - "print \"Adiabatic work done is %.2f L-atm\\n\"%(W)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.12 Page: 57" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.12 - Page: 57\n", - "\n", - "\n", - "Adiabatic Process \n", - "\n", - "Final Pressure is 0.84 atm\n", - "\n", - "Final Temperature is 169.673696 K\n", - "\n", - "Adiabatic Work done is 31.432 L-atm\n", - "\n", - "\n", - "\n", - "Isothermal Process\n", - "\n", - "Final temperature is 323 K\n", - "\n", - "Final pressure is 1.6 atm\n", - "\n", - "Work done during the isothermal process is 42.63 L-atm\n", - "\n" - ] - } - ], - "source": [ - "from math import log\n", - "print \"Example: 2.12 - Page: 57\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "m = 1## [kg]\n", - "P1 = 8## [atm]\n", - "T1 = 50 + 273## [K]\n", - "# V1 = V## [L]\n", - "# V2 = 5V## [L]\n", - "V1_by_V2 = 1/5#\n", - "gama = 1.4#\n", - "R = 0.082## [L-atm]\n", - "#***************#\n", - "\n", - "# Adiabatic process:\n", - "print \"Adiabatic Process \\n\"\n", - "P2 = P1*V1_by_V2**gama## [atm]\n", - "print \"Final Pressure is %.2f atm\\n\"%(P2)#\n", - "T2 = T1*V1_by_V2**(gama - 1)## [K]\n", - "print \"Final Temperature is %f K\\n\"%(T2)#\n", - "Wad = R*(T2 - T1)/(1 - gama)## [L-atm]\n", - "print \"Adiabatic Work done is %.3f L-atm\\n\"%(Wad)#\n", - "print \"\\n\"\n", - "\n", - "# Isothermal Process:\n", - "print \"Isothermal Process\\n\"\n", - "# In an isothermal Process, the temperature remans constant:\n", - "T2 = T1## [K]\n", - "print \"Final temperature is %d K\\n\"%(T2)#\n", - "# From the ideal gas:\n", - "# (P2*V2/T2) = (P1*V1/T1)\n", - "# Since T2 = T1\n", - "# P2*V2 = P1*V1\n", - "P2 = P1*V1_by_V2## [atm]\n", - "print \"Final pressure is %.1f atm\\n\"%(P2)#\n", - "W = R*T1*log(1/V1_by_V2)## [L-atm]\n", - "print \"Work done during the isothermal process is %.2f L-atm\\n\"%(W)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.13 Page: 58" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.13 - Page: 58\n", - "\n", - "\n", - "Isochoric Process\n", - "\n", - "Change in Internal Energy is 716.55 kJ\n", - "\n", - "Heat Supplied is 716.55 kJ\n", - "\n", - "Work done is 0 kJ\n", - "\n", - "Change in Enthalpy is 1003.24 kJ\n", - "\n", - "\n", - "\n", - "Isobaric Process\n", - "\n", - "Change in Internal Energy is 716.76 kJ\n", - "\n", - "Heat Supplied is 1003.45 kJ\n", - "\n", - "Work done is 286.69 kJ\n", - "\n", - "Change in Enthalpy is 1003.45 kJ\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.13 - Page: 58\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "m = 5## [kg]\n", - "M = 29## [kg/mol]\n", - "T1 = 37 + 273## [K]\n", - "P1 = 101.33## [kPa]\n", - "T2 = 237 + 273## [K]\n", - "Cp = 29.1## [J/mol K]\n", - "Cv = 20.78## [J/mol K]\n", - "R = 8.314## [J/K mol]\n", - "#*****************#\n", - "\n", - "n = m/M#\n", - "# From ideal gas equation:\n", - "V1 = n*R*T1/P1## [cubic m]\n", - "\n", - "# Isochoric Process:\n", - "print \"Isochoric Process\\n\"\n", - "# Volume = constant\n", - "V2 = V1## [cubic m]\n", - "deltaU = n*Cv*(T2 - T1)## [kJ]\n", - "# Since Volume is constant\n", - "W = 0#\n", - "Q = deltaU + W## [kJ]\n", - "# deltaH = deltaU + P*deltaV\n", - "# deltaH = deltaU + n*R*deltaT\n", - "deltaH = deltaU + n*R*(T2 - T1)## [kJ]\n", - "print \"Change in Internal Energy is %.2f kJ\\n\"%(deltaU)#\n", - "print \"Heat Supplied is %.2f kJ\\n\"%(Q)#\n", - "print \"Work done is %d kJ\\n\"%(W)#\n", - "print \"Change in Enthalpy is %.2f kJ\\n\"%(deltaH)#\n", - "print \"\\n\"\n", - "\n", - "# Isobaric Process\n", - "print \"Isobaric Process\\n\"\n", - "# Since Pressure is constant.\n", - "P2 = P1## [kPa]\n", - "deltaH = n*Cp*(T2 - T1)## [kJ]\n", - "Qp = deltaH## [kJ]\n", - "# deltaU = deltaH - P*deltaV\n", - "# From ideal gas equation:\n", - "deltaU = deltaH - n*R*(T2 - T1)## [kJ]\n", - "W = Qp - deltaU## [kJ]\n", - "print \"Change in Internal Energy is %.2f kJ\\n\"%(deltaU)#\n", - "print \"Heat Supplied is %.2f kJ\\n\"%(Qp)#\n", - "print \"Work done is %.2f kJ\\n\"%(W)#\n", - "print \"Change in Enthalpy is %.2f kJ\\n\"%(deltaH)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.14 Page: 60" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.14 - Page: 60\n", - "\n", - "\n", - "Step 1: Isothermal Expansion Of Ideal Gas\n", - "\n", - "delta_E for Step 1 is 0 J/mol\n", - "\n", - "Q for step 1 is 11679.76 J/mol\n", - "\n", - "W for step 1 is 11679.76 J/mol\n", - "\n", - "\n", - "\n", - "Step 2: Adiabatic Expansion of ideal gas\n", - "\n", - "delta_E for Step 2 is -6234 J/mol\n", - "\n", - "Q for step 2 is 0.00 J/mol\n", - "\n", - "W for step 2 is 6234.00 J/mol\n", - "\n", - "\n", - "\n", - "Step 3: Isothermal Compression Of Ideal Gas\n", - "\n", - "delta_E for Step 3 is 0 J/mol\n", - "\n", - "Q for step 3 is -5935.61 J/mol\n", - "\n", - "W for step 3 is -5935.61 J/mol\n", - "\n", - "\n", - "\n", - "Step 4: Adiabatic Compression of ideal gas\n", - "\n", - "delta_E for Step 4 is 6234 J/mol\n", - "\n", - "Q for step 4 is 0.00 J/mol\n", - "\n", - "W for step 4 is -6234.00 J/mol\n", - "\n", - "\n", - "\n", - "Net Work done for the complete cycle is 5744.14 J/mol\n", - "\n", - "The efficiency of the cycle is 0.49\n", - "\n" - ] - } - ], - "source": [ - "from math import log10\n", - "print \"Example: 2.14 - Page: 60\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "n = 1## [mol]\n", - "T1 = 610## [K]\n", - "P1 = 10**6## [N/square m]\n", - "T2 = 310## [K]\n", - "P2 = 10**5## [N/square m]\n", - "Cv = 20.78## [J/mol K]\n", - "#*************#\n", - "\n", - "R = 8.314## [J/K mol]\n", - "\n", - "# Step 1: Isothermal Expansion Of Ideal Gas:\n", - "print \"Step 1: Isothermal Expansion Of Ideal Gas\\n\"\n", - "T1 = 610## [K]\n", - "P1 = 10**6## [N/square m]\n", - "P2 = 10**5## [N/square m]\n", - "# Work done:\n", - "W1 = 2.303*n*R*T1*log10(P1/P2)## [J/mol]\n", - "# For isothermal expansion:\n", - "delta_E1 = 0## [J/mol]\n", - "# From first law of thermodynamics:\n", - "Q1 = delta_E1 + W1## [J/mol]\n", - "print \"delta_E for Step 1 is %d J/mol\\n\"%(delta_E1)#\n", - "print \"Q for step 1 is %.2f J/mol\\n\"%(Q1)#\n", - "print \"W for step 1 is %.2f J/mol\\n\"%(W1)#\n", - "print \"\\n\"\n", - "\n", - "# Step 2: Adiabatic Expansion of ideal gas:\n", - "print \"Step 2: Adiabatic Expansion of ideal gas\\n\"\n", - "Q2 = 0## [J/mol]\n", - "delta_E2 = Cv*(T2 - T1)## [J/mol]\n", - "# From first law of thermodynamics:\n", - "W2 = Q2 - delta_E2## [J/mol]\n", - "print \"delta_E for Step 2 is %d J/mol\\n\"%(delta_E2)#\n", - "print \"Q for step 2 is %.2f J/mol\\n\"%(Q2)#\n", - "print \"W for step 2 is %.2f J/mol\\n\"%(W2)#\n", - "print \"\\n\"\n", - "\n", - "# Step 3: Isothermal Compression Of Ideal Gas:\n", - "print \"Step 3: Isothermal Compression Of Ideal Gas\\n\"\n", - "T2 = 310## [K]\n", - "P1 = 10**5## [N/square m]\n", - "P2 = 10**6## [N/square m]\n", - "# Work done:\n", - "W3 = 2.303*n*R*T2*log10(P1/P2)## [J/mol]\n", - "# For isothermal expansion:\n", - "delta_E3 = 0## [J/mol]\n", - "# From first law of thermodynamics:\n", - "Q3 = delta_E3 + W3## [J/mol]\n", - "print \"delta_E for Step 3 is %d J/mol\\n\"%(delta_E3)#\n", - "print \"Q for step 3 is %.2f J/mol\\n\"%(Q3)#\n", - "print \"W for step 3 is %.2f J/mol\\n\"%(W3)#\n", - "print \"\\n\"\n", - "\n", - "# Step 4: Adiabatic Compression of ideal gas:\n", - "print \"Step 4: Adiabatic Compression of ideal gas\\n\"\n", - "T1 = 310## [K]\n", - "T2 = 610## [K]\n", - "Q4 = 0## [J/mol]\n", - "delta_E4 = Cv*(T2 - T1)## [J/mol]\n", - "# From first law of thermodynamics:\n", - "W4 = Q4 - delta_E4## [J/mol]\n", - "print \"delta_E for Step 4 is %d J/mol\\n\"%(delta_E4)#\n", - "print \"Q for step 4 is %.2f J/mol\\n\"%(Q4)#\n", - "print \"W for step 4 is %.2f J/mol\\n\"%(W4)#\n", - "print \"\\n\"\n", - "\n", - "# Net work done for the complete cycle:\n", - "W = W1 + W2 + W3 + W4## [J/mol]\n", - "print \"Net Work done for the complete cycle is %.2f J/mol\\n\"%(W)#\n", - "\n", - "# The efficiency of the cycle is given by:\n", - "eta = 1- T1/T2#\n", - "print \"The efficiency of the cycle is %.2f\\n\"%(eta)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.15 Page: 61" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.15 - Page: 61\n", - "\n", - "\n", - " Mathematics is involved in proving but just that no numerical computations are involved.\n", - "\n", - "\n", - " For prove refer to this example 2.15 on page 61 of the book.\n" - ] - } - ], - "source": [ - "print \"Example: 2.15 - Page: 61\\n\\n\"\n", - "\n", - "# Mathematics is involved in proving but just that no numerical computations are involved.\n", - "# For prove refer to this example 2.15 on page number 61 of the book.\n", - "\n", - "print \" Mathematics is involved in proving but just that no numerical computations are involved.\\n\\n\"\n", - "print \" For prove refer to this example 2.15 on page 61 of the book.\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.16 Page: 62" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.16 - Page: 62\n", - "\n", - "\n", - "First Process\n", - "\n", - "Change in Internal Energy is -2223.97 kJ\n", - "\n", - "Change in Enthalpy is -5612.22 kJ\n", - "\n", - "Heat Requirement is -2246.40 kJ\n", - "\n", - "\n", - "\n", - "Second Process\n", - "\n", - "Change in Internal Energy is -22441.57 kJ\n", - "\n", - "Change in Enthalpy is -56122.20 kJ\n", - "\n", - "Heat Requirement is -22464.00 kJ\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.16 - Page: 62\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "P1 = 1## [bar]\n", - "T1 = 300##[K]\n", - "V1 = 24.92## [cubic m/kmol]\n", - "P2 = 10## [bar]\n", - "T2 = 300## [K]\n", - "Cp = 29.10## [kJ/kmol K]\n", - "Cv = 20.78## [kJ/kmol K]\n", - "R = 8.314## [J/mol K]\n", - "#**************#\n", - "\n", - "# Basis: 1 kmol of ideal gas:\n", - "n = 1#\n", - "V2 = P1*V1/P2## [cubic m]\n", - "\n", - "# First Process:\n", - "print \"First Process\\n\"\n", - "# In the first step of the first process, the cooling of ga takes place at constant pressure.\n", - "# Here the volume is reduced appreciably and consequently the temperature decreases.\n", - "T_prime = T1*V2/V1## [K]\n", - "# Heat Requirement:\n", - "Q1 = n*Cp*(T_prime - T1)## [kJ]\n", - "deltaH1 = Q1## [kJ]\n", - "deltaU1 = deltaH1 - P1*(V2 - V1)## [kJ]\n", - "# In the second step, the gas is heated at constant Volume:\n", - "# V = constant\n", - "Q2 = n*Cv*(T2 - T_prime)## [kJ]\n", - "deltaU2 = Q2## [kJ]\n", - "deltaH2 = n*R*(T2 - T_prime)## [kJ]\n", - "deltaU = deltaU1 + deltaU2## [kJ]\n", - "deltaH = deltaH1 + deltaH2## [kJ]\n", - "Q = Q1 + Q2## [kJ]\n", - "print \"Change in Internal Energy is %.2f kJ\\n\"%(deltaU)#\n", - "print \"Change in Enthalpy is %.2f kJ\\n\"%(deltaH)#\n", - "print \"Heat Requirement is %.2f kJ\\n\"%(Q)#\n", - "print \"\\n\"\n", - "\n", - "# Second Process:\n", - "print \"Second Process\\n\"\n", - "# In the first step of the second process, the gas is heated at constant volume.\n", - "T_prime = T1*P2/P1## [K]\n", - "# Heat Requirement:\n", - "Q1 = n*Cv*(T_prime - T1)## [kJ]\n", - "deltaU1 = Q1## [kJ]\n", - "deltaH1 = n*R*(T_prime - T1)## [kJ]\n", - "# In the second step, the gas is cooled at constant presure:\n", - "# V = constant\n", - "Q2 = n*Cp*(T2 - T_prime)## [kJ]\n", - "deltaH2 = Q2## [kJ]\n", - "deltaU2 = deltaH2 - P1*(V2 - V1)## [kJ]\n", - "deltaU = deltaU1 + deltaU2## [kJ]\n", - "deltaH = deltaH1 + deltaH2## [kJ]\n", - "Q = Q1 + Q2## [kJ]\n", - "print \"Change in Internal Energy is %.2f kJ\\n\"%(deltaU)#\n", - "print \"Change in Enthalpy is %.2f kJ\\n\"%(deltaH)#\n", - "print \"Heat Requirement is %.2f kJ\\n\"%(Q)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.17 Page: 62" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.17 - Page: 64\n", - "\n", - "\n", - "Workdone by the gas is 251.33 kJ\n", - "\n" - ] - } - ], - "source": [ - "from math import pi\n", - "print \"Example: 2.17 - Page: 64\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "D1 = 1## [m]\n", - "P1 = 120## [kPa]\n", - "P2 = 360## [kPa]\n", - "# P = k*D**3\n", - "#***************#\n", - "\n", - "k = P1/D1**3## [proportionality constant]\n", - "D2 = (P2/k)**(1/3)## [m]\n", - "# Work done by the gas inside the balloon can be estimated as:\n", - "# W = integral(P*dV)#\n", - "# W = integral((k*D**3)*d((4/3)*pi*r**3)#\n", - "# W = (pi*k/6)*integral((D**3)*d(D**3))#\n", - "# W = (pi*k/12)*(D2**6 - D1**6)#\n", - "W = (pi*k/12)*(D2**6 - D1**6)## [kJ]\n", - "print \"Workdone by the gas is %.2f kJ\\n\"%(W)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.18 Page: 65" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.18 - Page: 65\n", - "\n", - "\n", - "Change in Inernal Enrgy is 1040.65 kJ\n", - "\n", - "Change in Enthalpy is 1456.35 kJ\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.18 - Page: 65\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "P1 = 10*100## [kPa]\n", - "T1 = 250## [K]\n", - "P2 = 1*100## [kPa]\n", - "T2 = 300## [K]\n", - "R = 8.314## [J/mol K]\n", - "Cv = 20.78## [kJ/kmol K]\n", - "Cp = 29.10## [kJ/kmol K]\n", - "#**********#\n", - "\n", - "V1 = R*T1/P1## [cubic m]\n", - "V2 = R*T2/P2## [cubic m]\n", - "\n", - "# Calculation based on First Process:\n", - "# In this constant-volume process, the initial pressure of 10 bar is reduced to a final pressure of 1 bar and consequently the temperature decreases.\n", - "T_prime = P2*V1/R## [K]\n", - "deltaU1 = Cv*(T_prime - T1)## [kJ]\n", - "deltaH1 = deltaU1 + V1*(P2 -P1)## [kJ]\n", - "# Since V = constant\n", - "W1 = 0##[kJ]\n", - "# By first law of thermodynamics:\n", - "Q = W1 + deltaU1## [kJ]\n", - "\n", - "# Calculation based on second process:\n", - "# In this process, the gas is heated at constant pressure to the final temperature of T2.\n", - "deltaH2 = Cp*(T2 - T_prime)## [kJ]\n", - "deltaU2 = deltaH2 - P2*(V2 - V1)## [kJ]\n", - "Q = deltaH2## [kJ]\n", - "W2 = Q - deltaU2## [kJ]\n", - "\n", - "deltaU = deltaU1 + deltaU2## [kJ]\n", - "deltaH = deltaH1 + deltaH2## [kJ]\n", - "print \"Change in Inernal Enrgy is %.2f kJ\\n\"%(deltaU)#\n", - "print \"Change in Enthalpy is %.2f kJ\\n\"%(deltaH)#" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Example: 2.19 Page: 69" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Example: 2.19 - Page: 69\n", - "\n", - "\n", - "Tempertaure of water in the second tank is 312.86 K\n", - "\n" - ] - } - ], - "source": [ - "print \"Example: 2.19 - Page: 69\\n\\n\"\n", - "\n", - "# Solution\n", - "\n", - "#*****Data*****#\n", - "T1 = 273## [K]\n", - "T2 = 273 + 67## [K]\n", - "m_dot = 20000## [kg/h]\n", - "Ws = -1.5## [hp]\n", - "Q = -38000## [kJ/min]\n", - "Z = 20## [m]\n", - "Cp = 4.2## [kJ/kg K]\n", - "g = 9.81## [m/second square]\n", - "#***************#\n", - "\n", - "Q = Q*60/m_dot## [kJ/kg]\n", - "Ws = Ws*0.7457*3600/m_dot## [kJ/kg]\n", - "PE = g*Z*10**(-3)## [kJ/kg]\n", - "# KE is assumed to be negligible.\n", - "# For Steady Flow process: dE/dt = 0\n", - "# From Eqn. 2.47:\n", - "deltaH = Q - Ws - PE## [kJ/kg]\n", - "H1 = Cp*(T2 - T1)## [kJ/kg]\n", - "H2 = H1 + deltaH## [kJ/kg]\n", - "\n", - "# Now, the temperature of the tank can be determined as:\n", - "T = (H2/Cp) + T1## [K]\n", - "print \"Tempertaure of water in the second tank is %.2f K\\n\"%(T)#" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} |