You are on page 1of 11

RESULTS:

Streamlines pattern for Re = 100, 400,1000


Vortex Contours for Re = 100, 400, 1000:
Comparing Numerical and Literature results for
u* @ x*=0.5 and Re = 100, 400 and 1000

Comparing Numerical and Literature results for


v* @ y*=0.5 and Re = 100, 400 and 1000
Conclusion:

The results are found to be very accurate when
compared to literature results.

With increasing Reynolds number(Re), the
vorticity increases.

Higher Re take more no. of iterations to converge
and thus time taken to solve also increases with
increase in Re.

Time complexity increases drastically as tolerance
is decreased.

First order upwind schemes converge a bit faster as
compared to second order but the accuracy is poor
for high Re(even when Re = 1000).
Fortran Solver:
program main
implicit none
integer :: n,i,j,k,t_iter,nRe
real :: h,dt,t_max,tol
Logical :: isConverged
character(len = 15) :: str
integer,dimension(:),allocatable :: Re
real,dimension(:,:),allocatable :: psi,psi_n,w,w_n,u,v,f

n = 129;
h = 1.0/n;
dt = 0.001;
t_iter = 500000;
tol = 0.01;

allocate(psi(n,n));
allocate(psi_n(n,n));
allocate(w(n,n));
allocate(w_n(n,n));
allocate(u(n,n));
allocate(v(n,n));
allocate(f(n,n));
allocate(Re(3));

Re(1) = 100;
Re(2) = 400;
Re(3) = 1000;
do nRe = 1,3
do i = 1,n
do j = 1,n
psi(i,j) = 0;
w(i,j) = 0;
w_n(i,j) = 0;
u(i,j) = 0;
v(i,j) = 0;
f(i,j) = 0;
end do
end do

do i = 1,n
u(i,n) = 1;
end do

tloop: do k = 1,t_iter
isConverged = .true.;

do i = 1,n
do j = 1,n
f(i,j) = 0;
end do
end do

do i = 2,n-1
w_n(i,1) = -2*psi(i,2)/(h*h);
w_n(1,i) = -2*psi(2,i)/(h*h);
w_n(n,i) = -2*psi(n-1,i)/(h*h);
w_n(i,n) = -2*(psi(i,n-1)+h)/(h*h);
end do
do i = 2,n-1
do j = 2,n-1
u(i,j) = (psi(i,j+1)-psi(i,j-1))/(2*h);
v(i,j) = -(psi(i+1,j)-psi(i-1,j))/(2*h);
if(u(i,j) >= 0)then
if(i==2) then
f(i,j) = f(i,j) - u(i,j)*(w(i,j)-w(i-1,j))/h;
else
f(i,j) = f(i,j) - u(i,j)*(3*w(i,j)-4*w(i-1,j)+w(i-2,j))/(2*h);
end if
else
if(i==2) then
f(i,j) = f(i,j) - u(i,j)*(w(i+1,j)-w(i,j))/h;
else
f(i,j) = f(i,j) - u(i,j)*(-3*w(i,j)+4*w(i+1,j)-w(i+2,j))/(2*h);
end if
end if
if(v(i,j) >= 0)then
if(j==2) then
f(i,j) = f(i,j) - v(i,j)*(w(i,j)-w(i,j-1))/h;
else
f(i,j) = f(i,j) - v(i,j)*(3*w(i,j)-4*w(i,j-1)+w(i,j-2))/(2*h);
end if
else
if(j==2) then
f(i,j) = f(i,j) - v(i,j)*(w(i,j+1)-w(i,j))/h;
else
f(i,j) = f(i,j) - v(i,j)*(-3*w(i,j)+4*w(i,j+1)-w(i,j+2))/(2*h);
end if
end if
f(i,j) = f(i,j) + (1.0/Re(nRe))*(w(i+1,j)+w(i-1,j)+w(i,j+1)+w(i,j-1)-
4*w(i,j))/(h*h);
w_n(i,j) = w(i,j) + f(i,j)*dt;
psi_n(i,j) = 0.25*(w_n(i,j)*(h*h)+psi(i-1,j)+psi(i+1,j)+psi(i,j-
1)+psi(i,j+1));
end do
end do iloop: do i = 1,n
do j = 1,n
if(abs((w_n(i,j)-w(i,j))/dt) > tol) then
isConverged = .false.;
exit iloop;
end if
end do
end do iloop
if(isConverged) then
print*,"value of k",k;
exit tloop;
end if
do i=1,n
do j=1,n
w(i,j) = w_n(i,j);
psi(i,j) = psi_n(i,j);
end do
end do
end do tloop
if(isConverged) then
print *,"The result converged";
write (str,*) Re(nRe)
str = adjustl(str)
open(10,file='psi2_Re'//trim(str)//'.dat')
open(20,file='omega2_Re'//trim(str)//'.dat')
open(30,file='u2_Re'//trim(str)//'.dat')
open(40,file='v2_Re'//trim(str)//'.dat')
do i = 1,n
write(10,*) (psi_n(i,j),j = 1,n);
write(20,*) (w_n(i,j),j = 1,n);
write(30,*) (i*1.0/n),(u(65,i));
write(40,*) (i*1.0/n),(v(i,65));
end do
close(10);
close(20);
close(30);
close(40);
else
print *,"The result did not converge";
end if
end do

end program

You might also like