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/plant_canopy_model_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!
     
    10211024                                  leaf_scalar_exch_coeff,                      &
    10221025                                  leaf_surface_conc, pch_index
    1023                                  
     1026
    10241027       line = ' '
    1025        
     1028
    10261029!
    10271030!--    Try to find radiation model package
     
    10291032       line = ' '
    10301033       DO   WHILE ( INDEX( line, '&plant_canopy_parameters' ) == 0 )
    1031           READ ( 11, '(A)', END=10 )  line
    1032        ENDDO
    1033        BACKSPACE ( 11 )
    1034 
    1035 !
    1036 !--    Read user-defined namelist
    1037        READ ( 11, plant_canopy_parameters )
    1038 
    1039 !
    1040 !--    Set flag that indicates that the radiation model is switched on
    1041        plant_canopy = .TRUE.
    1042        
    1043        GOTO 12
    1044 !
    1045 !--    Try to find old namelist
    1046  10    REWIND ( 11 )
    1047        line = ' '
    1048        DO   WHILE ( INDEX( line, '&canopy_par' ) == 0 )
    10491034          READ ( 11, '(A)', END=12 )  line
    10501035       ENDDO
     
    10531038!
    10541039!--    Read user-defined namelist
    1055        READ ( 11, canopy_par )
     1040       READ ( 11, plant_canopy_parameters, ERR = 10 )
     1041
     1042!
     1043!--    Set flag that indicates that the radiation model is switched on
     1044       plant_canopy = .TRUE.
     1045
     1046       GOTO 14
     1047
     1048 10    BACKSPACE( 11 )
     1049       READ( 11 ,fmt='(A)') line
     1050       CALL parin_fail_message ( 'plant_canopy_parameters', line )
     1051!
     1052!--    Try to find old namelist
     1053 12    REWIND ( 11 )
     1054       line = ' '
     1055       DO   WHILE ( INDEX( line, '&canopy_par' ) == 0 )
     1056          READ ( 11, '(A)', END=14 )  line
     1057       ENDDO
     1058       BACKSPACE ( 11 )
     1059
     1060!
     1061!--    Read user-defined namelist
     1062       READ ( 11, canopy_par, ERR = 13, END = 14 )
    10561063
    10571064       message_string = 'namelist canopy_par is deprecated and will be ' // &
     
    10591066                     'plant_canopy_parameters instead'
    10601067       CALL message( 'pcm_parin', 'PA0487', 0, 1, 0, 6, 0 )
    1061        
     1068
    10621069!
    10631070!--    Set flag that indicates that the radiation model is switched on
    10641071       plant_canopy = .TRUE.
    10651072
    1066  12    CONTINUE
    1067        
     1073       GOTO 14
     1074
     1075 13    BACKSPACE( 11 )
     1076       READ( 11 ,fmt='(A)') line
     1077       CALL parin_fail_message ( 'canopy_par', line )
     1078
     1079 14    CONTINUE
     1080
    10681081
    10691082    END SUBROUTINE pcm_parin
Note: See TracChangeset for help on using the changeset viewer.