We have derived Laplace's equation for steady-state water flow in two dimensions and have explained how the equation is solved by three Relaxation Methods: Jacobi, Gauss Siedel and Successive Over-Relaxation on a discrete 20 10 grids. The numerical method was illustrated by a Matlab programming code.
6. References
[1] John D. Anderson, JR (1995). Computational Fluid Dynamics: The Basics with Applications .McGraw Hill, Inc.
[2] Anderson, J.D. (1995). Computational Fluid Dynamics. Newyork.
[3] C. T, S. (1992). Using Computational Fluid Dynamics. Prentice Hall.
[4] Dr. Songdong Shao.(2012). Environmental Computational Fluid Dynamics Lecture 6
[5] Cynthia Vanessa Flores (CSUN), 2007. Numerical Simulation of Potential Flow using the …show more content…
dy=1.0; %Grid spacing in y direction nx=21; % Number points in x axis from 0 t0 20 ny=11; % Number points in y axis from 0 t0 10 % Calculation Factor fc=(dx^2*dy^2)/(2*(dx^2+dy^2)); % Define accuracy epsilon=0.00001; error=2*epsilon;% initial value for error % Define Initial Condition
Phi=zeros(nx,ny);
% Define Boundary Condition
Phi(1,:)=100.0;
Phi(nx,:)=0.0;
Phil=Phi;
% Iteration Loop iter=2; tic % Start Timer while error >=epsilon % Check the Allowed Accuracy
Phi=Phil; %replace old value with new value % Update inner points for i=2:(nx-1) for j=2:(ny-1) Phil(i,j)=fc*((Phi(i+1,j)+Phil(i-1,j))/dx^2+(Phi(i,j+1)+Phil(i,j-1))/dy^2); end end % Modify points adjacent to lower boundary for i=2:(nx-1) Phil(i,2)=fc*((Phi(i+1,2)+Phi(i-1,2))/dx^2+(Phi(i,3)+Phi(i,2))/dy^2); end % Modify points adjacent to upper boundary for i=2:(nx-1) Phil(i,ny-1)=fc*((Phi(i+1,ny-1)+Phi(i-1,ny-1))/dx^2+(Phi(i,ny-2)+Phi(i,ny-1))/dy^2); end % Update lower and upper boundary points for i=2:(nx-1) Phil(i,1)=Phil(i,2); Phil(i,ny)=Phil(i,ny-1); end error=max(max(abs(Phil(:,:)-Phi(:,:)))); iter=iter+1; end
%Calculate the flow velocity fields
U=zeros(nx,ny);
V=zeros(nx,ny); for i=2:(nx-1) for