Maple Services

Fluid Flow Past a Cylinder

© 1998 Waterloo Maple Inc.

NOTE: This worksheet uses Maple to illustrate the Fliud dynamics problem of flow past a cylinder.

Introduction

This worksheet demonstrates how Maple can be used in the field of Fluid Dynamics. We analyze and illustrate various flows past a cylinder of radius=1. First, a written procedure creates a Maple plot structure that displays a cylinder of radius=1 and the streamlines related to the input function.

> restart; with(plottools): with(plots):

Procedure to Graph Streamlines Past a Cylinder

A procedure called 'streams' will take four values as input. These parameters are:
       n, number of stream lines to be displayed,
       fcn, stream function to be plotted,
       pts, value of numpoints in a plot structure, and
       name, title of the graph

> streams:=proc(n,fcn,pts,name)
       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:

Flow of an Inviscid, Irrotational Fluid past a disk

First, use the circle theorem (Milne-Thompson Theorem) to find the complex potential of the flow past a disk of radius 1. Then separate the terms to find the velocity potential of the flow and the stream function of the flow. Finally, we use the procedure 'streams' to plot the streamlimes of the flow past the disk.

Uniform flow is given by

> f:=z->U*z:

Where U is the velocity of the flow of the fluid. Now the circle theorem gives

> W:=z->evalc(f(z)+f(a^2/z)):

The complex potential, W(z), of the flow is given by:

> W(z);

[Maple Math]

Letting [Maple Math] , assuming the variables x, y are real, and assigning values to U and a, we obtain the following:

> assume(x,real,y,real,z,real); U:=1: a:=1:

> W(z);

[Maple Math]

> complex_potential:=W(x*exp(I*y));

[Maple Math]

> vel_pot:=simplify(Re(complex_potential));

[Maple Math]

> strm_fcn:=expand(simplify(Im(complex_potential)));

[Maple Math]

> title1:="Flow Past a Sphere of Radius 1":

> streams(10,strm_fcn,1000,title1);

[Maple Plot]

>

Example 2

Calculate the flow past a disk of radius 1 with the angle of attack to be [Maple Math] radians below the x-axis.

> title2:=`Flow Past a Sphere of Radius 1 with Angle of Attack Pi/6`:

> fcn2:=(x-1/x)*sin(y-Pi/6):

> streams(10,fcn2,1000,title2);

[Maple Plot]

>

Example 3

In this case, the fluid flow has circulation=8 past a disk of radius 1, with angle of attack=- Pi/6 .

This is simply to illustrate the graphics and to provide another example.

> title3:=`Flow Past a Disk of Radius 1 with Circulation=8 and Angle of Attack Pi/6`:

> fcn3:=(x-1/x)*sin(y+Pi/32*Pi)+8/(2*Pi)*ln(x):

> streams(8,fcn3,300,title3);

[Maple Plot]

>

Example 4

Given an animation of the circulation of the fluid changing from -8 to 8 as it flows past a disk of radius 1, with angle of attack=-Pi/4. To view the animation click on the plot once it has been generated, and use the animation button bar or 'animation' on your context-sensitive menu (right-click your mouse on the plot with a PC).

> fcn:=(circ)->(x-1/x)*sin(y+Pi/4)+circ/(2*Pi)*ln(x):

> A:=[seq(streams(10,fcn(2.5*(i-9)),300,``),i=1..15)]:

> display(A,seq(A[15-i],i=1..14),insequence=true,scaling=constrained);

[Maple Plot]

Maple Services