0% found this document useful (0 votes)
2 views

10_Misc_Fluid_flow_II

This document outlines an exercise on fluid flow using the stream function for incompressible flow. It details the mathematical relationships, grid setup, boundary conditions, and initial conditions necessary for solving the flow around an object using a numerical method. The program loop for calculating the stream function is also described, emphasizing the averaging process and boundary condition applications.

Uploaded by

yeciwo5599
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

10_Misc_Fluid_flow_II

This document outlines an exercise on fluid flow using the stream function for incompressible flow. It details the mathematical relationships, grid setup, boundary conditions, and initial conditions necessary for solving the flow around an object using a numerical method. The program loop for calculating the stream function is also described, emphasizing the averaging process and boundary condition applications.

Uploaded by

yeciwo5599
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

5/11/2012 Miscellaneous Exercises Fluid Flow II 1

Fluid flow II: The stream function


This exercise is a continuation of the Fluid flow I
exercise. Read that exercise for an introduction.

It is possible to obtain solutions for


incompressible flow using the stream function 
rather than the potential function . The relation
between the fluid velocity u and the stream
function  is:

 
ux  and uy   ( Ux2 Uy2)  Psi2  Initial2
y x

Flow around an object

Note that flow left-to-right (ux > 0) requires  being larger at the top (largest y value).
 at interior points will be found using the relaxation method so that  satisfies Poisson's
equation. Finding  this way gives us a simple solution for the flow. Many other flow solutions
are possible, thus our answer is not unique.

Try it: Show that the divergence of the fluid velocity is zero indicating that  describes an
incompressible fluid.

The grid
There is no reason to assign values to the xi and yj that are on the grid. It is sufficient to know
the number of x grid points imax, the number of y grid points jmax, and the grid spacings x and
y.

imax  18 The number of x grid points. These are on the horizontal axis.
jmax  18 The number of y grid points. These are on the vertical axis.

The subscripts will have the values: i  0  imax j  0  jmax

Δx  1 Δy  1 The grid spacing is assumed unity in each direction.

Boundary condition Boolean matrix:


We will use a boundary condition matrix BB that has "1" at the nozzle wall and outside the
nozzle walls. Inside the boundary, BB = 0. Fluid is in the cells having BB = 0 at any corner. The
program loop gives the nozzle a slope of 1/3 so that the opening at the small end of the nozzle
is 1/3 of the opening at the large end. The subscript i runs from the bottom of the nozzle to the
top (see the figures) and the subscript j runs from left to right.
5/11/2012 Miscellaneous Exercises Fluid Flow II 2

The bondary conditon matrix:

BB  BB 0
imax jmax
for i  0  imax
for j  0  jmax
BB 1
i j
j i jmax  j i
BB  0 if   
i j jmax 3  imax jmax 3  imax
BB

Boundary condition matrix for the top half of the nozzle:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
3 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
T
BB  4 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0
5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

The initial gradient in :


At the top of the nozzle  will have a positive value and at the bottom of the nozzle  will have a
negative value, so that there is a gradient in  that causes flow to the right. The gradient will be
made approximately equal to 1 in our dimensionless units system which means that  = 9 at
the top of the nozzle and y = -9 at the bottom (when jmax = 18). The space outside the nozzle
will be given the same value as the nearest nozzle boundary.

Initial  Initial 0
imax jmax
for i  0  imax
for j  0  jmax
jmax
Initial  0.5 jmax if j   BB =0
i j 2 i j

jmax
Initial  0.5 jmax if j   BB =0
i j 2 i j

Initial
5/11/2012 Miscellaneous Exercises Fluid Flow II 3

Initial condition matrix for the top half of the nozzle:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
0 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
1 0 0 0 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
2 0 0 0 0 0 0 9 9 9 9 9 9 9 9 9 9 9 9 9
3 0 0 0 0 0 0 0 0 0 9 9 9 9 9 9 9 9 9 9
T
Initial  4 0 0 0 0 0 0 0 0 0 0 0 0 9 9 9 9 9 9 9
5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 9 9 9
6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9
7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

The program loop


The program loop will create the Psi function by averaging every point in the interior with with
four surroundings points. The number of iterations is set equal to several times the number of
points.
iters  3  imax jmax The number of iterations.

Psi( BB Initial)  Psi  Initial


Avg  Initial
for k  0  iters
i0
for j  1  jmax  1
Avg
i j 
 0.25 2  Psi
i 1 j
 Psi
i j  1
 Psi
i j  1  if BB
i j
0

Avg  Avg otherwise


i j i j
for i  1  imax  1
for j  1  jmax  1
Avg
i j
 0.25 Psi  i 1 j
 Psi
i 1 j
 Psi
i j  1
 Psi
i j  1 if BB
i j
0

Avg  Avg otherwise


i j i j
i  imax
for j  1  jmax  1
Avg
i j 
 0.25 2  Psi
i 1 j
 Psi
i j  1
 Psi
i j  1  if BB
i j
0

Avg  Avg otherwise


i j i j
Psi  Avg
Psi
5/11/2012 Miscellaneous Exercises Fluid Flow II 4

Avg is defined as a simple average of the Psi values at surrounding points. If we had not
assumed x = y = 1, then the average have to be a properly weighted average.

At the left and right boundaries, i = 0 and i = imax, symmetric boundary conditions are applied.
It is assumed that the point just outside the boundary has the same y value and the point just
inside the boundary. These boundary conditions are applied by having two extra loops in the
program for the boundary points i = 0 and i = imax.

The answer matrix Psi: Psi1  Psi( BB Initial)

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
1 8.3 8.3 8.5 9 9 9 9 9 9 9 9 9 9 9 9 9
2 7.4 7.5 7.6 7.9 8.1 8.3 9 9 9 9 9 9 9 9 9 9
3 6.5 6.6 6.7 6.8 7 7.3 7.6 7.9 8.2 9 9 9 9 9 9 9
T
Psi1  4 5.5 5.6 5.6 5.8 5.9 6.2 6.4 6.7 7 7.4 7.7 8.1 9 9 9 9
5 4.5 4.5 4.6 4.7 4.8 5 5.2 5.4 5.6 5.9 6.2 6.6 7.1 7.4 7.9 9
6 3.4 3.4 3.5 3.5 3.6 3.8 3.9 4.1 4.3 4.5 4.7 5 5.3 5.6 6 6.6
7 2.3 2.3 2.3 2.4 2.4 2.5 2.6 2.7 2.9 3 3.2 3.3 3.6 3.8 4.1 4.4
8 1.1 1.2 1.2 1.2 1.2 1.3 1.3 1.4 1.4 1.5 1.6 1.7 1.8 1.9 2 2.2
9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

The velocity field


The vector field for the velocities is found from  using the definitions at the beginning of the
exercise.

ii  1  imax  1 jj  1  jmax  1 Define a new set of indices that does not include the
boundary points.

Ux  0 Uy  0 Initialize the flow vectors


imax jmax imax jmax

The finite-differencing above is centered on the point ii,jj. If this point is in the fluid, then the sum
of the neighboring BB values is equal to 4. If this sum is not 4, the velocity vector is set to zero
so that it does not appear in the plot.

 Psi1  Psi1 
ii jj  1 ii jj  1
Ux  if  BB  BB  BB  BB = 4  0
ii jj ii jj  1 ii jj  1 ii 1 jj ii  1 jj
 2  Δy 

Uy

 if BB  BB  BB  BB = 4 
Psi1ii1 jj   Psi1ii1 jj  0
ii jj ii jj  1 ii jj  1 ii 1 jj ii  1 jj
 2  Δx 
5/11/2012 Miscellaneous Exercises Fluid Flow II 5

Vector field plot of u and contour plots of Psi1 and the boundary matrix BB

( Ux Uy) Psi1 BB

The stream function been plotted as a contour plot using a small number of contour lines.

Is there conservation of fluid?


To find the amount of fluid per unit time entering the left boundary, we integrate ux from the
bottom to the top:

d
2 2
where 1 and 2 refer to the lower boundary and
 u x dy  
1 1
dy
dy   2   1 upper boundary, respectively.

This integral has the same value for all vertical paths through the nozzle because  has the
same value at all points on the upper nozzle boundary and the same (lower) value at all points in
the lower nozzle boundary. The length of the flow vectors increases from left to right as the area
of the nozzle decreases.
5/11/2012 Miscellaneous Exercises Fluid Flow II 6

Circular flow about an object


A second example of flow is clockwise flow around an object. For this case, we will use a duct
of constant cross section (no nozzle) and place a circular object within it. Recall that our
equations are two-dimensional, hence the circular object is a cylinder (infinitely long) oriented
perpendicular to the plane of the plots. The radius of the object will be made 1/6 of the height of
the duct.

The boundary points are the top and bottom of the domain (the duct) and the boundary of the
object. The points on the boundary of the duct and the boundary of the circular object have their
BB value set to 0.

BB2  BB2 0
imax jmax
for i  0  imax
for j  0  jmax
BB2 1
i j
BB2  0 if j = 0  j = jmax
i j

 imax  2  jmax  2  jmax  2


BB2  0 if   i    j    
i j  2   2   6 
BB2

The intial values of  are made zero at the duct walls and -1 at the circular object. The equal
values at the top and bottom boundaries specify that there is not net flow in the duct from left to
right. A value of -1 on the object creates a positive gradient near the upper duct wall and a
negative gradient near the lower duct wall. Hence the flow is clockwise. At the left and right
boundaries, there is flow to the right in the upper half plane and flow to the left in the lower half
plane.

Initial2  Initial 0
imax jmax
for i  0  imax
for j  0  jmax
Initial 0
i j

 imax  2  jmax  j     jmax 


2 2
Initial  1 if   i     
i j  2   2   6 
Initial

Find the  values using the Psi function for the new conditions Psi2  Psi( BB2 Initial2 )
5/11/2012 Miscellaneous Exercises Fluid Flow II 7

Find the new velocity field from the new 

 Psi2
ii jj  1
 Psi2
ii jj  1 
Ux2  if  BB2  BB2  BB2  BB2 = 4  0
ii jj ii jj  1 ii jj  1 ii 1 jj ii 1 jj
 2  Δy 

 Psi2
ii  1 jj
 Psi2
ii  1 jj 
Uy2  if  BB2  BB2  BB2  BB2 = 4  0
ii jj ii jj  1 ii jj  1 ii 1 jj ii 1 jj
 2  Δx 

Plot of flow in a duct with a cylindrical object

The circular object appears as


a polygon in a contour plot
because of the small number
of grid points.

( Ux2 Uy2 ) Psi2 Initial2

Try it: Change the  values at the duct walls so that there is a net flow from left to right
superimposed upon the circular flow.

Try it: Rewrite the exercise so that the flow is correct if x and y are arbitrary.

Reference
A. M. Kuethe and J. D. Schetzer, Foundation of Aerodynamics (Wiley, New York, 1967),
chapter 2.

You might also like