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/surface_data_output_mod.f90

    r4828 r4842  
    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!
     30! 4828 2021-01-05 11:21:41Z Giersch
    2731! Bugfix: correct the down-ward surf_lsm index in the routine surface_data_output_collect_2d
    2832!
     
    42054209    IMPLICIT NONE
    42064210
    4207     CHARACTER (LEN=80) ::  line  !< dummy string that contains the current line of the parameter file
    4208 
    4209 
    4210     NAMELIST /surface_data_output_parameters/ averaging_interval_surf, data_output_surf,           &
    4211                                               dt_dosurf, dt_dosurf_av, skip_time_dosurf,           &
    4212                                               skip_time_dosurf_av, to_netcdf, to_vtk
    4213 
    4214     line = ' '
    4215 
    4216 !
    4217 !-- Try to find the namelist
    4218     REWIND ( 11 )
    4219     line = ' '
    4220     DO WHILE ( INDEX( line, '&surface_data_output_parameters' ) == 0 )
    4221        READ ( 11, '(A)', END=14 )  line
    4222     ENDDO
    4223     BACKSPACE ( 11 )
    4224 
    4225 !
    4226 !-- Read namelist
    4227     READ ( 11, surface_data_output_parameters, ERR = 10 )
    4228 !
    4229 !-- Set flag that indicates that surface data output is switched on
    4230     surface_output = .TRUE.
    4231     GOTO 14
    4232 
    4233  10 BACKSPACE( 11 )
    4234     READ( 11 , '(A)') line
    4235     CALL parin_fail_message( 'surface_data_output_parameters', line )
    4236 
    4237  14 CONTINUE
    4238 
     4211    CHARACTER(LEN=100) ::  line  !< dummy string that contains the current line of the parameter file
     4212
     4213    INTEGER(iwp) ::  io_status   !< status after reading the namelist file
     4214
     4215
     4216    NAMELIST /surface_data_output_parameters/  averaging_interval_surf,                            &
     4217                                               data_output_surf,                                   &
     4218                                               dt_dosurf,                                          &
     4219                                               dt_dosurf_av,                                       &
     4220                                               skip_time_dosurf,                                   &
     4221                                               skip_time_dosurf_av,                                &
     4222                                               to_netcdf,                                          &
     4223                                               to_vtk
     4224
     4225!
     4226!-- Move to the beginning of the namelist file and try to find and read the namelist.
     4227    REWIND( 11 )
     4228    READ( 11, surface_data_output_parameters, IOSTAT=io_status )
     4229!
     4230!-- Action depending on the READ status
     4231    IF ( io_status == 0 )  THEN
     4232!
     4233!--    surface_data_output_parameters namelist was found and read correctly. Set flag that indicates
     4234!--    that surface data output is switched on.
     4235       surface_output = .TRUE.
     4236
     4237    ELSEIF ( io_status > 0 )  THEN
     4238!
     4239!--    surface_data_output_parameters namelist was found but contained errors. Print an error
     4240!--    message including the line that caused the problem.
     4241       BACKSPACE( 11 )
     4242       READ( 11 , '(A)') line
     4243       CALL parin_fail_message( 'surface_data_output_parameters', line )
     4244
     4245    ENDIF
    42394246
    42404247 END SUBROUTINE surface_data_output_parin
Note: See TracChangeset for help on using the changeset viewer.