Example 4.3-1 Potential Flow around a cylinder
Showing how to get fig. 4.3-1 giving streamlines for the flow.
Using complex variables.
>  restart;
>  w:=z->-vinf*R*(z/R+R/z); Eq. 4.3-16
[Maple Math]
>  phi:=(x,y)->evalc(Re(w(x+I*y)));psi:=(x,y)->evalc(Im(w(x+I*y))); w(z)=phi(x,y)+i*psi(x,y) as given in eq. 4.3-17. note that Maple requires i to be I.
>  assume(x,real,y,real,vinf,real,R,real);
>  phi(x,y) ; velocity potential
[Maple Math]
>  psi(x,y); eq. 4.3-18 rearranged a little giving the stream function
[Maple Math]
>  Psi1:=(X,Y)->simplify(psi(X*R,Y*R)/vinf/R,assume=positive);
>  Psi1(X,Y); eq. 4.3-19
[Maple Math]
>  Psi1(0,2);Psi1(0,3/2); Two points on the X axis. Note the negative signs.
[Maple Math] [Maple Math]
>  Xa:=solve(Psi1(X,Y)=C,X);
[Maple Math]
>  X1:=unapply(Xa[1],Y,C);
>  X2:=unapply(Xa[2],Y,C); This is just the negative of X1.
>  X1(Y,0);simplify(X1(Y,-1));simplify(X1(Y,-3/2));
>  X1(1.6,-3/2);X2(1.6,-3/2);X1(-1.6,3/2);X2(-1.6,3/2);
>  with(plots):
>  p10:=plot(X1(Y,0),Y=0...1): First quadrant points: Psi is negative
>  p11:=plot(X1(Y,-5/6),Y=1.0...3/2,color=green):
>  p12:=plot(X1(Y,-3/2),Y=1.7...2,color=blue):
>  display({p10,p11,p12});
>  p20:=plot(X2(Y,0),Y=-1....0): Second quadrant points: Psi is positive
>  p21:=plot(X2(Y,5/6),Y=-3/2...-1,color=yellow):
>  p22:=plot(X2(Y,3/2),Y=-2...-1.7,color=magenta):
>  display({p20,p21,p22});
>  p40:=plot(X2(Y,0),Y=0...1): Fourth quadrant points: Psi is negative
>  p41:=plot(X2(Y,-5/6),Y=1.0...3/2,color=green):
>  p42:=plot(X2(Y,-3/2),Y=1.7...2,color=blue):
>  display({p40,p41,p42});
>  p30:=plot(X1(Y,0),Y=-1....0): Third quadrant points: Psi is positive
>  p31:=plot(X1(Y,5/6),Y=-3/2...-1,color=yellow):
>  p32:=plot(X1(Y,3/2),Y=-2...-1.7,color=magenta):
>  display({p10,p11,p12,p20,p21,p22,p30,p31,p32,p40,p41,p42},view=[-2...2,-2...2],labels=["Y","X"]); Using view, we can make the circle look like a circle. Compare to figure 4.3-1.
[Maple Plot]
The axes are switched giving a rotated form of figure 4.3-1