Ignore:
Timestamp:
Jan 15, 2021 3:22:11 PM (8 months ago)
Author:
raasch
Message:

local namelist parameter added to switch off the module although the respective module namelist appears in the namelist file, further copyright updates

File:
1 edited

Legend:

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

    r4828 r4843  
    2525! -----------------
    2626! $Id$
     27! reading of namelist file and actions in case of namelist errors revised so that statement labels
     28! and goto statements are not required any more,
     29! local namelist parameter added to switch off the module although the respective module namelist
     30! appears in the namelist file
     31!
     32! 4828 2021-01-05 11:21:41Z Giersch
    2733! - Add control flags
    2834!
     
    415421    LOGICAL ::  global_attribute          = .TRUE.   !< flag indicating a global attribute
    416422    LOGICAL ::  initial_write_coordinates = .FALSE.  !< flag indicating a global attribute
    417     LOGICAL ::  use_virtual_measurement   = .FALSE.  !< Namelist parameter
    418423
    419424    REAL(wp) ::  dt_virtual_measurement   = 0.0_wp  !< sampling interval
     
    817822 SUBROUTINE vm_parin
    818823
    819     CHARACTER(LEN=80) ::  line   !< dummy string that contains the current line of the parameter file
     824    CHARACTER(LEN=100) ::  line  !< dummy string that contains the current line of the parameter file
     825
     826    INTEGER(iwp) ::  io_status   !< status after reading the namelist file
     827
     828    LOGICAL ::  switch_off_module = .FALSE.  !< local namelist parameter to switch off the module
     829                                             !< although the respective module namelist appears in
     830                                             !< the namelist file
    820831
    821832    NAMELIST /virtual_measurement_parameters/  dt_virtual_measurement,                             &
     
    826837                                               off_ts,                                             &
    827838                                               off_ts_z,                                           &
    828                                                use_virtual_measurement,                            &
     839                                               switch_off_module,                                  &
    829840                                               vm_time_start
    830841
    831     line = ' '
    832 !
    833 !-- Try to find stg package
    834     REWIND ( 11 )
    835     line = ' '
    836     DO  WHILE ( INDEX( line, '&virtual_measurement_parameters' ) == 0 )
    837        READ ( 11, '(A)', END=20 )  line
    838     ENDDO
    839     BACKSPACE ( 11 )
    840 
    841 !
    842 !-- Read namelist
    843     READ ( 11, virtual_measurement_parameters, ERR = 10, END = 20 )
    844 
    845 !
    846 !-- Set flag that indicates that the virtual measurement module is switched on
    847     IF ( use_virtual_measurement )  virtual_measurement = .TRUE.
    848     GOTO 20
    849 
    850  10 BACKSPACE( 11 )
    851     READ( 11 , '(A)') line
    852     CALL parin_fail_message( 'virtual_measurement_parameters', line )
    853 
    854  20 CONTINUE
     842!
     843!-- Move to the beginning of the namelist file and try to find and read the namelist.
     844    REWIND( 11 )
     845    READ( 11, virtual_measurement_parameters, IOSTAT=io_status )
     846
     847!
     848!-- Action depending on the READ status
     849    IF ( io_status == 0 )  THEN
     850!
     851!--    virtual_measurements_parameters namelist was found and read correctly. Enable the
     852!--    virtual measurements.
     853       IF ( .NOT. switch_off_module )  virtual_measurement = .TRUE.
     854
     855    ELSEIF ( io_status > 0 )  THEN
     856!
     857!--    virtual_measurement_parameters namelist was found but contained errors. Print an error
     858!--    message including the line that caused the problem.
     859       BACKSPACE( 11 )
     860       READ( 11 , '(A)' ) line
     861       CALL parin_fail_message( 'virtual_measurement_parameters', line )
     862
     863    ENDIF
    855864
    856865 END SUBROUTINE vm_parin
Note: See TracChangeset for help on using the changeset viewer.