194 Computational Modelling in Hydraulic and Coastal Engineering
% iwo = Location of well in upper layer;
% iwu = Location of well in lower layer;
% Dx = Spatial step [m];
% Dt = Time step [day];
% nx = Number of spatial steps;
% nt = Number of time steps;
clc; clear all; close all;
% Input data;
Ho=20.8;
Hu=20;
qo=-3;
qu=0;
p=0.4;
K=500;
rdf=0.02;
iwo=45;
iwu=0;
Dx=200;
Dt=0.1;
nx=50;
nt=800000;
% Initial depths in the two layers;
for i=2:nx-1
ho(i)=Ho;
hon(i)=ho(i);
hu(i)=0;
hun(i)=hu(i);
end
ho(nx)=Ho;
hon(nx)=Ho;
hu(1)=Hu;
hun(1)=Hu;
ho(1)=0;
hon(1)=ho(1);
hu(nx)=0;
hun(nx)=hu(nx);
for k=1:nt
% Calculation of new depth values of the upper layer;
for i=2:nx-1
Qwo=0;
if i==iwo
Qwo=qo;
end
qr=-K*(ho(i+1)+hu(i+1)-ho(i)-hu(i))/
Dx*(ho(i)+ho(i+1))/2;
ql=-K*(ho(i)+hu(i)-ho(i-1)-hu(i-1))/
Dx*(ho(i)+ho(i-1))/2;
hon(i)=ho(i)-Dt*(qr-ql-Qwo)/Dx/p;
end
Précédent

- 207/302

Suivant