Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 4329)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 4346)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Introduction of wall_flags_total_0, which currently sets bits based on static
+! topography information used in wall_flags_static_0
+! 
+! 4329 2019-12-10 15:46:36Z motisi
 ! Renamed wall_flags_0 to wall_flags_static_0
 ! 
@@ -95,5 +99,5 @@
         ONLY:   ngp_2dh, ngp_2dh_s_inner, ngp_3d, ngp_3d_inner, ngp_sums,      &
                 ngp_sums_ls, nxl, nxr, nyn, nys, nzb, nzt, topo_min_level,     &
-                wall_flags_static_0
+                wall_flags_total_0
         
     USE kinds
@@ -257,9 +261,9 @@
        !$OMP DO
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k, flag) &
-       !$ACC PRESENT(wall_flags_static_0, u, v, pt, rmask, sums_l)
+       !$ACC PRESENT(wall_flags_total_0, u, v, pt, rmask, sums_l)
        DO  i = nxl, nxr
           DO  j =  nys, nyn
              DO  k = nzb, nzt+1
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) )
                 !$ACC ATOMIC
                 sums_l(k,1,tn)  = sums_l(k,1,tn)  + u(k,j,i)  * rmask(j,i,sr)  &
@@ -286,5 +290,5 @@
                                     * rmask(j,i,sr)                            &
                                     * MERGE( 1.0_wp, 0.0_wp,                   &
-                                             BTEST( wall_flags_static_0(k,j,i), 22 ) )
+                                             BTEST( wall_flags_total_0(k,j,i), 22 ) )
                 ENDDO
              ENDDO
@@ -301,5 +305,5 @@
              DO  j =  nys, nyn
                 DO  k = nzb, nzt+1
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) )
                    sums_l(k,44,tn)  = sums_l(k,44,tn) +                        &
                                       vpt(k,j,i) * rmask(j,i,sr) * flag
@@ -314,5 +318,5 @@
                 DO  j =  nys, nyn
                    DO  k = nzb, nzt+1
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) )
                       sums_l(k,42,tn) = sums_l(k,42,tn) +                      &
                                       ( q(k,j,i) - ql(k,j,i) ) * rmask(j,i,sr) &
@@ -338,5 +342,5 @@
                                     * rmask(j,i,sr)                            &
                                     * MERGE( 1.0_wp, 0.0_wp,                   &
-                                             BTEST( wall_flags_static_0(k,j,i), 22 ) )
+                                             BTEST( wall_flags_total_0(k,j,i), 22 ) )
                 ENDDO
              ENDDO
@@ -479,5 +483,5 @@
        !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j, k, m) &
        !$ACC PRIVATE(sums_l_etot, flag) &
-       !$ACC PRESENT(wall_flags_static_0, rmask, momentumflux_output_conversion) &
+       !$ACC PRESENT(wall_flags_total_0, rmask, momentumflux_output_conversion) &
        !$ACC PRESENT(hom(:,1,4,sr)) &
        !$ACC PRESENT(e, u, v, w, km, kh, p, pt) &
@@ -488,5 +492,5 @@
              sums_l_etot = 0.0_wp
              DO  k = nzb, nzt+1
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) )
 !
 !--             Prognostic and diagnostic variables
@@ -656,5 +660,5 @@
              DO  j =  nys, nyn
                 DO  k = nzb, nzt+1
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) )
 
                    u2   = u(k,j,i)**2
@@ -688,10 +692,10 @@
        !$OMP DO
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k, flag, w2, ust2, vst2) &
-       !$ACC PRESENT(wall_flags_static_0, u, v, w, rmask, hom(:,1,1:2,sr)) &
+       !$ACC PRESENT(wall_flags_total_0, u, v, w, rmask, hom(:,1,1:2,sr)) &
        !$ACC PRESENT(sums_l)
        DO  i = nxl, nxr
           DO  j =  nys, nyn
              DO  k = nzb, nzt+1
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) )
 
                 w2   = w(k,j,i)**2
@@ -717,5 +721,5 @@
        !$ACC PRIVATE(ki, flag, ust, vst, pts) &
        !$ACC PRESENT(kh, km, u, v, w, pt) &
-       !$ACC PRESENT(wall_flags_static_0, rmask, ddzu, rho_air_zw, hom(:,1,1:4,sr)) &
+       !$ACC PRESENT(wall_flags_total_0, rmask, ddzu, rho_air_zw, hom(:,1,1:4,sr)) &
        !$ACC PRESENT(heatflux_output_conversion, momentumflux_output_conversion) &
        !$ACC PRESENT(surf_def_h(0:2), surf_lsm_h, surf_usm_h) &
@@ -735,7 +739,7 @@
              DO  k = nzb, nzt
                 flag = MERGE( 1.0_wp, 0.0_wp,                                  &
-                              BTEST( wall_flags_static_0(k,j,i), 23 ) ) *             &
+                              BTEST( wall_flags_total_0(k,j,i), 23 ) ) *       &
                        MERGE( 1.0_wp, 0.0_wp,                                  &
-                              BTEST( wall_flags_static_0(k,j,i), 9  ) )
+                              BTEST( wall_flags_total_0(k,j,i), 9  ) )
 !
 !--             Momentum flux w"u"
@@ -1209,5 +1213,5 @@
 !--                rearranged according to the staggered grid.
              DO  k = nzb, nzt
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 22 ) )
                 ust = 0.5_wp * ( u(k,j,i)   - hom(k,1,1,sr) +                  &
                                  u(k+1,j,i) - hom(k+1,1,1,sr) )
@@ -1398,7 +1402,7 @@
 !--                fluxes, which are added further below. 
                    flag = MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_static_0(k,j,i), 23 ) ) *          &
+                                 BTEST( wall_flags_total_0(k,j,i), 23 ) ) *    &
                           MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_static_0(k,j,i), 9  ) )
+                                 BTEST( wall_flags_total_0(k,j,i), 9  ) )
 
                    ust = 0.5_wp * ( u(k,j,i)   - hom(k,1,1,sr) +               &
@@ -1433,7 +1437,7 @@
                 DO  k = nzb, nzt
                    flag = MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_static_0(k,j,i), 23 ) ) *          &
+                                 BTEST( wall_flags_total_0(k,j,i), 23 ) ) *    &
                           MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_static_0(k,j,i), 9  ) )
+                                 BTEST( wall_flags_total_0(k,j,i), 9  ) )
 !
 !--                Vertical heat flux
@@ -1484,5 +1488,5 @@
              DO  j = nys, nyn
                 DO  k = nzb+1, nzt
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 
                    sums_ll(k,1) = sums_ll(k,1) + 0.5_wp * w(k,j,i) * (         &
@@ -1526,5 +1530,5 @@
                 DO  k = nzb+1, nzt
 
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 
                    sums_l(k,57,tn) = sums_l(k,57,tn) - 0.5_wp * (              &
@@ -1555,5 +1559,5 @@
              DO  j = nys, nyn
                 DO  k = nzb+1, nzt
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 !
 !--                Subgrid horizontal heat fluxes u"pt", v"pt"
@@ -1653,5 +1657,5 @@
              DO  j =  nys, nyn
                 DO  k = nzb+1, nzt+1
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 
                    sums_l(k,100,tn)  = sums_l(k,100,tn)  + rad_lw_in(k,j,i)    &
