finite equation

advertisement
- Flow Around a Cylinder -
Numerical Solution of Flow Around a Circular Cylinder Using the
Finite Difference Method
Diana Tossounian
12/9/99
Numerical Analysis for Engineering
Fall 1999
1
- Flow Around a Cylinder -
Table of Contents
I. List of Symbols
II. Introduction
III. Problem Description and Formulation
Numerical Approach
IV. Results
V. Error Analysis
VI. Discussion
Conclusion
VII. References
VIII. Appendix
2
- Flow Around a Cylinder -
I. List of Symbols

stream function

potential function

theta
x, y
Cartesian coordinates
r,
Polar coordinates
w
complex potential
z
complex variable
U
uniform flow
a
cylinder radius
r
polar distance from cylinder center
u
x-component of fluid velocity
v
y-component of fluid velocity
2
 
Laplacian operator of , or del squared of 
3
- Flow Around a Cylinder -
II. Introduction
The purpose of my project is to use numerical methods to compute the streamlines around a circular
cylinder for incompressible, inviscid, irrotational, two-dimensional flow. Streamlines are quantitatively
labeled by a constant stream function to specify its position within the flow stream. The stream function is
the mass flux per unit time across any stationary line in the fluid. Therefore, streamlines are simply lines
along which the stream function is constant.
Fundamentally, the streamline patterns around a circular cylinder can be described by the superposition of
uniform flow with a doublet. The streamlines are close together at regions of high velocity. By
application of Bernoulli’s theorem between streamlines, this results in a decrease in pressure. The
streamline pattern is useful in the study of fluid flow since it gives an ideal picture of the variation of
pressure and velocity around an object.
Laplace’s equation in fluid dynamics describes incompressible, inviscid, irrotational, two-dimensional fluid
motion through the stream function. In order to solve for the stream function numerically, a grid with mesh
points will be drawn around the cylinder. The finite difference method in polar coordinates then will be
used to generate a series of difference equations that describe this ideal flow pattern around a cylinder.
Then the Gauss-Seidel iterative technique will be used to solve the matrix for the stream function at each
mesh point.
III. Problem Description and Formulation
Incompressible, inviscid, irrotational, two-dimensional fluid motion can be described by an elliptic linear
partial differential equation called Laplace’s equation expressed in Cartesian coordinates:
 2 
 2  2

0
x 2 y 2
or expressed in polar coordinates:
 2 1  1  2


0
r 2 r r r 2  2
Laplace’s equation for the stream function is simply derived from the irrotationality condition for an ideal
fluid in two dimensions:
v u

0
x y
whereas Laplace’s equation for the potential function is derived from the equation of continuity:
u v

0
x y
The velocity components u and v can be expressed in terms of both the stream function and the potential
function:
u



y
x
4
- Flow Around a Cylinder -
v



x
y
Substituting these expressions into the irrotationality condition and the continuity equation respectively, we
obtain Laplace’s equation for the stream and potential functions.
Laplace’s equation for the stream function can be solved numerically using the finite difference equation.
Because one of the boundaries to be defined in the problem is the circumference of the cylinder, I will use
Laplace’s equation in polar coordinates rather than Cartesian coordinates since it avoids complicated
differentiation near the boundary. The boundary conditions are found from the exact solution (see
Appendix – Part A) at the boundaries and with the following conditions:
U = 1 = uniform flow velocity
a = 1 = radius of the cylinder
One boundary is located at the surface of the cylinder and continues through the r-axis on each side of the
cylinder. I will call this the steady flow streamline =0 which is given by

a2 

0  U  r   sin 
r 

The steady flow streamline is satisfied by =0,, or r=1.
The other boundary is located at five radii away from the cylinder and is a function of the angular position
around the cylinder. These boundary conditions along with Laplace’s finite difference equation will be
used to generated a series of linear equations which can then be solved to describe the variation of the
stream function in the flow field.
IV. Numerical Approach
The numerical method for solving Laplace’s equation in polar coordinates begins by defining the mesh
points in the r- plane. Since the cylinder is symmetric about the r-axis, which is the direction in which
uniform flow is moving, I will only define the mesh on the upper plane of the r-axis, from  = 0 to 180
and r = 1 to 6. The grid points will be at the intersection of successive semi-circles at equally spaced
distances from the cylinder with straight lines originating from the cylinder center. To define the step size,
the variable h will be used to define r and the variable k will be used to define . The flow area will be
split into five sections radially and six sections angularly, making h=1 and k=/6. The semicircles will
each have a radius r = a+ih for i=0,1,2,3,4,5 and the straight lines will be positioned at equal angles  = j
 for j=0,1,2, 3,4,5,6. This results in a total of 42 mesh points in the flow area.
The Taylor series in the variable r is then used to generate the centered-difference formula for the two
partial derivatives with respect to r:
 2  i 1, j  2 i , j   i 1, j h 2  4


12 r 4
r 2
h2

1
h 2  3

 i 1, j   i 1, j 
r 2h
6 r 3


The centered-difference formula for the partial derivative with respect to  was also generated:
5
- Flow Around a Cylinder -
 2  i , j 1  2 i , j   i , j 1 k 2  4


12  4
 2
k2
These equations are then substituted into Laplace’s equation:
 i 1, j  2 i , j   i 1, j
h2
 i , j 1  2 i , j   i , j 1
1 1
1
 i 1, j   i 1, j +
=
a  ih 2h
(a  ih ) 2
k2

+

h 2  4 h 2  3 k 2  4
+
+
12 r 4
6 r 3 12  4
The portion of this equation on the right side of the equal sign can be cancelled out with a truncation error
of order
O(2h 2  k 2 ). Combining terms:

 2

1

1

2
1
1
1









 2
i

1
,
j
i

1
,
j
i
,
j

1





2
2
2
2
2
2
(a  ih )( 2h) 
(a  ih )( 2h) 
k (a  ih ) 
 k (a  ih )
h
h
h
 i, j 
And in a further simplified form:
A i , j  B i 1, j  C i 1, j  E i , j 1  D i , j 1  0
This is the difference equation for Laplace’s equation in polar coordinates where the coefficients are:
 1

1

A  2 2  2
2 
k (a  ih ) 
h
1
1
B 2 
(a  ih )( 2h)
h
1
1
C 2 
(a  ih )( 2h)
h
D
1
k (a  ih ) 2
E
1
k (a  ih ) 2
2
2
Since the value of the stream function is known at the boundaries, the difference equations need only be
generated for the unknown mesh points. There are 20 unknown mesh points which results in 20 difference
equations. The matrix will be defined by Ax=b. The matrix was generated by first defining an order in
which to label the unknown points. I chose to label the points by the following equation: Pl = i + n(m-j)
for i=1..4 (i=0 and i=5 are at the boundaries). Then starting from Pl=1, I generated the coefficient portion
of the matrix, or the A portion, from the finite difference equation above for the surrounding mesh points.
Each time a boundary was hit, this constant value was placed in the b portion of the matrix. This was done
for each mesh point until the matrix was completed. The first worksheet in the spreadsheet called
project.xls calculates the elements of the matrix. These calculated values were then inserted into an input
file called cylinder.txt. Now the Gauss-Seidel procedure can be used to solve the matrix.
The Gauss-Seidel procedure is a simple iteration to compute x:
i 1
xi
(k )

  (aij x j
j 1
(k )
)
n
 (a
j i 1
ij
x (jk 1) )  bi
aii
6


   i , j 1 


- Flow Around a Cylinder -
where
x i( k ) = most recently calculated values of x
xi( k 1) = previously calculated values of x
The stopping criteria for this iterative procedure is when
x ( k )  x ( k 1)
xk
 0.0001
The Maple algorithm used to perform the Gauss-Seidel iteration is called cylinder.mws and uses the
cylinder.txt input file. When the iteration is stopped, the values of x represent the values of the stream
functions at each of the mesh point locations.
V. Results
The numerical solutions for the unknown mesh points were found successfully. These values are found at
the end of the cylinder.mws file, and are included with the boundary mesh points in the fourth worksheet of
project.xls. Since it is not convenient to simply plot streamlines, or constant stream function lines, with the
numerical approach I used, I opted to show how the numerical solution varies as you move farther away
from the cylinder in the direction r at =/2 and compared this to the exact solution.
Variation of stream function with distance
12.0000
10.0000
Stream function
8.0000
6.0000
4.0000
2.0000
0.0000
1
2
3
4
5
6
r -- distance from cylinder
The red solid line in this plot represents the numerical solution, and the blue dotted line represents the exact
solution. First looking at the exact solution, you will notice a gentle positive slope from 1 to 2 radii and
then a leveling out thereafter. The gentle slope implies a faster velocity of the fluid flow closest to the
cylinder than the fluid flow much farther away. The numerical solution does not show a similar
characteristic, although it appears to marginally follow the exact solution until about 4 radii away when it
suddenly increases. The sudden dip down is due to the boundary condition joining the numerical solution
back to the exact solution. The sudden jump at 5 radii is disturbing and unfortunately I do not understand
why this occurred. It is possibly due to a typing error in my calculations, however I do not give much
credit to this possibility since it appears that the overall trend of the numerical solution is in the upward
7
- Flow Around a Cylinder -
direction, almost exponential. Perhaps there is an error in the finite difference equation which was not
apparent to me.
VI. Error Analysis
The numerical solution is compared to the exact solution in the fourth worksheet of the file project.xls.
Please refer to Part A in the Appendix to observe how the exact solution was found. The error between the
numerical solution and the exact solution appears to increase dramatically as you move farther away from
the cylinder. I rounded the solutions to the nearest 0.0001 however I do not believe that the increase in
error is due to the rounding error.
I plotted the error with increasing distance for three theta values: 5/6 (aqua), 2/3 (magenta), and /2
(blue).
Variation of error with distance
7.0000
6.0000
Error = Num sol - Exact sol
5.0000
4.0000
3.0000
2.0000
1.0000
0.0000
1
2
3
4
5
6
r -- distance from cylinder
This plot indicates that as you move farther away from the r-axis in theta, the error increases. This makes
sense since as you move away from the r-axis, you are also moving away from a boundary condition at r=1
(=0). Calculation of the numerical solution in proximity to multiple boundary conditions would increase
the likelihood of being close to the exact solution.
VII. Discussion
The computation of incompressible, inviscid, irrotational fluid flow around a cylinder is important because
conformal mapping can then be used to transform the flow around a cylinder into the flow around a wing or
airfoil. The idea behind airfoil analysis using conformal mapping is to relate the flow field around one
shape which is already known, for example a circular cylinder using finite difference methods, to the flow
field around an airfoil. As a starting point, a circle is usually used to calculate the initial flow field since it
is a relatively simple shape.
The value of using the finite difference method and subsequently Gauss-Seidel iterations to calculate flow
fields is also extended to the ability to calculate velocities and pressure profiles around the cylinder shape.
Integrating the surface pressures results in the ability to calculate the total forces and moments on the
cylinder. This method of computation is also valuable for more complex flow fields involving circulation,
viscosity, etc.
8
- Flow Around a Cylinder -
VIII.
Conclusion
The numerical solution of the flow around a circular cylinder has shown that using the finite difference
equation is a complex process that is best done with a handy computing tool such as Fortran, C, or Matlab.
This is because the computer reduces the chance of the error occurring due mistyping, miscalculation, etc.
especially in an iterative environment such as this one. Much time and energy was wasted in the course of
completing this project due to minor calculation errors performed by myself. A working knowledge of a
programming language would have reduced the time and effort involved.
If the numerical solution is correct, this project has taught me that the numerical solution in finite
difference calculations has large errors. However, I am quite sure that it is not correct since the finite
difference method is known to be a relatively accurate method of predicting flows over objects and is a
widely used computational method used today especially in the field of aerodynamics.
IX. References
Burden, R. L. and Faires, J. D., Numerical Analysis, Brooks-Cole, Pacific Grove, CA, 1997, p.670-682 and
p.443-447.
Heal, K. M. et al, Maple V: Learning Guide, Waterloo Maple, Inc. Waterloo, ON, 1998.
Smith, G. D., Numerical Solution of Partial Differential Equations: Finite Difference Methods, Clarendon
Press, London, 1985, p. 239-311.
Smith, D. L. and Houghton, J., Fluid Mechanics through worked examples, Cleaver-Hume Press, London,
1960, p.107-152.
Fox, R. W. and McDonald, A. T., Introduction to Fluid Mechanics, John Wiley & Sons, New York, NY,
1973, p. 201-237.
Lamb, H., Hydrodynamics, Dover Publications, New York, NY, 1945, p.62-91.
http://www.monmouth.com/~jsd/irro/richiami3_e.html
http://www.maplesoft.com/apps/html/fluid1.html
9
- Flow Around a Cylinder -
X. Appendices
Part A – Finding the exact solution of the stream function using the complex potential
The potential function and stream function can be described in the same expression by an analytic function
called the complex potential, w.
w  f ( z )    i
The analytic function is a convenient method of solving this problem by mapping the potential function and
the stream function in a complex plane. Mathematically, all two-dimensional flows are solutions of w=f(z)
where z = x + iy. The complex potential for flow around a circular cylinder is modeled as the combined
motion of uniform flow velocity U and a doublet at the origin. It is as follows:

a2 
w    i = U  z  
z 

i
where z = x + iy = r(cos + isin ) = re from Euler’s formula.
Substituting this expression for z in w we get:
w  U (re i  ra 2 e i )
U
 Ure i  a 2 e i
r
 Ur (cos   i sin  ) +
U 2
a (cos   i sin  )
r
Multiplying through and collecting real and imaginary terms:
w  (Ur 
U 2
U
a ) cos   (Ur  a 2 )i sin 
r
r
Since w =  + i,
U 2
a ) cos 
r

a2 
  U  r   sin 
r 

  (Ur 
  (Ur 
U 2
a ) sin 
r
The exact solution of the stream function is shown in polar coordinates here.
For this project I am only interested in finding the numerical solution of the
stream function.
A routine in Maple (see exact.mws) was used to plot the following graph which shows the streamlines of
incompressible, inviscid, irrotational fluid flow past a circular cylinder.
10
- Flow Around a Cylinder -
11
- Flow Around a Cylinder -
Part B – List of Computer Programs and Spreadsheets
cylinder.mws
Gauss-Seidel iterative program to solve the matrix of finite difference equations
# GAUSS-SEIDEL ITERATIVE TECHNIQUE ALGORITHM 7.2
>#
> # To solve Ax = b given an initial approximation x(0).
>#
> # INPUT: the number of equations and unknowns n; the entries
>#
A(I,J), 1<=I, J<=n, of the matrix A; the entries
>#
B(I), 1<=I<=n, of the inhomogeneous term b; the
>#
entries XO(I), 1<=I<=n, of x(0); tolerance TOL;
>#
maximum number of iterations N.
>#
> # OUTPUT: the approximate solution X(1),...,X(n) or a message
>#
that the number of iterations was exceeded.
> alg072 := proc() local AA, OK, NAME, INP, N, I, J, A, X1, TOL, NN, K, ERR, S, FLAG, OUP;
> printf(`This is the Gauss-Seidel Method for Linear Systems.\n`);
> printf(`The array will be input from a text file in the order\n`);
> printf(`A(1,1), A(1,2), ..., A(1,n+1), A(2,1), A(2,2), ...,
> A(2,n+1),..., A(n,1), A(n,2), ..., A(n,n+1)\n`);
> printf(`Place as many entries as desired on each line, but separate\n`);
> printf(`entries with `);
> printf(`at least one blank.\n\n\n`);
> AA := y;
> OK := FALSE;
> if AA = Y or AA = y then
> printf(`Input the file name in the form - drive:\\name.ext\n`);
> printf(`for example: A:\\DATA.DTA\n`);
> NAME := scanf(`%s`)[1];
> INP := fopen(NAME,READ,TEXT);
> OK := FALSE;
> while OK = FALSE do
> printf(`Input the number of equations - an integer.\n`);
> N := scanf(`%d`)[1];
> if N > 0 then
> for I from 1 to N do
> for J from 1 to N+1 do
> A[I-1,J-1] := fscanf(INP, `%f`)[1];
> od;
> od;
> for I from 1 to N do
> X1[I-1] := fscanf(INP, `%f`)[1];
> od;
> OK := TRUE;
> fclose(INP);
> else
> printf(`The number must be a positive integer\n`);
> fi;
> od;
> OK := FALSE;
> while OK = FALSE do
> printf(`Input the tolerance.\n`);
> TOL := scanf(`%f`)[1];
> if TOL > 0 then
> OK := TRUE;
12
- Flow Around a Cylinder -
> else
> printf(`Tolerance must be a positive.\n`);
> fi;
> od;
> OK := FALSE;
> while OK = FALSE do
> printf(`Input maximum number of iterations.\n`);
> NN := scanf(`%d`)[1];
> if NN > 0 then
> OK := TRUE;
> else
> printf(`Number must be a positive integer.\n`);
> fi;
> od;
> else
> printf(`The program will end so the input file can be created.\n`);
> fi;
> if OK = TRUE then
STEP 1
> K := 1;
> OK := FALSE;
STEP 2
> while OK = FALSE and K <= NN do
err is used to test accuracy - it measure the infinity-norm
> ERR := 0;
STEP 3
> for I from 1 to N do
> S := 0;
> for J from 1 to N do
> S := S-A[I-1,J-1]*X1[J-1];
> od;
> S := (S+A[I-1,N])/A[I-1,I-1];
> if abs(S) > ERR then
> ERR := abs(S);
> fi;
> X1[I-1] := X1[I-1] + S;
> od;
STEP 4
> if ERR <= TOL then
> OK := TRUE;
> fi;
process is complete
STEP 5
> K := K+1;
STEP 6 - is not used since only one vector is required
> od;
> if OK = FALSE then
> printf(`Maximum Number of Iterations Exceeded.\n`);
STEP 7
procedure completed unsuccessfully
> else
> printf(`Choice of output method:\n`);
> printf(`1. Output to screen\n`);
> printf(`2. Output to text file\n`);
> printf(`Please enter 1 or 2.\n`);
> FLAG := scanf(`%d`)[1];
13
- Flow Around a Cylinder -
> if FLAG = 2 then
> printf(`Input the file name in the form - drive:\\name.ext\n`);
> printf(`for example: A:\\OUTPUT.DTA\n`);
> NAME := scanf(`%s`)[1];
> OUP := fopen(NAME,WRITE,TEXT);
> else
> OUP := default;
> fi;
> fprintf(OUP, `GAUSS-SEIDEL METHOD FOR LINEAR SYSTEMS\n\n`);
> fprintf(OUP, `The solution vector is :\n`);
> for I from 1 to N do
> fprintf(OUP, ` %11.8f`, X1[I-1]);
> od;
> fprintf(OUP, `\nusing %d iterations\n`, K);
> fprintf(OUP, `with Tolerance %.10e in infinity-norm\n`, TOL);
> if OUP <> default then
> fclose(OUP):
> printf(`Output file %s created sucessfully`,NAME);
> fi;
> fi;
> fi;
> RETURN(0);
> end;
alg072 := proc()
local AA, OK, NAME, INP, N, I, J, A, X1, TOL, NN, K, ERR, S,
FLAG, OUP;
printf(`This is the Gauss-Seidel Method for Linear Sys\
tems.\n`);
printf(`The array will be input from a text file in th\
e order\n`);
printf(`A(1,1), A(1,2), ..., A(1,n+1), A(2,1), A(2,2),\
..., \nA(2,n+1),..., A(n,1), A(n,2), ..., A(n,n+1\
)\n`);
printf(`Place as many entries as desired on each line,\
but separate\n`);
printf(`entries with `);
printf(`at least one blank.\n\n\n`);
AA := y;
OK := FALSE;
if AA = Y or AA = y then
printf(`Input the file name in the form - drive:\\\
name.ext\n`);
printf(`for example: A:\\DATA.DTA\n`);
NAME := scanf(%s)[1];
INP := fopen(NAME, READ, TEXT);
OK := FALSE;
while OK = FALSE do
printf(`Input the number of equations - an int\
eger.\n`);
N := scanf(%d)[1];
if 0 < N then
for I to N do for J to N + 1 do
A[I - 1, J - 1] := fscanf(INP, %f)[1]
od
od;
14
- Flow Around a Cylinder -
for I to N do X1[I - 1] := fscanf(INP, %f)[1]
od;
OK := TRUE;
fclose(INP)
else printf(
`The number must be a positive integer\n`)
fi
od;
OK := FALSE;
while OK = FALSE do
printf(`Input the tolerance.\n`);
TOL := scanf(%f)[1];
if 0 < TOL then OK := TRUE
else printf(`Tolerance must be a positive.\n`)
fi
od;
OK := FALSE;
while OK = FALSE do
printf(`Input maximum number of iterations.\n`);
NN := scanf(%d)[1];
if 0 < NN then OK := TRUE
else printf(
`Number must be a positive integer.\n`)
fi
od
else printf(`The program will end so the input file ca\
n be created.\n`)
fi;
if OK = TRUE then
K := 1;
OK := FALSE;
while OK = FALSE and K <= NN do
ERR := 0;
for I to N do
S := 0;
for J to N do
S := S - A[I - 1, J - 1]*X1[J - 1]
od;
S := (S + A[I - 1, N])/A[I - 1, I - 1];
if ERR < abs(S) then ERR := abs(S) fi;
X1[I - 1] := X1[I - 1] + S
od;
if ERR <= TOL then OK := TRUE fi;
K := K + 1
od;
if OK = FALSE then printf(
`Maximum Number of Iterations Exceeded.\n`)
else
printf(`Choice of output method:\n`);
printf(`1. Output to screen\n`);
printf(`2. Output to text file\n`);
printf(`Please enter 1 or 2.\n`);
FLAG := scanf(%d)[1];
if FLAG = 2 then
printf(`Input the file name in the form - \
drive:\\name.ext\n`);
15
- Flow Around a Cylinder -
printf(`for example: A:\\OUTPUT.DTA\n`);
NAME := scanf(%s)[1];
OUP := fopen(NAME, WRITE, TEXT)
else OUP := default
fi;
fprintf(OUP,
`GAUSS-SEIDEL METHOD FOR LINEAR SYSTEMS\n\n`)
;
fprintf(OUP, `The solution vector is :\n`);
for I to N do fprintf(OUP, ` %11.8f`, X1[I - 1])
od;
fprintf(OUP, `\nusing %d iterations\n`, K);
fprintf(OUP,
`with Tolerance %.10e in infinity-norm\n`,
TOL);
if OUP <> default then
fclose(OUP);
printf(`Output file %s created sucessfully`,
NAME)
fi
fi
fi;
RETURN(0)
end
> alg072();
This is the Gauss-Seidel Method for Linear Systems.
The array will be input from a text file in the order
A(1,1), A(1,2), ..., A(1,n+1), A(2,1), A(2,2), ...,
A(2,n+1),..., A(n,1), A(n,2), ..., A(n,n+1)
Place as many entries as desired on each line, but separate
entries with at least one blank.
Input the file name in the form - drive:\name.ext
for example: A:\DATA.DTA
> a:\cylinder.txt
Input the number of equations - an integer.
> 20
Input the tolerance.
> .0001
Input maximum number of iterations.
> 100
Choice of output method:
1. Output to screen
2. Output to text file
Please enter 1 or 2.
>1
GAUSS-SEIDEL METHOD FOR LINEAR SYSTEMS
The solution vector is :
.46072192 1.00302256 2.26069090 6.20164023 .67777215 1.47102095 3.47508155 9.96948596
.66859931 1.45637330 3.59312783 10.78441910 .49491143 1.08238341 2.78909479 8.75901938
.24298799 .53046698 1.43268388 4.70803322
using 31 iterations
with Tolerance 1.0000000000e-04 in infinity-norm
16
- Flow Around a Cylinder -
cylinder.txt
Input file of finite difference matrix
-3.8238 0.9119 0.0000 0.0000 1.2500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.4053 -2.8106 0.4053 0.0000 0.0000 1.1667 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.2280 -2.4559 0.2280 0.0000 0.0000 1.1250 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.1459 -2.2918 0.0000 0.0000 0.0000 1.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -2.9167
0.9000 0.0000 0.0000 0.0000 -3.8238 0.9119 0.0000 0.0000 1.2500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.7500 0.0000 0.0000 0.4053 -2.8106 0.4053 0.0000 0.0000 1.1667 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.8333 0.0000 0.0000 0.2280 -2.4559 0.2280 0.0000 0.0000 1.1250 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.8750 0.0000 0.0000 0.1459 -2.2918 0.0000 0.0000 0.0000 1.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -5.0518
0.0000 0.0000 0.0000 0.0000 0.9000 0.0000 0.0000 0.0000 -3.8238 0.9119 0.0000 0.0000 1.2500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.7500 0.0000 0.0000 0.4053 -2.8106 0.4053 0.0000 0.0000 1.1667 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.8333 0.0000 0.0000 0.2280 -2.4559 0.2280 0.0000 0.0000 1.1250 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.8750 0.0000 0.0000 0.1459 -2.2918 0.0000 0.0000 0.0000 1.1000 0.0000 0.0000 0.0000 0.0000 -5.8333
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.9000 0.0000 0.0000 0.0000 -3.8238 0.9119 0.0000 0.0000 1.2500 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.7500 0.0000 0.0000 0.4053 -2.8106 0.4053 0.0000 0.0000 1.1667 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.8333 0.0000 0.0000 0.2280 -2.4559 0.2280 0.0000 0.0000 1.1250 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.8750 0.0000 0.0000 0.1459 -2.2918 0.0000 0.0000 0.0000 1.1000 -5.0518
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.9000 0.0000 0.0000 0.0000 -3.8238 0.9119 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.7500 0.0000 0.0000 0.4053 -2.8106 0.4053 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.8333 0.0000 0.0000 0.2280 -2.4559 0.2280 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.8750 0.0000 0.0000 0.1459 -2.2918 -2.9167
17
- Flow Around a Cylinder -
exact.mws
Calculates and plots stream function around a circular cylinder
Exact solution for flow over a circular cylinder:
> restart: with(plottools): with(plots):
> streams:=proc(n,fcn,pts,names) local f,k,DISK,p; f:=transform((r,th)->[r*cos(th),r*sin(th)]):
DISK:=disk([0,0],1,color=red); for k from -n by 2 to n do p[k]:=implicitplot(fcn=2*k/n,x=-n/2..n/2,y=Pi..Pi,numpoints=pts): od: display(seq(f(p[2*i]),i=-n/2..n/2), DISK, view=[-n/2..n/2,n/2..n/2],scaling=constrained, axes=boxed, title=name); end:
> f:=z->U*z:
> W:=z->evalc(f(z)+f(a^2/z)):
> W(z);
2
Ua
U z + ---z
> assume(x,real,y,real,z,real); U:=1: a:=1:
> W(z);
1
z~ + ---z~
> complex_potential:=W(x*exp(I*y));
cos(y~)
complex_potential := x~ cos(y~) + -----------------------2
2
x~ (cos(y~) + sin(y~) )
/
sin(y~)
\
+ I |x~ sin(y~) - ------------------------|
|
2
2|
\
x~ (cos(y~) + sin(y~) )/
> vel_pot:=simplify(Re(complex_potential));
2
cos(y~) (x~ + 1)
vel_pot := ----------------x~
> strm_fcn:=expand(simplify(Im(complex_potential)));
sin(y~)
strm_fcn := x~ sin(y~) - ------x~
> title1:="Flow Past a Cylinder":
> streams(10,strm_fcn,1000,title1);
18
- Flow Around a Cylinder -
project.xls
Calculates the elements and boundary conditions of the finite difference matrix
Compares the numerical solution to the exact solution
This file is too large to fit into this word processing document.
Please refer to the attached Excel spreadsheet in the email message that delivered this document.
19
Download