IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Fortran Discussion :

Compilation de code


Sujet :

Fortran

  1. #1
    Nouveau membre du Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2013
    Messages
    24
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Mai 2013
    Messages : 24
    Points : 36
    Points
    36
    Par défaut Compilation de code
    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

  2. #2
    Membre du Club
    Homme Profil pro
    Inscrit en
    Mai 2013
    Messages
    35
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Mai 2013
    Messages : 35
    Points : 65
    Points
    65
    Par défaut
    Bonjour,

    La variable Y n'étant pas déclarée dans le programme principal comme un tableau de réels, elle est considérée comme un réel simple (typage implicite) lors de l'appel de la subroutine gbound, ce qui est à l'origine des avertissements. Il suffit de rajouter la déclaration dans la liste des déclaration du programme principal.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    ! declaration de variables
            parameter (n=1000,m=50)
            real Y(0:m)
    ...

  3. #3
    Nouveau membre du Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2013
    Messages
    24
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Mai 2013
    Messages : 24
    Points : 36
    Points
    36
    Par défaut probleme de stokage de resultats
    Bonjour
    j'essaye toujours de resoudre le probleme de simulation d'un ecoulement dans un canal en determinant la vitesse et la temperature. le probleme dans mon code et que la vitesse ainsi que la temperature sont nulles. malheuresement je rencontre aussi un probleme avec le stokage de resultat pour le fichier 6 qui enregistre les lignes de courants enregistre aussi le contenu du fichier 7 et lorsque je demande un affichage sur l'ecran j'nobtient rien mais tous dans le fichier 6.
    merci bien pour vos temps precieux que vous le me consacrez. je compt beaucoup sur vos soutien et vos comprehension.merci bien merci
    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
    416
    417
    418
    419
     
    ! ce programme tend a calculer les isothermes et les temp à differentes valeurs de i
     
            ! 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)
            real Y(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=17.5
    	!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=1,n
    	rhoav=0.5*(rho(i-1,0)+rho(i,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

  4. #4
    Membre éclairé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2013
    Messages
    388
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Conseil

    Informations forums :
    Inscription : Janvier 2013
    Messages : 388
    Points : 692
    Points
    692
    Par défaut
    Il vaut mieux commencer la numérotation des unités de fichier à partir de 10.
    L'unité 6 par exemple correspond à la sortie vers l'écran. D'où le problème.
    Ouvrir 9 fichiers en même temps n'est pas une bonne pratique non plus.

Discussions similaires

  1. compilation de code source
    Par lejum dans le forum Général Java
    Réponses: 11
    Dernier message: 20/03/2006, 21h13
  2. Compiler du code Java via Java
    Par sozie9372 dans le forum Langage
    Réponses: 2
    Dernier message: 12/01/2006, 11h14
  3. Probleme en compilant le code avec C2.EXE ?!?!?
    Par angelevil dans le forum VB 6 et antérieur
    Réponses: 4
    Dernier message: 17/11/2005, 17h13
  4. [Servlet][Compilation] Erreur de compil dans code servlet
    Par gandalf_le_blanc dans le forum Servlets/JSP
    Réponses: 3
    Dernier message: 13/05/2004, 11h17
  5. Compiler un code sous windows
    Par KORTA dans le forum Choisir un environnement de développement
    Réponses: 2
    Dernier message: 30/09/2003, 17h53

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo