Changeset 24 for trunk/src/readcommand.f90
- Timestamp:
- May 23, 2014, 11:48:41 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/readcommand.f90
r20 r24 80 80 character(len=50) :: line 81 81 logical :: old 82 logical :: nml out=.true.!.false.82 logical :: nml_COMMAND=.true. , nmlout=.true. !.false. 83 83 integer :: readerror 84 84 85 85 namelist /command/ & 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 86 ldirect, & 87 ibdate,ibtime, & 88 iedate,ietime, & 89 loutstep, & 90 loutaver, & 91 loutsample, & 92 itsplit, & 93 lsynctime, & 94 ctl, & 95 ifine, & 96 iout, & 97 ipout, & 98 lsubgrid, & 99 lconvection, & 100 lagespectra, & 101 ipin, & 102 ioutputforeachrelease, & 103 iflux, & 104 mdomainfill, & 105 ind_source, & 106 ind_receptor, & 107 mquasilag, & 108 nested_output, & 109 linit_cond, & 110 surf_only 111 111 112 112 ! Presetting namelist command … … 144 144 open(unitcommand,file=path(1)(1:length(1))//'COMMAND',status='old', & 145 145 form='formatted',iostat=readerror) 146 ! If fail, check if file does not exist 147 if (readerror.ne.0) then 148 149 print*,'***ERROR: file COMMAND not found in ' 150 print*, path(1)(1:length(1))//'COMMAND' 151 print*, 'Check your pathnames file.' 152 stop 153 154 endif 155 156 read(unitcommand,command,iostat=readerror) 146 ! If fail, check if file does not exist 147 if (readerror.ne.0) then 148 print*,'***ERROR: file COMMAND not found in ' 149 print*, path(1)(1:length(1))//'COMMAND' 150 print*, 'Check your pathnames file.' 151 stop 152 endif 153 154 ! print error code 155 !write(*,*) 'readcommand > readerror open=' , readerror 156 !probe first line 157 read (unitcommand,901) line 158 !write(*,*) 'index(line,COMMAND) =', index(line,'COMMAND') 159 160 161 !default is namelist input 162 ! distinguish namelist from fixed text input 163 if (index(line,'COMMAND') .eq. 0) then 164 nml_COMMAND = .false. 165 !write(*,*) 'COMMAND file does not contain the string COMMAND in the first line' 166 endif 167 !write(*,*) 'readcommand > read as namelist? ' , nml_COMMAND 168 rewind(unitcommand) 169 read(unitcommand,command,iostat=readerror) 170 157 171 close(unitcommand) 158 172 173 !write(*,*) 'readcommand > readerror read=' , readerror 159 174 ! If error in namelist format, try to open with old input code 160 if (readerror.ne.0) then 175 ! if (readerror.ne.0) then 176 ! IP 21/5/2014 the previous line cause the old long format 177 ! to be confused with namelist input 178 179 ! use text input 180 if (nml_COMMAND .eqv. .false.) then 161 181 162 182 open(unitcommand,file=path(1)(1:length(1))//'COMMAND',status='old', & … … 173 193 if (index(line,'LDIRECT') .eq. 0) then 174 194 old = .false. 195 !write(*,*) 'readcommand old short' 175 196 else 176 197 old = .true. 198 !write(*,*) 'readcommand old long' 177 199 endif 178 200 rewind(unitcommand) 179 201 202 180 203 ! Read parameters 181 204 !**************** … … 231 254 if (old) call skplin(3,unitcommand) 232 255 read(unitcommand,*) linit_cond 256 if (old) call skplin(3,unitcommand) 257 read(unitcommand,*) surf_only 233 258 close(unitcommand) 234 259 … … 237 262 ! write command file in namelist format to output directory if requested 238 263 if (nmlout.eqv..true.) then 239 !open(unitcommand,file=path(2)(1:length(2))//'COMMAND.namelist.out',status='new',err=1000)240 264 open(unitcommand,file=path(2)(1:length(2))//'COMMAND.namelist',err=1000) 241 265 write(unitcommand,nml=command)
Note: See TracChangeset
for help on using the changeset viewer.