Index: palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_3d_model.f90	(revision 4329)
+++ palm/trunk/SOURCE/init_3d_model.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
 ! 
@@ -777,7 +781,7 @@
 !--       Set velocity components at non-atmospheric / oceanic grid points to 
 !--       zero. 
-          u = MERGE( u, 0.0_wp, BTEST( wall_flags_static_0, 1 ) )
-          v = MERGE( v, 0.0_wp, BTEST( wall_flags_static_0, 2 ) )
-          w = MERGE( w, 0.0_wp, BTEST( wall_flags_static_0, 3 ) )
+          u = MERGE( u, 0.0_wp, BTEST( wall_flags_total_0, 1 ) )
+          v = MERGE( v, 0.0_wp, BTEST( wall_flags_total_0, 2 ) )
+          w = MERGE( w, 0.0_wp, BTEST( wall_flags_total_0, 3 ) )
 !
 !--       Initialize surface variables, e.g. friction velocity, momentum 
@@ -827,6 +831,6 @@
 !
 !--       Set velocities back to zero
-          u = MERGE( u, 0.0_wp, BTEST( wall_flags_static_0, 1 ) )
-          v = MERGE( v, 0.0_wp, BTEST( wall_flags_static_0, 2 ) )         
+          u = MERGE( u, 0.0_wp, BTEST( wall_flags_total_0, 1 ) )
+          v = MERGE( v, 0.0_wp, BTEST( wall_flags_total_0, 2 ) )         
 !
 !--       WARNING: The extra boundary conditions set after running the
@@ -871,6 +875,6 @@
 !
 !--       Mask topography
-          u = MERGE( u, 0.0_wp, BTEST( wall_flags_static_0, 1 ) )
-          v = MERGE( v, 0.0_wp, BTEST( wall_flags_static_0, 2 ) )
+          u = MERGE( u, 0.0_wp, BTEST( wall_flags_total_0, 1 ) )
+          v = MERGE( v, 0.0_wp, BTEST( wall_flags_total_0, 2 ) )
 !
 !--       Set initial horizontal velocities at the lowest computational grid 
@@ -887,7 +891,7 @@
                    DO  k = nzb, nzt
                       u(k,j,i) = MERGE( u(k,j,i), 0.0_wp,                      &
-                                        BTEST( wall_flags_static_0(k,j,i), 20 ) )
+                                     BTEST( wall_flags_total_0(k,j,i), 20 ) )
                       v(k,j,i) = MERGE( v(k,j,i), 0.0_wp,                      &
-                                        BTEST( wall_flags_static_0(k,j,i), 21 ) )
+                                     BTEST( wall_flags_total_0(k,j,i), 21 ) )
                    ENDDO
                 ENDDO
@@ -1313,9 +1317,9 @@
                 DO  k = nzb, nzt
                    u(k,j,i)     = MERGE( u(k,j,i), 0.0_wp,                     &
-                                         BTEST( wall_flags_static_0(k,j,i), 1 ) )
+                                      BTEST( wall_flags_total_0(k,j,i), 1 ) )
                    v(k,j,i)     = MERGE( v(k,j,i), 0.0_wp,                     &
-                                         BTEST( wall_flags_static_0(k,j,i), 2 ) )
+                                      BTEST( wall_flags_total_0(k,j,i), 2 ) )
                    w(k,j,i)     = MERGE( w(k,j,i), 0.0_wp,                     &
-                                         BTEST( wall_flags_static_0(k,j,i), 3 ) )
+                                      BTEST( wall_flags_total_0(k,j,i), 3 ) )
                 ENDDO
              ENDDO
@@ -1395,13 +1399,13 @@
              DO  j = nys, nyn
                 DO  k = nzb+1, nzt
-                   volume_flow_initial_l(1) = volume_flow_initial_l(1) +       &
-                                              u_init(k) * dzw(k)               &
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,j,nxr), 1 )&
+                   volume_flow_initial_l(1) = volume_flow_initial_l(1) +         &
+                                              u_init(k) * dzw(k)                 &
+                                     * MERGE( 1.0_wp, 0.0_wp,                    &
+                                          BTEST( wall_flags_total_0(k,j,nxr), 1 )&
                                             )
 
-                   volume_flow_area_l(1)    = volume_flow_area_l(1) + dzw(k)   &
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,j,nxr), 1 )&
+                   volume_flow_area_l(1)    = volume_flow_area_l(1) + dzw(k)     &
+                                     * MERGE( 1.0_wp, 0.0_wp,                    &
+                                          BTEST( wall_flags_total_0(k,j,nxr), 1 )&
                                             )
                 ENDDO
@@ -1412,12 +1416,12 @@
              DO  i = nxl, nxr
                 DO  k = nzb+1, nzt
-                   volume_flow_initial_l(2) = volume_flow_initial_l(2) +       &
-                                              v_init(k) * dzw(k)               &        
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,nyn,i), 2 )&
+                   volume_flow_initial_l(2) = volume_flow_initial_l(2) +         &
+                                              v_init(k) * dzw(k)                 &        
+                                     * MERGE( 1.0_wp, 0.0_wp,                    &
+                                          BTEST( wall_flags_total_0(k,nyn,i), 2 )&
                                             )
-                   volume_flow_area_l(2)    = volume_flow_area_l(2) + dzw(k)   &        
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,nyn,i), 2 )&
+                   volume_flow_area_l(2)    = volume_flow_area_l(2) + dzw(k)     &        
+                                     * MERGE( 1.0_wp, 0.0_wp,                    &
+                                          BTEST( wall_flags_total_0(k,nyn,i), 2 )&
                                             )
                 ENDDO
@@ -1444,12 +1448,12 @@
              DO  j = nys, nyn
                 DO  k = nzb+1, nzt
-                   volume_flow_initial_l(1) = volume_flow_initial_l(1) +       &
-                                              hom_sum(k,1,0) * dzw(k)          &
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,j,nx), 1 ) &
+                   volume_flow_initial_l(1) = volume_flow_initial_l(1) +         &
+                                              hom_sum(k,1,0) * dzw(k)            &
+                                     * MERGE( 1.0_wp, 0.0_wp,                    &
+                                          BTEST( wall_flags_total_0(k,j,nx), 1 ) &
                                             )
-                   volume_flow_area_l(1)    = volume_flow_area_l(1) + dzw(k)   &
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,j,nx), 1 ) &
+                   volume_flow_area_l(1)    = volume_flow_area_l(1) + dzw(k)     &
+                                     * MERGE( 1.0_wp, 0.0_wp,                    &
+                                          BTEST( wall_flags_total_0(k,j,nx), 1 ) &
                                             )
                 ENDDO
@@ -1460,12 +1464,12 @@
              DO  i = nxl, nxr
                 DO  k = nzb+1, nzt
-                   volume_flow_initial_l(2) = volume_flow_initial_l(2) +       &
-                                              hom_sum(k,2,0) * dzw(k)          &        
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,ny,i), 2 ) &
+                   volume_flow_initial_l(2) = volume_flow_initial_l(2) +         &
+                                              hom_sum(k,2,0) * dzw(k)            &        
+                                     * MERGE( 1.0_wp, 0.0_wp,                    &
+                                          BTEST( wall_flags_total_0(k,ny,i), 2 ) &
                                             )
-                   volume_flow_area_l(2)    = volume_flow_area_l(2) + dzw(k)   &        
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,ny,i), 2 ) &
+                   volume_flow_area_l(2)    = volume_flow_area_l(2) + dzw(k)     &        
+                                     * MERGE( 1.0_wp, 0.0_wp,                    &
+                                          BTEST( wall_flags_total_0(k,ny,i), 2 ) &
                                             )
                 ENDDO
@@ -1492,12 +1496,12 @@
              DO  j = nys, nyn
                 DO  k = nzb+1, nzt
-                   volume_flow_initial_l(1) = volume_flow_initial_l(1) +       &
-                                              u(k,j,nx) * dzw(k)               &
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,j,nx), 1 ) &
+                   volume_flow_initial_l(1) = volume_flow_initial_l(1) +         &
+                                              u(k,j,nx) * dzw(k)                 &
+                                     * MERGE( 1.0_wp, 0.0_wp,                    &
+                                          BTEST( wall_flags_total_0(k,j,nx), 1 ) &
                                             )
-                   volume_flow_area_l(1)    = volume_flow_area_l(1) + dzw(k)   &
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,j,nx), 1 ) &
+                   volume_flow_area_l(1)    = volume_flow_area_l(1) + dzw(k)     &
+                                     * MERGE( 1.0_wp, 0.0_wp,                    &
+                                          BTEST( wall_flags_total_0(k,j,nx), 1 ) &
                                             )
                 ENDDO
@@ -1508,12 +1512,12 @@
              DO  i = nxl, nxr
                 DO  k = nzb+1, nzt
-                   volume_flow_initial_l(2) = volume_flow_initial_l(2) +       &
-                                              v(k,ny,i) * dzw(k)               &        
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,ny,i), 2 ) &
+                   volume_flow_initial_l(2) = volume_flow_initial_l(2) +         &
+                                              v(k,ny,i) * dzw(k)                 &        
+                                     * MERGE( 1.0_wp, 0.0_wp,                    &
+                                          BTEST( wall_flags_total_0(k,ny,i), 2 ) &
                                             )
-                   volume_flow_area_l(2)    = volume_flow_area_l(2) + dzw(k)   &        
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,ny,i), 2 ) &
+                   volume_flow_area_l(2)    = volume_flow_area_l(2) + dzw(k)     &        
+                                     * MERGE( 1.0_wp, 0.0_wp,                    &
+                                          BTEST( wall_flags_total_0(k,ny,i), 2 ) &
                                             )
                 ENDDO
@@ -1696,8 +1700,8 @@
 !--                xy-grid points above topography
                    ngp_2dh_outer_l(k,sr) = ngp_2dh_outer_l(k,sr)     +         &
-                                  MERGE( 1, 0, BTEST( wall_flags_static_0(k,j,i), 24 ) )
+                             MERGE( 1, 0, BTEST( wall_flags_total_0(k,j,i), 24 ) )
 
                    ngp_2dh_s_inner_l(k,sr) = ngp_2dh_s_inner_l(k,sr) +         &
-                                  MERGE( 1, 0, BTEST( wall_flags_static_0(k,j,i), 22 ) )
+                             MERGE( 1, 0, BTEST( wall_flags_total_0(k,j,i), 22 ) )
 
                 ENDDO
@@ -1795,5 +1799,5 @@
 !$ACC COPYIN(rho_air(nzb:nzt+1), rho_air_zw(nzb:nzt+1)) &
 !$ACC COPYIN(ddzu(1:nzt+1), ddzw(1:nzt+1)) &
-!$ACC COPYIN(wall_flags_static_0(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
+!$ACC COPYIN(wall_flags_total_0(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
 !$ACC COPYIN(bc_h(0:1)) &
 !$ACC COPYIN(bc_h(0)%i(1:bc_h(0)%ns)) &
