Changeset 4287 for palm/trunk
- Timestamp:
- Nov 1, 2019 2:50:20 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/user_module.f90
r4182 r4287 25 25 ! ----------------- 26 26 ! $Id$ 27 ! reading of namelist file and actions in case of namelist errors revised so that statement labels 28 ! and goto statements are not required any more; this revision also removes a previous bug 29 ! which appeared when the namelist has been commented out in the namelist file 30 ! 31 ! 4182 2019-08-22 15:20:23Z scharf 27 32 ! Corrected "Former revisions" section 28 33 ! … … 211 216 SUBROUTINE user_parin 212 217 213 214 CHARACTER (LEN=80) :: line !< 215 216 INTEGER(iwp) :: i !<218 CHARACTER (LEN=80) :: line !< string containing the last line read from namelist file 219 220 INTEGER(iwp) :: i !< 221 INTEGER(iwp) :: io_status !< status after reading the namelist file 217 222 INTEGER(iwp) :: j !< 218 223 219 224 220 NAMELIST /user_parameters/ & 221 user_module_enabled, & 222 data_output_pr_user, & 223 data_output_user, & 224 region, & 225 data_output_masks_user 225 NAMELIST /user_parameters/ & 226 data_output_masks_user, & 227 data_output_pr_user, & 228 data_output_user, & 229 region 226 230 227 231 ! … … 240 244 ! 241 245 !-- Position the namelist-file at the beginning (it was already opened in 242 !-- parin), search for user-defined namelist-group ("userpar", but any other 243 !-- name can be choosed) and position the file at this line. 246 !-- parin), and try to read (find) a namelist named "user_parameters". 244 247 REWIND ( 11 ) 245 246 line = ' ' 247 DO WHILE ( INDEX( line, '&user_parameters' ) == 0 ) 248 READ ( 11, '(A)', END=12 ) line 249 ENDDO 250 BACKSPACE ( 11 ) 251 252 !-- Set default module switch to true 253 user_module_enabled = .TRUE. 254 255 !-- Read user-defined namelist 256 READ ( 11, user_parameters, ERR = 10 ) 257 258 GOTO 12 259 260 10 BACKSPACE( 11 ) 261 READ( 11 , '(A)') line 262 CALL parin_fail_message( 'user_parameters', line ) 263 264 12 CONTINUE 248 READ( 11, user_parameters, IOSTAT=io_status ) 249 250 ! 251 !-- Actions depending on the READ status 252 IF ( io_status == 0 ) THEN 253 ! 254 !-- User namelist found and correctly read. Set default module switch to true. This activates 255 !-- calls of the user-interface subroutines. 256 user_module_enabled = .TRUE. 257 258 ELSEIF ( io_status > 0 ) THEN 259 ! 260 !-- User namelist was found, but contained errors. Print an error message containing the line 261 !-- that caused the problem 262 BACKSPACE( 11 ) 263 READ( 11 , '(A)') line 264 CALL parin_fail_message( 'user_parameters', line ) 265 266 ENDIF 265 267 266 268 !
Note: See TracChangeset
for help on using the changeset viewer.