You are on page 1of 2

clear all

close all
clc
%-------------------------------------------
% GRID & INPUT VARIABLES
%------------------------------------------

sx = 0.; % displacement of circle center in real axis.


sy = 0 ; % displacement of circle center in imaginary axis.

s = sx + i*sy; % resultant displacement in the z plane


r = 0.9; % radius of the cylinder in complex z plane (x+iy)

alpha = 6; % angle of attack, deg


alpha = alpha*pi/180; % angle of attack in radians

tol = +5e-2; % geometric grid tolerance for flow visualization


[x y]= meshgrid(-4:.1:4); % mesh or grid generation in the circle or complex z
z = x + i*y;

% grid tolerance check for flow visualization


for p = 1:length(x)
for q = 1:length(y)
if abs(z(p,q)-s) <= r - tol
z(p,q) = NaN;
end
end
end

%Total complex aerodynamic potential function and grid in airfoil plane


for p = 1:length(x)
for q = 1:length(y)
f(p,q) = -100*(z(p,q)) + 1/(z(p,q)-s) - 1i*150*log(z(p,q));
z1(p,q)=f(p,q)*exp(-1i*alpha);
end
end

phi = 0:.0001:2*pi; %% JOUKOWSKI MAPPING FUNCTION


for p = 1:length(phi)

zcirc(p) = r*(cos(phi(p))+1i*sin(phi(p))) + s;
end

% Plotting the solution


%----------------------------------
figure(1)
hold on
v2 = -400:5:400;
contourf(real(z),imag(z),imag(f),v2);
fill(real(zcirc),imag(zcirc),'k')
axis equal
axis(1.5*[-1 1 -1 1])
title('Stream lines around the cylinder Z.');

figure(2)
hold on
v2 = -400:5:400;
contourf(real(z),imag(z),imag(z1),v2);
fill(real(zcirc),imag(zcirc),'k')
axis equal
axis(1.5*[-1 1 -1 1])
title('Stream lines around the cylinder z1.');

You might also like