Common partial differential equations of computational hydraulics 37
im=30;
jm=60;
SS=10;
iter=1000;
% Initialization of the grid with zero potential values;
f(1:im,1:jm)=0;
is=im/2;
js=jm/2;
% Dirichlet type boundary conditions at the entrance and
exit of the conduit;
f(1:im,1)=10;
f(is-1:is+1,jm)=0;
k1=0;
k2=0;
% Spatial allocation of the potential source;
S(im,jm)=0;
S(15,30)=SS;
% Main program;
k=0;
for kk=1:iter
k=1+kk;
fold=f;
% Estimation of the potential values;
for k1=2:im-1
for k2=2:jm-1
6
4
2
0
0
10
20
30
40
50
60
0
5
10
15
20
25
30
× 10 –3
Figure 3.8 Distribution of the computational error.
Précédent

- 50/302

Suivant