Index: palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90
===================================================================
--- palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 4335)
+++ palm/trunk/SOURCE/synthetic_turbulence_generator_mod.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
+! 
+! 4335 2019-12-12 16:39:05Z suehring
 ! Commentation of last commit
 ! 
@@ -204,5 +208,5 @@
                nyng,                                                           &
                nysg,                                                           &
-               wall_flags_static_0
+               wall_flags_total_0
 
     USE kinds
@@ -986,5 +990,5 @@
        nr_non_topo_yz_l(1) = SUM(                                              &
                           MERGE( 1, 0,                                         &
-                                 BTEST( wall_flags_static_0(nzb:nzt,nys:nyn,i), 1 ) ) )
+                          BTEST( wall_flags_total_0(nzb:nzt,nys:nyn,i), 1 ) ) )
 !
 !--    Number of grid points where perturbations are imposed on v and w                                   
@@ -994,8 +998,8 @@
        nr_non_topo_yz_l(2) = SUM(                                              &
                           MERGE( 1, 0,                                         &
-                                 BTEST( wall_flags_static_0(nzb:nzt,nysv:nyn,i), 2 ) ) )
+                          BTEST( wall_flags_total_0(nzb:nzt,nysv:nyn,i), 2 ) ) )
        nr_non_topo_yz_l(3) = SUM(                                              &
                           MERGE( 1, 0,                                         &
-                                 BTEST( wall_flags_static_0(nzb:nzt,nys:nyn,i), 3 ) ) )
+                          BTEST( wall_flags_total_0(nzb:nzt,nys:nyn,i), 3 ) ) )
                                     
 #if defined( __parallel )
@@ -1015,5 +1019,5 @@
        nr_non_topo_xz_l(2) = SUM(                                              &
                           MERGE( 1, 0,                                         &
-                                 BTEST( wall_flags_static_0(nzb:nzt,j,nxl:nxr), 2 ) ) )
+                          BTEST( wall_flags_total_0(nzb:nzt,j,nxl:nxr), 2 ) ) )
 !
 !--    Number of grid points where perturbations are imposed on u and w 
@@ -1023,8 +1027,8 @@
        nr_non_topo_xz_l(1) = SUM(                                              &
                           MERGE( 1, 0,                                         &
-                                 BTEST( wall_flags_static_0(nzb:nzt,j,nxlu:nxr), 1 ) ) )
+                          BTEST( wall_flags_total_0(nzb:nzt,j,nxlu:nxr), 1 ) ) )
        nr_non_topo_xz_l(3) = SUM(                                              &
                           MERGE( 1, 0,                                         &
-                                 BTEST( wall_flags_static_0(nzb:nzt,j,nxl:nxr), 3 ) ) )
+                          BTEST( wall_flags_total_0(nzb:nzt,j,nxl:nxr), 3 ) ) )
                                     
 #if defined( __parallel )
@@ -1351,5 +1355,5 @@
                 dist_yz(k,j,1) = MIN( a11(k) * fu_yz(k,j), 3.0_wp ) *          &
                                     MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_static_0(k,j,i), 1 ) )
+                                    BTEST( wall_flags_total_0(k,j,i), 1 ) )
              ENDDO
           ENDDO
@@ -1368,5 +1372,5 @@
                                          + a22(k) * fv_yz(k,j) ), 3.0_wp ) *   &
                                     MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_static_0(k,j,i), 2 ) )   
+                                        BTEST( wall_flags_total_0(k,j,i), 2 ) )   
                 dist_yz(k,j,3) = MIN( ( SQRT(a33(k) / MAXVAL(a33) )            &
                                       * 1.3_wp )                               &
@@ -1375,5 +1379,5 @@
                                         + a33(k) * fw_yz(k,j) ), 3.0_wp )  *   &
                                     MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_static_0(k,j,i), 3 ) )
+                                        BTEST( wall_flags_total_0(k,j,i), 3 ) )
              ENDDO
           ENDDO
@@ -1398,5 +1402,5 @@
           mc_factor_l(1) = SUM( dist_yz(nzb:nzt,nys:nyn,1)                     &
                          * MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_static_0(nzb:nzt,nys:nyn,i), 1 ) ) )
+                           BTEST( wall_flags_total_0(nzb:nzt,nys:nyn,i), 1 ) ) )
         
           IF ( myidx == id_stg_left  )  i = nxl-1
@@ -1405,8 +1409,8 @@
           mc_factor_l(2) = SUM( dist_yz(nzb:nzt,nysv:nyn,2)                    &
                           * MERGE( 1.0_wp, 0.0_wp,                             &
-                                   BTEST( wall_flags_static_0(nzb:nzt,nysv:nyn,i), 2 ) ) )
+                            BTEST( wall_flags_total_0(nzb:nzt,nysv:nyn,i), 2 ) ) )
           mc_factor_l(3) = SUM( dist_yz(nzb:nzt,nys:nyn,3)                     &
                           * MERGE( 1.0_wp, 0.0_wp,                             &
-                                   BTEST( wall_flags_static_0(nzb:nzt,nys:nyn,i), 3 ) ) )
+                            BTEST( wall_flags_total_0(nzb:nzt,nys:nyn,i), 3 ) ) )
           
 #if defined( __parallel )
@@ -1425,5 +1429,5 @@
           dist_yz(:,:,1) = ( dist_yz(:,:,1) - mc_factor(1) )                   &
                         * MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_static_0(:,:,i), 1 ) )             
+                          BTEST( wall_flags_total_0(:,:,i), 1 ) )             
                                                                                
                                                                                
@@ -1433,9 +1437,9 @@
           dist_yz(:,:,2) = ( dist_yz(:,:,2) - mc_factor(2) )                   &
                         * MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_static_0(:,:,i), 2 ) )             
+                          BTEST( wall_flags_total_0(:,:,i), 2 ) )             
                                                                                
           dist_yz(:,:,3) = ( dist_yz(:,:,3) - mc_factor(3) )                   &
                         * MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_static_0(:,:,i), 3 ) )
+                          BTEST( wall_flags_total_0(:,:,i), 3 ) )
 !      
 !--       Add disturbances
@@ -1453,12 +1457,12 @@
                                            dist_yz(k,j,1)             )        &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                            BTEST( wall_flags_static_0(k,j,0), 1 ) )  
+                                     BTEST( wall_flags_total_0(k,j,0), 1 ) )  
                       v(k,j,-nbgp:-1)  = ( mean_inflow_profiles(k,2) +         &
                                            dist_yz(k,j,2)             )        &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                            BTEST( wall_flags_static_0(k,j,-1), 2 ) ) 
+                                     BTEST( wall_flags_total_0(k,j,-1), 2 ) ) 
                       w(k,j,-nbgp:-1)  =   dist_yz(k,j,3)                      &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                            BTEST( wall_flags_static_0(k,j,-1), 3 ) )
+                                     BTEST( wall_flags_total_0(k,j,-1), 3 ) )
                    ENDDO
                 ENDDO
@@ -1469,12 +1473,12 @@
                       u(k,j,0)   = ( u(k,j,0) + dist_yz(k,j,1) )               &
                                  * MERGE( 1.0_wp, 0.0_wp,                      &
-                                          BTEST( wall_flags_static_0(k,j,0), 1 ) )
+                                   BTEST( wall_flags_total_0(k,j,0), 1 ) )
                       u(k,j,-1)  = u(k,j,0)
                       v(k,j,-1)  = ( v(k,j,-1)  + dist_yz(k,j,2)  )            &
                                  * MERGE( 1.0_wp, 0.0_wp,                      &
-                                          BTEST( wall_flags_static_0(k,j,-1), 2 ) )
+                                   BTEST( wall_flags_total_0(k,j,-1), 2 ) )
                       w(k,j,-1)  = ( w(k,j,-1)  + dist_yz(k,j,3) )             &
                                  * MERGE( 1.0_wp, 0.0_wp,                      &
-                                          BTEST( wall_flags_static_0(k,j,-1), 3 ) )
+                                   BTEST( wall_flags_total_0(k,j,-1), 3 ) )
                    ENDDO
                 ENDDO
@@ -1486,11 +1490,11 @@
                    u(k,j,nxr+1) = ( u(k,j,nxr+1) + dist_yz(k,j,1) )            &
                                   * MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_static_0(k,j,nxr+1), 1 ) ) 
+                                    BTEST( wall_flags_total_0(k,j,nxr+1), 1 ) ) 
                    v(k,j,nxr+1) = ( v(k,j,nxr+1) + dist_yz(k,j,2) )            &
                                   * MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_static_0(k,j,nxr+1), 2 ) )
+                                    BTEST( wall_flags_total_0(k,j,nxr+1), 2 ) )
                    w(k,j,nxr+1) = ( w(k,j,nxr+1) + dist_yz(k,j,3) )            &
                                   * MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_static_0(k,j,nxr+1), 3 ) )
+                                    BTEST( wall_flags_total_0(k,j,nxr+1), 3 ) )
                 ENDDO
              ENDDO
@@ -1551,5 +1555,5 @@
                                          + a22(k) * fv_xz(k,i) ), 3.0_wp ) *   &
                                     MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_static_0(k,j,i), 2 ) )
+                                    BTEST( wall_flags_total_0(k,j,i), 2 ) )
              ENDDO
           ENDDO
@@ -1564,5 +1568,5 @@
                 dist_xz(k,i,1) = MIN( a11(k) * fu_xz(k,i), 3.0_wp ) *          &
                                     MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_static_0(k,j,i), 1 ) )   
+                                    BTEST( wall_flags_total_0(k,j,i), 1 ) )   
           
                 dist_xz(k,i,3) = MIN( ( SQRT(a33(k) / MAXVAL(a33) )            &
@@ -1572,5 +1576,5 @@
                                         + a33(k) * fw_xz(k,i) ), 3.0_wp )  *   &
                                     MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_static_0(k,j,i), 3 ) ) 
+                                    BTEST( wall_flags_total_0(k,j,i), 3 ) ) 
              ENDDO
           ENDDO
@@ -1593,5 +1597,5 @@
           mc_factor_l(2) = SUM( dist_xz(nzb:nzt,nxl:nxr,2)                     &
                          * MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_static_0(nzb:nzt,j,nxl:nxr), 2 ) ) )
+                           BTEST( wall_flags_total_0(nzb:nzt,j,nxl:nxr), 2 ) ) )
           
           IF ( myidy == id_stg_south  ) j = nys-1
@@ -1600,8 +1604,8 @@
           mc_factor_l(1) = SUM( dist_xz(nzb:nzt,nxlu:nxr,1)                    &
                          * MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_static_0(nzb:nzt,j,nxlu:nxr), 1 ) ) )
+                           BTEST( wall_flags_total_0(nzb:nzt,j,nxlu:nxr), 1 ) ) )
           mc_factor_l(3) = SUM( dist_xz(nzb:nzt,nxl:nxr,3)                     &
                          * MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_static_0(nzb:nzt,j,nxl:nxr), 3 ) ) )
+                           BTEST( wall_flags_total_0(nzb:nzt,j,nxl:nxr), 3 ) ) )
           
 #if defined( __parallel )
@@ -1619,5 +1623,5 @@
           dist_xz(:,:,2)   = ( dist_xz(:,:,2) - mc_factor(2) )                 &
                            * MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_static_0(:,j,:), 2 ) )          
+                             BTEST( wall_flags_total_0(:,j,:), 2 ) )          
                                                                                
                                                                                
@@ -1627,9 +1631,9 @@
           dist_xz(:,:,1)   = ( dist_xz(:,:,1) - mc_factor(1) )                 &
                            * MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_static_0(:,j,:), 1 ) )          
+                             BTEST( wall_flags_total_0(:,j,:), 1 ) )          
                                                                                
           dist_xz(:,:,3)   = ( dist_xz(:,:,3) - mc_factor(3) )                 &
                            * MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_static_0(:,j,:), 3 ) )      
+                             BTEST( wall_flags_total_0(:,j,:), 3 ) )      
 !         
 !--       Add disturbances
@@ -1639,12 +1643,12 @@
                    u(k,-1,i) = ( u(k,-1,i) + dist_xz(k,i,1) )                  &
                                         * MERGE( 1.0_wp, 0.0_wp,               &
-                                                 BTEST( wall_flags_static_0(k,-1,i), 1 ) )
+                                          BTEST( wall_flags_total_0(k,-1,i), 1 ) )
                    v(k,0,i)  = ( v(k,0,i)  + dist_xz(k,i,2)  )                 &
                                         * MERGE( 1.0_wp, 0.0_wp,               &
-                                                 BTEST( wall_flags_static_0(k,0,i), 2 ) )
+                                          BTEST( wall_flags_total_0(k,0,i), 2 ) )
                    v(k,-1,i) = v(k,0,i)
                    w(k,-1,i) = ( w(k,-1,i) + dist_xz(k,i,3)  )                 &
                                         * MERGE( 1.0_wp, 0.0_wp,               &
-                                                 BTEST( wall_flags_static_0(k,-1,i), 3 ) )
+                                          BTEST( wall_flags_total_0(k,-1,i), 3 ) )
                 ENDDO
              ENDDO
@@ -1656,11 +1660,11 @@
                    u(k,nyn+1,i) = ( u(k,nyn+1,i) + dist_xz(k,i,1) )            &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                             BTEST( wall_flags_static_0(k,nyn+1,i), 1 ) )
+                                       BTEST( wall_flags_total_0(k,nyn+1,i), 1 ) )
                    v(k,nyn+1,i) = ( v(k,nyn+1,i) + dist_xz(k,i,2) )            &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,nyn+1,i), 2 ) )
+                                       BTEST( wall_flags_total_0(k,nyn+1,i), 2 ) )
                    w(k,nyn+1,i) = ( w(k,nyn+1,i) + dist_xz(k,i,3) )            &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_static_0(k,nyn+1,i), 3 ) )
+                                       BTEST( wall_flags_total_0(k,nyn+1,i), 3 ) )
                 ENDDO
              ENDDO
