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

Added error handling for wrong input parameters

File:
1 edited

Legend:

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

    r3240 r3246  
    2525! -----------------
    2626! $Id$
     27! Added error handling for input namelist via parin_fail_message
     28!
     29! 3240 2018-09-12 12:04:40Z Giersch
    2730! The check that controls the number of user-defined profiles on the restart file
    2831! with the one given for the current run has been removed.
     
    140143    line = ' '
    141144    DO   WHILE ( INDEX( line, '&user_parameters' ) == 0 )
    142        READ ( 11, '(A)', END=10 )  line
    143     ENDDO
    144     BACKSPACE ( 11 )
    145 
    146 !
    147 !-- Read user-defined namelist
    148     READ ( 11, user_parameters )
    149 
    150     user_defined_namelist_found = .TRUE.
    151 
    152     GOTO 12
    153    
    154    
    155 10  REWIND ( 11 )
    156 
    157     line = ' '
    158     DO   WHILE ( INDEX( line, '&userpar' ) == 0 )
    159145       READ ( 11, '(A)', END=12 )  line
    160146    ENDDO
     
    163149!
    164150!-- Read user-defined namelist
    165     READ ( 11, userpar )
    166    
    167    
     151    READ ( 11, user_parameters, ERR = 10 )
     152
     153    user_defined_namelist_found = .TRUE.
     154
     155    GOTO 14
     156
     15710  BACKSPACE( 11 )
     158    READ( 11 ,fmt='(A)') line
     159    CALL parin_fail_message ( 'user_parameters', line )
     160
     16112  REWIND ( 11 )
     162
     163    line = ' '
     164    DO   WHILE ( INDEX( line, '&userpar' ) == 0 )
     165       READ ( 11, '(A)', END=14 )  line
     166    ENDDO
     167    BACKSPACE ( 11 )
     168
     169!
     170!-- Read user-defined namelist
     171    READ ( 11, userpar, ERR = 13, END = 14 )
     172
    168173    message_string = 'namelist userpar is deprecated and will be ' //          &
    169174                     'removed in near future. &Please use namelist ' //        &
    170175                     'user_parameters instead'
    171176    CALL message( 'user_parin', 'PA0487', 0, 1, 0, 6, 0 )
    172        
     177
    173178    user_defined_namelist_found = .TRUE.
    174    
    175    
    176  12 CONTINUE
     179
     180    GOTO 14
     181
     18213  BACKSPACE( 11 )
     183    READ( 11 ,fmt='(A)') line
     184    CALL parin_fail_message ( 'userpar', line )
     185
     18614 CONTINUE
    177187
    178188!
Note: See TracChangeset for help on using the changeset viewer.