Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29280 Discussions

how to write multiple time step files

rcpoudel
Beginner
901 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
901 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
901 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
901 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
901 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
901 Views
Tim18,
Thnaks for help. great.
Ram
0 Kudos
Reply