Bonjour
je vous remercie pour vos aide. lors de l'exécution de ce code avec gfortran je rencontre le problème suivant
heartliddrivchannel.for:99.29:

      call gbound(g,theta_in,Y,w,n,m)                                   
                             1
Warning: Rank mismatch in argument 'y' at (1) (rank-1 and scalar)
heartliddrivchannel.for:104.32:

      call result(u,v,rho,theta,Y,uo,n,m)                               
                                1
Warning: Rank mismatch in argument 'y' at (1) (rank-1 and scalar
Qu'est ce que je peut faire?
est ca pose un probleme dans l'enregistrement de fichier dat?
merci bien




Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
! declaration de variables
 
        parameter (n=1000,m=50)
	real f(0:8,0:n,0:m)
	real feq(0:8,0:n,0:m),rho(0:n,0:m)
	real w(0:8), cx(0:8),cy(0:8)
	real u(0:n,0:m), v(0:n,0:m)
	real g(0:8,0:n,0:m), geq(0:8,0:n,0:m),th(0:n,0:m)
        real theta(0:n,0:m),theta_in(0:m)
        real t_in(0:m)
	integer i,j,k,kk
        character Saida*2910
 
        ! opening files
 
        Saida='results/chanflowartth480.dat'
	open(2,file=saida)
        Saida='results/chanflowartth200.dat'
	open(3,file=saida)
        Saida='results/chanflowartth40.dat'
	open(4,file=saida)
        Saida='results/chanflowartth80.dat'
        open(5,file=saida)
        Saida='results/chanflowartstrli.dat'
	open(6,file=saida)
        Saida='results/chanflowartxvit200.dat'
	open(7,file=saida)
        Saida='results/chanflowartxvit40.dat'
        open(8,file=saida)
        Saida='results/chanflowartxvit120.dat'
	open(9,file=saida)
 
	!initialisations de variables
 
	cx(:)=(/0.0,1.0,0.0,-1.0,0.0,1.0,-1.0,-1.0,1.0/)
	cy(:)=(/0.0,0.0,1.0,0.0,-1.0,1.0,1.0,-1.0,-1.0/)
	w(:)=(/4./9.,1./9.,1./9.,1./9.,1./9.,1./36.,1./36.,1./36.,1./36./)
	uo=0.02
	!sumvelo=0.0
	rhof=999.1
	dx=1.0
	dy=dx
	dt=1.0
	tw=0.0
        t_in(m/2)=1.0
        th=0.0
        H=0.02
 
 
 
	g=0.0
	visco=0.885
 
	pr=1
	alpha=visco/pr
	!Re=uo*m/alpha
         Re=2*rhof*H*uo/visco
	print *, 'Re=', Re
	omega=1.0/(3.*visco+0.5)
	omegat=1.0/(3.*alpha+0.5)
	mstep=10
	do j=0,m
	do i=0,n
	rho(i,j)=rhof 
	u(i,j)=0.0
	v(i,j)=0.0
	end do
	end do
 
	! main loop
 
!/////////////////programme principale//////////////////////////
 
	do kk=1,mstep
	call collesion(u,v,f,feq,rho,omega,w,cx,cy,n,m)
 
 
	call streaming(f,n,m)
	call sfbound(f,n,m,uo)
 
	call rhouv(f,rho,u,v,cx,cy,n,m)
 
	do j=0,m
	do i=0,n
	sum=0.0
	do k=0,8
	sum=sum+g(k,i,j)
	theta(i,j)=sum
	end do
	end do
	end do
	! collestion for scalar
	call col(u,v,g,geq,th,theta,omegat,w,cx,cy,n,m,t_in,tw)
	! streaming for scalar
	!call streaming(g,n,m)!!!!!!!!!!!! n'existe pas
	call gbound(g,theta_in,Y,w,n,m)
 
        END DO
	! end of the main loop
 
	call result(u,v,rho,theta,Y,uo,n,m)
	do j=0,m
        print *,theta(12*n/25,j) 
        print *, u(n/5,j),u(n/25,j)
        end do
        stop
	end
	! end of the main program
 
!/////////////////////les subroutines////////////////////////////
 
	!////////////collision////////////////
 
        subroutine collesion(u,v,f,feq,rho,omega,w,cx,cy,n,m)
	real f(0:8,0:n,0:m)
	real feq(0:8,0:n,0:m),rho(0:n,0:m)
	real w(0:8), cx(0:8),cy(0:8)
	real u(0:n,0:m), v(0:n,0:m)
	DO i=0,n
	DO j=0,m
	t1=(u(i,j)*u(i,j))+(v(i,j)*v(i,j))
	DO k=0,8
	t2=(u(i,j)*cx(k))+(v(i,j)*cy(k))
	feq(k,i,j)=rho(i,j)*w(k)*(1.0+3.0*t2+4.50*t2*t2-1.50*t1)
	f(k,i,j)=omega*feq(k,i,j)+(1.-omega)*f(k,i,j)
	END DO
	END DO
	END DO
 
 
        return
	end
 
        !///////////////////col////////////////
 
      subroutine col(u,v,g,geq,theta,th,omegat,w,cx,cy,n,m,t_in,tw)
	real g(0:8,0:n,0:m),geq(0:8,0:n,0:m),theta(0:n,0:m)
        real th(0:n,0:m),t_in(m/2),tw
	real w(0:8),cx(0:8),cy(0:8)
	real u(0:n,0:m),v(0:n,0:m)
        t_in(m/2)=1.0
        tw=0.0 
	do i=0,n
	do j=0,m
        theta(i,j)=(th(i,j)-tw)/(t_in(m/2)-tw)
	do k=0,8
	geq(k,i,j)=theta(i,j)*w(k)*(1.0+3.0*(u(i,j)*cx(k)+v(i,j)*cy(k)))
	g(k,i,j)=omegat*geq(k,i,j)+(1.0-omegat)*g(k,i,j)
	end do
	end do
	end do
	return
	end
 
        !///////////////////propagation///////////////
 
	subroutine streaming(f,n,m)
	real f(0:8,0:n,0:m)
	! streaming
	DO j=0,m
	DO i=n,1,-1 !RIGHT TO LEFT
	f(1,i,j)=f(1,i-1,j)
 
	END DO
	DO i=0,n-1 !LEFT TO RIGHT
	f(3,i,j)=f(3,i+1,j)
	END DO
	END DO
	DO j=m,1,-1 !TOP TO BOTTOM
	DO i=0,n
	f(2,i,j)=f(2,i,j-1)
	END DO
	DO i=n,1,-1
	f(5,i,j)=f(5,i-1,j-1)
	END DO
	DO i=0,n-1
	f(6,i,j)=f(6,i+1,j-1)
	END DO
	END DO
	DO j=0,m-1 !BOTTOM TO TOP
	DO i=0,n
	f(4,i,j)=f(4,i,j+1)
	END DO
	DO i=0,n-1
	f(7,i,j)=f(7,i+1,j+1)
	END DO
	DO i=n,1,-1
	f(8,i,j)=f(8,i-1,j+1)
	END DO
	END DO
	return
	end
 
        !//////////////conditions aux limites////////////////
 
 
	 subroutine sfbound(f,n,m,uo)
 
	 real f(0:8,0:n,0:m)
 
	 do j=0,m
	!bounce back on west boundary!
	  rhow=(f(0,0,j)+f(2,0,j)+f(4,0,j)
     & +2.*(f(3,0,j)+f(6,0,j)+f(7,0,j)))/(1.-uo)
	  f(1,0,j)=f(3,0,j)+2.*rhow*uo/3
	  f(5,0,j)=f(7,0,j)+rhow*uo/6
	  f(8,0,j)=f(6,0,j)+rhow*uo/6
 
	 end do
 
	!bounce back on south boundary!
	 do i=0,n
	   f(2,i,0)=f(4,i,0)
	   f(5,i,0)=f(7,i,0)
	   f(6,i,0)=f(8,i,0)
	 end do
 
	!bounce back, north boundary
	 do i=0,n
	   f(4,i,m)=f(2,i,m)
	   f(8,i,m)=f(6,i,m)
	   f(7,i,m)=f(5,i,m)
	 end do
 
	 ! accont for open boundary condition at the outlet
	  do j=1,m
	    f(1,n,j)=2.*f(1,n-1,j)-f(1,n-2,j)
	    f(5,n,j)=2.*f(5,n-1,j)-f(5,n-2,j)
	    f(8,n,j)=2.*f(8,n-1,j)-f(8,n-2,j)
           end do 
 
	   return
	   end
 
       !/////////// cond aux limites sur g/////////////
 
	subroutine gbound(g,theta_in,Y,w,n,m)
	real g(0:8,0:n,0:m)
	real w(0:8),theta_in(0:m)
        real Y(0:m)
	! Boundary conditions
	! top boundary condition, theta=0.
	do j=0,m
	g(4,0,j)=-g(2,0,j)
	g(7,0,j)=-g(5,0,j)
	g(8,0,j)=-g(6,0,j)
        g(1,0,j)=-g(3,0,j)
	end do
	! east boundary condition, outlet cond ouverte.
	do j=0,m
 
	g(8,n,j)=2*g(8,n-1,j)-g(8,n-2,j)
	g(5,n,j)=2*g(5,n-1,j)-g(5,n-2,j)
	g(1,n,j)=2*g(1,n-1,j)-g(1,n-2,j)
 
	end do
	! inlet west boundary conditions, T=t_in et theta=theta_in dirichlet
	do j=0,m
 
        Y(j)=j/float(m)
        theta_in(j)=4*(Y(j)-(Y(j)*Y(j)))
 
	g(8,0,j)=theta_in(j)*(w(8)+w(6))-g(6,0,j)
	g(5,0,j)=theta_in(j)*(w(7)+w(5))-g(7,0,j)
	g(1,0,j)=theta_in(j)*(w(1)+w(3))-g(3,0,j)
 
	end do
	!Bottom boundary conditions,Theta=0 
 
	do i=0,n
	g(1,i,0)=-g(3,i,0)
	g(2,i,0)=-g(4,i,0)
 
 
	g(5,i,0)=-g(7,i,0)
	g(6,i,0)=-g(8,i,0)
 
	end do
	return
	end
 
!/////////calcul de la temperature///////////
 
	subroutine tcalcu(g,theta,n,m)
	real g(0:8,0:n,0:m),theta(0:n,0:m)
	do j=1,m-1
	do i=1,n-1
	ssumt=0.0
	do k=0,8
	ssumt=ssumt+g(k,i,j)
	end do
	theta(i,j)=ssumt
	end do
	end do
	return
	end
 
!/////////////calcul de la densite et precisement la vitesse/////////////
 
	subroutine rhouv(f,rho,u,v,cx,cy,n,m)
	real f(0:8,0:n,0:m),rho(0:n,0:m),u(0:n,0:m),v(0:n,0:m),cx(0:8)
     &, cy(0:8)
	do j=0,m
	do i=0,n
	ssum=0.0
	do k=0,8
	ssum=ssum+f(k,i,j)
	end do
	rho(i,j)=ssum
	end do
	end do
	DO i=1,n
	DO j=1,m-1
	usum=0.0
	vsum=0.0
	DO k=0,8
 
	usum=usum+f(k,i,j)*cx(k)
	vsum=vsum+f(k,i,j)*cy(k)
	END DO
	u(i,j)=usum/rho(i,j)
	v(i,j)=vsum/rho(i,j)
	END DO
	END DO
        !do i=1,n
        !u(i,0)=0.0
        !u(i,m)=0.0
        !end do
	return
	end
 
!////////////////calcul de lignes de courant et de resultat/////////////////
 
	subroutine result(u,v,rho,theta,Y,uo,n,m)
	real u(0:n,0:m),v(0:n,0:m),theta(0:n,0:m)
	real rho(0:n,0:m),strf(0:n,0:m)
	real Y(0:m)
	! streamfunction calculations
	strf(0,0)=0.
	do i=0,n
	rhoav=0.5*(rho(i-1,0)+rho(i,0))
	if(i.ne.0) strf(i,0)=strf(i-1,0)-rhoav*0.5*(v(i-1,0)+v(i,0))
	do j=1,m
	rhom=0.5*(rho(i,j)+rho(i,j-1))
	strf(i,j)=strf(i,j-1)+rhom*0.5*(u(i,j-1)+u(i,j))
	end do
	end do
 
       ! enregistrement de resultat
 
        do j=0,m
        Y(j)=j/float(m)
 
        end do
 
	do j=0,m
 
	write(2,*)Y(j),theta(12*n/25,j)
 
	end do
 
 
 
 
        do j=0,m
 
        write(3,*)Y(j),theta(n/5,j)
	end do
 
 
 
 
        do j=0,m
        write(4,*)Y(j),theta(n/25,j)
	end do
 
 
        do j=0,m
        write(5,*)Y(j),theta(2*n/25,j)
	end do
 
 
	do j=0,m
        do i=0,n
	write(6,*)i,j,strf(i,j)
	end do
        end do
 
 
 
	do j=0,m
	write(7,*)Y(j),u(n/5,j)
 
        end do
 
 
 
	do j=0,m
	write(8,*)Y(j),u(n/25,j)
        end do
 
 
 
        do j=0,m
	write(9,*)Y(j),u(3*n/25,j)
        end do
 
 
 
 
 
 
 
	return
	end