Wednesday, July 31, 2013

Stagnation Flow - Part III


Most of this post is based on the relevant discussion in Frank White’s "Viscous Fluid Flow" (I’m not using the current edition, and I surely didn’t pay $240 for it back in the ’80s). As this material comes from work done in about 1914, I don’t think I’m violating any copyright laws!
A couple of posts ago I introduced the stream function for inviscid flow at a stagnation point, such as that near the leading edge of an airfoil...
$$\Psi=Bxy$$
...where B is a real constant. Using the results of my last post, we find that the velocity parallel to the surface is...
$$u=Bx$$
Intuitively, we expect friction to retard the flow near the surface, and to have less effect the further from the surface we get. We express this with the following boundary conditions...
$$\begin{align} \lim_{y\to 0} u &=0\\ \lim_{y\to\infty} u &=Bx\end{align}$$
We’d also like to keep the form of the inviscid solution as much as we can (engineers being at least as lazy as anyone else), and so the following modified stream function and boundary conditions are proposed...
$$\begin{align} \Psi&=Bxf(y)\\ u&=Bxf’(y)\\ f’(0)&=0\\ \lim_{y\to\infty}f’(y)&=1\end{align}$$
What the above sort of says (to me) is that the function f(y) is merely a distortion of y, very distorted near the surface, and indistinguishable from y far enough away from the surface.
Is this distortion justified? Yes, if we can prove that introducing it has not violated any laws of physics [conservation of mass (continuity) and conservation of momentum (Navier-Stokes)].
Well, since we’ve retained the stream function, we don’t have to worry about continuity. We do need to look at Navier-Stokes(NS), starting in the "y" direction, assuming steady incompressible flow (note that subscripts denote partial derivatives here; yes, I’m not at all consistent in this regard, and very sloppy about noting what convention I’m using at a given moment... but I’m not charging you $240, either)...
$$\begin{align} -p_y+\mu(v_{xx}+v_{yy})&=\rho(uv_x+vv_y)\\ &\text{and now substitute derivatives of }\Psi\\ &\text{as appropriate}\\ -p_y+\mu[((-Bxf)_x)_{xx}-((Bxf)_x)_{yy}]&=\rho[(Bxf)_y((-Bxf)_x)_x-(Bxf)_x((-Bxf)_x)_y]\\ -p_y+\mu[(-Bf)_{xx}-(Bf)_{yy}&=\rho[-(Bxf_y)(Bf)_x+(Bf)(Bf)_y]\\ -p_y+\mu(0-Bf_{yy})&=\rho B^2[-xf_y(0)+ff_y]\\ -p_y-\mu Bf_{yy}&=\rho B^2 ff_y\\ &\text{and as nothing remaining is a function of x}\\ -p_{xy}&= 0 \end{align}$$
... which implies that \(p_x\) is a function only of x. This lets us pick the y value where we calculate the pressure gradient across the surface, and we pick a value where we know the most, far from the surface where friction can be ignored. In such circumstances, Bernoulli rules...
$$\begin{align} p&=p_0-\frac{1}{2}\rho(u^2+v^2)\\ &(p_0\text{ represents total pressure})\\ p_x&=-\rho(uu_x+vv_x)\\ &\text{and again we substitute our }\Psi \text{ derivatives}\\ p_x&=-\rho[(Bxf_y)(Bf_y)+(-Bf)(-Bf_x)]\\ p_x&=-\rho B^2[x(f_y)^2+f\cdot 0]\\ &f_y \text{ approaches 1 far from the surface.}\\ p_x&=-\rho B^2 x \end{align}$$
Now we are ready to tackle NS in the "x" direction.
$$\begin{align} -p_x+\mu(u_{xx}+u_{yy})&=\rho(uu_x+vu_y)\\ \rho B^2 x+\mu[(Bxf_y)_{xx}+(Bxf_y)_{yy}]&=\rho[(Bxf_y)(Bxf_y)_x-(Bf)(Bxf_y)_y]\\ \rho B^2 x+\mu(0+Bxf_{yyy})&=\rho xB^2[(f_y)^2-ff_{yy}]\\ 1+\frac{\nu}{B}f_{yyy}&=(f_y)^2-ff_{yy}\end{align}$$
It is convenient to scale both y and f by the factor \(\sqrt{\frac{B}{\nu}}\) (a study of why this is convenient is worthwhile), yielding the non-dimensional equation and boundary conditions...
$$\begin{align} 1+F_{YYY}&=(F_Y)^2-FF_{YY}\\ F(0)&=F_Y(0)=0\\ \lim_{Y\to\infty} F_Y &= 1\end{align}$$
Next time, we use Racket to generate a numerical solution to the above, and to explore some of the consequences of that solution.

Wednesday, July 17, 2013

Stagnation Flow - Part II


In my last post, I mentioned that we’d be working with the stream function \(\Psi\), rather than the complex potential \(\Phi\), but I haven’t really defined it well. You’ll remember that \(\Phi\) is related to the velocity field as follows:
$${{d\Phi}\over{dz}}=\overline{V}=u-iv$$
where u and v are the velocities along the x and y axes, respectively. In plotting streamlines, I’ve noted that the imaginary part of \(\Phi\) is \(\Psi\).
$$\Phi =\phi + i\Psi$$
We shall ignore \(\phi\)(little "fee"), as its properties where friction is a factor are the reason we’re tossing \(\Phi\) aside in the first place! So how does \(\Psi\) relate to velocity?
$$\begin{align} u-iv & = {{d\Phi}\over{dz}}\\ & = {{d\Phi}\over{dx}}\\ & = {{d\phi}\over{dx}}+i{{d\Psi}\over{dx}}\\ -iv & = i{{d\Psi}\over{dx}}\\ v & = -{{d\Psi}\over{dx}}\end{align}$$
Above we let dz = dx. Now we let dz = idy.
$$\begin{align} u-iv & = {{d\Phi}\over{dz}}\\ & = {{d\Phi}\over{i dy}}\\ & = {{d\phi}\over{i dy}}+i{{d\Psi}\over{i dy}}\\ & = -i{{d\phi}\over{i dy}}+{{d\Psi}\over{dy}}\\ u & = {{d\Psi}\over{dy}}\end{align}$$
Now we have velocity in terms of the stream function, which will prove to be useful in my next posting, in which we plug the stream function into Navier-Stokes.

Monday, July 15, 2013

Stagnation Flow - Part I


Now that the inviscid portion of ZFoil is working (although I already have some tweaks I want to try), it’s time to work on boundary layer code. The appropriate place to begin is, of course, the beginning, and the boundary layer begins at the leading edge, at the stagnation point where the flow is brought to a halt. Let us build such a flow using some of the tools I’ve already introduced.
Let us start with a uniform flow:
$$\overline{V}={{1}\over{2}}B$$ $$\Phi={{1}\over{2}}Bz$$
B is a real constant, and the fraction will prove to be convenient. The flow is too simple to even bother plotting, but let us apply the following transform:
$$w^2=z$$ $$\Phi={{1}\over{2}}Bw^2$$ $$\overline{V}=Bw$$
> (define (Phi w) (* 1/2 B w w))
> (define B 1)
> (plot (contours
         (λ(x y)
           (imag-part (Phi (make-rectangular x y))))
        -3.0 3.0 0.0 1.5
        #:levels '(-4.0 -2.0 -1.0 -0.5 -0.25 0.25 0.5 1.0 2.0 4.0))
        #:height 200)
(object:2d-plot-snip% ...)

In z space, B is a measure of velocity, but in w space, it is a measure of velocity gradient. The stagnation point is at w = 0. Note that I have plotted the imaginary component of the complex potential \(\Phi\) ("fee"), the stream function \(\Psi\) ("psi", very close to "sigh"). When I introduce friction in my next post, we will be able to retain \(\Psi\), but \(\Phi\) will have to go, as it assumes irrotational flow. I now present an explicit form of the inviscid stream function:
$$\begin{align} \Phi&={{1}\over{2}}Bw^2\\ \Phi&={{1}\over{2}}B(x+iy)^2\\ \Phi&={{1}\over{2}}B[(x^2-y^2)+i(2xy)]\\ \Psi&=Bxy\\ \end{align}$$
Yes, the streamlines are hyperbolas. In my next post, we will deal with how to modify this stream function to account for friction.

Saturday, July 6, 2013

A Momentous Occasion



The pitching moment code is done (and the lift code is fixed; my integration code had a bug), and it seems to work! Watch:
> (require "../zfoil.rkt"
           "../airfoils.rkt")
> (define my-geo (make-geometry naca-4412))
> (define alphas '(-0.05 0.0 0.05 0.1 0.15))
> (define CMs (for/list [(alpha alphas)]
                (CM alpha my-geo)))
> (plot (points (for/list [(alpha alphas)
                           (CM CMs)]
                  (vector alpha CM)))
        #:x-label "alpha"
        #:y-label "Cm"
        #:y-max -0.1
        #:y-min -0.14)
(object:2d-plot-snip% ...)

This agrees pretty well with other numerical methods, and more importantly, agrees with actual data available here.

Next, viscous flow and drag. This is to be strictly "cook book" for now. We’ll see if I am bored into motionless, or code it up quickly so I can actually play with my new toy!