Name: Title:

 Name:
ONLINE COMPILERS
LIBRARY
MANUAL PAGES & DOCS
CONTACT

User Submitted Source Code!

Description:
explicit
Language: FORTRAN
Code:
program explicit_heat_transfer_1D
implicit none
real::length_rod
real::delta_x,delta_t
real::alpha
real::T_L,T_R
real::Coef
integer::i,n_x,n,m
Real,allocatable::Tk(:),TK_1(:)
OPEN (UNIT=20,FILE='explicit method.txt', STATUS='replace')
!*******************************************************************
! input initial tempreture of sides
write(*,*) "please enter temperatur of left side of rod="
write(*,*) "please enter temperatur of right side of rod="
!*******************************************************************
! input dimension
write(*,*) "please enter length of rod="
!*******************************************************************
! input material data
write(*,*) "thermal diffusity="
!*******************************************************************
! input mesh data
write(*,*) "number of nodes in rod length="
!*******************************************************************
allocate(Tk(n_x),Tk_1(n_x))
! input of initial temperatur of internal nodes
Do i=2,n_x-1
TK(i)=0
End Do
!*******************************************************************
! boundary condition data
Tk(1)=T_L
TK(n_x)=T_R
!*******************************************************************
!steps calculation
delta_x=length_rod/(n_x-1)
write(*,*) "number of time step?"
!*******************************************************************
Coef=(alpha*delta_t)/(delta_x*delta_x)
Do m=1,n
Do i=2,n_x-1
TK_1(i)=(coef*(TK(i+1)-(2*Tk(i))+Tk(i-1)))+Tk(i)
End DO
Do i=2,n_x-1
Tk(i)=Tk_1(i)
End Do
write(20,*)"step",m
if (m>n-1) then
open(20,file='C:\Users\01Computer\Desktop\explicit heat transfer 1D\CFD.plt')
write(20,*)'VARIABLES="X","Temperature"'
Do i=1,n_x
write(20,*)i,Tk(i)
end do
end if
Do i=1,n_x
write(20,*)i,Tk(i)
end do
End DO
!******************************************************************
End program explicit_heat_transfer_1D