summaryrefslogtreecommitdiff
path: root/Introduction_to_flight_by_J_D_Anderson/Appendix.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Introduction_to_flight_by_J_D_Anderson/Appendix.ipynb')
-rwxr-xr-xIntroduction_to_flight_by_J_D_Anderson/Appendix.ipynb352
1 files changed, 352 insertions, 0 deletions
diff --git a/Introduction_to_flight_by_J_D_Anderson/Appendix.ipynb b/Introduction_to_flight_by_J_D_Anderson/Appendix.ipynb
new file mode 100755
index 00000000..d2f0522f
--- /dev/null
+++ b/Introduction_to_flight_by_J_D_Anderson/Appendix.ipynb
@@ -0,0 +1,352 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Appendix C"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Sublimation Pressure: 0.00109 KPa\n"
+ ]
+ }
+ ],
+ "source": [
+ "# -*- coding: utf8 -*-\n",
+ "from __future__ import division\n",
+ "from math import exp\n",
+ "#Example: 14.1\n",
+ "'''Determine the sublimation pressure of water vapor at −60◦C using data available in the\n",
+ "steam tables.\n",
+ "Control mass: Water.'''\n",
+ "\n",
+ "#Variable Declaration: \n",
+ "#from table in appendix B.1.5\n",
+ "T1 = 213.2\t\t\t#K, Temperature at state 1\n",
+ "P2 = 0.0129\t\t\t#kPa, pressure at state 2\n",
+ "T2 = 233.2\t\t\t#K, Temperature at state 2\n",
+ "hig = 2838.9\t\t#kJ/kg, enthalpy of sublimation \n",
+ "R = .46152\t\t\t#Gas constant \n",
+ "\n",
+ "#Calculations:\n",
+ "P1 = P2*exp(-hig/R*(1/T1-1/T2)) #using relation log(P2/P1) = (hig/R)*(1/T1-1/T2) \n",
+ "\n",
+ "#Results:\n",
+ "print 'Sublimation Pressure: ',round(P1,5),'KPa'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Change in internal energy: -159.4 J/Kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "# -*- coding: utf8 -*-\n",
+ "from __future__ import division\n",
+ "#Example: 14.4\n",
+ "'''The pressure on a block of copper having a mass of 1 kg is increased in a reversible process\n",
+ "from 0.1 to 100 MPa while the temperature is held constant at 15◦C. Determine the work\n",
+ "done on the copper during this process, the change in entropy per kilogram of copper, the\n",
+ "heat transfer, and the change of internal energy per kilogram.\n",
+ "Over the range of pressure and temperature in this problem, the following data can\n",
+ "be used:\n",
+ "Volume expansivity = αP = 5.0 × 10−5 K−1\n",
+ "Isothermal compressibility = βT = 8.6 × 10−12 m2/N\n",
+ "Specific volume = 0.000 114 m3/kg'''\n",
+ "\n",
+ "#Variable Declaration: \n",
+ "#known data\n",
+ "ap = 5*10**-5\t\t\t\t#K**-1 Volume expansivity\n",
+ "bt = 8.6*10**-12\t\t\t#m**2/N, Isothermal compressibility\n",
+ "v = 0.000114\t\t\t\t#m**3/kg, specific volume\n",
+ "P2 = 100*10**6\t\t\t\t#pressure at state 2 in kPa\n",
+ "P1 = 100\t\t\t\t\t#pressure at state 1 in kPa\n",
+ "T = 288.2\t\t\t\t\t#Temperature in K\n",
+ "\n",
+ "#Calculations:\n",
+ "w = -v*bt*(P2**2-P1**2)/2\t#work done in J/kg\n",
+ "q = -T*v*ap*(P2-P1)\t\t\t#heat in J/kg\n",
+ "du = q-w\t\t\t\t\t#change in internal energy in J/kg\n",
+ "\n",
+ "#Results:\n",
+ "print 'Change in internal energy: ',round(du,1),'J/Kg'\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Enthalpy change: 18.73 KJ/Kg\n",
+ "Temperature : 146.0 K\n"
+ ]
+ }
+ ],
+ "source": [
+ "# -*- coding: utf8 -*-\n",
+ "from __future__ import division\n",
+ "#Example: 14.5\n",
+ "'''Nitrogen is throttled from 20 MPa, −70◦C, to 2 MPa in an adiabatic, steady-state, steadyflow\n",
+ "process. Determine the final temperature of the nitrogen.\n",
+ "Control volume:\n",
+ "Inlet state:\n",
+ "Exit state:\n",
+ "Process:\n",
+ "Diagram:\n",
+ "Model:\n",
+ "Throttling valve.\n",
+ "P1, T1 known; state fixed.\n",
+ "P2 known.\n",
+ "Steady-state, throttling process.\n",
+ "Figure 14.8.\n",
+ "Generalized charts, Fig. D.2.'''\n",
+ "\n",
+ "#Variable Declaration: \n",
+ "#from table A.2\n",
+ "P1 = 20\t\t#pressure at state 1 in MPa\n",
+ "P2 = 2\t\t#pressure at state 2 in MPa\n",
+ "T1 = 203.2\t\t#Temperature at state 1 in K\n",
+ "Pr1 = P1/3.39\t\t#Reduced pressure at state 1\n",
+ "Pr2 = P2/3.39\t\t#Reduced pressure at state 2\n",
+ "Tr1 = T1/126.2\t\t#Reduced temperature\n",
+ "#from compressibility chart h1*-h1 = 2.1*R*Tc\n",
+ "#from zero pressure specific heat data h1*-h2* = Cp*(T1a-T2a)\n",
+ "#h2*-h2 = 0.5*R*Tc\n",
+ "#this gives dh = h1-h2 = -2.1*R*Tc+Cp*(T1a-T2a)+0.5*R*Tc\n",
+ "R = 0.2968\t\t#gas constant for given substance\n",
+ "Tc = 126.2\t\t#K, Constant temperature\n",
+ "Cp = 1.0416\t\t#heat enthalpy at constant pressure in kJ/kg\n",
+ "T2 = 146\t\t#temperature at state 2\n",
+ "\n",
+ "#Calculations:\n",
+ "dh = 0.5*R*Tc#\n",
+ "\n",
+ "#Results:\n",
+ "print 'Enthalpy change: ',round(dh,2),'KJ/Kg'\n",
+ "print 'Temperature :',round(T2,2),'K' "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Enthalpy change: 61.98 kJ/kg\n",
+ "Entropy Change: 1.0782 kJ/kg.K\n"
+ ]
+ }
+ ],
+ "source": [
+ "# -*- coding: utf8 -*-\n",
+ "from __future__ import division\n",
+ "from math import log\n",
+ "\n",
+ "#Example: 14.6\n",
+ "'''Nitrogen at 8 MPa, 150 K, is throttled to 0.5 MPa. After the gas passes through a short\n",
+ "length of pipe, its temperature is measured and found to be 125 K. Determine the heat\n",
+ "transfer and the change of entropy using the generalized charts. Compare these results\n",
+ "with those obtained by using the nitrogen tables.\n",
+ "Control volume:\n",
+ "Inlet state:\n",
+ "Exit state:\n",
+ "Process:\n",
+ "Diagram:\n",
+ "Model:\n",
+ "Throttle and pipe.\n",
+ "P1, T1 known; state fixed.\n",
+ "P2, T2 known; state fixed.\n",
+ "Steady state.\n",
+ "Figure 14.10.\n",
+ "Generalized charts, results to be compared with those\n",
+ "obtained with nitrogen tables.'''\n",
+ "\n",
+ "#Variable Declaration: \n",
+ "#from table A.2\n",
+ "P1 = 8\t\t\t\t\t#pressure at state 1 in MPa\n",
+ "P2 = 0.5\t\t\t\t#pressure at state 2 in MPa\n",
+ "T1 = 150\t\t\t\t#Temperature at state 1 in K\n",
+ "Pr1 = P1/3.39\t\t\t#Reduced pressure at state 1\n",
+ "Pr2 = P2/3.39\t\t\t#Reduced pressure at state 2\n",
+ "Tr1 = T1/126.2\t\t\t#Reduced temperature\n",
+ "T2 = 125\t\t\t\t#Temperature at state 2\n",
+ "R = 0.2968\t\t\t\t#gas constant for given substance\n",
+ "Tc = 126.2\t\t\t\t#K, Constant temperature\n",
+ "Cp = 1.0416\t\t\t\t#Heat enthalpy at constant pressure in kJ/kg\n",
+ "\n",
+ "#Calculations:\n",
+ "dh = (2.35)*R*Tc+Cp*(T2-T1)\t\t#\n",
+ "ds = 1.6*R-0.1*R+Cp*log(T2/T1)-R*log(P2/P1)\n",
+ "\n",
+ "#Results:\n",
+ "print 'Enthalpy change: ',round(dh,2),'kJ/kg'\n",
+ "print 'Entropy Change: ',round(ds,4),'kJ/kg.K'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Percentage deviation in specific volume using Kays rule: 4.8 %\n",
+ "Percentage deviation in specific volume using vander waals eqn: 6.4 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "# -*- coding: utf8 -*-\n",
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "#Example: 14.7\n",
+ "'''A mixture of 80% CO2 and 20% CH4 (mass basis) is maintained at 310.94 K, 86.19 bar,\n",
+ "at which condition the specific volume has been measured as 0.006757 m3/kg. Calculate\n",
+ "the percent deviation if the specific volume had been calculated by (a) Kay’s rule and (b)\n",
+ "van der Waals’ equation of state.\n",
+ "Control mass:\n",
+ "State:\n",
+ "Model:\n",
+ "Gas mixture.\n",
+ "P, v, T known.\n",
+ "(a) Kay’s rule. (b) van der Waals’ equation.'''\n",
+ "#Keys:\n",
+ "#a-denotes C02\n",
+ "#b-denotes CH4\n",
+ "#c-denotes critical conditions\n",
+ "\n",
+ "#Variable Declaration: \n",
+ "T = 310.94\t\t\t\t#Temperature of mixture K\n",
+ "P = 86.19\t\t\t\t#Pressure of mixture in MPa\n",
+ "Tca = 304.1\t\t\t\t#K\n",
+ "Tcb = 190.4\t\t\t\t#K\n",
+ "Pca = 7.38\t\t\t\t#MPa\n",
+ "Pcb = 4.60\t\t\t\t#MPa\n",
+ "Ra = 0.1889\t\t\t\t#gas constant for a in kJ/kg.K\n",
+ "Rb = 0.5183\t\t\t\t#gas constant for b in kJ/kg.K\n",
+ "xa = 0.8\t\t\t\t#fraction of CO2\n",
+ "xb = 0.2\t\t\t\t#fraction of CH4\n",
+ "Ma = 44.01\t\t\t\t#molecular mass of a\n",
+ "Mb = 16.043\t\t\t\t#molecular mass of b\n",
+ "Zm = 0.7\t\t\t\t#Compressiblity from generalised compressibility chart\n",
+ "ve = 0.0006757\t\t\t#experimental specific volume in m**3/kg\n",
+ "\n",
+ "#Calculations:\n",
+ "Rm = xa*Ra+xb*Rb\t\t#mean gas constant in kJ/kg.K\n",
+ "ya = xa/Ma/(xa/Ma+xb/Mb)#mole fraction of a\n",
+ "yb = xb/Mb/(xa/Ma+xb/Mb)#mole fraction of b\n",
+ "Tcm = ya*Tca+yb*Tcb\t\t#mean critical temp in K\n",
+ "Pcm = ya*Pca+yb*Tcb\t\t#mean critical pressure n MPa\n",
+ "Trm = T/Tcm\n",
+ "Prm = P/Pcm\n",
+ "vc = Zm*Rm*T/P/1000\t\t#specific volume calculated in m**3/kg\n",
+ "pd1 = (ve-vc)/ve*100\t#percent deviation\n",
+ "Aa = 27*Ra**2*Tca**2/(64*Pca*1000)\n",
+ "Ba = Ra*Tca/(8*Pca*1000)\n",
+ "Ab = 27*Rb**2*Tcb**2/(64*Pcb*1000)\n",
+ "Bb = Rb*Tcb/(8*Pcb*1000)\n",
+ "Am = (xa*sqrt(Aa)+xb*sqrt(Ab))**2\n",
+ "Bm = (xa*Ba+xb*Bb)\n",
+ "vc = 0.0006326\t\t\t#calculated specific volume in m**3/kg\n",
+ "pd2 = (ve-vc)/ve*100\n",
+ "\n",
+ "#Results:\n",
+ "print 'Percentage deviation in specific volume using Kays rule: ',round(pd1,1),'%'\n",
+ "print 'Percentage deviation in specific volume using vander waals eqn: ',round(pd2,1),'%' "
+ ]
+ }
+ ],
+ "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
+}