Index: palm/trunk/SOURCE/lpm.f90
===================================================================
--- palm/trunk/SOURCE/lpm.f90	(revision 3556)
+++ palm/trunk/SOURCE/lpm.f90	(revision 3560)
@@ -27,4 +27,8 @@
 ! -----------------
 ! $Id$
+! bugfix to guarantee correct particle releases in case that the release
+! interval is smaller than the model timestep
+! 
+! 2801 2018-02-14 16:01:55Z thiele
 ! Changed lpm from subroutine to module.
 ! Introduce particle transfer in nested models.
@@ -172,12 +176,12 @@
     USE particle_attributes,                                                   &
         ONLY:  collision_kernel, deleted_particles, deallocate_memory,         &
-               dt_write_particle_data, dt_prel, end_time_prel,                 &
-               grid_particles, merging,  number_of_particles,                  &
+               dt_write_particle_data, dt_prel, end_time_prel, grid_particles, &
+               last_particle_release_time, merging, number_of_particles,       &
                number_of_particle_groups, particles, particle_groups,          &
-               prt_count, splitting, step_dealloc, time_prel,                  &
-               time_write_particle_data, trlp_count_sum, trlp_count_recv_sum,  &
-               trnp_count_sum, trnp_count_recv_sum, trrp_count_sum,            & 
-               trrp_count_recv_sum, trsp_count_sum, trsp_count_recv_sum,       &
-               use_sgs_for_particles, write_particle_statistics
+               prt_count, splitting, step_dealloc, time_write_particle_data,   &
+               trlp_count_sum, trlp_count_recv_sum, trnp_count_sum,            &
+               trnp_count_recv_sum, trrp_count_sum, trrp_count_recv_sum,       &
+               trsp_count_sum, trsp_count_recv_sum, use_sgs_for_particles,     &
+               write_particle_statistics
                               
     USE pegrid
@@ -274,11 +278,13 @@
 !
 !-- If necessary, release new set of particles
-    IF ( time_prel >= dt_prel  .AND.  end_time_prel > simulated_time )  THEN
-
-       CALL lpm_create_particle(PHASE_RELEASE)
-!
-!--    The MOD function allows for changes in the output interval with
-!--    restart runs.
-       time_prel = MOD( time_prel, MAX( dt_prel, dt_3d ) )
+    IF ( ( simulated_time - last_particle_release_time ) >= dt_prel  .AND. end_time_prel > simulated_time ) &
+    THEN
+
+       DO WHILE ( ( simulated_time - last_particle_release_time ) >= dt_prel )
+
+          CALL lpm_create_particle( phase_release )
+          last_particle_release_time = last_particle_release_time + dt_prel
+
+       ENDDO
 
     ENDIF
@@ -429,7 +435,4 @@
 
 !
-!--    Increment time since last release
-       IF ( dt_3d_reached )  time_prel = time_prel + dt_3d
-!
 !--    Apply splitting and merging algorithm
        IF ( cloud_droplets )  THEN
Index: palm/trunk/SOURCE/lpm_init.f90
===================================================================
--- palm/trunk/SOURCE/lpm_init.f90	(revision 3556)
+++ palm/trunk/SOURCE/lpm_init.f90	(revision 3560)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! set the first particle release time
+! 
+! 3524 2018-11-14 13:36:44Z raasch
 ! added missing working precision
 ! 
@@ -260,5 +263,6 @@
                 curvature_solution_effects, density_ratio, grid_particles,     &
                 isf,i_splitting_mode, initial_weighting_factor, ibc_par_b,     &
-                ibc_par_lr, ibc_par_ns, ibc_par_t, iran_part, log_z_z0,        &
+                ibc_par_lr, ibc_par_ns, ibc_par_t, iran_part,                  &
+                last_particle_release_time, log_z_z0,                          &
                 max_number_of_particle_groups, min_nr_particle,                &
                 number_concentration,                                          &
@@ -654,5 +658,9 @@
        iran_part = iran_part + myid
 
-       CALL lpm_create_particle (PHASE_INIT)
+!
+!--    Create the particle set, and set the initial particles
+       CALL lpm_create_particle( phase_init )
+       last_particle_release_time = particle_advection_start
+
 !
 !--    User modification of initial particles
Index: palm/trunk/SOURCE/lpm_read_restart_file.f90
===================================================================
--- palm/trunk/SOURCE/lpm_read_restart_file.f90	(revision 3556)
+++ palm/trunk/SOURCE/lpm_read_restart_file.f90	(revision 3560)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! time_prel replaced by last_particle_release_time
+! 
+! 3049 2018-05-29 13:52:36Z Giersch
 ! Error messages revised
 ! 
@@ -93,12 +96,12 @@
     USE kinds
 
-    USE lpm_pack_and_sort_mod,                                                   &
+    USE lpm_pack_and_sort_mod,                                                 &
         ONLY:  lpm_sort_in_subboxes
 
     USE particle_attributes,                                                   &
         ONLY:  alloc_factor, bc_par_b, bc_par_lr, bc_par_ns, bc_par_t,         &
-               grid_particles, min_nr_particle, number_of_particles,           &
-               number_of_particle_groups, particle_groups, particle_type,      &
-               prt_count, time_prel, time_write_particle_data, zero_particle
+               grid_particles, last_particle_release_time, min_nr_particle,    &
+               number_of_particles, number_of_particle_groups, particle_groups,&
+               particle_type, prt_count, time_write_particle_data, zero_particle
 
     USE pegrid
@@ -153,6 +156,6 @@
 !-- allocate them and read their contents.
     READ ( 90 )  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t,                     &
-                 number_of_particle_groups, particle_groups, time_prel,        &
-                 time_write_particle_data
+                 last_particle_release_time, number_of_particle_groups,        &
+                 particle_groups, time_write_particle_data
 
     ALLOCATE( prt_count(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                        &
Index: palm/trunk/SOURCE/lpm_write_restart_file.f90
===================================================================
--- palm/trunk/SOURCE/lpm_write_restart_file.f90	(revision 3556)
+++ palm/trunk/SOURCE/lpm_write_restart_file.f90	(revision 3560)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! time_prel replaced by last_particle_release_time
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -75,7 +78,7 @@
     USE particle_attributes,                                                   &
         ONLY:  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, grid_particles,       &
-               number_of_particles, number_of_particle_groups,                 &
-               particles, particle_groups, prt_count, time_prel,               &
-               time_write_particle_data
+               last_particle_release_time, number_of_particles,                &
+               number_of_particle_groups, particles, particle_groups,          &
+               prt_count, time_write_particle_data
 
     USE pegrid
@@ -119,7 +122,7 @@
 !-- Write some particle parameters, the size of the particle arrays as
 !-- well as other dvrp-plot variables.
-    WRITE ( 90 )  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t,              &
-                  number_of_particle_groups, particle_groups, time_prel, &
-                  time_write_particle_data
+    WRITE ( 90 )  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t,                    &
+                  last_particle_release_time, number_of_particle_groups,       &
+                  particle_groups, time_write_particle_data
 
     WRITE ( 90 )  prt_count
Index: palm/trunk/SOURCE/mod_particle_attributes.f90
===================================================================
--- palm/trunk/SOURCE/mod_particle_attributes.f90	(revision 3556)
+++ palm/trunk/SOURCE/mod_particle_attributes.f90	(revision 3560)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! time_prel replaced by last_particle_release_time
+! 
+! 3405 2018-10-23 15:34:41Z raasch
 ! bugfix: BIND attribute added to derived type particle_type
 ! 
@@ -186,4 +189,5 @@
     REAL(wp) ::  end_time_prel = 9999999.9_wp              !< namelist parameter (see documentation)
     REAL(wp) ::  initial_weighting_factor = 1.0_wp         !< namelist parameter (see documentation)
+    REAL(wp) ::  last_particle_release_time = 0.0_wp       !< last time of particle release
     REAL(wp) ::  log_sigma(3) = 1.0_wp                     !< namelist parameter (see documentation)
     REAL(wp) ::  na(3) = 0.0_wp                            !< namelist parameter (see documentation)
@@ -194,5 +198,4 @@
     REAL(wp) ::  rm(3) = 1.0E-6_wp                         !< namelist parameter (see documentation)
     REAL(wp) ::  sgs_wf_part                               !< parameter for sgs
-    REAL(wp) ::  time_prel = 0.0_wp                        !< time for particle release
     REAL(wp) ::  time_write_particle_data = 0.0_wp         !< write particle data at current time on file
     REAL(wp) ::  weight_factor_merge = -1.0_wp             !< namelist parameter (see documentation)
Index: palm/trunk/SOURCE/netcdf_data_input_mod.f90
===================================================================
--- palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 3556)
+++ palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 3560)
@@ -20,9 +20,12 @@
 ! Current revisions:
 ! -----------------
-! Some formatting adjustment
+! 
 ! 
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Some formatting adjustment
+! 
+! 3556 2018-11-22 14:11:57Z suehring
 ! variables documented and unused variables removed
 ! 
Index: palm/trunk/SOURCE/surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/surface_mod.f90	(revision 3556)
+++ palm/trunk/SOURCE/surface_mod.f90	(revision 3560)
@@ -21,9 +21,12 @@
 ! Current revisions:
 ! ------------------
-! Surface restoring in restarts commented. Some formatting. 
+! 
 ! 
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Surface restoring in restarts commented. Some formatting. 
+! 
+! 3556 2018-11-22 14:11:57Z suehring
 ! variables documented
 ! 
