{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# CHAPTER12:LINEARIZED SUPERSONIC FLOW"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E01 : Pg 395"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The cl and cd according to the linearized theory are:cl = 0.12\n",
      "The cl and cd according to the linearized theory are:cd = 0.01\n"
     ]
    }
   ],
   "source": [
    "# All the quantities are expressed in SI units\n",
    "from math import pi,sqrt\n",
    "alpha = 5*pi/180;                    # angle of attack\n",
    "M_inf = 3;                            # freestream mach number\n",
    "\n",
    "# from eq.(12.23)\n",
    "c_l = 4*alpha/sqrt(M_inf**2 - 1);\n",
    "\n",
    "# from eq.(12.24)\n",
    "c_d = 4*alpha**2/sqrt(M_inf**2 - 1);\n",
    "\n",
    "print\"The cl and cd according to the linearized theory are:cl =\", round(c_l,2)\n",
    "print\"The cl and cd according to the linearized theory are:cd =\",round(c_d,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E02 : Pg 395"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The angle of attack of the wing is: 1.97493716351 degrees\n"
     ]
    }
   ],
   "source": [
    "# All the quantities are expressed in SI units\n",
    "from math import sqrt,pi\n",
    "M_inf = 2.;                       # freestream mach number\n",
    "rho_inf = 0.3648;                # freestream density at 11 km altitude\n",
    "T_inf = 216.78;                  # freestream temperature at 11 km altitude\n",
    "gam = 1.4;                       # ratio of specific heats\n",
    "R = 287.;                         # specific gas constant\n",
    "m = 9400.;                        # mass of the aircraft\n",
    "g = 9.8;                         # acceleratio due to gravity\n",
    "W = m*g;                         # weight of the aircraft\n",
    "S = 18.21;                       # wing planform area\n",
    "# thus\n",
    "a_inf = sqrt(gam*R*T_inf);\n",
    "V_inf = M_inf*a_inf;\n",
    "q_inf = 1./2.*rho_inf*V_inf**2.;\n",
    "\n",
    "# thus the aircraft lift coefficient is given as\n",
    "C_l = W/q_inf/S;\n",
    "\n",
    "alpha = 180./pi*C_l/4.*sqrt(M_inf**2. - 1.);\n",
    "\n",
    "print\"The angle of attack of the wing is:\",alpha,\"degrees\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E03 : Pg 400"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a) Net Cf =  4.3\n",
      "(b) cd = 2.82901631903\n"
     ]
    }
   ],
   "source": [
    "# All the quantities are expressed in SI units\n",
    "# All the quantities are expressed in SI units\n",
    "from math import sqrt,pi\n",
    "# (a)\n",
    "M_inf = 2.;                       # freestream mach number\n",
    "rho_inf = 0.3648;                # freestream density at 11 km altitude\n",
    "T_inf = 216.78;                  # freestream temperature at 11 km altitude\n",
    "gam = 1.4;                       # ratio of specific heats\n",
    "R = 287.;                         # specific gas constant\n",
    "m = 9400.;                        # mass of the aircraft\n",
    "g = 9.8;                         # acceleratio due to gravity\n",
    "W = m*g;                         # weight of the aircraft\n",
    "S = 18.21;                       # wing planform area\n",
    "c = 2.2;                         # chord length of the airfoil\n",
    "alpha = 0.035;                   # angle of attack as calculated in ex. 12.2\n",
    "T0 = 288.16;                     # ambient temperature at sea level\n",
    "mue0 = 1.7894e-5;                # reference viscosity at sea level\n",
    "\n",
    "# thus\n",
    "a_inf = sqrt(gam*R*T_inf);\n",
    "V_inf = M_inf*a_inf;\n",
    "\n",
    "# according to eq.(15.3), the viscosity at the given temperature is\n",
    "mue_inf = mue0*(T_inf/T0)**1.5*(T0+110.)/(T_inf+110.);\n",
    "\n",
    "# thus the Reynolds number can be given by\n",
    "Re = rho_inf*V_inf*c/mue_inf;\n",
    "\n",
    "# from fig.(19.1), for these values of Re and M, the skin friction coefficient is\n",
    "Cf = 2.15*10**-3;\n",
    "\n",
    "# thus, considering both sides of the flat plate\n",
    "net_Cf = 2.*Cf;\n",
    "\n",
    "# (b)\n",
    "c_d = 4.*alpha**2./sqrt(M_inf**2. - 1.);\n",
    "\n",
    "print\"(a) Net Cf = \",net_Cf*1e3\n",
    "print\"(b) cd =\",c_d*1e3"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "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.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
