- #1
s_hy
- 61
- 0
hi all,
i have the following code:
what actually i want is to produce automatically a file at a time in the loop with the name ending in a counter, for example: wave1.dat, wave2.dat,wave3.dat,...,wave599.dat,wave600.dat...but, my programming didn't run properly. Can anyone advice what is wrong with my code.
thanks
i have the following code:
Code:
do n = ninit,nlast
character(len=20) :: filename
integer :: n
do n = 1,600
write (filename, "I0") n
open (unit=110,file='wave'//trim(filename)//'.dat',action = 'write',status = 'old')
do i = iinit+1,ilast-1
!boundary condition
u(iinit,n+1) = 0
u(ilast,n+1) = 0
!end of boundary condition
u(i,n+1) = 2*(1-(alpha**2))*u(i,n)-u(i,n-1) + (alpha**2)*(u(i+1,n)+u(i-1,n))
Print*,'i,n,u(i,n+1)=',i,' ', n,' ', u(i,n+1)
Write (110,*)'i,n,u(i,n+1)=',i,' ', n,' ', u(i,n+1)
close (unit = 110)
end do !i
end do !n
what actually i want is to produce automatically a file at a time in the loop with the name ending in a counter, for example: wave1.dat, wave2.dat,wave3.dat,...,wave599.dat,wave600.dat...but, my programming didn't run properly. Can anyone advice what is wrong with my code.
thanks