Monday, February 2, 2015

Source panel method, solving potential flow around a body

Introduction
The source-panel is one of the simplest ways to model pressure along a body subjected to a flow at 0 angle of attack. The method ensures that flow cannot pass through the body - the normal component of the velocity on each panel is 0.

Source panel is not useful by itself for calculating lift

In order to use Potential Flow the following assumptions must be satisfied
- Incompressible
- Steady flow
- Low speed
- Irrotational

Approach
1. Introduction to Sources
2. Source sheet along a panel
3. Integration of a source sheet to calculate source strength
4. Effects of one panel's source sheet on the other and how to program the source-panel method

Sources/Sinks
A type of flowfield where the velocity is purely radial. You can think of it as a garden hose attached to a pan, the hose is turned on and fluid flow is coming out of the hose into the pan. The velocity potential $\phi$ is represented as $$ \phi = \frac{\gamma}{2\pi} log(r)$$
"r" is the distance to an arbitrary point by a source $\sqrt{(x-x0)^2 + (y-y0)^2}$
 The streamline $\psi$ is represented as $$\psi = \frac{\gamma}{2\pi} \theta$$ 

Velocity components u and v can both be derived from either the streamline or the velocity potential
$$u = \frac{\partial \phi}{\partial x} = \frac{\partial \psi}{\partial y}$$
$$v = \frac{\partial \phi}{\partial y} = -\frac{\partial \psi}{\partial x}$$

$$u = \frac{\gamma}{2\pi}\frac{x-x_0}{(x-x_0)^2 + (y-y_0)^2}$$
$$v = \frac{\gamma}{2\pi}\frac{y-y_0}{(x-x_0)^2 + (y-y_0)^2}$$

Panel Theory
The velocity potential around a body can be decomposed into $\phi = \phi_{\inf} + \phi_s + \phi_v$ freestream + source + vortex. For this example we will just consider the source and freestream.

$$ \phi_s = \int \frac{\gamma(s)}{2\pi} ln(r) ds $$ ds is the panel length and $q(s)$ is the source strength of the panel.

We don't immediately know $\gamma(s)$ this will be solved for in our system of equations.
$\gamma(s)$ depends on the free stream and the effects of all the other sources. The "r" term is the distance from panel i to panel j, j+2, j+3.

"r" is defined as $r_{i,j} = \sqrt{(x_i-x_j)^2+(y_i-y_j)^2}$, the radius from panel i to panel j.

In the Hess smith method, we assume a constant source throughout the panel. So in the figure above panel j's source directly effects panel i. One of the boundary conditions that we will assume is that there is no flow going through the center of panel i $V_i = 0$. We have to integrate the effects of panel j through the center of panel i.

$$
\phi_{i,j} = \int_j \frac{\lambda j}{2\pi} Ln(\sqrt{(x_i-x_j(s_j))^2+(y_i-y_j(s_j))^2})ds
$$

We want the boundary condition on panel i to be such that the velocity normal to the surface is 0. How do we achieve this? Take a look at the velocity potential. The velocity with respect to x is $\frac{\partial \phi}{\partial x}$, the velocity normal to the surface is similarly found to be $\frac{\partial \phi}{\partial n_i}$.

Finding $\frac{\partial \phi}{\partial n_i}$ seems challenging and it is, but we can break it down into the following.
$$ \frac{\partial}{\partial n_i} Ln(r_{i,j}) = \frac{1}{r_{i,j}} \frac{\partial r_{i,j}}{\partial n_i}$$
By chain rule:
$$
\frac{1}{r_{i,j}} \frac{\partial r_{i,j}}{\partial n_i} = \frac{1}{2 r_{i,j}} \frac{2(x_{ci}-x_j(s)) \frac{dx_i}{dn_i} + 2(y_{ci}-y_j(s)) \frac{dy_i}{dn_i}}{\sqrt{(x_{ci}-x_j(s))^2+(y_{ci}-y_{j}(s))^2}}
$$

Alternative View
It gets complicated but it is solvable. However, for me it's easier to view the x and y coordinates of panel j as a line, instead of using "s" as my parameter, I'll switch to using "t", t varies from 0 to 1

\begin{align}
s = \sqrt{(x_0+c_1 t)^2 + (y_0+v_t)^2} \\
ds = \frac{1}{2} \frac{2u(x_0 + c_1 t) + 2v(y_0 + c_2 t)}{\sqrt{(x_c-x(t))^2 + (y_c - y(t))^2}}
\end{align}

But it's still complicated. We can use the fact that $V \cdot \hat{n}$ is nothing but $ u\cdot \hat{n} + v \cdot \hat{n}$ Boundary conditions at "i" are $u \cdot \hat{n} = 0$ and $v \cdot \hat{n} = 0$ at $x_c$ and $y_c$. Note: $x_c$ and $y_c$ and $x_ci$ and $y_ci$ represent the location at the midpoint of panel i.

$$
\frac{1}{r_{i,j}} \frac{\partial r_{i,j}}{\partial n_i} = \frac{1}{2 r_{i,j}} \frac{2(x_{ci}-x_j(t)) \frac{dx_i}{dn_i} + 2(y_{ci}-y_j(t)) \frac{dy_i}{dn_i}}{\sqrt{(x_{ci}-x_j(t))^2+(y_{ci}-y_{j}(t))^2}}
$$

\begin{align}
x(t) = x_0 + c_1 t \\
y(t) = y_0 + c_2 t
\end{align}

From computer graphics we can find parameters $c_1$ and $c_2$ easily without using any angles.
\begin{align}
c_1 = x_1-x_0\\
c_2 = y_1-y_0
\end{align}
Now going back to the velocity potential, we have to integrate the velocity potential at "i" caused by all the sources in panel j from 1 to n where $j \neq i$ for all j. We have to sum up the effects of the source terms of all the panels!

$$
\Sigma_{j\neq i}^n V_{j}\cdot n_i= \Sigma_{j\neq i}^n \frac{\gamma_j}{2\pi} \int_{0}^{1} \frac{(x_{ci}-x(t)_j)cos(\beta_i) + (y_{ci}-y(t)_j)sin(\beta_i)}{(x_c-x(t)_j)^2 + (y_c - y(t)_j)^2} dt
$$

What do we do at i=j? Remember that with sources we have half in and half out.


We use the above information to help build a matrix Ax = b

$$A_{i,i} = 0.5$$
$$ A_{i,j} = \Sigma_{j\neq i} \frac{1}{2\pi} \int_{0}^{1} \frac{(x_{ci}-x(t)_j)cos(\beta_i) + (y_{ci}-y(t)_j)sin(\beta_i)}{(x_c-x(t)_j)^2 + (y_c - y(t)_j)^2} dt $$

We enforce the flow tangency condition ${\vec{V_{\inf}}} \cdot \hat{n_i}$ where $\vec{V_{\inf}} = [V_{\inf}cos(\alpha), V_{\inf}sin(\alpha)$, $n_i = [cos(\beta_i), sin(\beta_i)]$. By dot product and moving terms to rhs: 
$$ b_{i} =-\vec{V_{\inf}}cos(\alpha - \beta) $$

code coming soon