{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 1: Thermodynamic Definitions and Concepts"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 1.1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Vfg (ft^3/lbm) =  1.4059\n",
      " \n",
      " V (ft^3/lbm) =  0.8625\n",
      " \n",
      " V (ft^3/lbm) =  0.8625\n",
      " \n",
      " V (ft^3/lbm) =  0.8625\n",
      "press enter key to exit\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "''"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Determine the specific volume for steam of 60% quality at 425 F using \n",
    "#(a) Eq 1.3 (b) 1.4 (c) 1.5\n",
    "import math\n",
    "#initialisation of variables\n",
    "Vf= 0.019014 \t\t\t\t\t\t\t\t\t#ft^3/lbm\n",
    "Vg= 1.4249 \t\t\t\t\t\t\t\t\t\t#ft^3/lbm\n",
    "T= 425. \t\t\t\t\t\t\t\t\t\t#fahrenheit\n",
    "quality= 60. \t\t\t\t\t\t\t\t\t#%\n",
    "#CALCULATIONS\n",
    "Vfg= Vg-Vf \t\t\t\t\t\t\t\t\t\t#Specific volume \n",
    "V= (quality/100.)*Vg+(1-(quality/100.))*Vf \t\t#Volume using 1.3\n",
    "V1= Vf+(quality/100.)*Vfg  \t\t\t\t\t\t#Volume using 1.4\n",
    "V2= Vg-(1-(quality/100.))*Vfg \t\t\t\t\t#Volume using 1.5\n",
    "#RESULTS\n",
    "print '%s %.4f' % ('Vfg (ft^3/lbm) = ',Vfg)\n",
    "print '%s %.4f' % (' \\n V (ft^3/lbm) = ',V)\n",
    "print '%s %.4f' % (' \\n V (ft^3/lbm) = ',V1)\n",
    "print '%s %.4f' % (' \\n V (ft^3/lbm) = ',V2)\n",
    "raw_input('press enter key to exit')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 1.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "From keenan and keyes steam tables, at 500 f and 350 psia,\n",
      "\n",
      " Specific volume (ft^3/lbm) =  1.4913\n"
     ]
    }
   ],
   "source": [
    "#Saturated steam at 350 lbf/in^2 is heated to 500F. sketch a temperature-\n",
    "#-volume vapor dome and show the specific volume , temperature and pressure\n",
    "#for the saturated and superheated states\n",
    "#initialization of variables\n",
    "tsat=431.82 \t\t\t\t\t#F\n",
    "vf=0.019124 \t\t\t\t\t#ft^3/lbm\n",
    "vg=1.3267 \t\t\t\t\t\t#ft^3/lbm\n",
    "#Calculations\n",
    "print '%s' %('From keenan and keyes steam tables, at 500 f and 350 psia,')\n",
    "v=1.4913 \t\t\t\t\t\t#ft^3/lbm\n",
    "#Results\n",
    "print '%s %.4f' %('\\n Specific volume (ft^3/lbm) = ',v)\n",
    "raw_input('press enter key to exit')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 1.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "From keenan and keyes steam tables\n",
      "Amount of liquid compressed (cm^3/gm) =  0.0098\n"
     ]
    }
   ],
   "source": [
    "#If saturated liquid steam at 100C has its pressure increased to 200 bar \n",
    "#while the temperature remains constant, determine how much the liquid\n",
    "#is compressed.\n",
    "import math\n",
    "#initialisation of variables\n",
    "T= 100. \t\t\t\t#degrees\n",
    "P= 200. \t\t\t\t#bar\n",
    "#CALCULATIONS\n",
    "print '%s' %('From keenan and keyes steam tables')\n",
    "Psat= 1.0135 \t\t\t#bar\n",
    "Vf= 1.0435 \t\t\t\t#cm^3/gm\n",
    "V= 1.0337 \t\t\t\t#cm^3/gm\n",
    "v= Vf-V \t\t\t\t#Amount of compressed\n",
    "#RESULTS\n",
    "print '%s %.4f' % ('Amount of liquid compressed (cm^3/gm) = ',v)\n",
    "raw_input('press enter key to exit')"
   ]
  }
 ],
 "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.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
