Changes in trunk/src/readcommand.f90 [30:20]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/readcommand.f90
r30 r20 29 29 ! * 30 30 ! 18 May 1996 * 31 ! HSO, 1 July 2014 *32 ! Added optional namelist input *33 31 ! * 34 32 !***************************************************************************** … … 82 80 character(len=50) :: line 83 81 logical :: old 82 logical :: nmlout=.true. !.false. 84 83 integer :: readerror 85 84 86 85 namelist /command/ & 87 ldirect, & 88 ibdate,ibtime, & 89 iedate,ietime, & 90 loutstep, & 91 loutaver, & 92 loutsample, & 93 itsplit, & 94 lsynctime, & 95 ctl, & 96 ifine, & 97 iout, & 98 ipout, & 99 lsubgrid, & 100 lconvection, & 101 lagespectra, & 102 ipin, & 103 ioutputforeachrelease, & 104 iflux, & 105 mdomainfill, & 106 ind_source, & 107 ind_receptor, & 108 mquasilag, & 109 nested_output, & 110 linit_cond, & 111 lnetcdfout, & 112 surf_only 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 113 111 114 112 ! Presetting namelist command 115 ldirect= 0113 ldirect=1 116 114 ibdate=20000101 117 115 ibtime=0 … … 139 137 nested_output=0 140 138 linit_cond=0 141 lnetcdfout=0142 139 surf_only=0 143 140 … … 145 142 ! Namelist input first: try to read as namelist file 146 143 !************************************************************************** 147 open(unitcommand,file=path(1)(1:length(1))//'COMMAND',status='old',form='formatted',err=999) 148 149 ! try namelist input (default) 144 open(unitcommand,file=path(1)(1:length(1))//'COMMAND',status='old', & 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 150 156 read(unitcommand,command,iostat=readerror) 151 157 close(unitcommand) 152 158 153 ! distinguish namelist from fixed text input 154 if ((readerror.ne.0).or.(ldirect.eq.0)) then ! parse as text file format 155 156 open(unitcommand,file=path(1)(1:length(1))//'COMMAND',status='old', err=999) 159 ! If error in namelist format, try to open with old input code 160 if (readerror.ne.0) then 161 162 open(unitcommand,file=path(1)(1:length(1))//'COMMAND',status='old', & 163 err=999) 157 164 158 165 ! Check the format of the COMMAND file (either in free format, … … 166 173 if (index(line,'LDIRECT') .eq. 0) then 167 174 old = .false. 168 write(*,*) 'COMMAND in old short format, please update to namelist format'169 175 else 170 176 old = .true. 171 write(*,*) 'COMMAND in old long format, please update to namelist format'172 177 endif 173 178 rewind(unitcommand) 174 179 175 176 180 ! Read parameters 177 181 !**************** … … 179 183 call skplin(7,unitcommand) 180 184 if (old) call skplin(1,unitcommand) 185 181 186 read(unitcommand,*) ldirect 182 187 if (old) call skplin(3,unitcommand) … … 226 231 if (old) call skplin(3,unitcommand) 227 232 read(unitcommand,*) linit_cond 228 if (old) call skplin(3,unitcommand)229 read(unitcommand,*) surf_only230 233 close(unitcommand) 231 234 … … 234 237 ! write command file in namelist format to output directory if requested 235 238 if (nmlout.eqv..true.) then 239 !open(unitcommand,file=path(2)(1:length(2))//'COMMAND.namelist.out',status='new',err=1000) 236 240 open(unitcommand,file=path(2)(1:length(2))//'COMMAND.namelist',err=1000) 237 241 write(unitcommand,nml=command) 238 242 close(unitcommand) 243 ! open(unitheader,file=path(2)(1:length(2))//'header_nml',status='new',err=999) 244 ! write(unitheader,NML=COMMAND) 245 !close(unitheader) 239 246 endif 240 247 … … 346 353 endif 347 354 348 ! check for netcdf output switch (use for non-namelist input only!)349 if (iout.ge.8) then350 lnetcdfout = 1351 iout = iout - 8352 #ifndef NETCDF_OUTPUT353 print*,'ERROR: netcdf output not activated during compile time but used in COMMAND file!'354 print*,'Please recompile with netcdf library or use standard output format.'355 stop356 #endif357 endif358 359 355 ! Check whether a valid option for gridded model output has been chosen 360 356 !********************************************************************** … … 362 358 if ((iout.lt.1).or.(iout.gt.5)) then 363 359 write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND: #### ' 364 write(*,*) ' #### IOUT MUST BE 1, 2, 3, 4, OR 5 FOR #### ' 365 write(*,*) ' #### STANDARD FLEXPART OUTPUT OR 9 - 13 #### ' 366 write(*,*) ' #### FOR NETCDF OUTPUT #### ' 360 write(*,*) ' #### IOUT MUST BE 1, 2, 3, 4, OR 5! #### ' 367 361 stop 368 362 endif … … 376 370 stop 377 371 endif 372 378 373 379 374 … … 597 592 598 593 1000 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "COMMAND" #### ' 599 write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY #### '600 write(*,'(a)') path(2)(1:length(1))601 stop594 write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY #### ' 595 write(*,'(a)') path(2)(1:length(1)) 596 stop 602 597 end subroutine readcommand
Note: See TracChangeset
for help on using the changeset viewer.