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
|
program equation_de_la_chaleur
implicit none
integer, parameter :: m=11, n=18
integer :: i,j
real :: alpha, deltax, deltat
real :: r
real, dimension(m,n) :: t
alpha=4.d-6
deltax=1.d-2
deltat=1.d0
r=alpha*deltat/(deltax)**2
do i=1,m
t(i,1)=300
end do
do j=2,n
t(1,j)=350
end do
do j=2,n
t(m,j)=440
end do
!methode explicite de resolution
do j=1,n
do i=2,m-1
t(i,j+1)=r*t(i-1,j)+(1-2*r)*t(i,j)+r*t(i+1,j)
end do
end do
do j=1,n
write(1,*) j, (t(i,j),i=1,m)
end do
end program equation_de_la_chaleur |
Partager