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/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! A check that controls the number of user-defined profiles on the restart file
    2831! with the one given for the current run has been added.
     
    783786!--       The namelist "inipar" must be provided in the NAMELIST-file.
    784787          READ ( 11, initialization_parameters, ERR=10, END=11 )
    785 
    786           GOTO 12
    787 
    788  10       message_string = 'errors in initialization_parameters & or no ' //  &
    789                            'initialization_parameters-namelist ' //           &
    790                            'found (CRAY-machines only)'
    791           CALL message( 'parin', 'PA0271', 1, 2, 0, 6, 0 )
     788          GOTO 14
     789         
     790 10       BACKSPACE( 11 )
     791          READ( 11 ,fmt='(A)') line
     792          CALL parin_fail_message ( 'initialization_parameters', line )
    792793
    793794 11       REWIND ( 11 )
    794           READ ( 11, inipar, ERR=13, END=14 )
     795          READ ( 11, inipar, ERR=12, END=13 )
    795796 
    796797          message_string = 'namelist inipar is deprecated and will be ' //    &
     
    799800          CALL message( 'parin', 'PA0017', 0, 1, 0, 6, 0 )
    800801 
    801           GOTO 12
     802          GOTO 14
    802803 
    803  13       message_string = 'errors in inipar & or no inipar-namelist ' //      &
    804                            'found (CRAY-machines only)'
    805           CALL message( 'parin', 'PA0271', 1, 2, 0, 6, 0 )
    806          
    807  14       message_string = 'no initialization_parameters-namelist found'
     804 12       BACKSPACE( 11 )
     805          READ( 11 ,fmt='(A)') line
     806          CALL parin_fail_message ( 'inipar', line )
     807
     808 13       message_string = 'no initialization_parameters-namelist found'
    808809          CALL message( 'parin', 'PA0272', 1, 2, 0, 6, 0 )
    809810
     
    813814!--       can be omitted. In that case default values are used for the         
    814815!--       parameters.
    815  12       line = ' '
     816 14       line = ' '
    816817
    817818          REWIND ( 11 )
    818819          line = ' '
    819820          DO   WHILE ( INDEX( line, '&runtime_parameters' ) == 0 )
    820              READ ( 11, '(A)', END=20 )  line
     821             READ ( 11, '(A)', END=16 )  line
    821822          ENDDO
    822823          BACKSPACE ( 11 )
     
    824825!
    825826!--       Read namelist
    826           READ ( 11, runtime_parameters )
    827 
    828           GOTO 21
    829          
    830  20       REWIND ( 11 )
     827          READ ( 11, runtime_parameters, ERR = 15 )
     828          GOTO 18
     829
     830 15       BACKSPACE( 11 )
     831          READ( 11 ,fmt='(A)') line
     832          CALL parin_fail_message ( 'runtime_parameters', line )
     833
     834 16       REWIND ( 11 )
    831835          line = ' '
    832836          DO   WHILE ( INDEX( line, '&d3par' ) == 0 )
    833              READ ( 11, '(A)', END=21 )  line
     837             READ ( 11, '(A)', END=18 )  line
    834838          ENDDO
    835839          BACKSPACE ( 11 )
    836  
    837  !
     840
     841!
    838842!--       Read namelist
    839           READ ( 11, d3par )
    840  
     843          READ ( 11, d3par, ERR = 17, END = 18 )
     844
    841845          message_string = 'namelist d3par is deprecated and will be ' //      &
    842846                          'removed in near future. &Please use namelist ' //   &
    843847                          'runtime_parameters instead'
    844848          CALL message( 'parin', 'PA0487', 0, 1, 0, 6, 0 )
    845          
    846  21       CONTINUE
     849
     850          GOTO 18
     851
     852 17       BACKSPACE( 11 )
     853          READ( 11 ,fmt='(A)') line
     854          CALL parin_fail_message ( 'd3par', line )
     855
     856 18       CONTINUE
    847857
    848858!
Note: See TracChangeset for help on using the changeset viewer.