Index: palm/trunk/SOURCE/lagrangian_particle_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/lagrangian_particle_model_mod.f90	(revision 4828)
+++ palm/trunk/SOURCE/lagrangian_particle_model_mod.f90	(revision 4842)
@@ -24,4 +24,9 @@
 ! -----------------
 ! $Id$
+! 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 namelist removed
+!
+! 4828 2021-01-05 11:21:41Z Giersch
 ! output of particle time series added
 !
@@ -569,65 +574,7 @@
  SUBROUTINE lpm_parin
 
-    CHARACTER (LEN=80) ::  line  !<
-
-    NAMELIST /particles_par/                                                                       &
-       aero_species,                                                                               &
-       aero_type,                                                                                  &
-       aero_weight,                                                                                &
-       alloc_factor,                                                                               &
-       bc_par_b,                                                                                   &
-       bc_par_lr,                                                                                  &
-       bc_par_ns,                                                                                  &
-       bc_par_t,                                                                                   &
-       collision_kernel,                                                                           &
-       curvature_solution_effects,                                                                 &
-       deallocate_memory,                                                                          &
-       density_ratio,                                                                              &
-       dissipation_classes,                                                                        &
-       dt_dopts,                                                                                   &
-       dt_min_part,                                                                                &
-       dt_prel,                                                                                    &
-       dt_write_particle_data,                                                                     &
-       end_time_prel,                                                                              &
-       initial_weighting_factor,                                                                   &
-       log_sigma,                                                                                  &
-       max_number_particles_per_gridbox,                                                           &
-       merging,                                                                                    &
-       na,                                                                                         &
-       number_concentration,                                                                       &
-       number_of_particle_groups,                                                                  &
-       number_particles_per_gridbox,                                                               &
-       particles_per_point,                                                                        &
-       particle_advection_start,                                                                   &
-       particle_advection_interpolation,                                                           &
-       particle_maximum_age,                                                                       &
-       pdx,                                                                                        &
-       pdy,                                                                                        &
-       pdz,                                                                                        &
-       psb,                                                                                        &
-       psl,                                                                                        &
-       psn,                                                                                        &
-       psr,                                                                                        &
-       pss,                                                                                        &
-       pst,                                                                                        &
-       radius,                                                                                     &
-       radius_classes,                                                                             &
-       radius_merge,                                                                               &
-       radius_split,                                                                               &
-       random_start_position,                                                                      &
-       read_particles_from_restartfile,                                                            &
-       rm,                                                                                         &
-       seed_follows_topography,                                                                    &
-       splitting,                                                                                  &
-       splitting_factor,                                                                           &
-       splitting_factor_max,                                                                       &
-       splitting_function,                                                                         &
-       splitting_mode,                                                                             &
-       step_dealloc,                                                                               &
-       use_sgs_for_particles,                                                                      &
-       vertical_particle_advection,                                                                &
-       weight_factor_merge,                                                                        &
-       weight_factor_split,                                                                        &
-       write_particle_statistics
+    CHARACTER(LEN=100) ::  line  !< string containing current line of file PARIN
+
+    INTEGER(iwp) ::  io_status  !< status after reading the namelist file
 
     NAMELIST /particle_parameters/                                                                 &
@@ -699,59 +646,27 @@
 
 !
-!-- Position the namelist-file at the beginning (it was already opened in parin), search for the
-!-- namelist-group of the package and position the file at this line. Do the same for each
-!-- optionally used package.
-    line = ' '
-
-!
-!-- Try to find particles package
-    REWIND ( 11 )
-    line = ' '
-    DO   WHILE ( INDEX( line, '&particle_parameters' ) == 0 )
-       READ ( 11, '(A)', END=12 )  line
-    ENDDO
-    BACKSPACE ( 11 )
-!
-!-- Read user-defined namelist
-    READ ( 11, particle_parameters, ERR = 10 )
-!
-!-- Set flag that indicates that particles are switched on
-    particle_advection = .TRUE.
-
-    GOTO 14
-
-10  BACKSPACE( 11 )
-    READ( 11 , '(A)') line
-    CALL parin_fail_message( 'particle_parameters', line )
-!
-!-- Try to find particles package (old namelist)
-12  REWIND ( 11 )
-    line = ' '
-    DO WHILE ( INDEX( line, '&particles_par' ) == 0 )
-       READ ( 11, '(A)', END=14 )  line
-    ENDDO
-    BACKSPACE ( 11 )
-!
-!-- Read user-defined namelist
-    READ ( 11, particles_par, ERR = 13, END = 14 )
-
-    message_string = 'namelist particles_par is deprecated and will be ' //                        &
-                     'removed in near future. Please use namelist ' //                             &
-                     'particle_parameters instead'
-    CALL message( 'package_parin', 'PA0487', 0, 1, 0, 6, 0 )
-
-!
-!-- Set flag that indicates that particles are switched on
-    particle_advection = .TRUE.
-
-    GOTO 14
-
-13    BACKSPACE( 11 )
-       READ( 11 , '(A)') line
-       CALL parin_fail_message( 'particles_par', line )
-
-14 CONTINUE
+!-- Move to the beginning of the namelist file and try to find and read the namelist.
+    REWIND( 11 )
+    READ( 11, particle_parameters, IOSTAT=io_status )
+!
+!-- Action depending on the READ status
+    IF ( io_status == 0 )  THEN
+!
+!--    particle_parameters namelist was found and read correctly. Set flag that indicates that
+!--    particles are switched on.
+       particle_advection = .TRUE.
+
+    ELSEIF ( io_status > 0 )  THEN
+!
+!--    particle_parameters namelist was found, but contained errors. Print an error message
+!--    including the line that caused the error.
+       BACKSPACE( 11 )
+       READ( 11 , '(A)' ) line
+       CALL parin_fail_message( 'particle_parameters', line )
+
+    ENDIF
 
  END SUBROUTINE lpm_parin
+
 
 !--------------------------------------------------------------------------------------------------!
