{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# CHAPTER04:INCOMPRESSIBLE FLOW OVER AIRFOILS"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E01 : Pg 126"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "c_l = 0.650199104032\n",
      "\n",
      "for this c_l value, from fig. 4.10we get alpha = 4.0\n",
      "\n",
      "Re = 3.08015651202\n",
      "\n",
      "for this value of Re, from fig. 4.11 we get c_d = 0.0068\n",
      "\n",
      "D= 13.114752 N/m\n"
     ]
    }
   ],
   "source": [
    "# All the quantities are expressed in SI units\n",
    "import math\n",
    "c = 0.64;                                # chord length of the airfoil\n",
    "V_inf = 70.;                              # freestream velocity\n",
    "L_dash = 1254.;                           # lift per unit span L'\n",
    "rho_inf = 1.23;                          # density of air\n",
    "mu_inf = 1.789*10.**-5.;                       # freestream coefficient of viscosity\n",
    "q_inf = 1./2.*rho_inf*V_inf*V_inf;         # freestream dynamic pressure\n",
    "\n",
    "# thus the lift coefficient can be calculated as\n",
    "c_l = L_dash/q_inf/c;\n",
    "\n",
    "# for this value of C_l, from fig. 4.10\n",
    "alpha = 4.;\n",
    "\n",
    "# the Reynold's number is given as\n",
    "Re = rho_inf*V_inf*c/mu_inf;\n",
    "\n",
    "# for the above Re and alpha values, from fig. 4.11\n",
    "c_d = 0.0068;\n",
    "\n",
    "# thus the drag per unit span can be calculated as\n",
    "D_dash = q_inf*c*c_d;\n",
    "\n",
    "print\"c_l =\",c_l\n",
    "print\"\\nfor this c_l value, from fig. 4.10we get alpha =\",alpha\n",
    "print\"\\nRe =\",Re/1000000. \n",
    "print\"\\nfor this value of Re, from fig. 4.11 we get c_d =\",c_d\n",
    "print\"\\nD=\",D_dash,\"N/m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E02 : Pg 126"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Moment per unit span about the aerodynamic center is is M= -61.71648 Nm\n"
     ]
    }
   ],
   "source": [
    "# All the quantities are expressed in SI units\n",
    "\n",
    "c = 0.64;                                # chord length of the airfoil\n",
    "V_inf = 70.;                              # freestream velocity\n",
    "rho_inf = 1.23;                          # density of air\n",
    "q_inf = 1./2.*rho_inf*V_inf*V_inf;         # freestream dynamic pressure\n",
    "c_m_ac = -0.05                           # moment coefficient about the aerodynamic center as seen from fig. 4.11\n",
    "\n",
    "# thus moment per unit span about the aerodynamic center is given as\n",
    "M_dash = q_inf*c*c*c_m_ac;\n",
    "\n",
    "print\"The Moment per unit span about the aerodynamic center is is M=\",M_dash,\"Nm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E04 : Pg 127"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)Cl = 0.548311355616\n",
      "(b)Cm_le = -0.137077838904\n",
      "(c)m_c/4 = 0\n",
      "(d)Cm_te = 0.411233516712\n"
     ]
    }
   ],
   "source": [
    "# All the quantities are expressed in SI units\n",
    "from math import pi\n",
    "alpha = 5.*pi/180.;            # angle of attack in radians\n",
    "\n",
    "# from eq.(4.33)according to the thin plate theory, the lift coefficient is given by\n",
    "c_l = 2.*pi*alpha;\n",
    "\n",
    "# from eq.(4.39) the coefficient of moment about the leading edge is given by\n",
    "c_m_le = -c_l/4.;\n",
    "\n",
    "# from eq.(4.41)\n",
    "c_m_qc = 0;\n",
    "\n",
    "# thus the coefficient of moment about the trailing can be calculated as\n",
    "c_m_te = 3./4.*c_l;\n",
    "\n",
    "print\"(a)Cl =\", c_l\n",
    "print\"(b)Cm_le =\",c_m_le\n",
    "print\"(c)m_c/4 =\",c_m_qc\n",
    "print\"(d)Cm_te =\",c_m_te"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E06 : Pg 131"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The location of the aerodynamic center is x_ac = 0.241306818182\n"
     ]
    }
   ],
   "source": [
    "# All the quantities are expressed in SI units\n",
    "\n",
    "alpha1 = 4.;\n",
    "alpha2 = -1.1;\n",
    "alpha3 = -4.;\n",
    "cl_1 = 0.55;                # cl at alpha1\n",
    "cl_2 = 0;                   # cl at alpha2\n",
    "c_m_qc1 = -0.005;           # c_m_qc at alpha1\n",
    "c_m_qc3 = -0.0125;          # c_m_qc at alpha3\n",
    "\n",
    "# the lift slope is given by\n",
    "a0 = (cl_1 - cl_2)/(alpha1-alpha2);\n",
    "\n",
    "# the slope of moment coefficient curve is given by\n",
    "m0 = (c_m_qc1 - c_m_qc3)/(alpha1-alpha3);\n",
    "\n",
    "# from eq.4.71\n",
    "x_ac = -m0/a0 + 0.25;\n",
    "\n",
    "print\"The location of the aerodynamic center is x_ac =\",x_ac"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E07 : Pg 139"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)delta = 0.00425971375685 m\n",
      "(b)Cf = 7.5425331588\n",
      "Net Cf = 0.00150850663176\n"
     ]
    }
   ],
   "source": [
    "# All the quantities are expressed in SI units\n",
    "import math \n",
    "c = 1.5;            # airfoil chord\n",
    "Re_c = 3.1e6;       # Reynolds number at trailing edge\n",
    "\n",
    "# from eq.(4.84), the laminar boundary layer thickness at trailing edge is given by\n",
    "delta = 5*c/math.sqrt(Re_c);\n",
    "\n",
    "# from eq(4.86)\n",
    "Cf = 1.328/math.sqrt(Re_c);\n",
    "\n",
    "# the net Cf for both surfaces is given by\n",
    "Net_Cf = 2*Cf;\n",
    "\n",
    "print\"(a)delta =\",delta,\"m\"\n",
    "print\"(b)Cf =\",Cf*10000  \n",
    "print\"Net Cf =\",Net_Cf"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E08 : Pg 150"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a)delta = 0.0279267658904 m\n",
      "(b)Cf = 0.00372356878539\n",
      "Net Cf = 0.00744713757078\n"
     ]
    }
   ],
   "source": [
    "# All the quantities are expressed in SI units\n",
    "import math \n",
    "c = 1.5;            # airfoil chord\n",
    "Re_c = 3.1e6;       # Reynolds number at trailing edge\n",
    "\n",
    "# from eq.(4.87), the turbulent boundary layer thickness at trailing edge is given by\n",
    "delta = 0.37*c/(Re_c**0.2);\n",
    "\n",
    "# from eq(4.86)\n",
    "Cf = 0.074/(Re_c**0.2);\n",
    "\n",
    "# the net Cf for both surfaces is given by\n",
    "Net_Cf = 2*Cf;\n",
    "\n",
    "print\"(a)delta =\",delta,\"m\"\n",
    "print\"(b)Cf =\",Cf\n",
    "print\"Net Cf =\",Net_Cf"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example E09 : Pg 162"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The net skin friction coefficient is Net Cf= 0.00632\n"
     ]
    }
   ],
   "source": [
    "# All the quantities are expressed in SI units\n",
    "from math import sqrt\n",
    "c = 1.5;                # airfoil chord length\n",
    "Rex_cr = 5e5;           # critical Reynold's number\n",
    "Re_c = 3.1e6;           # Reynold's number at the trailing edge\n",
    "\n",
    "# the point of transition is given by\n",
    "x1 = Rex_cr/Re_c*c;\n",
    "\n",
    "# the various skin friction coefficients are given as\n",
    "Cf1_laminar = 1.328/sqrt(Rex_cr);\n",
    "Cfc_turbulent = 0.074/(Re_c**0.2);\n",
    "Cf1_turbulent = 0.074/(Rex_cr**0.2);\n",
    "\n",
    "# thus the total skin friction coefficient is given by\n",
    "Cf = x1/c*Cf1_laminar + Cfc_turbulent - x1/c*Cf1_turbulent;\n",
    "\n",
    "# taking both sides of plate into account\n",
    "Net_Cf = 2*Cf;\n",
    "\n",
    "print\"The net skin friction coefficient is Net Cf=\",round(Net_Cf,5)"
   ]
  }
 ],
 "metadata": {
  "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
}
