Bonjour,

J'essaie de faire tourner un code (méthode ADI) écrit en Fortran 90, en vue de simuler la conduction de la chaleur en régime stationnaire dans une plaque 2D.
Le code est tel que :

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
program main 
 
 
 implicit none 
 
 
  ! --- variables 
 real  :: h,l,Lo,Ha,Dt,rx,ry,zy,zx,wx,wy,sx,sy
 parameter ( Lo=2e-2,Ha=2e-2,Dt=1e-2)
 integer :: i,j,n,k1,k2,,d,io,f
 
  real, dimension(100):: a1,b1,c1,a2,b2,c2,F2,F1,Tf1,Tf2
 real, dimension(100,100) :: Td,T
 
   n=9
   k1=1
   k2=2
   f=n-1
 
 
 
  h= Lo*1./((n-1)*1.)
  l=Ha/((n-1)*1.)
  rx=Dt/(2.*(h**2))
  ry= Dt/(2.*(l**2))
 
  zy= (1.-(2.*ry))
  zx= (1.-(2.*rx))
  wx=(1.+(2.*rx))
  wy=(1.+(2.*ry))
  sx=2.*rx
  sy=2.*ry
 
 
  	!---conditions aux bords & conditions initiales 
 
do j=1,n
 T(1,j)=1.
 Td(1,j)=1.
 enddo
 do j=1,n
 do i=2,n-1
 T(i,j)=0.
 enddo
 enddo 
 do j=1,n
 Td(n,i)=0.
 T(n,i)=0.
 enddo
 
 
 
 !--- matrice de la première partie
 
			 do i=2,f
             a1(i)= wx
             enddo
             do i=3,f
             b1(i)=-rx
             enddo
             do i=2,f-1
             c1(i)=-rx
             enddo
 
 
 !--- matrice de la deuxièmee partie
	          do j=1,n
			  a2(j)= wy
			  enddo
			  do j=2,n-1
			  b2(j)=-ry
			  enddo
			  b2(n-1)=-sy
 
			  c2(1)=-sy
			  do j=2,n-1
			  c2(j)=-ry
			  enddo	
 
 
 
 
 
	     !---- boucle de temps
 
 	   	 do io=1,30
 
 
 
 
	 !--- calcul de température dans le premier pas
 
 
 
			  do j=1,n
			  do i=2,f
 
			  if(j.eq.1) then
			  F1(i)= zy*T(i,1)+sy*T(i,2)
 
	       	  else	if(j.ne.n) then
 
              F1(i)= ry*T(i,j-1)+zy*T(i,j)+ry*T(i,j+1)
			   else 
			  F1(i)= sy*T(i,n-1)+zy*T(i,n)
			   endif
 
              enddo
 
 
 
 
			call thomas (k2,f,a1,b1,c1,F1,Tf1)
 
 
 
			 do i=2,f
			 Td(i,j)=Tf1(i)
			 enddo
 
		enddo
 
 
 
 
 
 
		  !--- calcul de température dans le deuxième pas
 
 
 
		     do i1=2,f
		     do j =1,n
 
			 F2(j)= rx*Td(i1-1,j)+zx*Td(i1,j)+rx*Td(i1+1,j)
 
             enddo
 
 
 
		call thomas(k1,n,a2,b2,c2,F2,Tf2)
 
 
      		 do j=1,n
			 T(i1,j)=Tf2(j)
			 enddo
		     enddo 
 
 
		  enddo
 
 
 
              !-- affichage des températures
		  do j=1,n
		  do i=1,n
		  write(*,*) j,i,Td(i,j)
		  enddo
		  enddo
 
 
 
		! --subroutine
 
	   	contains		  
 
		  subroutine thomas(k,m,a,b,c,F,V)
		   integer m,k
		    real, dimension(m):: a,b,c,alpha,beta,y,F,V
			  !--- boucle vecteur alpha(i), beta(i)
 
 
		 alpha(k)=a(k)
		 do i=k+1,m
		 beta(i)=b(i)/alpha(i-1)
		 alpha(i)=a(i)-beta(i)*c(i-1)
		 enddo
 
		 !--- boucle y(i)
		 y(k)= F(k)
		 do i=k+1,m
		 y(i)= F(i)- (beta(i)*y(i-1))
		 enddo
		!--- boucle T(i)
		V(m)=y(m)/alpha(m)
		do i=m-1,k,-1
		V(i)= ((y(i)-c(i)*V(i+1))/alpha(i))
		enddo
 
		  return 
		 end subroutine 
 
			 end  program

Le programme tourne mais dès qu'il atteint la dernière valeur (ici par exemple n=7 ), il perd conscience Nom : unnamed.png
Affichages : 722
Taille : 157,1 Ko

Quelqu'un pourrait m'expliquer quelle est le problème ?
Merci d'avance