Index: /palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- /palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 59)
+++ /palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 60)
@@ -29,4 +29,6 @@
 +age_m in particle_type
 
+Particles-package is now part of the default code ("-p particles" is not needed any more).
+
 Move call of user_actions( 'after_integration' ) below increment of times
 and counters. user_actions is now called for each statistic region and has as an argument the number of the respective region (sr)
@@ -38,5 +40,5 @@
 __vtk directives removed from main program.
 
-check_parameters, data_output_ts, flow_statistics, init_particles, init_3d_model, modules, palm, parin, time_integration
+check_parameters, data_output_dvrp, data_output_ptseries, data_output_ts, flow_statistics, header, init_particles, init_3d_model, modules, palm, package_parin, parin, time_integration
 
 
Index: /palm/trunk/SOURCE/advec_particles.f90
===================================================================
--- /palm/trunk/SOURCE/advec_particles.f90	(revision 59)
+++ /palm/trunk/SOURCE/advec_particles.f90	(revision 60)
@@ -7,5 +7,5 @@
 ! particle_boundary_conds,
 ! vertical walls are regarded in the SGS model,
-! + user_advec_particles
+! + user_advec_particles, particles-package is now part of the defaut code
 ! TEST: PRINT statements on unit 9 (commented out)
 !
@@ -50,5 +50,4 @@
 ! Particle advection
 !------------------------------------------------------------------------------!
-#if defined( __particles )
 
     USE arrays_3d
@@ -68,26 +67,34 @@
     IMPLICIT NONE
 
-    INTEGER ::  deleted_particles, deleted_tails, i, ie, ii, inc, is, j, jj,   &
-                js, k, kk, kw, m, n, nc, nn, psi, tlength, trlp_count,         &
-                trlp_count_sum, trlp_count_recv, trlp_count_recv_sum,          &
-                trlpt_count, trlpt_count_recv, trnp_count, trnp_count_sum,     &
-                trnp_count_recv, trnp_count_recv_sum, trnpt_count,             &
-                trnpt_count_recv, trrp_count, trrp_count_sum, trrp_count_recv, &
+    INTEGER ::  agp, deleted_particles, deleted_tails, i, ie, ii, inc, is, j,  &
+                jj, js, k, kk, kw, m, n, nc, nn, num_gp, psi, tlength,         &
+                trlp_count, trlp_count_sum, trlp_count_recv,                   &
+                trlp_count_recv_sum, trlpt_count, trlpt_count_recv,            &
+                trnp_count, trnp_count_sum, trnp_count_recv,                   &
+                trnp_count_recv_sum, trnpt_count, trnpt_count_recv,            &
+                trrp_count, trrp_count_sum, trrp_count_recv,                   &
                 trrp_count_recv_sum, trrpt_count, trrpt_count_recv,            &
                 trsp_count, trsp_count_sum, trsp_count_recv,                   &
                 trsp_count_recv_sum, trspt_count, trspt_count_recv, nd
 
+    INTEGER ::  gp_outside_of_building(1:8)
+
     LOGICAL ::  dt_3d_reached, dt_3d_reached_l, prt_position
 
-    REAL    ::  aa, arg, bb, cc, dd, delta_r, dens_ratio, de_dx_int,           &
-                de_dx_int_l, de_dx_int_u, de_dy_int, de_dy_int_l, de_dy_int_u, &
-                de_dz_int, de_dz_int_l, de_dz_int_u, diss_int, diss_int_l,     &
-                diss_int_u, distance, dt_gap, dt_particle, d_radius, e_a,      &
-                e_int, e_int_l, e_int_u, e_mean_int, e_s, exp_arg, exp_term,   &
-                fs_int, gg, lagr_timescale, mean_r, new_r, p_int, pt_int,      &
-                pt_int_l, pt_int_u, q_int, q_int_l, q_int_u, ql_int, ql_int_l, &
-                ql_int_u, random_gauss, sl_r3, sl_r4, s_r3, s_r4, t_int,       &
-                u_int, u_int_l, u_int_u, vv_int, v_int, v_int_l, v_int_u,      &
-                w_int, w_int_l, w_int_u, x, y
+    REAL    ::  aa, arg, bb, cc, dd, delta_r, dens_ratio, de_dt, de_dt_min,    &
+                de_dx_int, de_dx_int_l, de_dx_int_u, de_dy_int, de_dy_int_l,   &
+                de_dy_int_u, de_dz_int, de_dz_int_l, de_dz_int_u, diss_int,    &
+                diss_int_l, diss_int_u, distance, dt_gap, dt_particle,         &
+                dt_particle_m, d_radius, d_sum, e_a, e_int, e_int_l, e_int_u,  &
+                e_mean_int, e_s, exp_arg, exp_term, fs_int, gg,                &
+                lagr_timescale, mean_r, new_r, p_int, pt_int, pt_int_l,        &
+                pt_int_u, q_int, q_int_l, q_int_u, ql_int, ql_int_l, ql_int_u, &
+                random_gauss, sl_r3, sl_r4, s_r3, s_r4, t_int, u_int, u_int_l, &
+                u_int_u, vv_int, v_int, v_int_l, v_int_u, w_int, w_int_l,      &
+                w_int_u, x, y
+
+    REAL, DIMENSION(1:30) ::  de_dxi, de_dyi, de_dzi, dissi, d_gp_pl, ei
+
+    REAL    ::  location(1:30,1:3)
 
     REAL, DIMENSION(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ::  de_dx, de_dy, de_dz
@@ -1687,7 +1694,7 @@
 !--             previous timestep the increase must not exceed 200%
 
-                dt_particle_old = particles(n)%age - particles(n)%age_m
-                IF ( dt_particle > 2.0 * dt_particle_old )  THEN 
-                   dt_particle = 2.0 * dt_particle_old
+                dt_particle_m = particles(n)%age - particles(n)%age_m
+                IF ( dt_particle > 2.0 * dt_particle_m )  THEN 
+                   dt_particle = 2.0 * dt_particle_m
                 ENDIF
 
@@ -1703,5 +1710,5 @@
                 de_dt_min = - e_int / dt_particle
 
-                de_dt = ( e_int - particles(n)%e_m ) / dt_particle_old
+                de_dt = ( e_int - particles(n)%e_m ) / dt_particle_m
 
                 IF ( de_dt < de_dt_min )  THEN
@@ -3436,5 +3443,4 @@
 8000 FORMAT (I6,1X,F7.2,4X,I6,5X,4(I3,1X,I4,'/',I4,2X),6X,I6)
 
-#endif
  END SUBROUTINE advec_particles
 
@@ -3447,5 +3453,4 @@
 ! Extend particle memory
 !------------------------------------------------------------------------------!
-#if defined( __particles )
 
     USE particle_attributes
@@ -3486,5 +3491,4 @@
     DEALLOCATE( tmp_particles, tmp_particle_mask )
 
-#endif
  END SUBROUTINE allocate_prt_memory
 
@@ -3497,5 +3501,4 @@
 ! Extend tail memory
 !------------------------------------------------------------------------------!
-#if defined( __particles )
 
     USE particle_attributes
@@ -3540,5 +3543,4 @@
     tail_mask(number_of_tails+1:maximum_number_of_tails) = .TRUE.
 
-#endif
  END SUBROUTINE allocate_tail_memory
 
@@ -3669,5 +3671,4 @@
 ! Write particle data on restart file
 !------------------------------------------------------------------------------!
-#if defined( __particles )
 
     USE control_parameters
@@ -3726,5 +3727,4 @@
     CLOSE ( 90 )
 
-#endif
  END SUBROUTINE write_particles
 
@@ -3736,5 +3736,4 @@
 ! Interpolate collision efficiency from table
 !------------------------------------------------------------------------------!
-#if defined( __particles )
 
     IMPLICIT NONE
@@ -3814,5 +3813,4 @@
     ENDIF
 
-#endif
  END SUBROUTINE collision_efficiency 
 
@@ -3826,5 +3824,4 @@
 ! Sort particles in the sequence the grid boxes are stored in memory
 !------------------------------------------------------------------------------!
-#if defined( __particles )
 
     USE arrays_3d
@@ -3911,4 +3908,3 @@
     CALL cpu_log( log_point_s(47), 'sort_particles', 'stop' )
 
-#endif
  END SUBROUTINE sort_particles
Index: /palm/trunk/SOURCE/data_output_dvrp.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_dvrp.f90	(revision 59)
+++ /palm/trunk/SOURCE/data_output_dvrp.f90	(revision 60)
@@ -32,4 +32,5 @@
 ! Actual revisions:
 ! -----------------
+! Particles-package is now part of the default code.
 ! TEST: write statements
 !
@@ -142,7 +143,6 @@
 !--    Select the plot mode (in case of isosurface or slicer only if user has
 !--    defined a variable which shall be plotted; otherwise do nothing)
-       IF ( mode_dvrp(m)(1:9) == 'particles' )  THEN
-
-#if defined( __particles )
+       IF ( mode_dvrp(m)(1:9) == 'particles'  .AND.  particle_advection )  THEN
+
     WRITE ( 9, * ) '*** myid=', myid, ' data_output_dvrp: anfang particles'
 #if defined( __ibm )
@@ -279,4 +279,13 @@
                                      psize, p_c, p_t )
                 WRITE (9,*) '--- after DVRP_PARTICLES'
+                WRITE (9,*) 'm-1 = ',m-1
+                WRITE (9,*) 'number_of_tails=', number_of_tails
+                WRITE (9,*) 'p_x =', p_x
+                WRITE (9,*) 'p_y =', p_y
+                WRITE (9,*) 'p_z =', p_z
+                WRITE (9,*) 'psize =', psize
+                WRITE (9,*) 'p_c =', p_c
+                WRITE (9,*) 'p_t =', p_t
+
 #if defined( __ibm )
     CALL FLUSH_( 9 )
@@ -298,5 +307,4 @@
 
           CALL cpu_log( log_point_s(28), 'dvrp_particles', 'stop' )
-#endif
 
 
Index: /palm/trunk/SOURCE/data_output_ptseries.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_ptseries.f90	(revision 59)
+++ /palm/trunk/SOURCE/data_output_ptseries.f90	(revision 60)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Particles-package is now part of the default code.
 !
 ! Former revisions:
@@ -22,5 +22,4 @@
 ! Output of particle data timeseries in NetCDF format.
 !------------------------------------------------------------------------------!
-#if defined( __particles )
 
     USE control_parameters
@@ -274,4 +273,3 @@
     CALL cpu_log( log_point(36), 'data_output_ptseries','stop', 'nobarrier' )
 
-#endif
  END SUBROUTINE data_output_ptseries
Index: /palm/trunk/SOURCE/header.f90
===================================================================
--- /palm/trunk/SOURCE/header.f90	(revision 59)
+++ /palm/trunk/SOURCE/header.f90	(revision 60)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! Output of netcdf_64bit_3d
+! Output of netcdf_64bit_3d, particles-package is now part of the default code.
 !
 ! Former revisions:
@@ -1028,58 +1028,60 @@
     ENDIF
 
-#if defined( __particles )
-!
-!-- Particle attributes
-    WRITE ( io, 480 )  particle_advection_start, dt_prel, bc_par_lr, &
-                       bc_par_ns, bc_par_b, bc_par_t, particle_maximum_age, &
-                       end_time_prel
-    IF ( use_sgs_for_particles )  WRITE ( io, 488 )  dt_min_part
-    IF ( random_start_position )  WRITE ( io, 481 )
-    IF ( particles_per_point > 1 )  WRITE ( io, 489 )  particles_per_point
-    WRITE ( io, 495 )  total_number_of_particles
-    IF ( .NOT. vertical_particle_advection )  WRITE ( io, 482 )
-    IF ( maximum_number_of_tailpoints /= 0 )  THEN
-       WRITE ( io, 483 )  maximum_number_of_tailpoints
-       IF ( minimum_tailpoint_distance /= 0 )  THEN
-          WRITE ( io, 484 )  total_number_of_tails, minimum_tailpoint_distance,&
-                             maximum_tailpoint_age
-       ENDIF
-    ENDIF
-    IF ( dt_write_particle_data /= 9999999.9 )  THEN
-       WRITE ( io, 485 )  dt_write_particle_data
-       output_format = ''
-       IF ( netcdf_output )  THEN
-          IF ( netcdf_64bit )  THEN
-             output_format = 'netcdf (64 bit offset) and binary'
-          ELSE
-             output_format = 'netcdf and binary'
-          ENDIF
-       ELSE
-          output_format = 'binary'
-       ENDIF
-       WRITE ( io, 345 )  output_format
-    ENDIF
-    IF ( dt_dopts /= 9999999.9 )  WRITE ( io, 494 )  dt_dopts
-    IF ( write_particle_statistics )  WRITE ( io, 486 )
-
-    WRITE ( io, 487 )  number_of_particle_groups
-
-    DO  i = 1, number_of_particle_groups
-       IF ( i == 1  .AND.  density_ratio(i) == 9999999.9 )  THEN
-          WRITE ( io, 490 )  i, 0.0
-          WRITE ( io, 492 )
-       ELSE
-          WRITE ( io, 490 )  i, radius(i)
-          IF ( density_ratio(i) /= 0.0 )  THEN
-             WRITE ( io, 491 )  density_ratio(i)
-          ELSE
+    IF ( particle_advection )  THEN
+!
+!--    Particle attributes
+       WRITE ( io, 480 )  particle_advection_start, dt_prel, bc_par_lr, &
+                          bc_par_ns, bc_par_b, bc_par_t, particle_maximum_age, &
+                          end_time_prel
+       IF ( use_sgs_for_particles )  WRITE ( io, 488 )  dt_min_part
+       IF ( random_start_position )  WRITE ( io, 481 )
+       IF ( particles_per_point > 1 )  WRITE ( io, 489 )  particles_per_point
+       WRITE ( io, 495 )  total_number_of_particles
+       IF ( .NOT. vertical_particle_advection )  WRITE ( io, 482 )
+       IF ( maximum_number_of_tailpoints /= 0 )  THEN
+          WRITE ( io, 483 )  maximum_number_of_tailpoints
+          IF ( minimum_tailpoint_distance /= 0 )  THEN
+             WRITE ( io, 484 )  total_number_of_tails,      &
+                                minimum_tailpoint_distance, &
+                                maximum_tailpoint_age
+          ENDIF
+       ENDIF
+       IF ( dt_write_particle_data /= 9999999.9 )  THEN
+          WRITE ( io, 485 )  dt_write_particle_data
+          output_format = ''
+          IF ( netcdf_output )  THEN
+             IF ( netcdf_64bit )  THEN
+                output_format = 'netcdf (64 bit offset) and binary'
+             ELSE
+                output_format = 'netcdf and binary'
+             ENDIF
+          ELSE
+             output_format = 'binary'
+          ENDIF
+          WRITE ( io, 345 )  output_format
+       ENDIF
+       IF ( dt_dopts /= 9999999.9 )  WRITE ( io, 494 )  dt_dopts
+       IF ( write_particle_statistics )  WRITE ( io, 486 )
+
+       WRITE ( io, 487 )  number_of_particle_groups
+
+       DO  i = 1, number_of_particle_groups
+          IF ( i == 1  .AND.  density_ratio(i) == 9999999.9 )  THEN
+             WRITE ( io, 490 )  i, 0.0
              WRITE ( io, 492 )
-          ENDIF
-       ENDIF
-       WRITE ( io, 493 )  psl(i), psr(i), pss(i), psn(i), psb(i), pst(i), &
-                          pdx(i), pdy(i), pdz(i)
-    ENDDO
-
-#endif
+          ELSE
+             WRITE ( io, 490 )  i, radius(i)
+             IF ( density_ratio(i) /= 0.0 )  THEN
+                WRITE ( io, 491 )  density_ratio(i)
+             ELSE
+                WRITE ( io, 492 )
+             ENDIF
+          ENDIF
+          WRITE ( io, 493 )  psl(i), psr(i), pss(i), psn(i), psb(i), pst(i), &
+                             pdx(i), pdy(i), pdz(i)
+       ENDDO
+
+    ENDIF
+
 
 !
@@ -1390,5 +1392,4 @@
             '    value is negative) by ',E8.1,' kg/m**3 at the beginning of', &
                  ' the 3D-simulation'/)
-#if defined( __particles )
 480 FORMAT ('    Particles:'/ &
             '    ---------'// &
@@ -1426,5 +1427,4 @@
                     F8.2,' s'/)
 495 FORMAT ('       Number of particles in total domain: ',I10/)
-#endif
 500 FORMAT (//' 1D-Model parameters:'/                           &
               ' -------------------'//                           &
Index: /palm/trunk/SOURCE/init_particles.f90
===================================================================
--- /palm/trunk/SOURCE/init_particles.f90	(revision 59)
+++ /palm/trunk/SOURCE/init_particles.f90	(revision 60)
@@ -4,5 +4,6 @@
 ! Actual revisions:
 ! -----------------
-! displacements for mpi_particle_type changed, age_m initialized
+! displacements for mpi_particle_type changed, age_m initialized,
+! particles-package is now part of the default code
 !
 ! Former revisions:
@@ -30,5 +31,4 @@
 ! plotting is done in data_output_dvrp.
 !------------------------------------------------------------------------------!
-#if defined( __particles )
 
     USE arrays_3d
@@ -560,4 +560,3 @@
 8000 FORMAT (I6,1X,F7.2,4X,I6,71X,I6)
 
-#endif
  END SUBROUTINE init_particles
Index: /palm/trunk/SOURCE/package_parin.f90
===================================================================
--- /palm/trunk/SOURCE/package_parin.f90	(revision 59)
+++ /palm/trunk/SOURCE/package_parin.f90	(revision 60)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Particles-paclage is now part of the default code
 !
 ! Former revisions:
@@ -84,5 +84,6 @@
 #endif
 
-#if defined( __particles )
+!
+!-- Try to find particles package
     REWIND ( 11 )
     zeile = ' '
@@ -101,5 +102,5 @@
 
  20 CONTINUE
-#endif
+
 
 #if defined( __spectra )
Index: /palm/trunk/SOURCE/particle_boundary_conds.f90
===================================================================
--- /palm/trunk/SOURCE/particle_boundary_conds.f90	(revision 59)
+++ /palm/trunk/SOURCE/particle_boundary_conds.f90	(revision 60)
@@ -16,5 +16,4 @@
 ! Routine developed by Jin Zhang (2006-2007)
 !------------------------------------------------------------------------------!
-#if defined( __particles )
 
     USE control_parameters
@@ -28,6 +27,11 @@
     IMPLICIT NONE
 
-    INTEGER ::  n
-
+    INTEGER ::  i, inc, ir, i1, i2, i3, i5, j, jr, j1, j2, j3, j5, k, k1, k2, &
+                k3, k5, n, t_index, t_index_number
+
+    REAL ::  dt_particle, pos_x, pos_x_old, pos_y, pos_y_old, pos_z, &
+             pos_z_old, prt_x, prt_y, prt_z, tmp_t, xline, yline, zline
+
+    REAL ::  t(1:200)
 
     CALL cpu_log( log_point_s(48), 'advec_part_refle', 'start' )
@@ -36,4 +40,6 @@
 
     DO  n = 1, number_of_particles
+
+       dt_particle = particles(n)%age - particles(n)%age_m
 
        i2 = ( particles(n)%x + 0.5 * dx ) * ddx
Index: /palm/trunk/SOURCE/user_interface.f90
===================================================================
--- /palm/trunk/SOURCE/user_interface.f90	(revision 59)
+++ /palm/trunk/SOURCE/user_interface.f90	(revision 60)
@@ -5,5 +5,5 @@
 ! -----------------
 ! New routine user_init_3d_model which allows the initial setting of all 3d
-! arrays under control of the user,
+! arrays under control of the user, new routine user_advec_particles,
 ! routine user_statistics now has one argument (sr),
 ! sample for generating time series quantities added
@@ -521,4 +521,29 @@
 
  END SUBROUTINE user_init_particles
+
+
+
+ SUBROUTINE user_advec_particles
+
+!------------------------------------------------------------------------------!
+!
+! Description:
+! ------------
+! Modification of initial particles by the user.
+!------------------------------------------------------------------------------!
+
+    USE particle_attributes
+    USE user
+
+    IMPLICIT NONE
+
+    INTEGER ::  n
+
+!
+!-- Here the user-defined actions follow
+!    DO  n = 1, number_of_initial_particles
+!    ENDDO
+
+ END SUBROUTINE user_advec_particles
 
 
Index: /palm/trunk/SOURCE/wall_fluxes.f90
===================================================================
--- /palm/trunk/SOURCE/wall_fluxes.f90	(revision 59)
+++ /palm/trunk/SOURCE/wall_fluxes.f90	(revision 60)
@@ -45,5 +45,4 @@
        USE indices
        USE statistics
-       USE user
 
        IMPLICIT NONE
@@ -210,5 +209,4 @@
        USE indices
        USE statistics
-       USE user
 
        IMPLICIT NONE
@@ -369,5 +367,4 @@
        USE indices
        USE statistics
-       USE user
 
        IMPLICIT NONE
@@ -475,5 +472,4 @@
        USE indices
        USE statistics
-       USE user
 
        IMPLICIT NONE
