Вы находитесь на странице: 1из 7

# CFD of incompressible Couette flow using

## pressure correction method

- Akhilesh Gogikar (12AE30007)

Abstract

The incompressible couette flow problem given in the book “CFD basics and applications” by
J.D.Anderson Jr. was taken up and Matlab code to solve the same was developed. The flow was
resolved into a staggered grid and the momentum equations were used to generate the velocity
fields and then the Poisson equation was solved to generate the pressure field. This was done
iteratively till the solution converged.

Computational grid

The solid points are the pressure points i.e. the pressure is calculated at this point, the u velocities
are defined at open circles or empty circles and the crosses are the points where v velocity is
defined.

## The boundary values for this problem are defined as follows:

At the wall the p’ will be assumed a constant zero along the length for mathematical convenience.
The problem also contains a velocity spike at (15, 5), just to produce a 2-D flow scenario.
Algorithm

## The program follows the steps given below:

1. The arbitrary pressure p*, and momenta 𝜌u* and 𝜌v* are assigned to all interior points.
2. Momentum equation is solved for 𝜌u* and 𝜌v* at the next time step.
3. Using the 𝜌u* and 𝜌v* so obtained p’ is calculated using pressure correction or Poisson
equation.
4. Pressure at all internal points is not calculated
5. Steps 2-4 are iterated till convergence is reached. The zero divergence is checked after
every iteration.

Results

## Chart1: Solution at the end of 1st time step

Chart2: Solution at the end of 4th time step Chart3: Mass source term condition at k=4
Chart4: Solution at K = 50 Chart 5: Mass source term at K=50

## Chart 6: Solution at K =150 Chart 7: Mass source term at k = 150

So far it can be seen that the y velocity introduced is still evidently affecting the solution, and only at
around K=150 it is resembling the solution, but even now the mass source is not near zero as we
expect it to be. Further solving till 300 iterations gives desired solution.

Chart 8: Mass source term is now zero Chart 9: The desired solution has
been attained.
Conclusion

The program to solve the given incompressible Couette flow was developed. The solution appears to
converge at the 300 iterations. When ∆t >0.001 the solution doesn’t appear to converge
satisfactorily. The following conditions were used during this simulation:

1. ∆𝑥 = 0.025 𝑓𝑡
2. ∆𝑦 = 0.001 ft.
3. ∆𝑡 = 0.0001 sec
4. 𝜌 = 0.002377 slug/ft^3
5. 𝜇 = 3.726e-7 lbs. s/ft^2

The procedure to apply pressure correction was understood, analysed and tested.

The Code
%Pressure correction method applied to incompressible flow between two
%parallel plates (i.e. Couette flow). Method taken from John Anderson's
%book "CFD - Basics with Applications", section 9.4.

## clc; clear all; close all;

% GEOMETRY CONSTANTS

## L = 0.5; % length of domain, ft

H = 0.01; % height of domain, ft

## Nxp = 21; % # of points in x direction at which pressure is resolved

Nyp = 11; % # of points in y direction at which pressure is resolved
Nxu = Nxp + 1; % # of points in x direction at which u velocity is resolved
Nyu = Nyp; % # of points in y direction at which u velocity is resolved
Nxv = Nxp + 2; % # of points in x direction at which v velocity is resolved
Nyv = Nyp + 1; % # of points in y direction at which v velocity is resolved

dx = L/(Nxp-1); % in x direction
dy = H/(Nyp-1); % in y direction

## dt = 1e-3; % time resolution, seconds

alpha_p = 0.1; % under-relaxation factor for pressure
alpha_u = 0; % under-relaxation factor for u velocity
alpha_v = 0; % under-relaxation factor for v velocity

## [xp yp] = meshgrid(0:dx:L,0:dy:H);

[xu yu] = meshgrid(-0.5*dx:dx:L+0.5*dx,0:dy:H);
[xv yv] = meshgrid(-1*dx:dx:L+1*dx,-0.5*dy:dy:H+0.5*dy);

## plot(xp,yp,'*r'); hold on; plot(xu,yu,'ob'); hold on;

plot(xv,yv,'xm'); hold on;

% FLUID CONSTANTS

## rho = 0.002377; % density of air, slug/ft^3

mu = 3.726e-7; % dynamic viscosity of air, lbf s/ft^2
% INITIAL CONDITIONS

pstar = zeros(Nyp,Nxp);
ustar = zeros(Nyu,Nxu); ustar(1,:) = 1;
vstar = zeros(Nyv,Nxv); vstar((Nyv-5)+1,15) = 0.5; % velocity spike at
(15,5), in ft/s

rho_ustar = rho.*ustar;
rho_vstar = rho.*vstar;
pprime = zeros(Nyp,Nxp);
pprime1 = zeros(Nyp,Nxp);
uprime = zeros(Nyu,Nxu);
vprime = zeros(Nyv,Nxv);
A = zeros(Nyu,Nxu);
B = zeros(Nyv,Nxv);

% BOUNDARY CONDITIONS

v = vstar;
u = ustar; % horizontal velocity, ft/s

## % PRESSURE CORRECTION METHOD

b = -dt/(dx^2);
c = -dt/(dy^2);
a = -2*(b + c);
d = zeros(Nyp,Nxp); % mass flow term in continuity equation

conv = ones(Nyp,Nxp);
figure; plot(0,d(7,15),'-o'); hold on; grid on;

for iter = 1 : 1,

## for i = 1:Nxp-1, % column, 1 to 20

for j = 2:Nyu-1, % row, 2 to 10
% for i = 1:Nxu-2, % column
% for j = 2:Nyu-1, % row

k = Nyp-((Nyp-j)+1)+1; % 2 to 10
kv = Nyv-((Nyv-j))+1; % 3 to 11
ku = Nyu-((Nyu-j)+1)+1; % 2 to 10

vbar1 = 0.5*(v(kv-1,i+1)+v(kv-1,i+2));
vbar2 = 0.5*(v(kv,i+1)+v(kv,i+2));

A(ku,i+1) = -((rho*(u(ku,i+2)^2)-rho*(u(ku,i)^2))/(2*dx)...
+ ((rho*u(ku-1,i+1)*vbar1)-(rho*u(ku+1,i+1)*vbar2))/(2*dy))...
+ mu*((u(ku,i+2)-2*u(ku,i+1)+u(ku,i))/(dx^2) ...
+ (u(ku-1,i+1)-2*u(ku,i+1)+u(ku+1,i+1))/(dy^2));

## rho_ustar(ku,i+1) = rho_ustar(ku,i+1) + A(ku,i+1)*dt ...

- (dt/dx)*(pstar(k,i+1) - pstar(k,i));
ustar(ku,i+1) = rho_ustar(ku,i+1)/rho;
u(ku,i+1) = ustar(ku,i+1);

end
end
ustar(:,1) = ustar(:,2);
ustar(:,Nxu) = ustar(:,Nxu-1);
u = ustar;

## for i = 1:Nxu-1, % column, 1 to 21

for j = 1:Nyu-1, % row, 1 to 10

k = Nyp-((Nyp-j))+1; % 2 to 11
kv = Nyv-((Nyv-j))+2; % 3 to 12
ku = Nyu-((Nyu-j))+1; % 2 to 11

ubar1 = 0.5*(u(ku,i+1)+u(ku-1,i+1));
ubar2 = 0.5*(u(ku,i)+u(ku-1,i));

B(kv-1,i+1) = -(((rho*v(kv-1,i+2)*ubar1)-(rho*v(kv-
1,i)*ubar2))/(2*dx)...
+ (rho*(v(kv-2,i+1)^2)-rho*(v(kv,i+1)^2))/(2*dy)) ...
+ mu*((v(kv-1,i+2)-2*v(kv-1,i+1)+v(kv-1,i))/(dx^2) ...
+ (v(kv-2,i+1)-2*v(kv-1,i+1)+v(kv,i+1))/(dy^2));

## rho_vstar(kv-1,i+1) = rho_vstar(kv-1,i+1) + B(kv-1,i+1)*dt...

- (dt/dy)*(pstar(k-1,i) - pstar(k,i));
vstar(kv-1,i+1) = rho_vstar(kv-1,i+1)/rho;
v(kv-1,i+1) = vstar(kv-1,i+1);

end
end

## rho_vstar(:,Nxv) = rho_vstar(:,Nxv-1); % v velocity zeroth order

interpolation
rho_vstar(:,1) = 0; % vertical velocity at inflow boundary
vstar = rho_vstar./rho;

for n = 1:200,
for i = 2:Nxp-1, % 2 to 20
for j = 2:Nyp-1, % 2 to 10

k = Nyp-((Nyp-j)+1)+1; % 2 to 10
kv = Nyv-((Nyv-j)+1)+2; % 3 to 11
ku = Nyu-((Nyu-j)+1)+1; % 2 to 10

d(k,i) = (1/dx)*(rho_ustar(ku,i+1)-
rho_ustar(ku,i))+(1/dy)*(rho_vstar(kv-1,i+1)-rho_vstar(kv,i+1));

pprime(:,1) = 0; % inflow
pprime(:,Nxp) = 0; % outflow
pprime(1,:) = 0; % top wall
pprime(Nyp,:) = 0; % bottom wall

pprime1(k,i) = -(1/a)*(b*pprime(k,i+1)+b*pprime(k,i-1)+c*pprime(k-
1,i)+c*pprime(k+1,i)+d(k,i));

## conv(k,i) = pprime1(k,i) - pprime(k,i);

pprime(k,i) = pprime1(k,i);

end
end
end
% for i = 1:Nxp-1, % 1 to 20
% for j=2:Nyp-1, % 2 to 10
%
% k = (Nyp-j)+1; % 2 to 10
% ku = (Nyu-j)+1; % 2 to 10
%
% uprime(ku,i+1) = (1/rho)*(-(dt/dx)*(pprime(k,i+1) - pprime(k,i))); %
x = 2 to 21, y = 2 to 10
%
% end
% end

% for i = 1:Nxu-1, % 1 to 21
% for j=1:Nyp-1, % 1 to 10
%
% k = (Nyp-j)+1; % 2 to 11
% kv = (Nyv-j)+1; % 3 to 12
%
% vprime(kv-1,i+1) = (1/rho)*(-(dt/dy)*(pprime(k-1,i) - pprime(k,i)));
% x = 2 to 22, y = 2 to 11
%
% end
% end

## fprintf('\nCompleted iteration %3d\n',iter);

pstar = pstar + alpha_p.*pprime;
u = ustar; %+ alpha_u.*uprime;
v = vstar; %+ alpha_v.*vprime;
plot(iter,abs(d(7,15))*1e3,'-o'); hold on; grid on;
xlabel('Iteration');
ylabel('d - (slug/ft^3.s) x 10^3');
end
figure;
plot(flipud(u(:,15)), yu(:,15),'-o'); xlabel('u / v, ft/s'); ylabel('y,
ft');
axis([0 1 0 H]); grid on; hold on;
plot(flipud(v(:,15)), yv(:,15),'r-o');

References: