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/lagrangian_particle_model_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! deprecated namelist removed
     29!
     30! 4828 2021-01-05 11:21:41Z Giersch
    2631! output of particle time series added
    2732!
     
    569574 SUBROUTINE lpm_parin
    570575
    571     CHARACTER (LEN=80) ::  line  !<
    572 
    573     NAMELIST /particles_par/                                                                       &
    574        aero_species,                                                                               &
    575        aero_type,                                                                                  &
    576        aero_weight,                                                                                &
    577        alloc_factor,                                                                               &
    578        bc_par_b,                                                                                   &
    579        bc_par_lr,                                                                                  &
    580        bc_par_ns,                                                                                  &
    581        bc_par_t,                                                                                   &
    582        collision_kernel,                                                                           &
    583        curvature_solution_effects,                                                                 &
    584        deallocate_memory,                                                                          &
    585        density_ratio,                                                                              &
    586        dissipation_classes,                                                                        &
    587        dt_dopts,                                                                                   &
    588        dt_min_part,                                                                                &
    589        dt_prel,                                                                                    &
    590        dt_write_particle_data,                                                                     &
    591        end_time_prel,                                                                              &
    592        initial_weighting_factor,                                                                   &
    593        log_sigma,                                                                                  &
    594        max_number_particles_per_gridbox,                                                           &
    595        merging,                                                                                    &
    596        na,                                                                                         &
    597        number_concentration,                                                                       &
    598        number_of_particle_groups,                                                                  &
    599        number_particles_per_gridbox,                                                               &
    600        particles_per_point,                                                                        &
    601        particle_advection_start,                                                                   &
    602        particle_advection_interpolation,                                                           &
    603        particle_maximum_age,                                                                       &
    604        pdx,                                                                                        &
    605        pdy,                                                                                        &
    606        pdz,                                                                                        &
    607        psb,                                                                                        &
    608        psl,                                                                                        &
    609        psn,                                                                                        &
    610        psr,                                                                                        &
    611        pss,                                                                                        &
    612        pst,                                                                                        &
    613        radius,                                                                                     &
    614        radius_classes,                                                                             &
    615        radius_merge,                                                                               &
    616        radius_split,                                                                               &
    617        random_start_position,                                                                      &
    618        read_particles_from_restartfile,                                                            &
    619        rm,                                                                                         &
    620        seed_follows_topography,                                                                    &
    621        splitting,                                                                                  &
    622        splitting_factor,                                                                           &
    623        splitting_factor_max,                                                                       &
    624        splitting_function,                                                                         &
    625        splitting_mode,                                                                             &
    626        step_dealloc,                                                                               &
    627        use_sgs_for_particles,                                                                      &
    628        vertical_particle_advection,                                                                &
    629        weight_factor_merge,                                                                        &
    630        weight_factor_split,                                                                        &
    631        write_particle_statistics
     576    CHARACTER(LEN=100) ::  line  !< string containing current line of file PARIN
     577
     578    INTEGER(iwp) ::  io_status  !< status after reading the namelist file
    632579
    633580    NAMELIST /particle_parameters/                                                                 &
     
    699646
    700647!
    701 !-- Position the namelist-file at the beginning (it was already opened in parin), search for the
    702 !-- namelist-group of the package and position the file at this line. Do the same for each
    703 !-- optionally used package.
    704     line = ' '
    705 
    706 !
    707 !-- Try to find particles package
    708     REWIND ( 11 )
    709     line = ' '
    710     DO   WHILE ( INDEX( line, '&particle_parameters' ) == 0 )
    711        READ ( 11, '(A)', END=12 )  line
    712     ENDDO
    713     BACKSPACE ( 11 )
    714 !
    715 !-- Read user-defined namelist
    716     READ ( 11, particle_parameters, ERR = 10 )
    717 !
    718 !-- Set flag that indicates that particles are switched on
    719     particle_advection = .TRUE.
    720 
    721     GOTO 14
    722 
    723 10  BACKSPACE( 11 )
    724     READ( 11 , '(A)') line
    725     CALL parin_fail_message( 'particle_parameters', line )
    726 !
    727 !-- Try to find particles package (old namelist)
    728 12  REWIND ( 11 )
    729     line = ' '
    730     DO WHILE ( INDEX( line, '&particles_par' ) == 0 )
    731        READ ( 11, '(A)', END=14 )  line
    732     ENDDO
    733     BACKSPACE ( 11 )
    734 !
    735 !-- Read user-defined namelist
    736     READ ( 11, particles_par, ERR = 13, END = 14 )
    737 
    738     message_string = 'namelist particles_par is deprecated and will be ' //                        &
    739                      'removed in near future. Please use namelist ' //                             &
    740                      'particle_parameters instead'
    741     CALL message( 'package_parin', 'PA0487', 0, 1, 0, 6, 0 )
    742 
    743 !
    744 !-- Set flag that indicates that particles are switched on
    745     particle_advection = .TRUE.
    746 
    747     GOTO 14
    748 
    749 13    BACKSPACE( 11 )
    750        READ( 11 , '(A)') line
    751        CALL parin_fail_message( 'particles_par', line )
    752 
    753 14 CONTINUE
     648!-- Move to the beginning of the namelist file and try to find and read the namelist.
     649    REWIND( 11 )
     650    READ( 11, particle_parameters, IOSTAT=io_status )
     651!
     652!-- Action depending on the READ status
     653    IF ( io_status == 0 )  THEN
     654!
     655!--    particle_parameters namelist was found and read correctly. Set flag that indicates that
     656!--    particles are switched on.
     657       particle_advection = .TRUE.
     658
     659    ELSEIF ( io_status > 0 )  THEN
     660!
     661!--    particle_parameters namelist was found, but contained errors. Print an error message
     662!--    including the line that caused the error.
     663       BACKSPACE( 11 )
     664       READ( 11 , '(A)' ) line
     665       CALL parin_fail_message( 'particle_parameters', line )
     666
     667    ENDIF
    754668
    755669 END SUBROUTINE lpm_parin
     670
    756671
    757672!--------------------------------------------------------------------------------------------------!
Note: See TracChangeset for help on using the changeset viewer.