Ignore:
Timestamp:
Jan 14, 2021 10:42:28 AM (3 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, deprecated namelists removed

File:
1 edited

Legend:

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

    r4828 r4842  
    2424! -----------------
    2525! $Id$
     26! reading of namelist file and actions in case of namelist errors revised so that statement labels
     27! and goto statements are not required any more
     28!
     29! 4828 2021-01-05 11:21:41Z Giersch
    2630! Enable 3D data output also with 64-bit precision
    2731!
     
    336340
    337341
    338     CHARACTER (LEN=80)  ::  line  !< dummy string that contains the current line of the parameter file
    339 
    340     NAMELIST /dynamics_parameters/                                                                 &
    341        dynamics_module_enabled
    342 
    343 
    344     line = ' '
    345 !
    346 !-- Try to find module-specific namelist
    347     REWIND ( 11 )
    348     line = ' '
    349     DO   WHILE ( INDEX( line, '&dynamics_parameters' ) == 0 )
    350        READ ( 11, '(A)', END=12 )  line
    351     ENDDO
    352     BACKSPACE ( 11 )
    353 
    354 !-- Set default module switch to true
     342    CHARACTER(LEN=100)  ::  line  !< dummy string that contains the current line of the parameter
     343                                  !< file
     344    INTEGER(iwp)  ::  io_status   !< status after reading the namelist file
     345
     346   
     347    NAMELIST /dynamics_parameters/  dynamics_module_enabled
     348
     349!
     350!-- Set default module switch to true.
    355351    dynamics_module_enabled = .TRUE.
    356352
    357 !-- Read user-defined namelist
    358     READ ( 11, dynamics_parameters, ERR = 10 )
    359 
    360     GOTO 12
    361 
    362 10  BACKSPACE( 11 )
    363     READ( 11 , '(A)') line
    364     CALL parin_fail_message( 'dynamics_parameters', line )
    365 
    366 12  CONTINUE
     353!-- Move to the beginning of the namelist file and try to find and read the namelist.
     354    REWIND( 11 )
     355    READ( 11, dynamics_parameters, IOSTAT=io_status )
     356
     357!
     358!-- Action depending on the READ status
     359    IF ( io_status > 0 )  THEN
     360!
     361!--    dynamics_parameters namelist was found, but contained errors. Print an error message
     362!--    including the line that caused the problem.
     363       BACKSPACE( 11 )
     364       READ( 11 , '(A)') line
     365       CALL parin_fail_message( 'dynamics_parameters', line )
     366
     367    ENDIF
    367368
    368369 END SUBROUTINE dynamics_parin
Note: See TracChangeset for help on using the changeset viewer.