Ignore:
Timestamp:
Dec 11, 2020 2:18:43 PM (4 years ago)
Author:
raasch
Message:

reading of namelist file and actions in case of namelist errors revised so that statement labels and goto statements are not required any more

File:
1 edited

Legend:

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

    r4807 r4822  
    2626! -----------------
    2727! $Id$
     28! reading of namelist file and actions in case of namelist errors revised so that statement labels
     29! and goto statements are not required any more
     30!
     31! 4807 2020-12-02 21:02:28Z gronemeier
    2832! Add checks for setup of UV exposure (only workaround!); corrected formatting errors.
    2933!
     
    13831387!
    13841388!-- Internal variables
    1385     CHARACTER (LEN=80) ::  line  !< Dummy string for current line in parameter file
     1389    CHARACTER (LEN=100) ::  line  !< Dummy string for current line in parameter file
     1390
     1391    INTEGER(iwp) ::  io_status   !< Status after reading the namelist file
    13861392
    13871393    NAMELIST /biometeorology_parameters/  clothing,                                                &
     
    13931399                                          uv_exposure
    13941400
    1395 
    1396 !-- Try to find biometeorology_parameters namelist
    1397     REWIND ( 11 )
    1398     line = ' '
    1399     DO WHILE ( INDEX( line, '&biometeorology_parameters' ) == 0 )
    1400        READ ( 11, '(A)', END = 20 )  line
    1401     ENDDO
    1402     BACKSPACE ( 11 )
    1403 
    1404 !
    1405 !-- Read biometeorology_parameters namelist
    1406     READ ( 11, biometeorology_parameters, ERR = 10, END = 20 )
    1407 
    1408 !
    1409 !-- Set flag that indicates that the biomet_module is switched on
    1410     biometeorology = .TRUE.
    1411 
    1412     GOTO 20
    1413 
    1414 !
    1415 !-- In case of error
    1416  10 BACKSPACE( 11 )
    1417     READ( 11 , '(A)') line
    1418     CALL parin_fail_message( 'biometeorology_parameters', line )
    1419 
    1420 !
    1421 !-- Complete
    1422  20 CONTINUE
    1423 
     1401!
     1402!-- Move to the beginning of the namelist file and try to find and read the namelist named
     1403!-- biometeorology_parameters.
     1404    REWIND( 11 )
     1405    READ( 11, biometeorology_parameters, IOSTAT=io_status )
     1406!
     1407!-- Action depending on the READ status
     1408    IF ( io_status == 0 )  THEN
     1409!
     1410!--    biometeorology_parameters namelist was found and read correctly. Set flag that
     1411!--    biometeorology_mod is switched on.
     1412       biometeorology = .TRUE.
     1413
     1414    ELSEIF ( io_status > 0 )  THEN
     1415!
     1416!--    biometeorology_parameters namelist was found, but contained errors. Print an error message
     1417!--    containing the line that caused the problem.
     1418       BACKSPACE( 11 )
     1419       READ( 11 , '(A)') line
     1420       CALL parin_fail_message( 'biometeorology_parameters', line )
     1421
     1422    ENDIF
    14241423
    14251424 END SUBROUTINE bio_parin
     1425
    14261426
    14271427!--------------------------------------------------------------------------------------------------!
Note: See TracChangeset for help on using the changeset viewer.