{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "###### Content provided under a Creative Commons Attribution license, CC-BY 4.0; code under BSD 3-Clause license (c)2015 L.A. Barba, Pi-Yueh Chuang." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Joukowski Transformation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is your [_AeroPython_](https://github.com/barbagroup/AeroPython) assignment for the second course module, titled **\"Potential vortices and lift.\"** The first course module, \"Building blocks of potential flow\" (first three IPython Notebooks of the series) ended with the representation of potential flow around a 2D cylinder by means of superposing a doublet singularity and a free stream. And in the second module, you learned that adding a vortex singularity, you can get lift around the cylinder. You may ask: *is all this useful?* \n", "\n", "Here's how it all starts getting useful. Using some simple techniques from complex-variable calculus, we can generate the flow around some airfoils starting with the flow around 2D cylinders. The trick is to use a [*conformal map*](http://en.wikipedia.org/wiki/Conformal_map) (a complex function that preserves angles) to move from the cylinder plane to the airfoil plane. \n", "\n", "Let's explore this classic method!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Introduction" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You learned how to construct potential flow over a cylinder via superposition of a free stream and a [doublet](03_Lesson03_doublet.ipynb) singularity. You also learned that adding a vortex can generate [lift on the cylinder](06_Lesson06_vortexLift.ipynb) But what's the big deal? Why is this important to us? What can we do with this potential cylinder flow?\n", "\n", "Back in the years when computers were not available, fluid dynamicists and mathematicians used a powerful tool—complex analysis—to study potential flows without directly solving partial-differential governing equations. With the magic of complex analysis and the known solution of potential flow over a cylinder, they could easily obtain many kinds of external potential flows, including flows over several types of airfoils.\n", "\n", "Nowadays, though, we no longer use these magical tools. But, not just out of nostalgia, it's still interesting to know the basic concept behind the magic: conformal mappings. In this assignment, we will guide you step by step to obtain potential flow over an airfoil starting with the flow over a cylinder and the famous conformal mapping called the **Joukowski transformation**. You will realize how important potential cylinder flow is in the history of aerodynamics!\n", "\n", "Don't worry. We won't talk too much about the mathematics. And you don't have to calculate by hand as the pioneers of aerodynamics did. Just follow the steps and let Python do the heavy lifting." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Complex numbers in Python" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's start with two complex planes, one defined by points $z = x + iy$, and the other defined by points $\\xi = \\xi_x+i\\xi_y$. The Joukowski transformation takes a point in the $z$-plane and \"maps\" it to the $\\xi$-plane by:\n", "\n", "$$\n", "\\begin{equation}\n", "\\xi = z + \\frac{c^2}{z}\n", "\\end{equation}\n", "$$\n", "\n", "where $c$ is a constant parameter. Before we discuss the Joukowski transformation, let's gain some practice with complex numbers in Python.\n", "\n", "Using complex numbers, your function for the Joukowski transformation will look \n", "very simple, and you won't have to calculate the real and imaginary parts separately. \n", "\n", "Python (and therefore, NumPy) can deal with complex numbers right out of the box. But the imaginary number, $i=\\sqrt{-1}$, is represented by `j`, *not* `i`, to avoid clashes with the common use of `i` in iterations. \n", "\n", "\n", "If you haven't used them before, try some simple manipulations of complex numbers now. For example, enter the following in a cell block:\n", "\n", "```Python\n", "3 + 2j\n", "```\n", "\n", "Now try:\n", "\n", "```Python\n", "a = 3\n", "b = 3\n", "z = a + b * 1j\n", "print('z = ', z)\n", "print('The type of the variable is ', type(z))\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise\n", "\n", "Get familiar with complex-number operations in Python by answering the following:\n", "\n", "1. $(2.75+3.69i)\\times(8.55-6.13i)=$ \n", "2. $1.4\\times e^{i5.32}=$ \n", "3. $\\frac{7.51-9.15i}{4.43+9.64i}=$\n", "\n", "Don't forget to enter your answers on [Open edX](https://openedx.seas.gwu.edu/courses/course-v1:MAE+MAE6226+2017/about).\n", "(Notes: you will need to enter your results with a 2-digit precision after the decimal point in the auto-graded section.)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Shapes created by the Joukowski transformation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Start by writing a Python function that takes `z` and `c` as parameters, and returns the Joukowski transformation of `z`.\n", "\n", "We can generate several patterns using Joukowski transforms. Use your Python function to perform the calculations described below and answer the questions.\n", "\n", "Just take $c=1$ here for simplicity.\n", "\n", "\n", "1. On the $z$-plane, place a circle with radius $R$ larger than $c=1$, say $R=1.5$, centered at the origin. What does the shape look like when mapped on the $\\xi$-plane?\n", " 1. circle\n", " 2. ellipse\n", " 3. symmetric airfoil\n", " 4. cambered airfoil\n", "2. Now, place a circle on the $z$-plane with radius such that $c \\lt R \\lt 2c$ (e.g., $c=1$; $R=1.2$), centered at $(x_c,y_c)=(c-R, 0)$. What does the shape look like on the $\\xi$-plane?\n", " 1. circle\n", " 2. ellipse\n", " 3. symmetric airfoil\n", " 4. cambered airfoil\n", "3. Put a circle at $(x_c, y_c)=(-\\Delta x, \\Delta y)$, where $\\Delta x$ and $\\Delta y$ are small positive numbers, e.g. $\\Delta x=0.1$ and $\\Delta y=0.1$. The radius $R$ of the circle is $R = \\sqrt{(c - x_c)^2 + y_c^2}$. What does the shape on $\\xi$-plane look like?\n", " 1. circle\n", " 2. ellipse\n", " 3. symmetric airfoil\n", " 4. cambered airfoil\n", "4. Consider the case when you obtain a symmetric airfoil. In polar coordinates, $(\\theta, r=R)$, which point on the circle corresponds to the trailing edge of the airfoil?\n", " * $\\theta=$?\n", "\n", "Don't forget to enter your answers on [Open edX](https://openedx.seas.gwu.edu/courses/course-v1:MAE+MAE6226+2017/about).\n", "(Notes: you will need to enter your results with a 2-digit precision after the decimal point in the auto-graded section.)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Grid points on the $z$-plane using polar coordinates" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "By the Joukowski transformation, a point on the $z$-plane corresponds to a point on the $\\xi$-plane. As you saw in the previous section, this transformation sometimes gives a shape that looks quite a lot like an airfoil. _What's the use of this?_\n", "\n", "It turns out that in complex analysis, when you have a solution to Laplace's equation on the complex plane and apply a [conformal mapping](http://en.wikipedia.org/wiki/Conformal_map), the transformed function is still a solution of the Laplace equation.\n", "\n", "This means that we can map the potential function and the streamlines of flow over a cylinder on the $z$-plane to the $\\xi$-plane, and obtain the streamlines of flow over an airfoil. The stream function around the airfoil will be given by:\n", "\n", "$$\n", "\\begin{equation}\n", "\\psi(\\xi_x, \\xi_y) = \\psi(\\xi_x(x, y), \\xi_y(x, y))\n", "\\end{equation}\n", "$$\n", "\n", "where the complex coordinates of $\\xi$, $\\xi_x$ and $\\xi_y$, are obtained from the Joukowski transformation of $z=x+iy$.\n", "\n", "In this exercise, you will obtain the flow over a symmetric Joukowski airfoil with zero and non-zero angle of attack. We obtain the shape of our target airfoil by placing a cylinder centered at $(x_c, y_c)=(-0.15, 0)$ with radius $R = 1.15$ and parameter $c=1$. You'll reach the goal step-by-step with problems (3) to (6).\n", "\n", "First, build a set of grid points on the $z$-plane and see how these points look like on the $\\xi$-plane. Use polar coordinates to build your grid on the $z$-plane. If you place grid points inside the cylinder, they will end up outside the airfoil after a Joukowski transformation (try it for yourself!). This is a problem. The streamlines inside the cylinder are not physical anyway, so we'll just ignore this region." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise\n", "\n", "1. Build a grid in polar coordinates in the $z$-plane. Use $N_r = 100$ points in the radial direction, within the range $R \\le r \\le 5$, and $N_\\theta = 145$ points in the axial direction, within the range $0 \\le \\theta \\le 2\\pi$.\n", "2. Use the Joukowski transformation to map the grid into the $\\xi$-plane.\n", "3. Plot the grid points in both planes using the function `pyplot.scatter()`.\n", "\n", "You should obtain figures that look like this:\n", "\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4. Flow over a symmetric Joukowski airfoil with zero angle of attack" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Stream function and streamlines\n", "\n", "Now, you will evaluate potential flow over the cylinder on the $z$-plane. As mentioned above, $\\psi(\\xi) = \\psi(\\xi(z))$. This means that, after evaluating the stream function at a certain point on the $z$-plane, the corresponding point on the $\\xi$-plane has the same value of the stream function. We can plot the streamlines on both planes using the function `pyplot.contour()`, because the stream function is a scalar function.\n", "\n", "Use $1$ as the free stream velocity, i.e., $U_{\\infty}=1$. You have to calculate the strength of the doublet first in order to have a cylinder with radius $R=1.15$.\n", "\n", "You should obtain streamline patterns similar to those shown in the following figures.\n", "\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Velocity vector and pressure coefficient\n", "\n", "To get the pressure coefficients, we need to compute the velocity fields.\n", "We can simply obtain the velocity field on the $z$-plane using the coordinates of the grid points on the $z$-plane.\n", "But can we just say that the velocity at the corresponding points on the $\\xi$-plane is the same as that on the $z$-plane, just like what we did for the stream function?\n", "_The answer is no._ \n", "\n", "The values of the stream function remain the same on the original and mapped points because the stream function is a scalar solution of Laplace's equation!\n", "\n", "However, the velocity is a vector and is not a solution of Laplace's equation. \n", "When the coordinate system changes by the conformal map, the values of the vector in the new system are different. \n", "\n", "Now, let's go back to our problem: the $z$-plane and the $\\xi$-plane are two different coordinate systems.\n", "The velocity at a specific point on the $z$-plane is not the same as that at the corresponding point on the $\\xi$-plane.\n", "Some manipulation must be done.\n", "\n", "We recall that the velocity potential, $\\phi$, is also a solution of Laplace's equation; therefore, the potential values remain the same at a point under the conformal transformation.\n", "The same applies to the complex potential, $F(z) = F(\\xi(z)) = \\phi + i \\psi$.\n", "\n", "The complex velocity in the $z$-plane is defined by:\n", "\n", "$$\n", "\\begin{equation}\n", "W_z = \\frac{dF}{dz} = u_z - i v_z\n", "\\end{equation}\n", "$$\n", "\n", "where $u_z = \\frac{\\partial \\psi}{\\partial y}$ and $v_z = -\\frac{\\partial \\psi}{\\partial x}$.\n", "\n", "We can obtain the complex velocity in the $\\xi$-plane, $W_\\xi = u_\\xi - i v_\\xi$, by applying a chain rule:\n", "\n", "$$\n", "\\begin{equation}\n", "W_\\xi = \\frac{dF}{d\\xi} = \\frac{dF}{dz} \\times \\frac{dz}{d\\xi} = \\frac{dF}{dz} / \\frac{d\\xi}{dz} = W_z / \\frac{d\\xi}{dz}\n", "\\end{equation}\n", "$$\n", "\n", "where\n", "\n", "$$\n", "\\begin{equation}\n", "\\frac{d\\xi}{dz} = \\frac{d\\left(z + \\frac{c^2}{z}\\right)}{dz} = 1 - \\left(\\frac{c}{z}\\right)^2\n", "\\end{equation}\n", "$$\n", "\n", "Once we have the velocity fields, we can get the pressure coefficient on each plane.\n", "\n", "The velocity field on each plane should look like this (using the function `pyplot.quiver()`):\n", "\n", "
\n", "\n", "The pressure coefficient on each plane should look like this (using the function `pyplot.contourf()`):\n", "\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise\n", "\n", "* Write the Python code to obtain the figures shown above (streamlines, velocity field, and pressure coefficient in both planes).\n", "* Answer the following questions:\n", " 1. What is the strength of the doublet?\n", " 2. What is the velocity at the $62^\\text{nd}$ point on the airfoil surface? (We assume that the trailing edge is the $1^\\text{st}$ point and that we index the points counterclockwise.)\n", " 3. What is the minimum value of the pressure coefficient on the airfoil surface?\n", "\n", "Don't forget to enter your answers on [Open edX](https://openedx.seas.gwu.edu/courses/course-v1:MAE+MAE6226+2017/about).\n", "(Notes: you will need to enter your results with a 2-digit precision after the decimal point in the auto-graded section.)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5. Flow over a symmetric Joukowski airfoil with non-zero angle of attack, without circulation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, we want to place the airfoil at an angle of attack (AoA) with respect to the free stream.\n", "Of course we can use flow over a cylinder and the Joukowski transformation to do this.\n", "*But how?*\n", "Can we superpose a free stream with non-zero inlet angle and a doublet to obtain what we want?\n", "Actually, we can't.\n", "If we do so, we won't be able to obtain a closed streamline, like we did in the previous case (in which a closed circular streamline can be taken as a cylinder surface).\n", "\n", "A way to achieve a uniform flow with an inlet angle is by simply rotating the complex plane $z$ to get a new complex plane $z'$, where the $x'$-axis (i.e., real part of $z'$) is parallel to the free-stream direction, with its origin located at the center of the cylinder $\\left(x_c, y_c\\right)$, as shown in the figure below.\n", "\n", "
\n", "\n", "The relationship between the $z'$-plane and the $z$-plane is:\n", "\n", "$$\n", "\\begin{equation}\n", "z'=\\left[ z-(x_c+iy_c) \\right]e^{-i\\times AoA}\n", "\\end{equation}\n", "$$\n", "\n", "i.e.,\n", "\n", "$$\n", "\\begin{equation}\n", "\\left\\{\n", "\\begin{array}{lcr}\n", "x' & = & (x-x_c)\\cos(AoA) + (y-y_c)\\sin(AoA) \\\\\n", "y' & = & - (x-x_c)\\sin(AoA) + (y-y_c)\\cos(AoA)\n", "\\end{array}\n", "\\right.\n", "\\end{equation}\n", "$$\n", "\n", "Now, we can obtain the flow over a cylinder on the new plane $z'$ by adding a free stream with **zero inlet angle** to a doublet **centered at the origin**.\n", "Then, we can obtain the flow on the $z$-plane and, finally, on the $\\xi$-plane.\n", "Again, the stream function remains the same at the same point under the three coordinate systems ($z'$, $z$, and $\\xi$).\n", "\n", "You should get streamlines in the $z$-plane and in the $\\xi$-plane that look like this:\n", "\n", "
\n", "\n", "The velocity vector need to be rotated back from the $z'$-plane to the $z$-plane.\n", "\n", "$$\n", "\\begin{equation}\n", "W_z = \\frac{dF}{dz} = \\frac{dF}{dz'} \\times \\frac{dz'}{dz} = W_{z'} e^{-i \\times \\text{AoA}}\n", "\\end{equation}\n", "$$\n", "\n", "Once you have the velocity in the $z$-plane, you can use what you learned in the previous exercise to get the velocity in the $\\xi$-plane.\n", "\n", "You should get the velocity and pressure coefficient (in the $z$ and $\\xi$ planes) that look like this:\n", "\n", "
\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise\n", "\n", "* Write the Python code to obtain the figures shown above (streamlines, velocity field, and pressure coefficient in the $z$ and $\\xi$ planes). Set the angle of attack to $\\text{AoA} = 20^\\circ$.\n", "* Answer the following questions:\n", " 1. Do you think the flow over the airfoil looks reasonable? Explain why.\n", " 2. What are the index of the stagnation points on the airfoil? (We assume that the trailing edge is the $1^\\text{st}$ point and that we index the points counterclockwise.)\n", " 3. How much is the lift? The lift, $L=-\\oint p \\times \\sin{\\theta} dA$, is perpendicular to the free-stream direction.\n", " 4. How much is the drag? The drag, $D=-\\oint p \\times \\cos{\\theta} dA$, is in the direction of the free-stream.\n", " 5. What is the velocity at the $50^\\text{th}$ point on the airfoil?\n", " 6. What is the pressure coefficient at the $75^\\text{th}$ point on the airfoil?\n", "\n", "Don't forget to enter your answers on [Open edX](https://openedx.seas.gwu.edu/courses/course-v1:MAE+MAE6226+2017/about).\n", "(Notes: you will need to enter your results with a 2-digit precision after the decimal point in the auto-graded section.)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 6. Flow over a symmetric Joukowski airfoil with non-zero angle of attack, with circulation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The flow obtained in the last exercise is not physical.\n", "What we need is a **vortex**.\n", "In [Lesson 6](06_Lesson06_vortexLift.ipynb), we saw that, by adding a vortex (i.e., circulation) to a potential flow over a cylinder, we can modify the position of the stagnation points and generate lift.\n", "\n", "To make the flow more physical, we need to satisfy the [Kutta condition](http://en.wikipedia.org/wiki/Kutta_condition),\n", ">\"A body with a sharp trailing edge which is moving through a fluid will create about itself a circulation of sufficient strength to hold the rear stagnation point at the trailing edge.\"\n", "\n", "This condition helps us in choosing the strength of the vortex to add.\n", "The strength of the vortex should be calculated so that the rear-stagnation point on the cylinder moves from $\\theta=\\text{AoA}$ to $\\theta=0^\\circ$ in the $z$-plane.\n", "You should be able to calculate the strength with what you learned in [Lesson 6](06_Lesson06_vortexLift.ipynb).\n", "\n", "The streamlines, velocity, and pressure coefficient in the $z$-plane and in the $\\xi$-plane should look like this:\n", "\n", "
\n", "
\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise\n", "\n", "* Write the Python code to obtain the figures shown above (streamlines, velocity field, and pressure coefficient in the $z$ and $\\xi$ planes). Set the angle of attack to $\\text{AoA} = 20^\\circ$.\n", "* Answer the following questions:\n", " 1. What is the strength of the vortex?\n", " 2. How much is the lift and does it agree with the Kutta-Joukowski theorem? The lift, $L=-\\oint p \\times \\sin{\\theta} dA$, is perpendicular to the free-stream direction.\n", " 3. How much is the drag? The drag, $D=-\\oint p \\times \\cos{\\theta} dA$, is in the direction of the free-stream.\n", " 4. What are the index of the stagnation points on the airfoil? (We assume that the trailing edge is the $1^\\text{st}$ point and that we index the points counterclockwise.)\n", " 5. What is the velocity at the $92^\\text{nd}$ point on the airfoil? \n", " 6. What is the pressure coefficient at the $111^\\text{th}$ point on the airfoil?\n", " 7. Explain what is going on with the pressure coefficient at the trailing edge of the airfoil.\n", "\n", "Don't forget to enter your answers on [Open edX](https://openedx.seas.gwu.edu/courses/course-v1:MAE+MAE6226+2017/about).\n", "(Notes: you will need to enter your results with a 2-digit precision after the decimal point in the auto-graded section.)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from IPython.core.display import HTML\n", "def css_styling(filepath):\n", " styles = open(filepath, 'r').read()\n", " return HTML(styles)\n", "css_styling('../styles/custom.css')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.1" } }, "nbformat": 4, "nbformat_minor": 1 }