Upload
adam-kowaleski
View
75
Download
2
Embed Size (px)
Citation preview
1
MAC2282.991 – APPLIED CALCULUS PROJECT
Methods for Plotting Streamlines in Excel
ADAM KOWALESKI, University of South Florida
Advisor:
DR. STANLEY C KRANC, Civil and Environmental Engineering, University of South
Florida
Subject Area Advisor:
DR. GERALD L HEFLEY, Mathematics, University of South Florida
Fall Semester, 2014
Abstract: This project seeks to offer methods to locate and plot streamlines of
constant and incompressible flow ψ using Excel, an accessible software. This is
accomplished by taking the stream function for uniform flow about a cylinder and
applying the Cauchy-Riemann condition followed by parametric differentiation.
Using Excel, we will build a multipurpose dataset which can be used to model and
plot streamlines.
2
TABLE OF CONTENTS
Problem Statement………………………………………………………………………………………… 3
Motivation………………………………………………………………………………………………………. 3
Mathematical Description and Solution Approach………………………………………… 3
Discussion………………………………………………………………………………………………………. 7
Conclusion and Recommendations……………………………………………………………….. 7
References……………………………………………………………………………………………………… 9
3
PROBLEM STATEMENT
Streamlines are lines always tangent to the velocity vector of the fluid
particles in flow (Shames 119). The stream functions for ideal and inviscid fluid flow are well known and given as,
𝜓 = 𝑉0𝑦 −𝑎𝑠𝑖𝑛𝜃
𝑟 (1)
𝜙 = 𝑉0𝑥 −𝑎𝑐𝑜𝑠𝜃
𝑟 (2)
The strength of the doublet is represented by the variable a. In this analysis
lines of constant 𝜓 are the streamlines. The contour lines of 𝜙 form a family of
curves which intersect the streamlines orthogonally (Shames 562).
MOTIVATION
Coupled with the author’s semester study in Calculus 3 at the University of
South Florida the motivation for this paper was to find streamlines.
MATHEMATICAL DESCRIPTION AND SOLUTION APPROACH
As a starting visual exercise consider an x-y grid with 𝜓 computed at each
combination of x and y. It is not difficult to imagine approximately where the
streamline would be, say for 𝜓 = 0.15 as roughly drawn in Table 1.
Table 1
4
Finding this line is the more difficult task at hand. Starting with the gradients
of 𝜙 we have the following.
∇𝜙 = 𝑉𝑥𝑖 + 𝑉𝑦𝑗
∇𝜙 = ∂𝜓
∂y 𝑖 −
∂𝜓
∂x𝑗
Next we consider the Cauchy-Riemann equations which tell us:
∂𝜓
∂y=
∂𝜙
∂x
∂𝜓
∂x= −
∂𝜙
∂y
For our problem, Shames notes that in the study of 2-D potential flow, we express
the velocity V in terms 𝜓 shown as (Shames 299).
𝑉𝑥 = ∂𝜓
∂y= 𝑉0 +
𝑎(𝑦2 − 𝑥2)
(𝑦2 + 𝑥2)2 (3)
𝑉𝑦 = − ∂𝜓
∂x= −
2𝑎𝑥𝑦
(𝑦2 + 𝑥2)2 (4)
Now we can take (1) and (2) and convert them to x and y as shown below in (5)
and (6), respectively.
𝜓 = 𝑉0𝑦 −
𝑎𝑦
√𝑥2 + 𝑦2
√𝑥2 + 𝑦2= 𝑉0𝑦 −
𝑎𝑦
𝑥2 + 𝑦2 (5)
𝜙 = 𝑉0𝑥 +𝑎𝑥
𝑥2 + 𝑦2 (6)
By implicit differentiation of 𝜓
𝑑𝑦
𝑑𝑥=
−2𝑎𝑥𝑦(𝑦2 + 𝑥2)2
𝑉0 −𝑎
𝑦2 + 𝑥2 +2𝑎𝑦2
(𝑦2 + 𝑥2)2
(7)
5
Now, with (7) let us consider two methods to produce a streamline. First we
will apply Heun’s method (Kranc 1). Second we will use linear interpolation.
In Excel, lay out columns for x, y, k1 and k2. We will also include cells for a,
dx and 𝑉0. Next we program the following functions and march them down each
cell.
𝑥𝑛 = 𝑥𝑛+𝑑𝑥
𝑦1 = 0.5 ∗ (𝑘1 + 𝑘2) ∗ 𝑑𝑥
𝑘1 = 𝑓(𝑥) =𝑑𝑦
𝑑𝑥= (4)
𝑘2 = 𝑓(𝑥 + 𝑑𝑥, 𝑦 + 𝑑𝑦) 𝑤ℎ𝑒𝑟𝑒 𝑑𝑦 = 𝑘1
Note that a, 𝑦0 and 𝑉0 are chosen arbitrarily along with a uniform dx. A wise
user will lock these cells (except for 𝑦0) so as they are changed new computations
are generated immediately. As we will discuss later, finer increments (say 0.1
versus 0.01) generally produce more accurate graphs. Running these calculations
and plotting the x and y values yields the streamline of constant equal to the value
entered at 𝑦0.
Here is an example setup.
Table 2
Second to Heun’s method we use linear interpolation. Linear interpolation is a
method to locate unknown values on a line. Peltier provides a good commentary
and the following computation in Excel which correlates to the given solution for y
(Peltier, Peltier Tech Blog):
6
Table 3
A3: =MATCH(A2,A6:A18)
B2: =INDEX(B6:B18,A3) + (A2-INDEX(A6:A18,A3)) * (INDEX(B6:B18,A3+1)-
INDEX(B6:B18,A3)) / (INDEX(A6:A18,A3+1)-INDEX(A6:A18,A3))
Note that cell A3 is an arbitrary position (on the sheet), but should
correspond to the 𝜓 value we are looking for. Cell B3 will be our value for y. The
setup here will be similar with x and y columns. The constant will need to be
interpolated against all values -1 to 1 for each increment. Essentially, we are telling
Excel to search each column and return the closest value to the constant of our
choosing. After running the calculation for all x and y combinations we can
construct the streamline.
Table 3 shows an example of the operation in Excel. The equations are
marched down for all combinations of x and y. A second x and y column are setup
to the right to return the interpolated values for convenience.
7
Table 4
DISCUSSION
Table 5
In Table 5 we can see several lines of constant 𝜓 graphed using Heun’s method. Interpolation would produce the same result at dx = 0.01. You can see
particles entering closer to 0 on the axis interact more closely to the cylinder in the center.
v0 0.7
dx 0.01
psi 0.26
y x psi match Interpolated y X Y
-1.00 -1 -0.675 140 0.395872945 -1 0.3959
-0.99 -1 -0.668001263 -0.9 0.4009
-0.98 -1 -0.661005101 -0.8 0.4075
-0.97 -1 -0.654011593 -0.7 0.4163
-0.96 -1 -0.647020816 -0.6 0.4277
-0.95 -1 -0.640032852 -0.5 0.4423
-0.94 -1 -0.633047781 -0.4 0.4599
-0.93 -1 -0.626065687 -0.3 0.4786
8
Table 6
Table 6 is an example of the streamline produced by interpolation. The
generated result is the same as Heun’s method with dx at 0.01 We can see this in Table 7.
Table 7
Further, a line of 𝜙 at 0.25 has also been partially graphed. Compare 𝜓 and
𝜙. They intersect orthogonally. Note here in Table 7, our (x0, y0) is (01, 0.4) for
Heun’s method which corresponds to the constant 0.25 (which was entered into the interpolator).
Lastly, concerning Heun’s method, graphically and mathematically, we see in
(8) the exact same data set. Equation (8) can make for a less burdensome entry
than equation (3) if sheets for 𝑉𝑦and 𝑉𝑥 have already been created prior.
9
𝑉𝑦
𝑉𝑥=
𝑑𝑦𝑑𝑡𝑑𝑥𝑑𝑡
=𝑑𝑦
𝑑𝑥 (8)
CONCLUSION AND RECOMMENDATIONS
In conclusion, this project demonstrates easily attainable methods of finding streamlines by applying Calculus coursework using common software. With this as
base other possibilities exist.
Table 8
Table 8 provides examples for other graphing similar components using the
same methods.
Another option that can be achieved after the streamlines have been attained
is to add rotation. This can be executed simply by adding equation (8) to the interpolator. Or, it could be achieved by Heun’s method if you were to implicitly
differentiate 𝜓 in (8) and add it to equation (7). For example, we can add rotation.
Shames gives the formula for clockwise rotation as
𝜓 = 𝑉0𝑦 −𝑎𝑠𝑖𝑛𝜃
𝑟 +
𝜆
2𝜋𝑙𝑛r
Which as before we can convert to x and y:
10
𝜓 = 𝑉0𝑦 −𝑎𝑦
𝑥2 + 𝑦2+
𝜆
2𝜋𝑙𝑛√𝑥2+𝑦2 (8)
For counterclockwise rotation; simply reverse the second sign in (8).
Table 9
REFERENCES
Kranc, S.C. Plotting Streamlines and Pathlines on a Microcomputer. Comp. in Ed. Div. of
ASEE, (1986), V. VI, No. 3, pp. 20-21.
Peltier, Jon. "Excel Interpolation Formulas." Peltier Tech Blog. Jon Peltier, 18 Aug. 2014.
Web. 28 Nov. 2014.
Shames, Irving Herman. Mechanics of Fluids. New York: McGraw-Hill, 1962. Print.