Hi..need help in Fortran...
This is the main loop of the program..
do iStep=0,nStep
write(7,*)iStep
!* Compute new temperature using FTCS scheme.
do i=1,N
if( istep==0) then !only for t=0
tt_new(i)=250
write(7,*)tt_new(i)
else
if(i==1) then
tt_new(i)=2*coeff*(tt(i+1)+35.494)-0.036*tt(i)
write(7,*)tt(i)
else
if(i==N) then
tt_new(i)=2*coeff*(tt(i-1)+35.494)-0.036*tt(i)
write(7,*)tt(i)
else
tt_new(i) = coeff*(tt(i+1) + tt(i-1)+33.333)+(1 - 2*coeff)*tt(i)
write (7,*) tt_new(i)
end if
end if
end if
end do
do i=1,N
tt(i) = tt_new(i) ! Reset temperature to new values
enddo
end do
this is the output....
0
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
2.5000000E+02
1
2.5000000E+02 <--
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.6666650E+02
2.5000000E+02 <--
As you can see...the programm doesn't calculate the values for the first and last node...Can you tell me why???