Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 4462)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 4463)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Calculate horizontally averaged profiles of all velocity components at the 
+! same place
+! 
+! 4444 2020-03-05 15:59:50Z raasch
 ! bugfix: cpp-directives for serial mode added
 ! 
@@ -264,5 +268,5 @@
        ENDIF
 ! 
-!--    Horizontally averaged profiles of horizontal velocities and temperature.
+!--    Horizontally averaged profiles of all velocities and temperature.
 !--    They must have been computed before, because they are already required
 !--    for other horizontal averages.
@@ -284,4 +288,7 @@
                                                               * flag
                 !$ACC ATOMIC
+                sums_l(k,3,tn)  = sums_l(k,3,tn)  + w(k,j,i)  * rmask(j,i,sr)  &
+                                                              * flag
+                !$ACC ATOMIC
                 sums_l(k,4,tn)  = sums_l(k,4,tn)  + pt(k,j,i) * rmask(j,i,sr)  &
                                                               * flag
@@ -289,5 +296,5 @@
           ENDDO
        ENDDO
-       !$ACC UPDATE HOST(sums_l(:,1,tn), sums_l(:,2,tn), sums_l(:,4,tn))
+       !$ACC UPDATE HOST(sums_l(:,1,tn), sums_l(:,2,tn), sums_l(:,3,tn), sums_l(:,4,tn))
 
 !
@@ -365,4 +372,5 @@
              sums_l(:,1,0) = sums_l(:,1,0) + sums_l(:,1,i)
              sums_l(:,2,0) = sums_l(:,2,0) + sums_l(:,2,i)
+             sums_l(:,3,0) = sums_l(:,3,0) + sums_l(:,3,i)
              sums_l(:,4,0) = sums_l(:,4,0) + sums_l(:,4,i)
              IF ( ocean_mode )  THEN
@@ -391,4 +399,7 @@
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
        CALL MPI_ALLREDUCE( sums_l(nzb,2,0), sums(nzb,2), nzt+2-nzb, MPI_REAL,  &
+                           MPI_SUM, comm2d, ierr )
+       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
+       CALL MPI_ALLREDUCE( sums_l(nzb,3,0), sums(nzb,3), nzt+2-nzb, MPI_REAL,  &
                            MPI_SUM, comm2d, ierr )
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
@@ -425,4 +436,5 @@
        sums(:,1) = sums_l(:,1,0)
        sums(:,2) = sums_l(:,2,0)
+       sums(:,3) = sums_l(:,3,0)
        sums(:,4) = sums_l(:,4,0)
        IF ( ocean_mode )  sums(:,23) = sums_l(:,23,0)
@@ -443,11 +455,12 @@
        sums(:,1) = sums(:,1) / ngp_2dh(sr)
        sums(:,2) = sums(:,2) / ngp_2dh(sr)
+       sums(:,3) = sums(:,3) / ngp_2dh(sr)
        sums(:,4) = sums(:,4) / ngp_2dh_s_inner(:,sr)
        hom(:,1,1,sr) = sums(:,1)             ! u
        hom(:,1,2,sr) = sums(:,2)             ! v
+       hom(:,1,3,sr) = sums(:,3)             ! w
        hom(:,1,4,sr) = sums(:,4)             ! pt
-       !$ACC UPDATE DEVICE(hom(:,1,1,sr), hom(:,1,2,sr), hom(:,1,4,sr))
-
-
+       !$ACC UPDATE DEVICE(hom(:,1,1,sr), hom(:,1,2,sr), hom(:,1,3,sr), hom(:,1,4,sr))
+       
 !
 !--    Salinity
@@ -506,7 +519,4 @@
 !
 !--             Prognostic and diagnostic variables
-                !$ACC ATOMIC
-                sums_l(k,3,tn)  = sums_l(k,3,tn)  + w(k,j,i)  * rmask(j,i,sr)  &
-                                                              * flag
                 !$ACC ATOMIC
                 sums_l(k,8,tn)  = sums_l(k,8,tn)  + e(k,j,i)  * rmask(j,i,sr)  &
@@ -1700,5 +1710,4 @@
        IF ( threads_per_task > 1 )  THEN
           DO  i = 1, threads_per_task-1
-             sums_l(:,3,0)          = sums_l(:,3,0) + sums_l(:,3,i)
              sums_l(:,4:40,0)       = sums_l(:,4:40,0) + sums_l(:,4:40,i)
              sums_l(:,45:pr_palm,0) = sums_l(:,45:pr_palm,0) + &
@@ -1774,5 +1783,4 @@
 !--    Profiles:
        DO  k = nzb, nzt+1
-          sums(k,3)             = sums(k,3)             / ngp_2dh(sr)
           sums(k,12:22)         = sums(k,12:22)         / ngp_2dh(sr)
           sums(k,30:32)         = sums(k,30:32)         / ngp_2dh(sr)
@@ -1849,5 +1857,4 @@
 !--    Collect horizontal average in hom.
 !--    Compute deduced averages (e.g. total heat flux)
-       hom(:,1,3,sr)  = sums(:,3)      ! w
        hom(:,1,8,sr)  = sums(:,8)      ! e     profiles 5-7 are initial profiles
        hom(:,1,9,sr)  = sums(:,9)      ! km
