Index: palm/trunk/SOURCE/lpm_release_set.f90
===================================================================
--- palm/trunk/SOURCE/lpm_release_set.f90	(revision 1329)
+++ palm/trunk/SOURCE/lpm_release_set.f90	(revision 1359)
@@ -20,5 +20,7 @@
 ! Current revisions:
 ! ------------------
-! 
+! New particle structure integrated. 
+! Kind definition added to all floating point numbers.
+! lpm_init changed form a subroutine to a module.
 ! 
 ! Former revisions:
@@ -53,4 +55,7 @@
         ONLY:  iran, message_string, netcdf_data_format
 
+    USE lpm_init_mod,                                                          &
+        ONLY: lpm_create_particle, PHASE_RELEASE
+
     USE grid_variables,                                                        &
         ONLY:  dx, dy
@@ -62,13 +67,6 @@
 
     USE particle_attributes,                                                   &
-        ONLY:  initial_particles, iran_part, maximum_number_of_particles,      &
-               maximum_number_of_tails, minimum_tailpoint_distance,            &
-               number_of_initial_particles, number_of_initial_tails,           &
-               number_of_particles, number_of_tails, particles,                &
-               particle_tail_coordinates, pdx, pdy, pdz, psb, psl, psn, psr,   &
-               pss, pst, random_start_position, use_particle_tails
-
-    USE random_function_mod,                                                   &
-        ONLY:  random_function
+        ONLY:  minimum_tailpoint_distance, number_of_tails, particles,         &
+               particle_tail_coordinates, use_particle_tails
 
     IMPLICIT NONE
@@ -80,115 +78,41 @@
 
 
+    CALL lpm_create_particle(PHASE_RELEASE)
 !
-!-- Check, if particle storage must be extended
-    IF ( number_of_particles + number_of_initial_particles > &
-         maximum_number_of_particles  )  THEN
-       IF ( netcdf_data_format < 3 )  THEN
-          message_string = 'maximum_number_of_particles needs to be increa' // &
-                           'sed &but this is not allowed with netcdf_data_' // &
-                           'format < 3'
-          CALL message( 'lpm_release_set', 'PA0146', 2, 2, -1, 6, 1 )
-       ELSE
-          CALL lpm_extend_particle_array( number_of_initial_particles )
-       ENDIF
-    ENDIF
+!-- particle tails currently not available
+! !
+! !-- Set the beginning of the new particle tails and their age
+!     IF ( use_particle_tails )  THEN
+! 
+!        DO  n = is, ie
+! !
+! !--       New particles which should have a tail, already have got a
+! !--       provisional tail id unequal zero (see lpm_init)
+!           IF ( particles(n)%tail_id /= 0 )  THEN
+! 
+!              number_of_tails = number_of_tails + 1
+!              nn = number_of_tails
+!              particles(n)%tail_id = nn   ! set the final tail id
+!              particle_tail_coordinates(1,1,nn) = particles(n)%x
+!              particle_tail_coordinates(1,2,nn) = particles(n)%y
+!              particle_tail_coordinates(1,3,nn) = particles(n)%z
+!              particle_tail_coordinates(1,4,nn) = particles(n)%class
+!              particles(n)%tailpoints = 1
+! 
+!              IF ( minimum_tailpoint_distance /= 0.0 )  THEN
+!                 particle_tail_coordinates(2,1,nn) = particles(n)%x
+!                 particle_tail_coordinates(2,2,nn) = particles(n)%y
+!                 particle_tail_coordinates(2,3,nn) = particles(n)%z
+!                 particle_tail_coordinates(2,4,nn) = particles(n)%class
+!                 particle_tail_coordinates(1:2,5,nn) = 0.0_wp
+!                 particles(n)%tailpoints = 2
+!              ENDIF
+! 
+!           ENDIF
+! 
+!        ENDDO
+! 
+!     ENDIF
 
-!
-!-- Check, if tail storage must be extended
-    IF ( use_particle_tails )  THEN
-       IF ( number_of_tails + number_of_initial_tails > &
-            maximum_number_of_tails  )  THEN
-          IF ( netcdf_data_format < 3 )  THEN
-             message_string = 'maximum_number_of_tails needs to be increas' // &
-                              'ed &but this is not allowed with netcdf_dat' // &
-                              'a_format < 3'
-             CALL message( 'lpm_release_set', 'PA0147', 2, 2, -1, 6, 1 )
-          ELSE
-             CALL lpm_extend_tail_array( number_of_initial_tails )
-          ENDIF
-       ENDIF
-    ENDIF
-
-    IF ( number_of_initial_particles /= 0 )  THEN
-
-       is = number_of_particles + 1
-       ie = number_of_particles + number_of_initial_particles
-       particles(is:ie) = initial_particles(1:number_of_initial_particles)
-!
-!--    Add random fluctuation to particle positions. Particles should
-!--    remain in the subdomain.
-       IF ( random_start_position )  THEN
-
-          DO  n = is, ie
-
-             IF ( psl(particles(n)%group) /= psr(particles(n)%group) )  THEN
-                particles(n)%x = particles(n)%x +                         &
-                                 ( random_function( iran_part ) - 0.5 ) * &
-                                 pdx(particles(n)%group)
-                IF ( particles(n)%x  <=  ( nxl - 0.5 ) * dx )  THEN
-                   particles(n)%x = ( nxl - 0.4999999999 ) * dx
-                ELSEIF ( particles(n)%x  >=  ( nxr + 0.5 ) * dx )  THEN
-                   particles(n)%x = ( nxr + 0.4999999999 ) * dx
-                ENDIF
-             ENDIF
-
-             IF ( pss(particles(n)%group) /= psn(particles(n)%group) )  THEN
-                particles(n)%y = particles(n)%y +                         &
-                                 ( random_function( iran_part ) - 0.5 ) * &
-                                 pdy(particles(n)%group)
-                IF ( particles(n)%y  <=  ( nys - 0.5 ) * dy )  THEN
-                   particles(n)%y = ( nys - 0.4999999999 ) * dy
-                ELSEIF ( particles(n)%y  >=  ( nyn + 0.5 ) * dy )  THEN
-                   particles(n)%y = ( nyn + 0.4999999999 ) * dy
-                ENDIF
-             ENDIF
-
-             IF ( psb(particles(n)%group) /= pst(particles(n)%group) )  THEN
-                particles(n)%z = particles(n)%z +                         &
-                                 ( random_function( iran_part ) - 0.5 ) * &
-                                 pdz(particles(n)%group)
-             ENDIF
-
-          ENDDO
-
-       ENDIF
-
-!
-!--    Set the beginning of the new particle tails and their age
-       IF ( use_particle_tails )  THEN
-
-          DO  n = is, ie
-!
-!--          New particles which should have a tail, already have got a
-!--          provisional tail id unequal zero (see lpm_init)
-             IF ( particles(n)%tail_id /= 0 )  THEN
-
-                number_of_tails = number_of_tails + 1
-                nn = number_of_tails
-                particles(n)%tail_id = nn   ! set the final tail id
-                particle_tail_coordinates(1,1,nn) = particles(n)%x
-                particle_tail_coordinates(1,2,nn) = particles(n)%y
-                particle_tail_coordinates(1,3,nn) = particles(n)%z
-                particle_tail_coordinates(1,4,nn) = particles(n)%class
-                particles(n)%tailpoints = 1
-
-                IF ( minimum_tailpoint_distance /= 0.0 )  THEN
-                   particle_tail_coordinates(2,1,nn) = particles(n)%x
-                   particle_tail_coordinates(2,2,nn) = particles(n)%y
-                   particle_tail_coordinates(2,3,nn) = particles(n)%z
-                   particle_tail_coordinates(2,4,nn) = particles(n)%class
-                   particle_tail_coordinates(1:2,5,nn) = 0.0
-                   particles(n)%tailpoints = 2
-                ENDIF
-
-             ENDIF
-
-          ENDDO
-
-       ENDIF
-
-       number_of_particles = number_of_particles + number_of_initial_particles
-
-    ENDIF
 
  END SUBROUTINE lpm_release_set
