Sie sind auf Seite 1von 5

!---------1000K---------!

!200k

500K

!--------100 K -----------!

program heat_conduction
implicit none

!************** VARIABLES USED ********************

real, dimension(:,:), allocatable:: T


integer i,j,k,iter,nx,ny,n
real dx,dy
real lb, rb ,tb ,bb

,ini

real a

!**************************************************

!************* USER INPUT *************************

print*, "enter the totoal number of nodes in x"


read*, nx

print*, "enter the totoal number of nodes in y"


read*, ny

print*, "enter dx"


read*, dx

print*, "enter dy"


read*, dy

print*, "enter left boundary condition"


read*, lb

print*, "enter right boundary condition"


read*, rb

print*, "enter the to boundary condition"


read*, tb

print*, "enter the bottom boundary condition"


read*, bb

print*, "enter the total number of iterations"


read*, iter

!*************************************************

allocate(T(ny,nx))

!***************** INITIALIZING *******************

do i= 1,ny
T(i,1) = lb
T(i,nx) = rb
end do

do i=1,nx
T(1,i) = tb
T(ny,i) = bb
end do

ini = (0.25)*(lb+rb+tb+bb)

do i=2,ny-1
do j=2,nx-1

T(1,i) =ini

end do
end do

!**************************************************

a=( ((dx**2)*(dy**2))/(2*(dx**2 + dy**2)) )

!*************** SOLVING *************************

do n = 2,iter
do i = 2,ny-1
do j = 2,nx-1

T(i,j) = a * (((T(i+1,j) + T(i-1,j) )/dx**2) + ((T(i,j-1) + T(i,j+1) )/dy**2))


print*, i, j, n, T(i,j)

end do
end do
end do

read*, k

end program heat_conduction