Changeset 3246 for palm/trunk


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

Added error handling for wrong input parameters

Location:
palm/trunk/SOURCE
Files:
15 edited

Legend:

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

    r3241 r3246  
    2727! -----------------
    2828! $Id$
     29! Added error handling for input namelist via parin_fail_message
     30!
     31! 3241 2018-09-12 15:02:00Z raasch
    2932! +nest_chemistry
    3033!
     
    867870      line = ' '
    868871      DO   WHILE ( INDEX( line, '&chemistry_parameters' ) == 0 )
    869          READ ( 11, '(A)', END=10 )  line
     872         READ ( 11, '(A)', END=20 )  line
    870873      ENDDO
    871874      BACKSPACE ( 11 )
    872875!
    873876!--   Read chemistry namelist
    874       READ ( 11, chemistry_parameters )                         
     877      READ ( 11, chemistry_parameters, ERR = 10, END = 20 )
    875878!
    876879!--   Enable chemistry model
    877       air_chemistry = .TRUE.                   
    878 
    879      
    880  10   CONTINUE
     880      air_chemistry = .TRUE.
     881      GOTO 20
     882
     883 10   BACKSPACE( 11 )
     884      READ( 11 ,fmt='(A)') line
     885      CALL parin_fail_message ( 'chemistry_parameters', line )
     886
     887 20   CONTINUE
    881888
    882889      t_steps = my_steps          !(todo: Why not directly make t_steps a
  • palm/trunk/SOURCE/land_surface_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!
     
    49944997       line = ' '
    49954998       DO   WHILE ( INDEX( line, '&land_surface_parameters' ) == 0 )
    4996           READ ( 11, '(A)', END=10 )  line
     4999          READ ( 11, '(A)', END=12 )  line
    49975000       ENDDO
    49985001       BACKSPACE ( 11 )
     
    50005003!
    50015004!--    Read user-defined namelist
    5002        READ ( 11, land_surface_parameters )
     5005       READ ( 11, land_surface_parameters, ERR = 10 )
    50035006
    50045007!
     
    50065009       land_surface = .TRUE.
    50075010       
    5008        GOTO 12
     5011       GOTO 14
     5012
     5013 10    BACKSPACE( 11 )
     5014       READ( 11 ,fmt='(A)') line
     5015       CALL parin_fail_message ( 'land_surface_parameters', line )
    50095016!
    50105017!--    Try to find old namelist
    5011  10    REWIND ( 11 )
     5018 12    REWIND ( 11 )
    50125019       line = ' '
    50135020       DO   WHILE ( INDEX( line, '&lsm_par' ) == 0 )
    5014           READ ( 11, '(A)', END=12 )  line
     5021          READ ( 11, '(A)', END=14 )  line
    50155022       ENDDO
    50165023       BACKSPACE ( 11 )
     
    50185025!
    50195026!--    Read user-defined namelist
    5020        READ ( 11, lsm_par )
     5027       READ ( 11, lsm_par, ERR = 13, END = 14 )
    50215028
    50225029       message_string = 'namelist lsm_par is deprecated and will be ' // &
     
    50285035!--    Set flag that indicates that the land surface model is switched on
    50295036       land_surface = .TRUE.
    5030 
    5031 
    5032  12    CONTINUE
     5037       
     5038       GOTO 14
     5039
     5040 13    BACKSPACE( 11 )
     5041       READ( 11 ,fmt='(A)') line
     5042       CALL parin_fail_message ( 'lsm_par', line )
     5043
     5044
     5045 14    CONTINUE
    50335046       
    50345047
  • palm/trunk/SOURCE/message.f90

    r3241 r3246  
    2525! -----------------
    2626! $Id$
     27! Added SUBROUTINE parin_fail_message for error handling of input namelists
     28!
     29! 3241 2018-09-12 15:02:00Z raasch
    2730! unused variables removed
    2831!
     
    288291
    289292 END SUBROUTINE location_message
     293
     294
     295!------------------------------------------------------------------------------!
     296! Description:
     297! ------------
     298!> Prints out the given location on stdout
     299!------------------------------------------------------------------------------!
     300 
     301 SUBROUTINE parin_fail_message( location, line )
     302
     303    USE control_parameters,                                                    &
     304        ONLY:  message_string
     305
     306    IMPLICIT NONE
     307
     308    CHARACTER(LEN=*) ::  location !< text to be output on stdout
     309    CHARACTER(LEN=*) ::  line
     310
     311    message_string = 'Error(s) in NAMELIST '// TRIM(location) //                 &
     312                     '&Reading fails at& '// line
     313          CALL message( 'parin', 'PA0271', 1, 2, 0, 6, 0 )
     314
     315 END SUBROUTINE parin_fail_message
  • palm/trunk/SOURCE/multi_agent_system_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!
     
    37753778!
    37763779!--    Read user-defined namelist
    3777        READ ( 11, agent_parameters )
     3780       READ ( 11, agent_parameters, ERR = 10, END = 20 )
    37783781
    37793782!
    37803783!--    Set flag that indicates that agents are switched on
    37813784       agents_active = .TRUE.
     3785       GOTO 20
     3786
     3787 10    BACKSPACE( 11 )
     3788       READ( 11 ,fmt='(A)') line
     3789       CALL parin_fail_message ( 'agent_parameters', line )
    37823790
    37833791 20    CONTINUE
  • palm/trunk/SOURCE/package_parin.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!
     
    301304    line = ' '
    302305    DO   WHILE ( INDEX( line, '&dvrp_graphics_par' ) == 0 )
    303        READ ( 11, '(A)', END=20 )  line
     306       READ ( 11, '(A)', END=21 )  line
    304307    ENDDO
    305308    BACKSPACE ( 11 )
     
    307310!
    308311!-- Read user-defined namelist
    309     READ ( 11, dvrp_graphics_par )
    310 
    311  20 CONTINUE
     312    READ ( 11, dvrp_graphics_par, ERR = 20 )
     313
     314    GOTO 21
     315 20 BACKSPACE( 11 )
     316    READ( 11 ,fmt='(A)') line
     317    CALL parin_fail_message ( 'dvrp_graphics_par', line )
     318
     319 21 CONTINUE
    312320#endif
    313321
     
    317325    line = ' '
    318326    DO   WHILE ( INDEX( line, '&particle_parameters' ) == 0 )
    319        READ ( 11, '(A)', END=30 )  line
     327       READ ( 11, '(A)', END=12 )  line
    320328    ENDDO
    321329    BACKSPACE ( 11 )
     
    323331!
    324332!-- Read user-defined namelist
    325     READ ( 11, particle_parameters )
     333    READ ( 11, particle_parameters, ERR = 10 )
    326334
    327335!
     
    329337    particle_advection = .TRUE.
    330338   
    331     GOTO 31
     339    GOTO 14
     340
     34110  BACKSPACE( 11 )
     342    READ( 11 ,fmt='(A)') line
     343    CALL parin_fail_message ( 'particle_parameters', line )
    332344
    333345!
    334346!-- Try to find particles package (old namelist)
    335 30  REWIND ( 11 )
     34712  REWIND ( 11 )
    336348    line = ' '
    337349    DO   WHILE ( INDEX( line, '&particles_par' ) == 0 )
    338        READ ( 11, '(A)', END=31 )  line
     350       READ ( 11, '(A)', END=14 )  line
    339351    ENDDO
    340352    BACKSPACE ( 11 )
     
    342354!
    343355!-- Read user-defined namelist
    344     READ ( 11, particles_par )
     356    READ ( 11, particles_par, ERR = 13, END = 14 )
    345357   
    346358   
     
    354366    particle_advection = .TRUE.
    355367
    356  31 CONTINUE
     368       GOTO 14
     369
     370 13    BACKSPACE( 11 )
     371       READ( 11 ,fmt='(A)') line
     372       CALL parin_fail_message ( 'particles_par', line )
     373
     374 14 CONTINUE
    357375
    358376 END SUBROUTINE package_parin
  • 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!
  • 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
  • palm/trunk/SOURCE/radiation_model_mod.f90

    r3241 r3246  
    2828! -----------------
    2929! $Id$
     30! Added error handling for input namelist via parin_fail_message
     31!
     32! 3241 2018-09-12 15:02:00Z raasch
    3033! unused variables removed or commented
    3134!
     
    27872790       line = ' '
    27882791       DO   WHILE ( INDEX( line, '&radiation_parameters' ) == 0 )
    2789           READ ( 11, '(A)', END=10 )  line
    2790        ENDDO
    2791        BACKSPACE ( 11 )
    2792 
    2793 !
    2794 !--    Read user-defined namelist
    2795        READ ( 11, radiation_parameters )
    2796 
    2797 !
    2798 !--    Set flag that indicates that the radiation model is switched on
    2799        radiation = .TRUE.
    2800        
    2801        GOTO 12
    2802 !
    2803 !--    Try to find old namelist
    2804  10    REWIND ( 11 )
    2805        line = ' '
    2806        DO   WHILE ( INDEX( line, '&radiation_par' ) == 0 )
    28072792          READ ( 11, '(A)', END=12 )  line
    28082793       ENDDO
     
    28112796!
    28122797!--    Read user-defined namelist
    2813        READ ( 11, radiation_par )
    2814        
     2798       READ ( 11, radiation_parameters, ERR = 10 )
     2799
     2800!
     2801!--    Set flag that indicates that the radiation model is switched on
     2802       radiation = .TRUE.
     2803
     2804       GOTO 14
     2805
     2806 10    BACKSPACE( 11 )
     2807       READ( 11 ,fmt='(A)') line
     2808       CALL parin_fail_message ( 'radiation_parameters', line )
     2809!
     2810!--    Try to find old namelist
     2811 12    REWIND ( 11 )
     2812       line = ' '
     2813       DO   WHILE ( INDEX( line, '&radiation_par' ) == 0 )
     2814          READ ( 11, '(A)', END=14 )  line
     2815       ENDDO
     2816       BACKSPACE ( 11 )
     2817
     2818!
     2819!--    Read user-defined namelist
     2820       READ ( 11, radiation_par, ERR = 13, END = 14 )
     2821
    28152822       message_string = 'namelist radiation_par is deprecated and will be ' // &
    28162823                     'removed in near future. Please use namelist ' //         &
     
    28182825       CALL message( 'radiation_parin', 'PA0487', 0, 1, 0, 6, 0 )
    28192826
    2820        
    28212827!
    28222828!--    Set flag that indicates that the radiation model is switched on
     
    28292835       ENDIF
    28302836
    2831  12    CONTINUE
     2837       GOTO 14
     2838
     2839 13    BACKSPACE( 11 )
     2840       READ( 11 ,fmt='(A)') line
     2841       CALL parin_fail_message ( 'radiation_par', line )
     2842
     2843 14    CONTINUE
    28322844       
    28332845    END SUBROUTINE radiation_parin
  • 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
  • palm/trunk/SOURCE/synthetic_turbulence_generator_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!
     
    967970    line = ' '
    968971    DO WHILE ( INDEX( line, '&stg_par' ) == 0 )
    969        READ ( 11, '(A)', END=10 )  line
     972       READ ( 11, '(A)', END=20 )  line
    970973    ENDDO
    971974    BACKSPACE ( 11 )
     
    973976!
    974977!-- Read namelist
    975     READ ( 11, stg_par )
     978    READ ( 11, stg_par, ERR = 10, END = 20 )
    976979
    977980!
     
    979982!-- on
    980983    syn_turb_gen = .TRUE.
    981 
    982 
    983  10 CONTINUE
     984    GOTO 20
     985
     986 10 BACKSPACE( 11 )
     987    READ( 11 ,fmt='(A)') line
     988    CALL parin_fail_message ( 'stg_par', line )
     989
     990 20 CONTINUE
    984991
    985992 END SUBROUTINE stg_parin
  • palm/trunk/SOURCE/urban_surface_mod.f90

    r3241 r3246  
    2828! -----------------
    2929! $Id$
     30! Added error handling for input namelist via parin_fail_message
     31!
     32! 3241 2018-09-12 15:02:00Z raasch
    3033! unused variables removed
    3134!
     
    53495352                           soil_inner_temperature,                             &
    53505353                           window_inner_temperature
     5354                           
     5355                           
     5356 
    53515357!
    53525358!--    Try to find urban surface model package
     
    53545360       line = ' '
    53555361       DO   WHILE ( INDEX( line, '&urban_surface_parameters' ) == 0 )
    5356           READ ( 11, '(A)', END=10 )  line
    5357        ENDDO
    5358        BACKSPACE ( 11 )
    5359 
    5360 !
    5361 !--    Read user-defined namelist
    5362        READ ( 11, urban_surface_parameters )
    5363 !
    5364 !--    Set flag that indicates that the land surface model is switched on
    5365        urban_surface = .TRUE.
    5366 
    5367        GOTO 12
    5368 !
    5369 !--    Try to find old namelist
    5370  10    REWIND ( 11 )
    5371        line = ' '
    5372        DO   WHILE ( INDEX( line, '&urban_surface_par' ) == 0 )
    53735362          READ ( 11, '(A)', END=12 )  line
    53745363       ENDDO
     
    53775366!
    53785367!--    Read user-defined namelist
    5379        READ ( 11, urban_surface_par )
     5368       READ ( 11, urban_surface_parameters, ERR = 10 )
     5369
     5370!
     5371!--    Set flag that indicates that the urban surface model is switched on
     5372       urban_surface = .TRUE.
     5373
     5374       GOTO 14
     5375
     5376 10    BACKSPACE( 11 )
     5377       READ( 11 ,fmt='(A)') line
     5378       CALL parin_fail_message ( 'urban_surface_parameters', line )
     5379!
     5380!--    Try to find old namelist
     5381 12    REWIND ( 11 )
     5382       line = ' '
     5383       DO   WHILE ( INDEX( line, '&urban_surface_par' ) == 0 )
     5384          READ ( 11, '(A)', END=14 )  line
     5385       ENDDO
     5386       BACKSPACE ( 11 )
     5387
     5388!
     5389!--    Read user-defined namelist
     5390       READ ( 11, urban_surface_par, ERR = 13, END = 14 )
    53805391
    53815392       message_string = 'namelist urban_surface_par is deprecated and will be ' // &
    5382                      'removed in near future. Please use namelist ' //             &
    5383                      'urban_surface_parameters instead' 
     5393                     'removed in near future. Please use namelist ' //   &
     5394                     'urban_surface_parameters instead'
    53845395       CALL message( 'usm_parin', 'PA0487', 0, 1, 0, 6, 0 )
    5385 !
    5386 !--    Set flag that indicates that the land surface model is switched on
     5396
     5397!
     5398!--    Set flag that indicates that the urban surface model is switched on
    53875399       urban_surface = .TRUE.
    53885400
    5389  12    CONTINUE
     5401       GOTO 14
     5402
     5403 13    BACKSPACE( 11 )
     5404       READ( 11 ,fmt='(A)') line
     5405       CALL parin_fail_message ( 'urban_surface_par', line )
     5406
     5407
     5408 14    CONTINUE
    53905409
    53915410
  • 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!
  • palm/trunk/SOURCE/uv_exposure_model_mod.f90

    r3241 r3246  
    2525! -----------------
    2626! $Id$
     27! Added error handling for input namelist via parin_fail_message and small
     28! typo bugfix
     29!
     30! 3241 2018-09-12 15:02:00Z raasch
    2731! unused variables removed
    2832!
     
    449453    REWIND ( 11 )
    450454    line = ' '
    451     DO   WHILE ( INDEX( line, '&biometerology_parameters' ) == 0 )
    452        READ ( 11, '(A)', END=10 )  line
     455    DO   WHILE ( INDEX( line, '&biometeorology_parameters' ) == 0 )
     456       READ ( 11, '(A)', END=20 )  line
    453457    ENDDO
    454458    BACKSPACE ( 11 )
     
    456460!
    457461!-- Read user-defined namelist
    458     READ ( 11, biometeorology_parameters )
     462    READ ( 11, biometeorology_parameters, ERR = 10, END = 20 )
    459463
    460464!
     
    462466    uv_exposure = .TRUE.
    463467
    464 
    465  10 CONTINUE
     468 10 BACKSPACE( 11 )
     469    READ( 11 ,fmt='(A)') line
     470    CALL parin_fail_message ( 'biometeorology_parameters', line )
     471
     472
     473 20 CONTINUE
    466474       
    467475
  • palm/trunk/SOURCE/virtual_flight_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!
     
    250253       line = ' '
    251254       DO   WHILE ( INDEX( line, '&virtual_flight_parameters' ) == 0 )
    252           READ ( 11, '(A)', END=10 )  line
    253        ENDDO
    254        BACKSPACE ( 11 )
    255 
    256 !
    257 !--    Read namelist
    258        READ ( 11, virtual_flight_parameters )
    259 !
    260 !--    Set switch that virtual flights shall be carried out
    261        virtual_flight = .TRUE.
    262 
    263        GOTO 12
    264 !
    265 !--    Try to find the old namelist
    266  10    REWIND ( 11 )
    267        line = ' '
    268        DO   WHILE ( INDEX( line, '&flight_par' ) == 0 )
    269255          READ ( 11, '(A)', END=12 )  line
    270256       ENDDO
     
    273259!
    274260!--    Read namelist
    275        READ ( 11, flight_par )
     261       READ ( 11, virtual_flight_parameters, ERR = 10 )
     262!
     263!--    Set switch that virtual flights shall be carried out
     264       virtual_flight = .TRUE.
     265
     266       GOTO 14
     267
     268 10    BACKSPACE( 11 )
     269       READ( 11 ,fmt='(A)') line
     270       CALL parin_fail_message ( 'virtual_flight_parameters', line )
     271!
     272!--    Try to find the old namelist
     273 12    REWIND ( 11 )
     274       line = ' '
     275       DO   WHILE ( INDEX( line, '&flight_par' ) == 0 )
     276          READ ( 11, '(A)', END=14 )  line
     277       ENDDO
     278       BACKSPACE ( 11 )
     279
     280!
     281!--    Read namelist
     282       READ ( 11, flight_par, ERR = 13, END = 14 )
    276283       
    277284       message_string = 'namelist flight_par is deprecated and will be ' // &
     
    283290       virtual_flight = .TRUE.
    284291
    285  12    CONTINUE
     292       GOTO 14
     293
     294 13    BACKSPACE( 11 )
     295       READ( 11 ,fmt='(A)') line
     296       CALL parin_fail_message ( 'flight_par', line )
     297
     298 14    CONTINUE
    286299
    287300    END SUBROUTINE flight_parin
  • 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.