Ignore:
Timestamp:
Sep 13, 2018 3:14:50 PM (3 years ago)
Author:
sward
Message:

Added error handling for wrong input parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/spectra_mod.f90

    r3241 r3246  
    2525! -----------------
    2626! $Id$
     27! Added error handling for input namelist via parin_fail_message
     28!
     29! 3241 2018-09-12 15:02:00Z raasch
    2730! unused variables removed
    2831!
     
    237240       line = ' '
    238241       DO   WHILE ( INDEX( line, '&spectra_parameters' ) == 0 )
    239           READ ( 11, '(A)', END=10 )  line
     242          READ ( 11, '(A)', END=12 )  line
    240243       ENDDO
    241244       BACKSPACE ( 11 )
     
    243246!
    244247!--    Read namelist
    245        READ ( 11, spectra_parameters )
     248       READ ( 11, spectra_parameters, ERR = 10 )
    246249
    247250!
     
    254257       calculate_spectra = .TRUE.
    255258
    256        GOTO 12
     259       GOTO 14
     260
     261 10    BACKSPACE( 11 )
     262       READ( 11 ,fmt='(A)') line
     263       CALL parin_fail_message ( 'spectra_parameters', line )
    257264!
    258265!--    Try to find the old namelist
    259  10    REWIND ( 11 )
     266 12    REWIND ( 11 )
    260267       line = ' '
    261268       DO   WHILE ( INDEX( line, '&spectra_par' ) == 0 )
    262           READ ( 11, '(A)', END=12 )  line
     269          READ ( 11, '(A)', END=14 )  line
    263270       ENDDO
    264271       BACKSPACE ( 11 )
     
    266273!
    267274!--    Read namelist
    268        READ ( 11, spectra_par )
     275       READ ( 11, spectra_par, ERR = 13, END = 14 )
    269276
    270277       
     
    282289       calculate_spectra = .TRUE.
    283290       
     291       GOTO 14
     292
     293 13    BACKSPACE( 11 )
     294       READ( 11 ,fmt='(A)') line
     295       CALL parin_fail_message ( 'spectra_par', line )
    284296       
    285  12    CONTINUE
     297       
     298 14    CONTINUE
    286299
    287300    END SUBROUTINE spectra_parin
Note: See TracChangeset for help on using the changeset viewer.