Index: palm/trunk/SOURCE/advec_particles.f90
===================================================================
--- palm/trunk/SOURCE/advec_particles.f90	(revision 77)
+++ palm/trunk/SOURCE/advec_particles.f90	(revision 82)
@@ -117,5 +117,5 @@
 !       WRITE (9,*) '--- advec_particles: #1'
 !       WRITE (9,*) '    #of p=',number_of_particles,' #of t=',number_of_tails
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !    ENDIF
 !
@@ -165,5 +165,5 @@
 
 !    WRITE ( 9, * ) '*** advec_particles: ##0.3'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    nd = 0
 !    DO  n = 1, number_of_particles
@@ -172,5 +172,5 @@
 !    IF ( nd /= deleted_particles ) THEN
 !       WRITE (9,*) '*** nd=',nd,' deleted_particles=',deleted_particles
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !       CALL MPI_ABORT( comm2d, 9999, ierr )
 !    ENDIF
@@ -1872,5 +1872,5 @@
 
 !    WRITE ( 9, * ) '*** advec_particles: ##0.4'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    nd = 0
 !    DO  n = 1, number_of_particles
@@ -1879,5 +1879,5 @@
 !    IF ( nd /= deleted_particles ) THEN
 !       WRITE (9,*) '*** nd=',nd,' deleted_particles=',deleted_particles
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !       CALL MPI_ABORT( comm2d, 9999, ierr )
 !    ENDIF
@@ -1904,8 +1904,8 @@
              ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_prt_memory dt_prel'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                 CALL allocate_prt_memory( number_of_initial_particles )
 !    WRITE ( 9, * ) '*** advec_particles: after allocate_prt_memory dt_prel'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
              ENDIF
           ENDIF
@@ -1928,8 +1928,8 @@
                 ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_tail_memory dt_prel'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                    CALL allocate_tail_memory( number_of_initial_tails )
 !    WRITE ( 9, * ) '*** advec_particles: after allocate_tail_memory dt_prel'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                 ENDIF
              ENDIF
@@ -2008,5 +2008,5 @@
              ENDIF
 !    WRITE ( 9, * ) '*** advec_particles: after setting the beginning of new tails'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 
              number_of_particles = number_of_particles + &
@@ -2017,5 +2017,5 @@
 
 !    WRITE ( 9, * ) '*** advec_particles: ##0.5'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    nd = 0
 !    DO  n = 1, number_of_particles
@@ -2024,5 +2024,5 @@
 !    IF ( nd /= deleted_particles ) THEN
 !       WRITE (9,*) '*** nd=',nd,' deleted_particles=',deleted_particles
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !       CALL MPI_ABORT( comm2d, 9999, ierr )
 !    ENDIF
@@ -2031,5 +2031,5 @@
 !       WRITE (9,*) '--- advec_particles: #2'
 !       WRITE (9,*) '    #of p=',number_of_particles,' #of t=',number_of_tails
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !    ENDIF
 !    DO  n = 1, number_of_particles
@@ -2038,5 +2038,5 @@
 !          WRITE (9,*) '+++ n=',n,' (of ',number_of_particles,')'
 !          WRITE (9,*) '    id=',particles(n)%tail_id,' of (',number_of_tails,')'
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -2103,5 +2103,5 @@
 
 !    WRITE ( 9, * ) '*** advec_particles: ##1'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    nd = 0
 !    DO  n = 1, number_of_particles
@@ -2111,5 +2111,5 @@
 !          WRITE (9,*) '+++ n=',n,' (of ',number_of_particles,')'
 !          WRITE (9,*) '    id=',particles(n)%tail_id,' of (',number_of_tails,')'
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -2117,5 +2117,5 @@
 !    IF ( nd /= deleted_particles ) THEN
 !       WRITE (9,*) '*** nd=',nd,' deleted_particles=',deleted_particles
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !       CALL MPI_ABORT( comm2d, 9999, ierr )
 !    ENDIF
@@ -2274,5 +2274,5 @@
 
 !    WRITE ( 9, * ) '*** advec_particles: ##2'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    nd = 0
 !    DO  n = 1, number_of_particles
@@ -2282,5 +2282,5 @@
 !          WRITE (9,*) '+++ n=',n,' (of ',number_of_particles,')'
 !          WRITE (9,*) '    id=',particles(n)%tail_id,' of (',number_of_tails,')'
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -2288,5 +2288,5 @@
 !    IF ( nd /= deleted_particles ) THEN
 !       WRITE (9,*) '*** nd=',nd,' deleted_particles=',deleted_particles
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !       CALL MPI_ABORT( comm2d, 9999, ierr )
 !    ENDIF
@@ -2313,8 +2313,8 @@
              ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_prt_memory trrp'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                 CALL allocate_prt_memory( trrp_count_recv )
 !    WRITE ( 9, * ) '*** advec_particles: after allocate_prt_memory trrp'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
              ENDIF
           ENDIF
@@ -2341,8 +2341,8 @@
                 ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_tail_memory trrpt'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                    CALL allocate_tail_memory( trrpt_count_recv )
 !    WRITE ( 9, * ) '*** advec_particles: after allocate_tail_memory trrpt'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                 ENDIF
              ENDIF
@@ -2370,5 +2370,5 @@
 !          WRITE (9,*) '--- advec_particles: #3'
 !          WRITE (9,*) '    #of p=',number_of_particles,' #of t=',number_of_tails
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !       ENDIF
 
@@ -2390,8 +2390,8 @@
              ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_prt_memory trlp'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                 CALL allocate_prt_memory( trlp_count_recv )
 !    WRITE ( 9, * ) '*** advec_particles: after allocate_prt_memory trlp'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
              ENDIF
           ENDIF
@@ -2418,8 +2418,8 @@
                 ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_tail_memory trlpt'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                    CALL allocate_tail_memory( trlpt_count_recv )
 !    WRITE ( 9, * ) '*** advec_particles: after allocate_tail_memory trlpt'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                 ENDIF
              ENDIF
@@ -2447,5 +2447,5 @@
 !          WRITE (9,*) '--- advec_particles: #4'
 !          WRITE (9,*) '    #of p=',number_of_particles,' #of t=',number_of_tails
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !       ENDIF
 
@@ -2460,5 +2460,5 @@
 
 !    WRITE ( 9, * ) '*** advec_particles: ##3'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    nd = 0
 !    DO  n = 1, number_of_particles
@@ -2468,5 +2468,5 @@
 !          WRITE (9,*) '+++ n=',n,' (of ',number_of_particles,')'
 !          WRITE (9,*) '    id=',particles(n)%tail_id,' of (',number_of_tails,')'
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -2474,5 +2474,5 @@
 !    IF ( nd /= deleted_particles ) THEN
 !       WRITE (9,*) '*** nd=',nd,' deleted_particles=',deleted_particles
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !       CALL MPI_ABORT( comm2d, 9999, ierr )
 !    ENDIF
@@ -2538,5 +2538,5 @@
 
 !    WRITE ( 9, * ) '*** advec_particles: ##4'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    nd = 0
 !    DO  n = 1, number_of_particles
@@ -2546,5 +2546,5 @@
 !          WRITE (9,*) '+++ n=',n,' (of ',number_of_particles,')'
 !          WRITE (9,*) '    id=',particles(n)%tail_id,' of (',number_of_tails,')'
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -2552,5 +2552,5 @@
 !    IF ( nd /= deleted_particles ) THEN
 !       WRITE (9,*) '*** nd=',nd,' deleted_particles=',deleted_particles
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !       CALL MPI_ABORT( comm2d, 9999, ierr )
 !    ENDIF
@@ -2715,5 +2715,5 @@
 
 !    WRITE ( 9, * ) '*** advec_particles: ##5'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    nd = 0
 !    DO  n = 1, number_of_particles
@@ -2723,5 +2723,5 @@
 !          WRITE (9,*) '+++ n=',n,' (of ',number_of_particles,')'
 !          WRITE (9,*) '    id=',particles(n)%tail_id,' of (',number_of_tails,')'
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -2729,5 +2729,5 @@
 !    IF ( nd /= deleted_particles ) THEN
 !       WRITE (9,*) '*** nd=',nd,' deleted_particles=',deleted_particles
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !       CALL MPI_ABORT( comm2d, 9999, ierr )
 !    ENDIF
@@ -2754,8 +2754,8 @@
              ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_prt_memory trnp'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                 CALL allocate_prt_memory( trnp_count_recv )
 !    WRITE ( 9, * ) '*** advec_particles: after allocate_prt_memory trnp'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
              ENDIF
           ENDIF
@@ -2782,8 +2782,8 @@
                 ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_tail_memory trnpt'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                    CALL allocate_tail_memory( trnpt_count_recv )
 !    WRITE ( 9, * ) '*** advec_particles: after allocate_tail_memory trnpt'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                 ENDIF
              ENDIF
@@ -2811,5 +2811,5 @@
 !          WRITE (9,*) '--- advec_particles: #5'
 !          WRITE (9,*) '    #of p=',number_of_particles,' #of t=',number_of_tails
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !       ENDIF
 
@@ -2831,8 +2831,8 @@
              ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_prt_memory trsp'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                 CALL allocate_prt_memory( trsp_count_recv )
 !    WRITE ( 9, * ) '*** advec_particles: after allocate_prt_memory trsp'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
              ENDIF
           ENDIF
@@ -2859,8 +2859,8 @@
                 ELSE
 !    WRITE ( 9, * ) '*** advec_particles: before allocate_tail_memory trspt'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                    CALL allocate_tail_memory( trspt_count_recv )
 !    WRITE ( 9, * ) '*** advec_particles: after allocate_tail_memory trspt'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
                 ENDIF
              ENDIF
@@ -2888,5 +2888,5 @@
 !          WRITE (9,*) '--- advec_particles: #6'
 !          WRITE (9,*) '    #of p=',number_of_particles,' #of t=',number_of_tails
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !       ENDIF
 
@@ -2901,5 +2901,5 @@
 
 !    WRITE ( 9, * ) '*** advec_particles: ##6'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    nd = 0
 !    DO  n = 1, number_of_particles
@@ -2909,5 +2909,5 @@
 !          WRITE (9,*) '+++ n=',n,' (of ',number_of_particles,')'
 !          WRITE (9,*) '    id=',particles(n)%tail_id,' of (',number_of_tails,')'
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -2915,5 +2915,5 @@
 !    IF ( nd /= deleted_particles ) THEN
 !       WRITE (9,*) '*** nd=',nd,' deleted_particles=',deleted_particles
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !       CALL MPI_ABORT( comm2d, 9999, ierr )
 !    ENDIF
@@ -3133,5 +3133,5 @@
 
 !    WRITE ( 9, * ) '*** advec_particles: ##7'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    nd = 0
 !    DO  n = 1, number_of_particles
@@ -3141,5 +3141,5 @@
 !          WRITE (9,*) '+++ n=',n,' (of ',number_of_particles,')'
 !          WRITE (9,*) '    id=',particles(n)%tail_id,' of (',number_of_tails,')'
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -3147,5 +3147,5 @@
 !    IF ( nd /= deleted_particles ) THEN
 !       WRITE (9,*) '*** nd=',nd,' deleted_particles=',deleted_particles
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !       CALL MPI_ABORT( comm2d, 9999, ierr )
 !    ENDIF
@@ -3167,5 +3167,5 @@
 !       IF ( nd /= deleted_particles ) THEN
 !          WRITE (9,*) '*** advec_part nd=',nd,' deleted_particles=',deleted_particles
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -3189,5 +3189,5 @@
 !                WRITE (9,*) '+++ n=',n,' (of ',number_of_tails,' #oftails)'
 !                WRITE (9,*) '    id=',new_tail_id(n)
-!                CALL FLUSH_( 9 )
+!                CALL local_flush( 9 )
                 ENDIF
              ENDDO
@@ -3196,5 +3196,5 @@
 !       IF ( nd /= deleted_tails  .AND.  use_particle_tails ) THEN
 !          WRITE (9,*) '*** advec_part nd=',nd,' deleted_tails=',deleted_tails
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -3211,5 +3211,5 @@
 !        WRITE (9,*) '    new_tail_id=', new_tail_id(particles(n)%tail_id), &
 !                         ' of (',number_of_tails,')'
-!        CALL FLUSH_( 9 )
+!        CALL local_flush( 9 )
 !     ENDIF
                 particles(n)%tail_id = new_tail_id(particles(n)%tail_id)
@@ -3219,5 +3219,5 @@
 !     IF ( nn /= number_of_tails  .AND.  use_particle_tails ) THEN
 !        WRITE (9,*) '*** advec_part #of_tails=',number_of_tails,' nn=',nn
-!        CALL FLUSH_( 9 )
+!        CALL local_flush( 9 )
 !        DO  n = 1, number_of_particles
 !           WRITE (9,*) 'prt# ',n,' tail_id=',particles(n)%tail_id, &
@@ -3233,8 +3233,8 @@
 !       WRITE (9,*) '--- advec_particles: #7'
 !       WRITE (9,*) '    #of p=',number_of_particles,' #of t=',number_of_tails
-!       CALL FLUSH_( 9 )
+!       CALL local_flush( 9 )
 !    ENDIF
 !    WRITE ( 9, * ) '*** advec_particles: ##8'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    DO  n = 1, number_of_particles
 !       IF ( particles(n)%tail_id<0 .OR. particles(n)%tail_id>number_of_tails ) &
@@ -3242,5 +3242,5 @@
 !          WRITE (9,*) '+++ n=',n,' (of ',number_of_particles,')'
 !          WRITE (9,*) '    id=',particles(n)%tail_id,' of (',number_of_tails,')'
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -3252,5 +3252,5 @@
 
 !    WRITE ( 9, * ) '*** advec_particles: ##9'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    DO  n = 1, number_of_particles
 !       IF ( particles(n)%tail_id<0 .OR. particles(n)%tail_id>number_of_tails ) &
@@ -3258,5 +3258,5 @@
 !          WRITE (9,*) '+++ n=',n,' (of ',number_of_particles,')'
 !          WRITE (9,*) '    id=',particles(n)%tail_id,' of (',number_of_tails,')'
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -3341,5 +3341,5 @@
     CALL user_particle_attributes
 !    WRITE ( 9, * ) '*** advec_particles: ##10'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 !    DO  n = 1, number_of_particles
 !       IF ( particles(n)%tail_id<0 .OR. particles(n)%tail_id>number_of_tails ) &
@@ -3347,5 +3347,5 @@
 !          WRITE (9,*) '+++ n=',n,' (of ',number_of_particles,')'
 !          WRITE (9,*) '    id=',particles(n)%tail_id,' of (',number_of_tails,')'
-!          CALL FLUSH_( 9 )
+!          CALL local_flush( 9 )
 !          CALL MPI_ABORT( comm2d, 9999, ierr )
 !       ENDIF
@@ -3366,5 +3366,5 @@
 !--          next tailpoint
 !             WRITE ( 9, * ) '*** advec_particles: ##10.1  nn=',nn
-!             CALL FLUSH_( 9 )
+!             CALL local_flush( 9 )
              IF ( minimum_tailpoint_distance /= 0.0 )  THEN
                 distance = ( particle_tail_coordinates(1,1,nn) -      &
@@ -3376,5 +3376,5 @@
              ENDIF
 !             WRITE ( 9, * ) '*** advec_particles: ##10.2'
-!             CALL FLUSH_( 9 )
+!             CALL local_flush( 9 )
 !
 !--          First, increase the index of all existings tailpoints by one
@@ -3395,5 +3395,5 @@
              ENDIF
 !             WRITE ( 9, * ) '*** advec_particles: ##10.3'
-!             CALL FLUSH_( 9 )
+!             CALL local_flush( 9 )
 !
 !--          In any case, store the new point at the beginning of the tail
@@ -3403,5 +3403,5 @@
              particle_tail_coordinates(1,4,nn) = particles(n)%color
 !             WRITE ( 9, * ) '*** advec_particles: ##10.4'
-!             CALL FLUSH_( 9 )
+!             CALL local_flush( 9 )
 !
 !--          Increase the age of the tailpoints
@@ -3418,5 +3418,5 @@
              ENDIF
 !             WRITE ( 9, * ) '*** advec_particles: ##10.5'
-!             CALL FLUSH_( 9 )
+!             CALL local_flush( 9 )
 
           ENDIF
@@ -3426,5 +3426,5 @@
     ENDIF
 !    WRITE ( 9, * ) '*** advec_particles: ##11'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 
 !
@@ -3533,5 +3533,5 @@
     ENDIF
     WRITE (9,*) '*** Request: ',new_maximum_number,' new_maximum_number(tails)'
-!    CALL FLUSH_( 9 )
+!    CALL local_flush( 9 )
 
     tmp_tail(:,:,1:number_of_tails)  = &
