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/wind_turbine_model_mod.f90

    r3241 r3246  
    2626! -----------------
    2727! $Id$
     28! Added error handling for input namelist via parin_fail_message
     29!
     30! 3241 2018-09-12 15:02:00Z raasch
    2831! unused variables removed
    2932!
     
    535538       line = ' '
    536539       DO  WHILE ( INDEX( line, '&wind_turbine_parameters' ) == 0 )
    537           READ ( 11, '(A)', END=10 )  line
    538        ENDDO
    539        BACKSPACE ( 11 )
    540 
    541 !
    542 !--    Read user-defined namelist
    543        READ ( 11, wind_turbine_parameters, IOSTAT=ierrn )
    544 
    545        IF ( ierrn < 0 )  THEN
    546           message_string = 'no wind_turbine_parameters-NAMELIST found: '  //    &
    547                            'End of file has reached'
    548           CALL message( 'wtm_parin', 'PA0460', 1, 2, 0, 6, 0 )
    549        ELSEIF ( ierrn > 0 ) THEN
    550           message_string = 'errors in wind_turbine_parameters-NAMELIST: '  //   &
    551                            'some variables for steering may not be properly set'
    552           CALL message( 'wtm_parin', 'PA0466', 1, 2, 0, 6, 0 )               
    553        ENDIF
    554        
    555 !
    556 !--    Set flag that indicates that the wind turbine model is switched on
    557        wind_turbine = .TRUE.
    558        
    559        GOTO 12
    560 
    561 !
    562 !--    Try to find wind turbine model package
    563  10    REWIND ( 11 )
    564        line = ' '
    565        DO  WHILE ( INDEX( line, '&wind_turbine_par' ) == 0 )
    566540          READ ( 11, '(A)', END=12 )  line
    567541       ENDDO
     
    570544!
    571545!--    Read user-defined namelist
    572        READ ( 11, wind_turbine_par, IOSTAT=ierrn )
    573 
    574        IF ( ierrn < 0 )  THEN
    575           message_string = 'no wind_turbine_par-NAMELIST found: '  //          &
    576                            'End of file has reached'
    577           CALL message( 'wtm_parin', 'PA0460', 1, 2, 0, 6, 0 )
    578        ELSEIF ( ierrn > 0 ) THEN
    579           message_string = 'errors in wind_turbine_par-NAMELIST: '  //         &
    580                            'some variables for steering may not be properly set'
    581           CALL message( 'wtm_parin', 'PA0466', 1, 2, 0, 6, 0 )               
    582        ENDIF
     546       READ ( 11, wind_turbine_parameters, ERR = 10 )
     547!
     548!--    Set flag that indicates that the wind turbine model is switched on
     549       wind_turbine = .TRUE.
     550       
     551       GOTO 14
     552
     553 10    BACKSPACE( 11 )
     554       READ( 11 ,fmt='(A)') line
     555       CALL parin_fail_message ( 'wind_turbine_parameters', line )
     556
     557!
     558!--    Try to find wind turbine model package
     559 12    REWIND ( 11 )
     560       line = ' '
     561       DO  WHILE ( INDEX( line, '&wind_turbine_par' ) == 0 )
     562          READ ( 11, '(A)', END=14 )  line
     563       ENDDO
     564       BACKSPACE ( 11 )
     565
     566!
     567!--    Read user-defined namelist
     568       READ ( 11, wind_turbine_par, ERR = 13, END = 14 )
    583569     
    584570       message_string = 'namelist wind_tubrine_par is deprecated and will ' // &
     
    591577       wind_turbine = .TRUE.
    592578
    593  12    CONTINUE   ! TBD Change from continue, mit ierrn machen
     579       GOTO 14
     580
     581 13    BACKSPACE( 11 )
     582       READ( 11 ,fmt='(A)') line
     583       CALL parin_fail_message ( 'wind_turbine_par', line )
     584
     585 14    CONTINUE   ! TBD Change from continue, mit ierrn machen
    594586
    595587
Note: See TracChangeset for help on using the changeset viewer.