|
编译环境为 IVS+IVF
对于不需要在命令行中输入参数的Fortran程序,
我采用do循环和open就可以让它重复生成不同的chem.asc文件(完成我所需的工作)
[Fortran] 纯文本查看 复制代码 PROGRAM CKINTERP
IMPLICIT NONE
INTEGER MDIM,KDIM,IDIM,MAXTP,MAXSP,MAXTB,LIN,LOUT,LTHRM,LINCK,
& MAXORD,LIWORK,LRWORK,LCWORK
PARAMETER(MDIM=10,KDIM=100,IDIM=500,MAXTP=3,MAXSP=12,MAXTB=10,
& LIN=15,LOUT=16,LTHRM=17,LINCK=25,MAXORD=10,
& LIWORK=40000,LRWORK=40000,LCWORK=10000)
INTEGER IWORK(LIWORK)
DOUBLE PRECISION RWORK(LRWORK)
CHARACTER*16 CWORK(LCWORK)
LOGICAL L(KDIM)
integer i
character*2 filelist
do i=1,3
write(filelist,"(i2)") i
OPEN (LIN,FILE="chem"//trim(adjustl(filelist))//".inp",
& STATUS='UNKNOWN', FORM='FORMATTED')
OPEN (LOUT, FILE="chem"//trim(adjustl(filelist))//".out",
& FORM='FORMATTED', STATUS='UNKNOWN')
OPEN (LTHRM, FILE="therm"//trim(adjustl(filelist))//".dat",
1 FORM='FORMATTED', STATUS='UNKNOWN')
open(LINCK,file="chem"//trim(adjustl(filelist))//".asc",
& FORM='FORMATTED',STATUS='UNKNOWN')
CALL CKINTP (MDIM, KDIM, IDIM, MAXTP, MAXSP, MAXTB,
1 LIN, LOUT, LTHRM, LINCK, MAXORD,
2 LIWORK, IWORK, LRWORK, RWORK, LCWORK, CWORK, L)
但是对于会有需要输入命令行参数的程序,就只能出现运行完成第一个,然后就关闭,运行完成了。
如何让它继续处理第二个chem2.asc 和第三个 chem3.asc?
[Fortran] 纯文本查看 复制代码 PARAMETER (LENRWK=100000, LENIWK=100000, LENLWK=200, LENCWK=200,
1 LIN=5, LOUT=6, LREST=14, LSAVE=15, LRCRVR=16,
2 LINKCK=25)
DIMENSION RWORK(LENRWK), IWORK(LENIWK)
CHARACTER CWORK(LENCWK)*16
LOGICAL LWORK(LENLWK)
integer i
character*2 filelist
do i=1,3
write(filelist,"(i2)") i
OPEN (LINKCK, FORM='FORMATTED',STATUS='UNKNOWN',
1 FILE="chem"//trim(adjustl(filelist))//".asc")
OPEN (LREST, FORM='UNFORMATTED',STATUS='UNKNOWN',
1 FILE="rest"//trim(adjustl(filelist))//".bin")
OPEN (LRCRVR, FORM='UNFORMATTED',STATUS='UNKNOWN',
1 FILE="recov"//trim(adjustl(filelist))//".bin")
OPEN (LSAVE, FORM='UNFORMATTED',STATUS='UNKNOWN',
1 FILE="save"//trim(adjustl(filelist))//".bin")
CALL PSR (LIN, LOUT, LINKCK, LREST, LSAVE, LRCRVR, LENLWK,
1 LWORK, LENIWK, IWORK, LENRWK, RWORK, LENCWK, CWORK)
STOP
END
请问应该如何解决这一问题?能够让它重复读取这几个文件并执行?
|
|