Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29273 Discussions

how to write multiple time step files

rcpoudel
Beginner
875 Views
All,
I want to open mutiple time step file eg. q005.dat, q015.dat, ..................... q995.dat., and write formattted solution(CFD) data on it. There will be hundreds of them, each for one time steps.
I have been able to open a file and write a time step data on it. How can I extend to several files........?
Any help will be highly appreciated.
Regards,
0 Kudos
5 Replies
TimP
Honored Contributor III
875 Views
Where are you seeing difficulty? Close the file, open the next one,...
Are you asking how to generated multiple file names? e.g.

character(len=9) fname

do nfile=1,995
write(fname,"('q',i3.3)")nfile
open(11,file=fname)
....
close(11)
enddo
0 Kudos
rcpoudel
Beginner
875 Views
Tim18,
Thanks! I am almost there; generated the mutiple files with your help.....thanks a lot.
How could Iappend extension '.dat' on files such generated? May this be a silly question, I am asking again as my usual method did not work out here .....and I am new......
Ram
0 Kudos
TimP
Honored Contributor III
875 Views
write(fname,"('q',i3.3,'.dat')")nfile
or
open(11,file=fname//'.dat')

Message Edited by tim18 on 06-17-200604:42 AM

0 Kudos
TimP
Honored Contributor III
875 Views
Actually, I did mean to include this:
write(fname,"('q',i3.3,'.dat')")nfile

Although many people would do
open(11, file=fname//'.dat')
0 Kudos
rcpoudel
Beginner
875 Views
Tim18,
Thnaks for help. great.
Ram
0 Kudos
Reply