Sie sind auf Seite 1von 5

Test for Pollutant and Porous Flow

% The is pollutant flow in a shallow porous medium. % The explicit finite difference method is used. % The unknown is the concentration. % The steady state velocity components are found from % Darcys Law, see the function [velx vely] = por2db_fun(nx,ny,L,W) clear; % % Input data and some useful variables. % L = 500; % length in x direction W = 100; % length in y direction T = 8.; % final time maxk = 1600; % number of time steps dt = T/maxk; nx = 100.; % number of steps in x direction dx = L/nx; ny = 50.; % number of steps in y direction dy = W/ny; decay = .1; % decay rate % variable wind vector from Darcys Law. [velx vely] = por2d_fun(nx,ny,L,W); % Set initial conditions. for i = 1:nx+1 x(i) =(i-1)*dx; for j = 1:ny+1 y(j) =(j-1)*dy; u(i,j,1) = 0.; end end % Set upwind boundary conditions. for k = 1:maxk+1 time(k) = (k-1)*dt; for j = 1:ny+1 u(1,j,k) = 10.0; u(nx+1,j,k) = 10.0; end for i = 1:nx+1 u(i,ny+1,k) = 10.0; end u(40:60,ny-2:ny,1) = 10.0; end % % Execute the explicit finite difference method. % Use upwind finite differences. % % ???????????????????????????????????????????????????? % % Output is given in time dependent meshc(),see above, % and final time using meshc() and contour(). % figure(4) subplot(2,1,1)

mesh(x,y,u(:,:,maxk)'); xlabel('x') ylabel('y') zlabel('concentration') title(['Concentration at time = ' num2str(maxk*dt)]) subplot(2,1,2) contour(x,y,u(:,:,maxk)'); xlabel('x') ylabel('y') title(['Contours at time = ' num2str(maxk*dt)])

function [velx vely] = por2d_fun(nx,ny,L,W) % Steady state saturated 2D porous flow. % SOR is used to solve the algebraic system. % The unknown is the pressure. % % Input data % % Data for SOR maxm = 1000; eps = 0.005; ww = 1.97; % Porous medium data Hcond = 100.; % hydraulic conductivity iw = 30; % location of "wells jw = 30; iwp = 80; jwp = 20; R_well = -3200; % pump rate uleft = 100. ; % upstream concentratitons uright = 100.; for j = 1:ny+1 u(1,j) = uleft; u(nx+1,j) = uright; end for j = 1:ny+1 for i = 2:nx u(i,j) = 100.; end end dx = L/nx; rdx = 1./dx; rdx2 = Hcond/(dx*dx); dy = W/ny; rdy = 1./dy; rdy2 = Hcond/(dy*dy); % Calibrated well to be independent of mesh R_well = R_well/(dx*dy); xw = (iw)*dx; yw = (jw)*dy; for i = 1:nx+1 x(i) = dx*(i-1); end for j = 1:ny+1

y(j) = dy*(j-1); end % % % % % % % Execute SOR Algorithm ????????????????????????????????????????????????????? Output to Terminal m ww figure(1) meshc(x,y,u') xlabel('x') ylabel('y') zlabel('pressure') title('Steady State Pressure' ) figure(2) [X Y] = meshgrid(x(1:nx), y(1:ny)); velx = -Hcond*diff(u,1,1)/dx; vely = -Hcond*diff(u,1,2)/dy; subplot(2,1,1) quiver(X, Y, velx(1:nx,1:ny)', vely(1:nx,1:ny)') xlabel('x') ylabel('y') title('Velocity Vectors') axis([0 L 0 W]) subplot(2,1,2) quiver(X, Y, velx(1:nx,1:ny)', vely(1:nx,1:ny)') xlabel('x') ylabel('y') title('Velocity Vectors') axis([100 200 50 70])

Steady State Pressure

100 90 80

pressure

70 60 50 40 100 500 50 200 y 0 100 0 x 400 300

Velocity Vectors 100

50

50

100

150

200

250 300 x Velocity Vectors

350

400

450

500

70 65 60 55 50 100

110

120

130

140

150 x

160

170

180

190

200

Concentration at time = 2 10 5 0 100 50 0 y Concentration at time = 4 10 5 0 100 50 0 y 0 100 200 x 300 400 0 100 200 x 300 400

concentration

500

concentration

500

Concentration at time = 8 10 5 0 100 50 0 y Contours at time = 8 100 0 100 200 x 300 400

concentration

500

50

50

100

150

200

250 x

300

350

400

450

500

Das könnte Ihnen auch gefallen