Index: /palm/trunk/SOURCE/advec_ws.f90
===================================================================
--- /palm/trunk/SOURCE/advec_ws.f90	(revision 4328)
+++ /palm/trunk/SOURCE/advec_ws.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4328 2019-12-09 18:53:04Z suehring
 ! Minor formatting adjustments
 ! 
@@ -186,5 +189,5 @@
                nzb_max,                                                        &
                nzt,                                                            &
-               wall_flags_0
+               wall_flags_static_0
 
     USE grid_variables,                                                        &
@@ -408,5 +411,5 @@
 !--             u component - x-direction
 !--             WS1 (0), WS3 (1), WS5 (2)
-                IF ( .NOT. BTEST(wall_flags_0(k,j,i+1),1)  .OR.                &
+                IF ( .NOT. BTEST(wall_flags_static_0(k,j,i+1),1)  .OR.         &
                          ( ( bc_dirichlet_l .OR. bc_radiation_l )              &
                            .AND. i <= nxlu  )    .OR.                          &
@@ -415,7 +418,7 @@
                 THEN                                                           
                     advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 0 )      
-                ELSEIF ( ( .NOT. BTEST(wall_flags_0(k,j,i+2),1)  .AND.         &
-                                 BTEST(wall_flags_0(k,j,i+1),1)  .OR.          &
-                           .NOT. BTEST(wall_flags_0(k,j,i-1),1) )              &
+                ELSEIF ( ( .NOT. BTEST(wall_flags_static_0(k,j,i+2),1)  .AND.  &
+                                 BTEST(wall_flags_static_0(k,j,i+1),1)  .OR.   &
+                           .NOT. BTEST(wall_flags_static_0(k,j,i-1),1) )       &
                                                      .OR.                      &
                          ( ( bc_dirichlet_r .OR. bc_radiation_r )              &
@@ -428,7 +431,7 @@
 !--                Clear flag for WS1                                          
                    advc_flags_m(k,j,i) = IBCLR( advc_flags_m(k,j,i), 0 )       
-                ELSEIF ( BTEST(wall_flags_0(k,j,i+1),1)  .AND.                 &
-                         BTEST(wall_flags_0(k,j,i+2),1)  .AND.                 &
-                         BTEST(wall_flags_0(k,j,i-1),1) )                      &
+                ELSEIF ( BTEST(wall_flags_static_0(k,j,i+1),1)  .AND.          &
+                         BTEST(wall_flags_static_0(k,j,i+2),1)  .AND.          &
+                         BTEST(wall_flags_static_0(k,j,i-1),1) )               &
                 THEN                                                           
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 2 )       
@@ -440,5 +443,5 @@
 !--             u component - y-direction                                      
 !--             WS1 (3), WS3 (4), WS5 (5)                                      
-                IF ( .NOT. BTEST(wall_flags_0(k,j+1,i),1)   .OR.               &
+                IF ( .NOT. BTEST(wall_flags_static_0(k,j+1,i),1)   .OR.        &
                          ( ( bc_dirichlet_s .OR. bc_radiation_s )              &
                            .AND. j == nys   )    .OR.                          &
@@ -447,7 +450,7 @@
                 THEN                                                           
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 3 )       
-                ELSEIF ( ( .NOT. BTEST(wall_flags_0(k,j+2,i),1)  .AND.         &
-                                 BTEST(wall_flags_0(k,j+1,i),1)  .OR.          &
-                           .NOT. BTEST(wall_flags_0(k,j-1,i),1) )              &
+                ELSEIF ( ( .NOT. BTEST(wall_flags_static_0(k,j+2,i),1)  .AND.  &
+                                 BTEST(wall_flags_static_0(k,j+1,i),1)  .OR.   &
+                           .NOT. BTEST(wall_flags_static_0(k,j-1,i),1) )       &
                                                      .OR.                      &
                          ( ( bc_dirichlet_s .OR. bc_radiation_s )              &
@@ -460,7 +463,7 @@
 !--                Clear flag for WS1                                          
                    advc_flags_m(k,j,i) = IBCLR( advc_flags_m(k,j,i), 3 )       
-                ELSEIF ( BTEST(wall_flags_0(k,j+1,i),1)  .AND.                 &
-                         BTEST(wall_flags_0(k,j+2,i),1)  .AND.                 &
-                         BTEST(wall_flags_0(k,j-1,i),1) )                      &
+                ELSEIF ( BTEST(wall_flags_static_0(k,j+1,i),1)  .AND.          &
+                         BTEST(wall_flags_static_0(k,j+2,i),1)  .AND.          &
+                         BTEST(wall_flags_static_0(k,j-1,i),1) )               &
                 THEN                                                           
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 5 )       
@@ -490,32 +493,32 @@
                                                                                
                 flag_set = .FALSE.                                             
-                IF ( ( .NOT. BTEST(wall_flags_0(k-1,j,i),1)   .AND.            &
-                             BTEST(wall_flags_0(k,j,i),1)     .AND.            &
-                             BTEST(wall_flags_0(k+1,j,i),1) ) .OR.             &
-                     ( .NOT. BTEST(wall_flags_0(k_pp,j,i),1)  .AND.            &                              
-                             BTEST(wall_flags_0(k+1,j,i),1)   .AND.            &
-                             BTEST(wall_flags_0(k,j,i),1) )   .OR.             &
-                     k == nzt )                                                &
+                IF ( ( .NOT. BTEST(wall_flags_static_0(k-1,j,i),1)       .AND.     &
+                             BTEST(wall_flags_static_0(k,j,i),1)         .AND.     &
+                             BTEST(wall_flags_static_0(k+1,j,i),1) )     .OR.      &
+                     ( .NOT. BTEST(wall_flags_static_0(k_pp,j,i),1)      .AND.     &                              
+                             BTEST(wall_flags_static_0(k+1,j,i),1)       .AND.     &
+                             BTEST(wall_flags_static_0(k,j,i),1) )       .OR.      &
+                     k == nzt )                                                    &
                 THEN                                                           
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 6 )       
                    flag_set = .TRUE.                                           
-                ELSEIF ( ( .NOT. BTEST(wall_flags_0(k_mm,j,i),1)    .OR.       &
-                           .NOT. BTEST(wall_flags_0(k_ppp,j,i),1) ) .AND.      & 
-                                 BTEST(wall_flags_0(k-1,j,i),1)     .AND.      &
-                                 BTEST(wall_flags_0(k,j,i),1)       .AND.      &
-                                 BTEST(wall_flags_0(k+1,j,i),1)     .AND.      &
-                                 BTEST(wall_flags_0(k_pp,j,i),1)    .AND.      &
-                           .NOT. flag_set                           .OR.       & 
-                         k == nzt - 1 )                                        &
+                ELSEIF ( ( .NOT. BTEST(wall_flags_static_0(k_mm,j,i),1)    .OR.    &
+                           .NOT. BTEST(wall_flags_static_0(k_ppp,j,i),1) ) .AND.   & 
+                                 BTEST(wall_flags_static_0(k-1,j,i),1)     .AND.   &
+                                 BTEST(wall_flags_static_0(k,j,i),1)       .AND.   &
+                                 BTEST(wall_flags_static_0(k+1,j,i),1)     .AND.   &
+                                 BTEST(wall_flags_static_0(k_pp,j,i),1)    .AND.   &
+                           .NOT. flag_set                           .OR.           & 
+                         k == nzt - 1 )                                            &
                 THEN                                                           
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 7 )       
                    flag_set = .TRUE.                                           
-                ELSEIF ( BTEST(wall_flags_0(k_mm,j,i),1)  .AND.                &
-                         BTEST(wall_flags_0(k-1,j,i),1)   .AND.                &
-                         BTEST(wall_flags_0(k,j,i),1)     .AND.                &
-                         BTEST(wall_flags_0(k+1,j,i),1)   .AND.                &
-                         BTEST(wall_flags_0(k_pp,j,i),1)  .AND.                &
-                         BTEST(wall_flags_0(k_ppp,j,i),1) .AND.                &
-                         .NOT. flag_set )                                      &
+                ELSEIF ( BTEST(wall_flags_static_0(k_mm,j,i),1)            .AND.   &
+                         BTEST(wall_flags_static_0(k-1,j,i),1)             .AND.   &
+                         BTEST(wall_flags_static_0(k,j,i),1)               .AND.   &
+                         BTEST(wall_flags_static_0(k+1,j,i),1)             .AND.   &
+                         BTEST(wall_flags_static_0(k_pp,j,i),1)            .AND.   &
+                         BTEST(wall_flags_static_0(k_ppp,j,i),1)           .AND.   &
+                         .NOT. flag_set )                                          &
                 THEN
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 8 )
@@ -539,5 +542,5 @@
 !--             v component - x-direction
 !--             WS1 (9), WS3 (10), WS5 (11)
-                IF ( .NOT. BTEST(wall_flags_0(k,j,i+1),2)  .OR.                &
+                IF ( .NOT. BTEST(wall_flags_static_0(k,j,i+1),2)  .OR.         &
                          ( ( bc_dirichlet_l .OR. bc_radiation_l )              &
                            .AND. i == nxl   )    .OR.                          &
@@ -548,7 +551,7 @@
 !                                                                              
 !--             WS3                                                            
-                ELSEIF ( ( .NOT. BTEST(wall_flags_0(k,j,i+2),2)   .AND.        &
-                                 BTEST(wall_flags_0(k,j,i+1),2) ) .OR.         &
-                           .NOT. BTEST(wall_flags_0(k,j,i-1),2)                &
+                ELSEIF ( ( .NOT. BTEST(wall_flags_static_0(k,j,i+2),2)   .AND. &
+                                 BTEST(wall_flags_static_0(k,j,i+1),2) ) .OR.  &
+                           .NOT. BTEST(wall_flags_static_0(k,j,i-1),2)         &
                                                  .OR.                          &
                          ( ( bc_dirichlet_r .OR. bc_radiation_r )              &
@@ -560,8 +563,8 @@
 !                                                                              
 !--                Clear flag for WS1                                          
-                   advc_flags_m(k,j,i) = IBCLR( advc_flags_m(k,j,i), 9 )       
-                ELSEIF ( BTEST(wall_flags_0(k,j,i+1),2)  .AND.                 &
-                         BTEST(wall_flags_0(k,j,i+2),2)  .AND.                 &
-                         BTEST(wall_flags_0(k,j,i-1),2) )                      &
+                   advc_flags_m(k,j,i) = IBCLR( advc_flags_m(k,j,i), 9 )     
+                ELSEIF ( BTEST(wall_flags_static_0(k,j,i+1),2)  .AND.          &
+                         BTEST(wall_flags_static_0(k,j,i+2),2)  .AND.          &
+                         BTEST(wall_flags_static_0(k,j,i-1),2) )               &
                 THEN                                                           
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 11 )      
@@ -573,5 +576,5 @@
 !--             v component - y-direction                                      
 !--             WS1 (12), WS3 (13), WS5 (14)                                   
-                IF ( .NOT. BTEST(wall_flags_0(k,j+1,i),2) .OR.                 &
+                IF ( .NOT. BTEST(wall_flags_static_0(k,j+1,i),2) .OR.          &
                          ( ( bc_dirichlet_s .OR. bc_radiation_s )              &
                            .AND. j <= nysv  )    .OR.                          &
@@ -580,7 +583,7 @@
                 THEN                                                           
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 12 )      
-                ELSEIF ( ( .NOT. BTEST(wall_flags_0(k,j+2,i),2)  .AND.         &
-                                 BTEST(wall_flags_0(k,j+1,i),2)  .OR.          &
-                           .NOT. BTEST(wall_flags_0(k,j-1,i),2) )              &
+                ELSEIF ( ( .NOT. BTEST(wall_flags_static_0(k,j+2,i),2)  .AND.  &
+                                 BTEST(wall_flags_static_0(k,j+1,i),2)  .OR.   &
+                           .NOT. BTEST(wall_flags_static_0(k,j-1,i),2) )       &
                                                      .OR.                      &
                          ( (  bc_dirichlet_s .OR. bc_radiation_s )             &
@@ -593,7 +596,7 @@
 !--                Clear flag for WS1                                          
                    advc_flags_m(k,j,i) = IBCLR( advc_flags_m(k,j,i), 12 )      
-                ELSEIF ( BTEST(wall_flags_0(k,j+1,i),2)  .AND.                 &
-                         BTEST(wall_flags_0(k,j+2,i),2)  .AND.                 &
-                         BTEST(wall_flags_0(k,j-1,i),2) )                      & 
+                ELSEIF ( BTEST(wall_flags_static_0(k,j+1,i),2)  .AND.          &
+                         BTEST(wall_flags_static_0(k,j+2,i),2)  .AND.          &
+                         BTEST(wall_flags_static_0(k,j-1,i),2) )               & 
                 THEN
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 14 )
@@ -623,32 +626,32 @@
                 
                 flag_set = .FALSE.
-                IF ( ( .NOT. BTEST(wall_flags_0(k-1,j,i),2)   .AND.            &
-                             BTEST(wall_flags_0(k,j,i),2)     .AND.            &
-                             BTEST(wall_flags_0(k+1,j,i),2) ) .OR.             &
-                     ( .NOT. BTEST(wall_flags_0(k_pp,j,i),2)  .AND.            &                              
-                             BTEST(wall_flags_0(k+1,j,i),2)   .AND.            &
-                             BTEST(wall_flags_0(k,j,i),2) )   .OR.             &
-                     k == nzt )                                                &
+                IF ( ( .NOT. BTEST(wall_flags_static_0(k-1,j,i),2)          .AND.     &
+                             BTEST(wall_flags_static_0(k,j,i),2)            .AND.     &
+                             BTEST(wall_flags_static_0(k+1,j,i),2) )        .OR.      &
+                     ( .NOT. BTEST(wall_flags_static_0(k_pp,j,i),2)         .AND.     &                              
+                             BTEST(wall_flags_static_0(k+1,j,i),2)          .AND.     &
+                             BTEST(wall_flags_static_0(k,j,i),2) )          .OR.      &
+                     k == nzt )                                                       &
                 THEN                                                           
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 15 )      
                    flag_set = .TRUE.                                           
-                ELSEIF ( ( .NOT. BTEST(wall_flags_0(k_mm,j,i),2)    .OR.       &
-                           .NOT. BTEST(wall_flags_0(k_ppp,j,i),2) ) .AND.      & 
-                                 BTEST(wall_flags_0(k-1,j,i),2)     .AND.      &
-                                 BTEST(wall_flags_0(k,j,i),2)       .AND.      &
-                                 BTEST(wall_flags_0(k+1,j,i),2)     .AND.      &
-                                 BTEST(wall_flags_0(k_pp,j,i),2)    .AND.      &
-                           .NOT. flag_set                           .OR.       & 
-                         k == nzt - 1 )                                        &
+                ELSEIF ( ( .NOT. BTEST(wall_flags_static_0(k_mm,j,i),2)    .OR.       &
+                           .NOT. BTEST(wall_flags_static_0(k_ppp,j,i),2) ) .AND.      & 
+                                 BTEST(wall_flags_static_0(k-1,j,i),2)     .AND.      &
+                                 BTEST(wall_flags_static_0(k,j,i),2)       .AND.      &
+                                 BTEST(wall_flags_static_0(k+1,j,i),2)     .AND.      &
+                                 BTEST(wall_flags_static_0(k_pp,j,i),2)    .AND.      &
+                           .NOT. flag_set                                  .OR.       & 
+                         k == nzt - 1 )                                               &
                 THEN                                                           
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 16 )      
                    flag_set = .TRUE.                                           
-                ELSEIF ( BTEST(wall_flags_0(k_mm,j,i),2)  .AND.                &
-                         BTEST(wall_flags_0(k-1,j,i),2)   .AND.                &
-                         BTEST(wall_flags_0(k,j,i),2)     .AND.                &
-                         BTEST(wall_flags_0(k+1,j,i),2)   .AND.                &
-                         BTEST(wall_flags_0(k_pp,j,i),2)  .AND.                &
-                         BTEST(wall_flags_0(k_ppp,j,i),2) .AND.                &
-                         .NOT. flag_set )                                      &
+                ELSEIF ( BTEST(wall_flags_static_0(k_mm,j,i),2)             .AND.     &
+                         BTEST(wall_flags_static_0(k-1,j,i),2)              .AND.     &
+                         BTEST(wall_flags_static_0(k,j,i),2)                .AND.     &
+                         BTEST(wall_flags_static_0(k+1,j,i),2)              .AND.     &
+                         BTEST(wall_flags_static_0(k_pp,j,i),2)             .AND.     &
+                         BTEST(wall_flags_static_0(k_ppp,j,i),2)            .AND.     &
+                         .NOT. flag_set )                                             &
                 THEN
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 17 )
@@ -672,5 +675,5 @@
 !--             w component - x-direction
 !--             WS1 (18), WS3 (19), WS5 (20)
-                IF ( .NOT. BTEST(wall_flags_0(k,j,i+1),3) .OR.                 &
+                IF ( .NOT. BTEST(wall_flags_static_0(k,j,i+1),3) .OR.          &
                          ( (  bc_dirichlet_l .OR. bc_radiation_l )             &
                            .AND. i == nxl   )    .OR.                          &
@@ -678,8 +681,8 @@
                            .AND. i == nxr   ) )                                &
                 THEN                                                           
-                   advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 18 )      
-                ELSEIF ( ( .NOT. BTEST(wall_flags_0(k,j,i+2),3)  .AND.         &
-                                 BTEST(wall_flags_0(k,j,i+1),3)  .OR.          &
-                           .NOT. BTEST(wall_flags_0(k,j,i-1),3) )              &
+                   advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 18 )     
+                ELSEIF ( ( .NOT. BTEST(wall_flags_static_0(k,j,i+2),3)  .AND.  &
+                                 BTEST(wall_flags_static_0(k,j,i+1),3)  .OR.   &
+                           .NOT. BTEST(wall_flags_static_0(k,j,i-1),3) )       &
                                                      .OR.                      &
                          ( ( bc_dirichlet_r .OR. bc_radiation_r )              &
@@ -692,7 +695,7 @@
 !--                Clear flag for WS1                                          
                    advc_flags_m(k,j,i) = IBCLR( advc_flags_m(k,j,i), 18 )      
-                ELSEIF ( BTEST(wall_flags_0(k,j,i+1),3)  .AND.                 &
-                         BTEST(wall_flags_0(k,j,i+2),3)  .AND.                 &
-                         BTEST(wall_flags_0(k,j,i-1),3) )                      &
+                ELSEIF ( BTEST(wall_flags_static_0(k,j,i+1),3)  .AND.          &
+                         BTEST(wall_flags_static_0(k,j,i+2),3)  .AND.          &
+                         BTEST(wall_flags_static_0(k,j,i-1),3) )               &
                 THEN                                                           
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i),20 )       
@@ -704,5 +707,5 @@
 !--             w component - y-direction                                      
 !--             WS1 (21), WS3 (22), WS5 (23)                                   
-                IF ( .NOT. BTEST(wall_flags_0(k,j+1,i),3) .OR.                 &
+                IF ( .NOT. BTEST(wall_flags_static_0(k,j+1,i),3) .OR.          &
                          ( ( bc_dirichlet_s .OR. bc_radiation_s )              &
                            .AND. j == nys   )    .OR.                          &
@@ -710,9 +713,9 @@
                            .AND. j == nyn   ) )                                &
                 THEN                                                           
-                   advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 21 )      
-                ELSEIF ( ( .NOT. BTEST(wall_flags_0(k,j+2,i),3)  .AND.         &
-                                 BTEST(wall_flags_0(k,j+1,i),3)  .OR.          &
-                           .NOT. BTEST(wall_flags_0(k,j-1,i),3) )              &
-                                                     .OR.                      &
+                   advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 21 )     
+                ELSEIF ( ( .NOT. BTEST(wall_flags_static_0(k,j+2,i),3)  .AND.  &
+                                 BTEST(wall_flags_static_0(k,j+1,i),3)  .OR.   &
+                           .NOT. BTEST(wall_flags_static_0(k,j-1,i),3) )       &
+                                                     .OR.                     
                          ( ( bc_dirichlet_s .OR. bc_radiation_s )              &
                            .AND. j == nysv  )    .OR.                          &
@@ -724,8 +727,8 @@
 !--                Clear flag for WS1                                          
                    advc_flags_m(k,j,i) = IBCLR( advc_flags_m(k,j,i), 21 )      
-                ELSEIF ( BTEST(wall_flags_0(k,j+1,i),3)  .AND.                 &
-                         BTEST(wall_flags_0(k,j+2,i),3)  .AND.                 &
-                         BTEST(wall_flags_0(k,j-1,i),3) )                      &
-                THEN
+                ELSEIF ( BTEST(wall_flags_static_0(k,j+1,i),3)  .AND.          &
+                         BTEST(wall_flags_static_0(k,j+2,i),3)  .AND.          &
+                         BTEST(wall_flags_static_0(k,j-1,i),3) )               &
+                THEN                                                           
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 23 )
 !
@@ -754,10 +757,10 @@
                 ENDIF  
                 
-                flag_set = .FALSE.
-                IF ( ( .NOT. BTEST(wall_flags_0(k,j,i),3)     .AND.            &
-                             BTEST(wall_flags_0(k+1,j,i),3) ) .OR.             &
-                     ( .NOT. BTEST(wall_flags_0(k+1,j,i),3)   .AND.            &
-                             BTEST(wall_flags_0(k,j,i),3) )   .OR.             &        
-                     k == nzt -1 )                                             &
+                flag_set = .FALSE.                                        
+                IF ( ( .NOT. BTEST(wall_flags_static_0(k,j,i),3)          .AND.     &
+                             BTEST(wall_flags_static_0(k+1,j,i),3) )      .OR.      &
+                     ( .NOT. BTEST(wall_flags_static_0(k+1,j,i),3)        .AND.     &
+                             BTEST(wall_flags_static_0(k,j,i),3) )        .OR.      &        
+                     k == nzt -1 )                                                  &
                 THEN
 !
@@ -769,23 +772,23 @@
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 24 )
                    flag_set = .TRUE.
-                ELSEIF ( ( .NOT. BTEST(wall_flags_0(k-1,j,i),3)    .AND.       &
-                                 BTEST(wall_flags_0(k,j,i),3)      .AND.       &
-                                 BTEST(wall_flags_0(k+1,j,i),3)    .AND.       &
-                                 BTEST(wall_flags_0(k_pp,j,i),3) ) .OR.        &
-                         ( .NOT. BTEST(wall_flags_0(k_pp,j,i),3)   .AND.       &
-                                 BTEST(wall_flags_0(k+1,j,i),3)    .AND.       &
-                                 BTEST(wall_flags_0(k,j,i),3)      .AND.       &
-                                 BTEST(wall_flags_0(k-1,j,i),3) )  .AND.       &
-                           .NOT. flag_set                          .OR.        & 
-                         k == nzt - 2 )                                        &
+                ELSEIF ( ( .NOT. BTEST(wall_flags_static_0(k-1,j,i),3)    .AND.     &
+                                 BTEST(wall_flags_static_0(k,j,i),3)      .AND.     &
+                                 BTEST(wall_flags_static_0(k+1,j,i),3)    .AND.     &
+                                 BTEST(wall_flags_static_0(k_pp,j,i),3) ) .OR.      &
+                         ( .NOT. BTEST(wall_flags_static_0(k_pp,j,i),3)   .AND.     &
+                                 BTEST(wall_flags_static_0(k+1,j,i),3)    .AND.     &
+                                 BTEST(wall_flags_static_0(k,j,i),3)      .AND.     &
+                                 BTEST(wall_flags_static_0(k-1,j,i),3) )  .AND.     &
+                           .NOT. flag_set                          .OR.             & 
+                         k == nzt - 2 )                                             &
                 THEN                                                           
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 25 )      
                    flag_set = .TRUE.                                           
-                ELSEIF ( BTEST(wall_flags_0(k-1,j,i),3)   .AND.                &
-                         BTEST(wall_flags_0(k,j,i),3)     .AND.                &
-                         BTEST(wall_flags_0(k+1,j,i),3)   .AND.                &
-                         BTEST(wall_flags_0(k_pp,j,i),3)  .AND.                &
-                         .NOT. flag_set )                                      &
-                THEN
+                ELSEIF ( BTEST(wall_flags_static_0(k-1,j,i),3)            .AND.     &
+                         BTEST(wall_flags_static_0(k,j,i),3)              .AND.     &
+                         BTEST(wall_flags_static_0(k+1,j,i),3)            .AND.     &
+                         BTEST(wall_flags_static_0(k_pp,j,i),3)           .AND.     &
+                         .NOT. flag_set )                                           &
+                THEN                                                                
                    advc_flags_m(k,j,i) = IBSET( advc_flags_m(k,j,i), 26 )
                 ENDIF
@@ -857,33 +860,33 @@
           DO  j = nys, nyn
              DO  k = nzb+1, nzt
-                IF ( .NOT.  BTEST(wall_flags_0(k,j,i),0) )  CYCLE
+                IF ( .NOT.  BTEST(wall_flags_static_0(k,j,i),0) )  CYCLE
 !
 !--             scalar - x-direction
 !--             WS1 (0), WS3 (1), WS5 (2)
-                IF ( ( .NOT. BTEST(wall_flags_0(k,j,i+1),0)                    &
-                 .OR.  .NOT. BTEST(wall_flags_0(k,j,i+2),0)                    &   
-                 .OR.  .NOT. BTEST(wall_flags_0(k,j,i-1),0) )                  &
-                   .OR.  ( non_cyclic_l  .AND.  i == 0  )                      &
-                   .OR.  ( non_cyclic_r  .AND.  i == nx ) )  THEN           
-                   advc_flag(k,j,i) = IBSET( advc_flag(k,j,i), 0 )             
-                ELSEIF ( ( .NOT. BTEST(wall_flags_0(k,j,i+3),0)                &
-                    .AND.        BTEST(wall_flags_0(k,j,i+1),0)                &
-                    .AND.        BTEST(wall_flags_0(k,j,i+2),0)                &
-                    .AND.        BTEST(wall_flags_0(k,j,i-1),0)                &
-                         )                       .OR.                          &
-                         ( .NOT. BTEST(wall_flags_0(k,j,i-2),0)                &
-                    .AND.        BTEST(wall_flags_0(k,j,i+1),0)                &
-                    .AND.        BTEST(wall_flags_0(k,j,i+2),0)                &
-                    .AND.        BTEST(wall_flags_0(k,j,i-1),0)                &
-                         )                                                     &
-                                                 .OR.                          &
-                         ( non_cyclic_r  .AND.  i == nx-1 )  .OR.              &
+                IF ( ( .NOT. BTEST(wall_flags_static_0(k,j,i+1),0)      .OR.          &
+                       .NOT. BTEST(wall_flags_static_0(k,j,i+2),0)      .OR.          &   
+                       .NOT. BTEST(wall_flags_static_0(k,j,i-1),0) )    .OR.          &
+                       ( non_cyclic_l  .AND.  i == 0  )                 .OR.          &
+                       ( non_cyclic_r  .AND.  i == nx ) )  THEN           
+                 advc_flag(k,j,i) = IBSET( advc_flag(k,j,i), 0 )             
+                ELSEIF ( ( .NOT. BTEST(wall_flags_static_0(k,j,i+3),0)  .AND.         &
+                                 BTEST(wall_flags_static_0(k,j,i+1),0)  .AND.         &
+                                 BTEST(wall_flags_static_0(k,j,i+2),0)  .AND.         &
+                                 BTEST(wall_flags_static_0(k,j,i-1),0)                &
+                         )                       .OR.                                 &
+                         ( .NOT. BTEST(wall_flags_static_0(k,j,i-2),0)  .AND.         &
+                                 BTEST(wall_flags_static_0(k,j,i+1),0)  .AND.         &
+                                 BTEST(wall_flags_static_0(k,j,i+2),0)  .AND.         &
+                                 BTEST(wall_flags_static_0(k,j,i-1),0)                &
+                         )                                                            &
+                                                 .OR.                                 &
+                         ( non_cyclic_r  .AND.  i == nx-1 )  .OR.                     &
                          ( non_cyclic_l  .AND.  i == 1    ) )  THEN           
                    advc_flag(k,j,i) = IBSET( advc_flag(k,j,i), 1 )             
-                ELSEIF ( BTEST(wall_flags_0(k,j,i+1),0)                        &
-                   .AND. BTEST(wall_flags_0(k,j,i+2),0)                        &
-                   .AND. BTEST(wall_flags_0(k,j,i+3),0)                        &
-                   .AND. BTEST(wall_flags_0(k,j,i-1),0)                        &
-                   .AND. BTEST(wall_flags_0(k,j,i-2),0) )                      &
+                ELSEIF ( BTEST(wall_flags_static_0(k,j,i+1),0)           .AND.        &
+                         BTEST(wall_flags_static_0(k,j,i+2),0)           .AND.        &
+                         BTEST(wall_flags_static_0(k,j,i+3),0)           .AND.        &
+                         BTEST(wall_flags_static_0(k,j,i-1),0)           .AND.        &
+                         BTEST(wall_flags_static_0(k,j,i-2),0) )                      &
                 THEN                                                           
                    advc_flag(k,j,i) = IBSET( advc_flag(k,j,i), 2 )             
@@ -892,33 +895,33 @@
 !--             scalar - y-direction                                           
 !--             WS1 (3), WS3 (4), WS5 (5)                                      
-                IF ( ( .NOT. BTEST(wall_flags_0(k,j+1,i),0)                    &
-                 .OR.  .NOT. BTEST(wall_flags_0(k,j+2,i),0)                    &   
-                 .OR.  .NOT. BTEST(wall_flags_0(k,j-1,i),0))                   &
-                   .OR.  ( non_cyclic_s  .AND.  j == 0  )                      &
-                   .OR.  ( non_cyclic_n  .AND.  j == ny ) )  THEN                                                           
+                IF ( ( .NOT. BTEST(wall_flags_static_0(k,j+1,i),0)        .OR.        &
+                       .NOT. BTEST(wall_flags_static_0(k,j+2,i),0)        .OR.        &   
+                       .NOT. BTEST(wall_flags_static_0(k,j-1,i),0))       .OR.        &
+                     ( non_cyclic_s  .AND.  j == 0  )                     .OR.        &
+                     ( non_cyclic_n  .AND.  j == ny ) )  THEN                                                           
                    advc_flag(k,j,i) = IBSET( advc_flag(k,j,i), 3 )             
 !                                                                              
 !--             WS3                                                            
-                ELSEIF ( ( .NOT. BTEST(wall_flags_0(k,j+3,i),0)                &
-                    .AND.        BTEST(wall_flags_0(k,j+1,i),0)                &
-                    .AND.        BTEST(wall_flags_0(k,j+2,i),0)                &
-                    .AND.        BTEST(wall_flags_0(k,j-1,i),0)                &
-                         )                       .OR.                          &
-                         ( .NOT. BTEST(wall_flags_0(k,j-2,i),0)                &
-                    .AND.        BTEST(wall_flags_0(k,j+1,i),0)                &
-                    .AND.        BTEST(wall_flags_0(k,j+2,i),0)                &
-                    .AND.        BTEST(wall_flags_0(k,j-1,i),0)                &
-                         )                                                     &
-                                                 .OR.                          &
-                         ( non_cyclic_s  .AND.  j == 1    )  .OR.              &
+                ELSEIF ( ( .NOT. BTEST(wall_flags_static_0(k,j+3,i),0)    .AND.       &
+                                 BTEST(wall_flags_static_0(k,j+1,i),0)    .AND.       &
+                                 BTEST(wall_flags_static_0(k,j+2,i),0)    .AND.       &
+                                 BTEST(wall_flags_static_0(k,j-1,i),0)                &
+                         )                       .OR.                                 &
+                         ( .NOT. BTEST(wall_flags_static_0(k,j-2,i),0)    .AND.       &
+                                 BTEST(wall_flags_static_0(k,j+1,i),0)    .AND.       &
+                                 BTEST(wall_flags_static_0(k,j+2,i),0)    .AND.       &
+                                 BTEST(wall_flags_static_0(k,j-1,i),0)                &
+                         )                                                            &
+                                                 .OR.                                 &
+                         ( non_cyclic_s  .AND.  j == 1    )  .OR.                     &
                          ( non_cyclic_n  .AND.  j == ny-1 ) )  THEN           
                    advc_flag(k,j,i) = IBSET( advc_flag(k,j,i), 4 )             
 !                                                                              
 !--             WS5                                                            
-                ELSEIF ( BTEST(wall_flags_0(k,j+1,i),0)                        &
-                   .AND. BTEST(wall_flags_0(k,j+2,i),0)                        &
-                   .AND. BTEST(wall_flags_0(k,j+3,i),0)                        &
-                   .AND. BTEST(wall_flags_0(k,j-1,i),0)                        &
-                   .AND. BTEST(wall_flags_0(k,j-2,i),0) )                      &
+                ELSEIF ( BTEST(wall_flags_static_0(k,j+1,i),0)           .AND.        &
+                         BTEST(wall_flags_static_0(k,j+2,i),0)           .AND.        &
+                         BTEST(wall_flags_static_0(k,j+3,i),0)           .AND.        &
+                         BTEST(wall_flags_static_0(k,j-1,i),0)           .AND.        &
+                         BTEST(wall_flags_static_0(k,j-2,i),0) )                      &
                 THEN                                                           
                    advc_flag(k,j,i) = IBSET( advc_flag(k,j,i), 5 )             
@@ -928,5 +931,5 @@
 !--             for passive scalars, even if only one direction may be 
 !--             blocked by topography. These locations will be identified
-!--             by wall_flags_0 bit 31. Note, since several modules define 
+!--             by wall_flags_static_0 bit 31. Note, since several modules define 
 !--             advection flags but may apply different scalar boundary 
 !--             conditions, bit 31 is temporarily stored on advc_flags. 
@@ -1076,18 +1079,18 @@
                                                                                
                 flag_set = .FALSE.                                             
-                IF ( .NOT. BTEST(wall_flags_0(k-1,j,i),0)  .AND.               &
-                           BTEST(wall_flags_0(k,j,i),0)    .OR.                &
-                     .NOT. BTEST(wall_flags_0(k_pp,j,i),0) .AND.               &                              
-                           BTEST(wall_flags_0(k,j,i),0)    .OR.                &
+                IF ( .NOT. BTEST(wall_flags_static_0(k-1,j,i),0)  .AND.               &
+                           BTEST(wall_flags_static_0(k,j,i),0)    .OR.                &
+                     .NOT. BTEST(wall_flags_static_0(k_pp,j,i),0) .AND.               &                              
+                           BTEST(wall_flags_static_0(k,j,i),0)    .OR.                &
                      k == nzt )                                                &
                 THEN                                                           
                    advc_flag(k,j,i) = IBSET( advc_flag(k,j,i), 6 )             
                    flag_set = .TRUE.                                           
-                ELSEIF ( ( .NOT. BTEST(wall_flags_0(k_mm,j,i),0)    .OR.       &
-                           .NOT. BTEST(wall_flags_0(k_ppp,j,i),0) ) .AND.      & 
-                                 BTEST(wall_flags_0(k-1,j,i),0)     .AND.      &
-                                 BTEST(wall_flags_0(k,j,i),0)       .AND.      &
-                                 BTEST(wall_flags_0(k+1,j,i),0)     .AND.      &
-                                 BTEST(wall_flags_0(k_pp,j,i),0)    .AND.      &
+                ELSEIF ( ( .NOT. BTEST(wall_flags_static_0(k_mm,j,i),0)    .OR.       &
+                           .NOT. BTEST(wall_flags_static_0(k_ppp,j,i),0) ) .AND.      & 
+                                 BTEST(wall_flags_static_0(k-1,j,i),0)     .AND.      &
+                                 BTEST(wall_flags_static_0(k,j,i),0)       .AND.      &
+                                 BTEST(wall_flags_static_0(k+1,j,i),0)     .AND.      &
+                                 BTEST(wall_flags_static_0(k_pp,j,i),0)    .AND.      &
                            .NOT. flag_set                           .OR.       & 
                          k == nzt - 1 )                                        &
@@ -1095,10 +1098,10 @@
                    advc_flag(k,j,i) = IBSET( advc_flag(k,j,i), 7 )             
                    flag_set = .TRUE.                                           
-                ELSEIF ( BTEST(wall_flags_0(k_mm,j,i),0)  .AND.                &
-                         BTEST(wall_flags_0(k-1,j,i),0)   .AND.                &
-                         BTEST(wall_flags_0(k,j,i),0)     .AND.                &
-                         BTEST(wall_flags_0(k+1,j,i),0)   .AND.                &
-                         BTEST(wall_flags_0(k_pp,j,i),0)  .AND.                &
-                         BTEST(wall_flags_0(k_ppp,j,i),0) .AND.                &
+                ELSEIF ( BTEST(wall_flags_static_0(k_mm,j,i),0)  .AND.                &
+                         BTEST(wall_flags_static_0(k-1,j,i),0)   .AND.                &
+                         BTEST(wall_flags_static_0(k,j,i),0)     .AND.                &
+                         BTEST(wall_flags_static_0(k+1,j,i),0)   .AND.                &
+                         BTEST(wall_flags_static_0(k_pp,j,i),0)  .AND.                &
+                         BTEST(wall_flags_static_0(k_ppp,j,i),0) .AND.                &
                         .NOT. flag_set )                                       &
                 THEN
Index: /palm/trunk/SOURCE/bulk_cloud_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4289 2019-11-05 14:33:41Z knoop
 ! Removed parameters precipitation and precipitation_amount_interval from namelist
 ! 
@@ -141,5 +144,5 @@
                nbgp, nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb, nzt,     &
                topo_top_ind,                                                   &
-               wall_flags_0
+               wall_flags_static_0
 
     USE kinds
@@ -1396,5 +1399,5 @@
                                              )                                 &
                                     * MERGE( 1.0_wp, 0.0_wp,                   &
-                                             BTEST( wall_flags_0(k,j,i), 0 )   &
+                                             BTEST( wall_flags_static_0(k,j,i), 0 )   &
                                           )
                    IF ( qc_p(k,j,i) < 0.0_wp )  qc_p(k,j,i) = 0.0_wp
@@ -1486,5 +1489,5 @@
                                              )                                 &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                             BTEST( wall_flags_0(k,j,i), 0 )   &
+                                             BTEST( wall_flags_static_0(k,j,i), 0 )   &
                                           )
                    IF ( nc_p(k,j,i) < 0.0_wp )  nc_p(k,j,i) = 0.0_wp
@@ -1583,5 +1586,5 @@
                                              )                                 &
                                     * MERGE( 1.0_wp, 0.0_wp,                   &
-                                             BTEST( wall_flags_0(k,j,i), 0 )   &
+                                             BTEST( wall_flags_static_0(k,j,i), 0 )   &
                                           )
                    IF ( qr_p(k,j,i) < 0.0_wp )  qr_p(k,j,i) = 0.0_wp
@@ -1673,5 +1676,5 @@
                                              )                                 &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                             BTEST( wall_flags_0(k,j,i), 0 )   &
+                                             BTEST( wall_flags_static_0(k,j,i), 0 )   &
                                           )
                    IF ( nr_p(k,j,i) < 0.0_wp )  nr_p(k,j,i) = 0.0_wp
@@ -1770,5 +1773,5 @@
                                        )                                 &
                                  * MERGE( 1.0_wp, 0.0_wp,                &
-                                          BTEST( wall_flags_0(k,j,i), 0 )&
+                                          BTEST( wall_flags_static_0(k,j,i), 0 )&
                                         )
              IF ( qc_p(k,j,i) < 0.0_wp )  qc_p(k,j,i) = 0.0_wp
@@ -1829,5 +1832,5 @@
                                        )                                 &
                                  * MERGE( 1.0_wp, 0.0_wp,                &
-                                          BTEST( wall_flags_0(k,j,i), 0 )&
+                                          BTEST( wall_flags_static_0(k,j,i), 0 )&
                                         )
              IF ( nc_p(k,j,i) < 0.0_wp )  nc_p(k,j,i) = 0.0_wp
@@ -1894,5 +1897,5 @@
                                        )                                 &
                                  * MERGE( 1.0_wp, 0.0_wp,                &
-                                          BTEST( wall_flags_0(k,j,i), 0 )&
+                                          BTEST( wall_flags_static_0(k,j,i), 0 )&
                                         )
              IF ( qr_p(k,j,i) < 0.0_wp )  qr_p(k,j,i) = 0.0_wp
@@ -1953,5 +1956,5 @@
                                        )                                 &
                                  * MERGE( 1.0_wp, 0.0_wp,                &
-                                          BTEST( wall_flags_0(k,j,i), 0 )&
+                                          BTEST( wall_flags_static_0(k,j,i), 0 )&
                                         )
              IF ( nr_p(k,j,i) < 0.0_wp )  nr_p(k,j,i) = 0.0_wp
@@ -2501,5 +2504,5 @@
                                      to_be_resorted(k,j,i),                    &
                                      REAL( fill_value, KIND = wp ),            &
-                                     BTEST( wall_flags_0(k,j,i), flag_nr )     &
+                                     BTEST( wall_flags_static_0(k,j,i), flag_nr )     &
                                   )
              ENDDO
@@ -2643,5 +2646,5 @@
                                      to_be_resorted(k,j,i),                    &
                                      REAL( fill_value, KIND = wp ),            &
-                                     BTEST( wall_flags_0(k,j,i), flag_nr )     &
+                                     BTEST( wall_flags_static_0(k,j,i), flag_nr )     &
                                   )
              ENDDO
@@ -3043,5 +3046,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 IF ( qr(k,j,i) <= eps_sb )  THEN
@@ -3097,5 +3100,5 @@
 !
 !--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
           IF ( qr(k,j,i) <= eps_sb )  THEN
@@ -3165,5 +3168,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
 !
@@ -3266,5 +3269,5 @@
 !
 !--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 !
 !--       Call calculation of supersaturation
@@ -3366,5 +3369,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 !
 !--             Call calculation of supersaturation 
@@ -3453,5 +3456,5 @@
 !
 !--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 !
 !--       Call calculation of supersaturation
@@ -3542,5 +3545,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 IF ( microphysics_morrison ) THEN
@@ -3668,5 +3671,5 @@
 !
 !--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
           IF ( microphysics_morrison ) THEN
              nc_auto = nc(k,j,i)
@@ -3779,5 +3782,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 IF ( qc(k,j,i) > ql_crit )  THEN
@@ -3826,5 +3829,5 @@
 !
 !--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
           IF ( qc(k,j,i) > ql_crit )  THEN
@@ -3877,5 +3880,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 IF ( microphysics_morrison ) THEN
@@ -3958,5 +3961,5 @@
 !
 !--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
           IF ( microphysics_morrison ) THEN
              nc_accr = nc(k,j,i)
@@ -4038,5 +4041,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 IF ( qr(k,j,i) > eps_sb )  THEN
@@ -4093,5 +4096,5 @@
 !
 !--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
           IF ( qr(k,j,i) > eps_sb )  THEN
@@ -4155,5 +4158,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 IF ( qr(k,j,i) > eps_sb )  THEN
@@ -4277,5 +4280,5 @@
 !
 !--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
           IF ( qr(k,j,i) > eps_sb )  THEN
@@ -4391,5 +4394,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 IF ( microphysics_morrison ) THEN
@@ -4485,5 +4488,5 @@
 !
 !--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
           IF ( microphysics_morrison ) THEN
              nc_sedi = nc(k,j,i)
@@ -4591,5 +4594,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 IF ( qr(k,j,i) > eps_sb )  THEN
@@ -4656,5 +4659,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 c_nr(k) = 0.25_wp * ( w_nr(k-1) +                              &
@@ -4672,5 +4675,5 @@
 !
 !--                Predetermine flag to mask topography
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                    d_mean = 0.5_wp * ( qr(k+1,j,i) - qr(k-1,j,i) )
@@ -4706,5 +4709,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 !
 !--             Sum up all rain drop number densities which contribute to the flux
@@ -4833,5 +4836,5 @@
 !
 !--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
           IF ( qr(k,j,i) > eps_sb )  THEN
@@ -4893,5 +4896,5 @@
 !
 !--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
           c_nr(k) = 0.25_wp * ( w_nr(k-1) + 2.0_wp * w_nr(k) + w_nr(k+1) ) *   &
@@ -4907,5 +4910,5 @@
 !
 !--          Predetermine flag to mask topography
-             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
              d_mean = 0.5_wp * ( qr(k+1,j,i) - qr(k-1,j,i) )
@@ -4940,5 +4943,5 @@
 !
 !--       Predetermine flag to mask topography
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 !
 !--       Sum up all rain drop number densities which contribute to the flux
@@ -5150,5 +5153,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
 !
Index: /palm/trunk/SOURCE/calc_mean_profile.f90
===================================================================
--- /palm/trunk/SOURCE/calc_mean_profile.f90	(revision 4328)
+++ /palm/trunk/SOURCE/calc_mean_profile.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -63,5 +66,5 @@
        USE indices,                                                            &
            ONLY:  ngp_2dh_s_inner, nxl, nxr, nyn, nys, nzb, nzb, nzt,          &
-                  wall_flags_0
+                  wall_flags_static_0
 
        USE kinds
@@ -107,5 +110,5 @@
                    sums_l(k,pr,tn) = sums_l(k,pr,tn) + var(k,j,i)              &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 22 ) )
+                                              BTEST( wall_flags_static_0(k,j,i), 22 ) )
                 ENDDO
              ENDDO
Index: /palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4329)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4306 2019-11-25 12:04:48Z banzhafs
 ! Corretion for r4304 commit
 !
@@ -246,5 +249,5 @@
     USE indices,                                                                                   &
          ONLY:  advc_flags_s,                                                                      &
-                nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nz, nzb, nzt, wall_flags_0
+                nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nz, nzb, nzt, wall_flags_static_0
 
     USE pegrid,                                                                                    &
@@ -917,5 +920,5 @@
                 DO  j = nysg, nyng
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       cs_3d(k,j,i) = cs_pr_init(k) * flag
                    ENDDO
@@ -942,5 +945,5 @@
                 DO  j = nysg, nyng
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       cs_3d(k,j,i) = cs_3d(k,j,copied) * flag
                    ENDDO
@@ -979,5 +982,5 @@
                 DO  j = ss, ee
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       cs_3d(k,j,i) = cs_pr_init(k) * flag
                    ENDDO
@@ -1005,5 +1008,5 @@
                 DO  j = ss, ee
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       cs_3d(k,j,i) = cs_3d(k,copied,i) * flag
                    ENDDO
@@ -1328,5 +1331,5 @@
                                               chem_species(lsp)%conc(k,j,i),                       &
                                               REAL( fill_value, KIND = wp ),                       &
-                                              BTEST( wall_flags_0(k,j,i), 0 ) )
+                                              BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -1340,5 +1343,5 @@
                                               chem_species(lsp)%conc_av(k,j,i),                    &
                                               REAL( fill_value, KIND = wp ),                       &
-                                              BTEST( wall_flags_0(k,j,i), 0 ) )
+                                              BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -1436,5 +1439,5 @@
                                              chem_species(lsp)%conc(k,j,i),   &
                                              REAL( fill_value, KIND = wp ),   &
-                                             BTEST( wall_flags_0(k,j,i), 0 ) )
+                                             BTEST( wall_flags_static_0(k,j,i), 0 ) )
                      ENDDO
                   ENDDO
@@ -1449,5 +1452,5 @@
                                              chem_species(lsp)%conc_av(k,j,i),&
                                              REAL( fill_value, KIND = wp ),   &
-                                             BTEST( wall_flags_0(k,j,i), 0 ) )
+                                             BTEST( wall_flags_static_0(k,j,i), 0 ) )
                      ENDDO
                   ENDDO
@@ -1529,9 +1532,9 @@
                       im = mask_i(mid,i)
                       jm = mask_j(mid,j)
-                      ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                      ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                       DO  k = 1, mask_size_l(mid,3)
                          kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !--                      Set value if not in building
-                         IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                         IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                             local_pf(i,j,k) = fill_value
                          ELSE
@@ -1565,9 +1568,9 @@
                       im = mask_i(mid,i)
                       jm = mask_j(mid,j)
-                      ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                      ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                       DO  k = 1, mask_size_l(mid,3)
                          kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !--                      Set value if not in building
-                         IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                         IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                             local_pf(i,j,k) = fill_value
                          ELSE
@@ -1892,5 +1895,5 @@
        ALLOCATE( cs_advc_flags_s(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
 !
-!--    In case of decyling, set Neumann boundary conditions for wall_flags_0 
+!--    In case of decyling, set Neumann boundary conditions for wall_flags_static_0 
 !--    bit 31 instead of cyclic boundary conditions.
 !--    Bit 31 is used to identify extended degradation zones (please see
@@ -1898,5 +1901,5 @@
 !--    Note, since several also other modules like Salsa or other future 
 !--    one may access this bit but may have other boundary conditions, the 
-!--    original value of wall_flags_0 bit 31 must not be modified. Hence, 
+!--    original value of wall_flags_static_0 bit 31 must not be modified. Hence, 
 !--    store the boundary conditions directly on cs_advc_flags_s. 
 !--    cs_advc_flags_s will be later overwritten in ws_init_flags_scalar and
@@ -1905,5 +1908,5 @@
        cs_advc_flags_s = 0
        cs_advc_flags_s = MERGE( IBSET( cs_advc_flags_s, 31 ), 0,               &
-                                BTEST( wall_flags_0, 31 ) )
+                                BTEST( wall_flags_static_0, 31 ) )
 
        IF ( decycle_chem_ns )  THEN
@@ -2745,5 +2748,5 @@
                      * ( chem_species(ilsp)%conc(k,j,i) - chem_species(ilsp)%conc_pr_init(k) )     &
                      )                                                                             &
-                     * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                     * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 IF ( chem_species(ilsp)%conc_p(k,j,i) < 0.0_wp )  THEN
@@ -2855,5 +2858,5 @@
                )                                                                                   &
                * MERGE( 1.0_wp, 0.0_wp,                                                            &
-               BTEST( wall_flags_0(k,j,i), 0 )                                                     &
+               BTEST( wall_flags_static_0(k,j,i), 0 )                                                     &
                )
 
@@ -2997,5 +3000,5 @@
                         rmask(j,i,sr)  *                                   &
                         MERGE( 1.0_wp, 0.0_wp,                             &
-                        BTEST( wall_flags_0(k,j,i), 22 ) )
+                        BTEST( wall_flags_static_0(k,j,i), 22 ) )
                 ENDDO
              ENDDO
Index: /palm/trunk/SOURCE/coriolis.f90
===================================================================
--- /palm/trunk/SOURCE/coriolis.f90	(revision 4328)
+++ /palm/trunk/SOURCE/coriolis.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4196 2019-08-29 11:02:06Z gronemeier
 ! Consider rotation of model domain
 ! 
@@ -76,5 +79,5 @@
            
        USE indices,                                                            &
-           ONLY:  nxl, nxlu, nxr, nyn, nys, nysv, nzb, nzt, wall_flags_0
+           ONLY:  nxl, nxlu, nxr, nyn, nys, nysv, nzb, nzt, wall_flags_static_0
                    
        USE kinds
@@ -104,5 +107,5 @@
           CASE ( 1 )
              !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k, flag) &
-             !$ACC PRESENT(wall_flags_0) &
+             !$ACC PRESENT(wall_flags_static_0) &
              !$ACC PRESENT(v, w, vg) &
              !$ACC PRESENT(tend)
@@ -112,5 +115,5 @@
 !
 !--                   Predetermine flag to mask topography
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 1 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 1 ) )
 
                       tend(k,j,i) = tend(k,j,i) + flag *                                           &
@@ -129,5 +132,5 @@
           CASE ( 2 )
              !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k, flag) &
-             !$ACC PRESENT(wall_flags_0) &
+             !$ACC PRESENT(wall_flags_static_0) &
              !$ACC PRESENT(u, w, ug) &
              !$ACC PRESENT(tend)
@@ -137,5 +140,5 @@
 !
 !--                   Predetermine flag to mask topography
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 2 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 2 ) )
 
                       tend(k,j,i) = tend(k,j,i) - flag *                                           &
@@ -154,5 +157,5 @@
           CASE ( 3 )
              !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k, flag) &
-             !$ACC PRESENT(wall_flags_0) &
+             !$ACC PRESENT(wall_flags_static_0) &
              !$ACC PRESENT(u, v) &
              !$ACC PRESENT(tend)
@@ -162,5 +165,5 @@
 !
 !--                   Predetermine flag to mask topography
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 3 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 3 ) )
 
                       tend(k,j,i) = tend(k,j,i)                                                 &
@@ -202,5 +205,5 @@
            
        USE indices,                                                            &
-           ONLY:  nzb, nzt, wall_flags_0
+           ONLY:  nzb, nzt, wall_flags_static_0
            
        USE kinds
@@ -232,5 +235,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 1 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 1 ) )
 
                 tend(k,j,i) = tend(k,j,i) + flag *                                                 &
@@ -249,5 +252,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 2 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 2 ) )
 
                 tend(k,j,i) = tend(k,j,i) - flag *                                                 &
@@ -266,5 +269,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 3 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 3 ) )
 
                 tend(k,j,i) = tend(k,j,i)                                                 &
Index: /palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_2d.f90	(revision 4328)
+++ /palm/trunk/SOURCE/data_output_2d.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -97,5 +100,5 @@
     USE indices,                                                               &
         ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg,       &
-               nzb, nzt, wall_flags_0
+               nzb, nzt, wall_flags_static_0
 
     USE kinds
@@ -1181,5 +1184,5 @@
                       local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i),          &
                                                REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i),     &
+                                               BTEST( wall_flags_static_0(k,j,i),     &
                                                       flag_nr ) ) 
                    ENDDO
Index: /palm/trunk/SOURCE/data_output_3d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_3d.f90	(revision 4328)
+++ /palm/trunk/SOURCE/data_output_3d.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -95,9 +98,9 @@
     USE indices,                                                               &
         ONLY:  nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt,     &
-               wall_flags_0
+               wall_flags_static_0
 #else
     USE indices,                                                               &
         ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb,  &
-               nzt, wall_flags_0
+               nzt, wall_flags_static_0
 #endif
 
@@ -620,5 +623,5 @@
                                       to_be_resorted(k,j,i),                   &
                                       REAL( fill_value, KIND = wp ),           &
-                                      BTEST( wall_flags_0(k,j,i), flag_nr ) )
+                                      BTEST( wall_flags_static_0(k,j,i), flag_nr ) )
                 ENDDO
              ENDDO
Index: /palm/trunk/SOURCE/data_output_mask.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_mask.f90	(revision 4328)
+++ /palm/trunk/SOURCE/data_output_mask.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4246 2019-09-30 09:27:52Z pavelkrc
 ! Corrected "Former revisions" section
 ! 
@@ -91,5 +94,5 @@
 
     USE indices,                                                               &
-        ONLY:  nbgp, nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0
+        ONLY:  nbgp, nxl, nxr, nyn, nys, nzb, nzt, wall_flags_static_0
 
     USE kinds
@@ -261,10 +264,10 @@
                          im = mask_i(mid,i)
                          jm = mask_j(mid,j)
-                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )),&
+                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )),&
                                        DIM = 1 ) - 1
                          DO  k = 1, mask_size_l(mid,3)
                             kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !--                         Set value if not in building
-                            IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                            IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                local_pf(i,j,k) = fill_value
                             ELSE
@@ -330,9 +333,9 @@
                          im = mask_i(mid,i)
                          jm = mask_j(mid,j)
-                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                          DO  k = 1, mask_size_l(mid,3)
                             kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !--                         Set value if not in building
-                            IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                            IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                local_pf(i,j,k) = fill_value
                             ELSE
@@ -373,9 +376,9 @@
                             im = mask_i(mid,i)
                             jm = mask_j(mid,j)
-                            ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                            ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                             DO  k = 1, mask_size_l(mid,3)
                                kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !--                            Set value if not in building
-                               IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                               IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                   local_pf(i,j,k) = fill_value
                                ELSE
@@ -467,9 +470,9 @@
                          im = mask_i(mid,i)
                          jm = mask_j(mid,j)
-                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                          DO  k = 1, mask_size_l(mid,3)
                             kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !--                         Set value if not in building
-                            IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                            IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                local_pf(i,j,k) = fill_value
                             ELSE
@@ -506,9 +509,9 @@
                          im = mask_i(mid,i)
                          jm = mask_j(mid,j)
-                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                          DO  k = 1, mask_size_l(mid,3)
                             kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !--                         Set value if not in building
-                            IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                            IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                local_pf(i,j,k) = fill_value
                             ELSE
@@ -648,9 +651,9 @@
                    im = mask_i(mid,i)
                    jm = mask_j(mid,j)
-                   ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                   ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                    DO  k = 1, mask_size_l(mid,3)
                       kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !--                   Set value if not in building
-                      IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                      IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                          local_pf(i,j,k) = fill_value
                       ELSE
Index: /palm/trunk/SOURCE/diagnostic_output_quantities_mod.f90
===================================================================
--- /palm/trunk/SOURCE/diagnostic_output_quantities_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/diagnostic_output_quantities_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -92,5 +95,5 @@
 ! 
     USE indices,                                                               &
-        ONLY:  nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0
+        ONLY:  nxl, nxr, nyn, nys, nzb, nzt, wall_flags_static_0
 ! 
     USE kinds
@@ -582,5 +585,5 @@
                 local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i),                &
                                          REAL( fill_value, KIND = wp ),        &
-                                         BTEST( wall_flags_0(k,j,i), flag_nr ) ) 
+                                         BTEST( wall_flags_static_0(k,j,i), flag_nr ) ) 
              ENDDO
           ENDDO
@@ -685,5 +688,5 @@
                 local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i),                &
                                          REAL( fill_value, KIND = wp ),        &
-                                         BTEST( wall_flags_0(k,j,i), flag_nr ) ) 
+                                         BTEST( wall_flags_static_0(k,j,i), flag_nr ) ) 
              ENDDO
           ENDDO
@@ -802,5 +805,5 @@
                 im = mask_i(mid,i)
                 jm = mask_j(mid,j)
-                ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), &
+                ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), &
                               DIM = 1 ) - 1
                 DO  k = 1, mask_size_l(mid,3)
@@ -808,5 +811,5 @@
 !
 !--                Set value if not in building
-                   IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                   IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                       local_pf(i,j,k) = fill_value
                    ELSE
@@ -933,5 +936,5 @@
                           - (   u(k,j+1,i) + u(k,j+1,i+1)                      &
                               - u(k,j-1,i) - u(k,j-1,i+1) ) * ddy     )**2  )  &
-                       * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0) )
+                       * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0) )
                    ENDDO
                 ENDDO
@@ -944,5 +947,5 @@
                    DO  k = nzb+1, nzt
                       uu(k,j,i) = u(k,j,i) * u(k,j,i)                          &
-                       * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 1) )
+                       * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 1) )
                    ENDDO
                 ENDDO
@@ -955,5 +958,5 @@
                    DO  k = nzb+1, nzt
                       vv(k,j,i) = v(k,j,i) * v(k,j,i)                          &
-                       * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 2) )
+                       * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 2) )
                    ENDDO
                 ENDDO
@@ -966,5 +969,5 @@
                    DO  k = nzb+1, nzt-1
                       ww(k,j,i) = w(k,j,i) * w(k,j,i)                          &
-                       * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 3) )
+                       * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 3) )
                    ENDDO
                 ENDDO
Index: /palm/trunk/SOURCE/diffusion_s.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_s.f90	(revision 4328)
+++ /palm/trunk/SOURCE/diffusion_s.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -83,5 +86,5 @@
        
        USE indices,                                                            &
-           ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt, wall_flags_0
+           ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt, wall_flags_static_0
        
        USE kinds
@@ -132,5 +135,5 @@
        !$ACC PRIVATE(surf_e, surf_s, flag, mask_top, mask_bottom) &
        !$ACC PRIVATE(mask_north, mask_south, mask_west, mask_east) &
-       !$ACC PRESENT(wall_flags_0, kh) &
+       !$ACC PRESENT(wall_flags_static_0, kh) &
        !$ACC PRESENT(s) &
        !$ACC PRESENT(ddzu, ddzw, drho_air, rho_air_zw) &
@@ -156,12 +159,12 @@
 !
 !--             Predetermine flag to mask topography and wall-bounded grid points
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
 !
 !--             Predetermine flag to mask wall-bounded grid points, equivalent to
 !--             former s_outer array
-                mask_west  = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i-1), 0 ) )
-                mask_east  = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i+1), 0 ) )
-                mask_south = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j-1,i), 0 ) )
-                mask_north = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j+1,i), 0 ) )
+                mask_west  = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i-1), 0 ) )
+                mask_east  = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i+1), 0 ) )
+                mask_south = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j-1,i), 0 ) )
+                mask_north = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j+1,i), 0 ) )
 
                 tend(k,j,i) = tend(k,j,i)                                      &
@@ -297,11 +300,11 @@
 !--             flux at model top. 
                 mask_bottom = MERGE( 1.0_wp, 0.0_wp,                           &
-                                     BTEST( wall_flags_0(k-1,j,i), 8 ) ) 
+                                     BTEST( wall_flags_static_0(k-1,j,i), 8 ) ) 
                 mask_top    = MERGE( 1.0_wp, 0.0_wp,                           &
-                                     BTEST( wall_flags_0(k+1,j,i), 8 ) ) *     &
+                                     BTEST( wall_flags_static_0(k+1,j,i), 8 ) ) *     &
                               MERGE( 1.0_wp, 0.0_wp,                           &
-                                     BTEST( wall_flags_0(k+1,j,i), 9 ) ) 
+                                     BTEST( wall_flags_static_0(k+1,j,i), 9 ) ) 
                 flag        = MERGE( 1.0_wp, 0.0_wp,                           &
-                                     BTEST( wall_flags_0(k,j,i), 0 ) )
+                                     BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 tend(k,j,i) = tend(k,j,i)                                      &
@@ -412,5 +415,5 @@
        
        USE indices,                                                            &
-           ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt, wall_flags_0
+           ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt, wall_flags_static_0
        
        USE kinds
@@ -462,12 +465,12 @@
 !
 !--       Predetermine flag to mask topography and wall-bounded grid points
-          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) ) 
+          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
 !
 !--       Predetermine flag to mask wall-bounded grid points, equivalent to
 !--       former s_outer array
-          mask_west  = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i-1), 0 ) )
-          mask_east  = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i+1), 0 ) )
-          mask_south = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j-1,i), 0 ) )
-          mask_north = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j+1,i), 0 ) )
+          mask_west  = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i-1), 0 ) )
+          mask_east  = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i+1), 0 ) )
+          mask_south = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j-1,i), 0 ) )
+          mask_north = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j+1,i), 0 ) )
 !
 !--       Finally, determine flag to mask both topography itself as well
@@ -607,11 +610,11 @@
 !--       flux at model top.   
           mask_bottom = MERGE( 1.0_wp, 0.0_wp,                                 &
-                               BTEST( wall_flags_0(k-1,j,i), 8 ) ) 
+                               BTEST( wall_flags_static_0(k-1,j,i), 8 ) ) 
           mask_top    = MERGE( 1.0_wp, 0.0_wp,                                 &
-                               BTEST( wall_flags_0(k+1,j,i), 8 ) )  *          &
+                               BTEST( wall_flags_static_0(k+1,j,i), 8 ) )  *          &
                         MERGE( 1.0_wp, 0.0_wp,                                 &
-                               BTEST( wall_flags_0(k+1,j,i), 9 ) )
+                               BTEST( wall_flags_static_0(k+1,j,i), 9 ) )
           flag        = MERGE( 1.0_wp, 0.0_wp,                                 &
-                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
           tend(k,j,i) = tend(k,j,i)                                            &
Index: /palm/trunk/SOURCE/diffusion_u.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_u.f90	(revision 4328)
+++ /palm/trunk/SOURCE/diffusion_u.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -72,5 +75,5 @@
        
        USE indices,                                                            &
-           ONLY:  nxlu, nxr, nyn, nys, nzb, nzt, wall_flags_0
+           ONLY:  nxlu, nxr, nyn, nys, nzb, nzt, wall_flags_static_0
      
        USE kinds
@@ -105,5 +108,5 @@
        !$ACC PRIVATE(surf_e, surf_s, flag, kmym, kmyp, kmzm, kmzp) &
        !$ACC PRIVATE(mask_bottom, mask_north, mask_south, mask_top) &
-       !$ACC PRESENT(wall_flags_0, km) &
+       !$ACC PRESENT(wall_flags_static_0, km) &
        !$ACC PRESENT(u, v, w) &
        !$ACC PRESENT(ddzu, ddzw, drho_air, rho_air_zw) &
@@ -121,7 +124,7 @@
 !--             It is sufficient to masked only north- and south-facing surfaces, which
 !--             need special treatment for the u-component. 
-                flag       = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i),   1 ) ) 
-                mask_south = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j-1,i), 1 ) )
-                mask_north = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j+1,i), 1 ) )
+                flag       = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i),   1 ) ) 
+                mask_south = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j-1,i), 1 ) )
+                mask_north = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j+1,i), 1 ) )
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
@@ -196,11 +199,11 @@
 !--             momentum flux at model top.  
                 mask_bottom = MERGE( 1.0_wp, 0.0_wp,                           &
-                                     BTEST( wall_flags_0(k-1,j,i), 8 ) ) 
+                                     BTEST( wall_flags_static_0(k-1,j,i), 8 ) ) 
                 mask_top    = MERGE( 1.0_wp, 0.0_wp,                           &
-                                     BTEST( wall_flags_0(k+1,j,i), 8 ) ) *     &
+                                     BTEST( wall_flags_static_0(k+1,j,i), 8 ) ) *     &
                               MERGE( 1.0_wp, 0.0_wp,                           &
-                                     BTEST( wall_flags_0(k+1,j,i), 9 ) ) 
+                                     BTEST( wall_flags_static_0(k+1,j,i), 9 ) ) 
                 flag        = MERGE( 1.0_wp, 0.0_wp,                           &
-                                     BTEST( wall_flags_0(k,j,i), 1 ) ) 
+                                     BTEST( wall_flags_static_0(k,j,i), 1 ) ) 
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
@@ -319,5 +322,5 @@
        
        USE indices,                                                            &
-           ONLY:  nzb, nzt, wall_flags_0
+           ONLY:  nzb, nzt, wall_flags_static_0
       
        USE kinds
@@ -353,7 +356,7 @@
 !--       It is sufficient to masked only north- and south-facing surfaces, which
 !--       need special treatment for the u-component. 
-          flag       = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i),   1 ) ) 
-          mask_south = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j-1,i), 1 ) )
-          mask_north = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j+1,i), 1 ) )
+          flag       = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i),   1 ) ) 
+          mask_south = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j-1,i), 1 ) )
+          mask_north = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j+1,i), 1 ) )
 !
 !--       Interpolate eddy diffusivities on staggered gridpoints
@@ -422,11 +425,11 @@
 !--       momentum flux at model top. 
           mask_bottom = MERGE( 1.0_wp, 0.0_wp,                                 &
-                               BTEST( wall_flags_0(k-1,j,i), 8 ) ) 
+                               BTEST( wall_flags_static_0(k-1,j,i), 8 ) ) 
           mask_top    = MERGE( 1.0_wp, 0.0_wp,                                 &
-                               BTEST( wall_flags_0(k+1,j,i), 8 ) ) *           &
+                               BTEST( wall_flags_static_0(k+1,j,i), 8 ) ) *           &
                         MERGE( 1.0_wp, 0.0_wp,                                 &
-                               BTEST( wall_flags_0(k+1,j,i), 9 ) )
+                               BTEST( wall_flags_static_0(k+1,j,i), 9 ) )
           flag        = MERGE( 1.0_wp, 0.0_wp,                                 &
-                               BTEST( wall_flags_0(k,j,i), 1 ) ) 
+                               BTEST( wall_flags_static_0(k,j,i), 1 ) ) 
 !
 !--       Interpolate eddy diffusivities on staggered gridpoints
Index: /palm/trunk/SOURCE/diffusion_v.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_v.f90	(revision 4328)
+++ /palm/trunk/SOURCE/diffusion_v.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -70,5 +73,5 @@
        
        USE indices,                                                            &
-           ONLY:  nxl, nxr, nyn, nysv, nzb, nzt, wall_flags_0
+           ONLY:  nxl, nxr, nyn, nysv, nzb, nzt, wall_flags_static_0
        
        USE kinds
@@ -101,5 +104,5 @@
        !$ACC PRIVATE(surf_e, surf_s, flag, kmxm, kmxp, kmzm, kmzp) &
        !$ACC PRIVATE(mask_bottom, mask_east, mask_west, mask_top) &
-       !$ACC PRESENT(wall_flags_0, km) &
+       !$ACC PRESENT(wall_flags_static_0, km) &
        !$ACC PRESENT(u, v, w) &
        !$ACC PRESENT(ddzu, ddzw, drho_air, rho_air_zw) &
@@ -118,7 +121,7 @@
 !--             It is sufficient to masked only east- and west-facing surfaces, which
 !--             need special treatment for the v-component. 
-                flag      = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i),   2 ) ) 
-                mask_east = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i+1), 2 ) )
-                mask_west = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i-1), 2 ) )
+                flag      = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i),   2 ) ) 
+                mask_east = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i+1), 2 ) )
+                mask_west = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i-1), 2 ) )
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
@@ -192,11 +195,11 @@
 !--             momentum flux at model top.  
                 mask_bottom = MERGE( 1.0_wp, 0.0_wp,                           &
-                                     BTEST( wall_flags_0(k-1,j,i), 8 ) ) 
+                                     BTEST( wall_flags_static_0(k-1,j,i), 8 ) ) 
                 mask_top    = MERGE( 1.0_wp, 0.0_wp,                           &
-                                     BTEST( wall_flags_0(k+1,j,i), 8 ) ) *     &
+                                     BTEST( wall_flags_static_0(k+1,j,i), 8 ) ) *     &
                               MERGE( 1.0_wp, 0.0_wp,                           &
-                                     BTEST( wall_flags_0(k+1,j,i), 9 ) ) 
+                                     BTEST( wall_flags_static_0(k+1,j,i), 9 ) ) 
                 flag        = MERGE( 1.0_wp, 0.0_wp,                           &
-                                     BTEST( wall_flags_0(k,j,i), 2 ) ) 
+                                     BTEST( wall_flags_static_0(k,j,i), 2 ) ) 
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
@@ -310,5 +313,5 @@
        
        USE indices,                                                            &
-           ONLY:  nzb, nzt, wall_flags_0
+           ONLY:  nzb, nzt, wall_flags_static_0
        
        USE kinds
@@ -346,7 +349,7 @@
 !--       It is sufficient to masked only east- and west-facing surfaces, which
 !--       need special treatment for the v-component. 
-          flag      = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i),   2 ) ) 
-          mask_east = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i+1), 2 ) )
-          mask_west = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i-1), 2 ) )
+          flag      = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i),   2 ) ) 
+          mask_east = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i+1), 2 ) )
+          mask_west = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i-1), 2 ) )
 !
 !--       Interpolate eddy diffusivities on staggered gridpoints
@@ -416,11 +419,11 @@
 !--       momentum flux at model top.  
           mask_bottom = MERGE( 1.0_wp, 0.0_wp,                                 &
-                               BTEST( wall_flags_0(k-1,j,i), 8 ) ) 
+                               BTEST( wall_flags_static_0(k-1,j,i), 8 ) ) 
           mask_top    = MERGE( 1.0_wp, 0.0_wp,                                 &
-                               BTEST( wall_flags_0(k+1,j,i), 8 ) ) *           &
+                               BTEST( wall_flags_static_0(k+1,j,i), 8 ) ) *           &
                         MERGE( 1.0_wp, 0.0_wp,                                 &
-                               BTEST( wall_flags_0(k+1,j,i), 9 ) ) 
+                               BTEST( wall_flags_static_0(k+1,j,i), 9 ) ) 
           flag        = MERGE( 1.0_wp, 0.0_wp,                                 &
-                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                               BTEST( wall_flags_static_0(k,j,i), 2 ) )
 !
 !--       Interpolate eddy diffusivities on staggered gridpoints
Index: /palm/trunk/SOURCE/diffusion_w.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_w.f90	(revision 4328)
+++ /palm/trunk/SOURCE/diffusion_w.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -66,5 +69,5 @@
            
        USE indices,                                                            &            
-           ONLY :  nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0
+           ONLY :  nxl, nxr, nyn, nys, nzb, nzt, wall_flags_static_0
            
        USE kinds
@@ -98,5 +101,5 @@
        !$ACC PRIVATE(surf_e, surf_s, flag, kmxm, kmxp, kmym, kmyp) &
        !$ACC PRIVATE(mask_west, mask_east, mask_south, mask_north) &
-       !$ACC PRESENT(wall_flags_0, km) &
+       !$ACC PRESENT(wall_flags_static_0, km) &
        !$ACC PRESENT(u, v, w) &
        !$ACC PRESENT(ddzu, ddzw, rho_air, drho_air_zw) &
@@ -111,13 +114,13 @@
 !--             Predetermine flag to mask topography and wall-bounded grid points. 
                 flag       = MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j,i),   3 ) ) 
+                                    BTEST( wall_flags_static_0(k,j,i),   3 ) ) 
                 mask_east  = MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j,i+1), 3 ) )
+                                    BTEST( wall_flags_static_0(k,j,i+1), 3 ) )
                 mask_west  = MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j,i-1), 3 ) )
+                                    BTEST( wall_flags_static_0(k,j,i-1), 3 ) )
                 mask_south = MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j-1,i), 3 ) )
+                                    BTEST( wall_flags_static_0(k,j-1,i), 3 ) )
                 mask_north = MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j+1,i), 3 ) )
+                                    BTEST( wall_flags_static_0(k,j+1,i), 3 ) )
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
@@ -251,5 +254,5 @@
            
        USE indices,                                                            &            
-           ONLY :  nzb, nzt, wall_flags_0
+           ONLY :  nzb, nzt, wall_flags_static_0
            
        USE kinds
@@ -283,9 +286,9 @@
 !
 !--       Predetermine flag to mask topography and wall-bounded grid points. 
-          flag       = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i),   3 ) ) 
-          mask_east  = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i+1), 3 ) )
-          mask_west  = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i-1), 3 ) )
-          mask_south = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j-1,i), 3 ) )
-          mask_north = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j+1,i), 3 ) )
+          flag       = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i),   3 ) ) 
+          mask_east  = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i+1), 3 ) )
+          mask_west  = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i-1), 3 ) )
+          mask_south = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j-1,i), 3 ) )
+          mask_north = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j+1,i), 3 ) )
 !
 !--       Interpolate eddy diffusivities on staggered gridpoints
Index: /palm/trunk/SOURCE/disturb_field.f90
===================================================================
--- /palm/trunk/SOURCE/disturb_field.f90	(revision 4328)
+++ /palm/trunk/SOURCE/disturb_field.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4237 2019-09-25 11:33:42Z knoop
 ! Added missing OpenMP directives
 ! 
@@ -59,5 +62,5 @@
     USE indices,                                                               &
         ONLY:  nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzb_max, &
-               nzt, wall_flags_0
+               nzt, wall_flags_static_0
         
     USE kinds
@@ -214,5 +217,5 @@
              DO  k = nzb, nzb_max
                 dist1(k,j,i) = MERGE( dist1(k,j,i), 0.0_wp,                    &
-                                      BTEST( wall_flags_0(k,j,i), flag_nr )    &
+                                      BTEST( wall_flags_static_0(k,j,i), flag_nr )    &
                                     )
              ENDDO
Index: /palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- /palm/trunk/SOURCE/flow_statistics.f90	(revision 4328)
+++ /palm/trunk/SOURCE/flow_statistics.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -92,5 +95,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_0
+                wall_flags_static_0
         
     USE kinds
@@ -254,9 +257,9 @@
        !$OMP DO
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k, flag) &
-       !$ACC PRESENT(wall_flags_0, u, v, pt, rmask, sums_l)
+       !$ACC PRESENT(wall_flags_static_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_0(k,j,i), 22 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_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)  &
@@ -283,5 +286,5 @@
                                     * rmask(j,i,sr)                            &
                                     * MERGE( 1.0_wp, 0.0_wp,                   &
-                                             BTEST( wall_flags_0(k,j,i), 22 ) )
+                                             BTEST( wall_flags_static_0(k,j,i), 22 ) )
                 ENDDO
              ENDDO
@@ -298,5 +301,5 @@
              DO  j =  nys, nyn
                 DO  k = nzb, nzt+1
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 22 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
                    sums_l(k,44,tn)  = sums_l(k,44,tn) +                        &
                                       vpt(k,j,i) * rmask(j,i,sr) * flag
@@ -311,5 +314,5 @@
                 DO  j =  nys, nyn
                    DO  k = nzb, nzt+1
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 22 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_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) &
@@ -335,5 +338,5 @@
                                     * rmask(j,i,sr)                            &
                                     * MERGE( 1.0_wp, 0.0_wp,                   &
-                                             BTEST( wall_flags_0(k,j,i), 22 ) )
+                                             BTEST( wall_flags_static_0(k,j,i), 22 ) )
                 ENDDO
              ENDDO
@@ -476,5 +479,5 @@
        !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j, k, m) &
        !$ACC PRIVATE(sums_l_etot, flag) &
-       !$ACC PRESENT(wall_flags_0, rmask, momentumflux_output_conversion) &
+       !$ACC PRESENT(wall_flags_static_0, rmask, momentumflux_output_conversion) &
        !$ACC PRESENT(hom(:,1,4,sr)) &
        !$ACC PRESENT(e, u, v, w, km, kh, p, pt) &
@@ -485,5 +488,5 @@
              sums_l_etot = 0.0_wp
              DO  k = nzb, nzt+1
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 22 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
 !
 !--             Prognostic and diagnostic variables
@@ -653,5 +656,5 @@
              DO  j =  nys, nyn
                 DO  k = nzb, nzt+1
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 22 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
 
                    u2   = u(k,j,i)**2
@@ -685,10 +688,10 @@
        !$OMP DO
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k, flag, w2, ust2, vst2) &
-       !$ACC PRESENT(wall_flags_0, u, v, w, rmask, hom(:,1,1:2,sr)) &
+       !$ACC PRESENT(wall_flags_static_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_0(k,j,i), 22 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
 
                 w2   = w(k,j,i)**2
@@ -714,5 +717,5 @@
        !$ACC PRIVATE(ki, flag, ust, vst, pts) &
        !$ACC PRESENT(kh, km, u, v, w, pt) &
-       !$ACC PRESENT(wall_flags_0, rmask, ddzu, rho_air_zw, hom(:,1,1:4,sr)) &
+       !$ACC PRESENT(wall_flags_static_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) &
@@ -732,7 +735,7 @@
              DO  k = nzb, nzt
                 flag = MERGE( 1.0_wp, 0.0_wp,                                  &
-                              BTEST( wall_flags_0(k,j,i), 23 ) ) *             &
+                              BTEST( wall_flags_static_0(k,j,i), 23 ) ) *             &
                        MERGE( 1.0_wp, 0.0_wp,                                  &
-                              BTEST( wall_flags_0(k,j,i), 9  ) )
+                              BTEST( wall_flags_static_0(k,j,i), 9  ) )
 !
 !--             Momentum flux w"u"
@@ -1206,5 +1209,5 @@
 !--                rearranged according to the staggered grid.
              DO  k = nzb, nzt
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 22 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_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) )
@@ -1395,7 +1398,7 @@
 !--                fluxes, which are added further below. 
                    flag = MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_0(k,j,i), 23 ) ) *          &
+                                 BTEST( wall_flags_static_0(k,j,i), 23 ) ) *          &
                           MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_0(k,j,i), 9  ) )
+                                 BTEST( wall_flags_static_0(k,j,i), 9  ) )
 
                    ust = 0.5_wp * ( u(k,j,i)   - hom(k,1,1,sr) +               &
@@ -1430,7 +1433,7 @@
                 DO  k = nzb, nzt
                    flag = MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_0(k,j,i), 23 ) ) *          &
+                                 BTEST( wall_flags_static_0(k,j,i), 23 ) ) *          &
                           MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_0(k,j,i), 9  ) )
+                                 BTEST( wall_flags_static_0(k,j,i), 9  ) )
 !
 !--                Vertical heat flux
@@ -1481,5 +1484,5 @@
              DO  j = nys, nyn
                 DO  k = nzb+1, nzt
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                    sums_ll(k,1) = sums_ll(k,1) + 0.5_wp * w(k,j,i) * (         &
@@ -1523,5 +1526,5 @@
                 DO  k = nzb+1, nzt
 
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                    sums_l(k,57,tn) = sums_l(k,57,tn) - 0.5_wp * (              &
@@ -1552,5 +1555,5 @@
              DO  j = nys, nyn
                 DO  k = nzb+1, nzt
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 !
 !--                Subgrid horizontal heat fluxes u"pt", v"pt"
@@ -1650,5 +1653,5 @@
              DO  j =  nys, nyn
                 DO  k = nzb+1, nzt+1
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                    sums_l(k,100,tn)  = sums_l(k,100,tn)  + rad_lw_in(k,j,i)    &
Index: /palm/trunk/SOURCE/indoor_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/indoor_model_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/indoor_model_mod.f90	(revision 4329)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4310 2019-11-26 19:01:28Z suehring
 ! Remove dt_indoor from namelist input. The indoor model is an hourly-based 
 ! model, calling it more/less often lead to inaccurate results.
@@ -478,5 +481,5 @@
 
     USE indices,                                                               &
-        ONLY:  nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0
+        ONLY:  nxl, nxr, nyn, nys, nzb, nzt, wall_flags_static_0
 
     USE grid_variables,                                                        &
@@ -668,5 +671,5 @@
 !
 !--             Check if grid point belongs to a building. 
-                IF ( BTEST( wall_flags_0(k,j,i), 6 ) )  THEN
+                IF ( BTEST( wall_flags_static_0(k,j,i), 6 ) )  THEN
                    k_min_l(nb) = MIN( k_min_l(nb), k )
                    k_max_l(nb) = MAX( k_max_l(nb), k )
Index: /palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- /palm/trunk/SOURCE/init_3d_model.f90	(revision 4328)
+++ /palm/trunk/SOURCE/init_3d_model.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4286 2019-10-30 16:01:14Z resler
 ! implement new palm_date_time_mod
 ! 
@@ -774,7 +777,7 @@
 !--       Set velocity components at non-atmospheric / oceanic grid points to 
 !--       zero. 
-          u = MERGE( u, 0.0_wp, BTEST( wall_flags_0, 1 ) )
-          v = MERGE( v, 0.0_wp, BTEST( wall_flags_0, 2 ) )
-          w = MERGE( w, 0.0_wp, BTEST( wall_flags_0, 3 ) )
+          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 ) )
 !
 !--       Initialize surface variables, e.g. friction velocity, momentum 
@@ -824,6 +827,6 @@
 !
 !--       Set velocities back to zero
-          u = MERGE( u, 0.0_wp, BTEST( wall_flags_0, 1 ) )
-          v = MERGE( v, 0.0_wp, BTEST( wall_flags_0, 2 ) )         
+          u = MERGE( u, 0.0_wp, BTEST( wall_flags_static_0, 1 ) )
+          v = MERGE( v, 0.0_wp, BTEST( wall_flags_static_0, 2 ) )         
 !
 !--       WARNING: The extra boundary conditions set after running the
@@ -868,6 +871,6 @@
 !
 !--       Mask topography
-          u = MERGE( u, 0.0_wp, BTEST( wall_flags_0, 1 ) )
-          v = MERGE( v, 0.0_wp, BTEST( wall_flags_0, 2 ) )
+          u = MERGE( u, 0.0_wp, BTEST( wall_flags_static_0, 1 ) )
+          v = MERGE( v, 0.0_wp, BTEST( wall_flags_static_0, 2 ) )
 !
 !--       Set initial horizontal velocities at the lowest computational grid 
@@ -884,7 +887,7 @@
                    DO  k = nzb, nzt
                       u(k,j,i) = MERGE( u(k,j,i), 0.0_wp,                      &
-                                        BTEST( wall_flags_0(k,j,i), 20 ) )
+                                        BTEST( wall_flags_static_0(k,j,i), 20 ) )
                       v(k,j,i) = MERGE( v(k,j,i), 0.0_wp,                      &
-                                        BTEST( wall_flags_0(k,j,i), 21 ) )
+                                        BTEST( wall_flags_static_0(k,j,i), 21 ) )
                    ENDDO
                 ENDDO
@@ -1310,9 +1313,9 @@
                 DO  k = nzb, nzt
                    u(k,j,i)     = MERGE( u(k,j,i), 0.0_wp,                     &
-                                         BTEST( wall_flags_0(k,j,i), 1 ) )
+                                         BTEST( wall_flags_static_0(k,j,i), 1 ) )
                    v(k,j,i)     = MERGE( v(k,j,i), 0.0_wp,                     &
-                                         BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         BTEST( wall_flags_static_0(k,j,i), 2 ) )
                    w(k,j,i)     = MERGE( w(k,j,i), 0.0_wp,                     &
-                                         BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         BTEST( wall_flags_static_0(k,j,i), 3 ) )
                 ENDDO
              ENDDO
@@ -1395,10 +1398,10 @@
                                               u_init(k) * dzw(k)               &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,nxr), 1 )&
+                                              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_0(k,j,nxr), 1 )&
+                                              BTEST( wall_flags_static_0(k,j,nxr), 1 )&
                                             )
                 ENDDO
@@ -1412,9 +1415,9 @@
                                               v_init(k) * dzw(k)               &        
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,nyn,i), 2 )&
+                                              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_0(k,nyn,i), 2 )&
+                                              BTEST( wall_flags_static_0(k,nyn,i), 2 )&
                                             )
                 ENDDO
@@ -1444,9 +1447,9 @@
                                               hom_sum(k,1,0) * dzw(k)          &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,nx), 1 ) &
+                                              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_0(k,j,nx), 1 ) &
+                                              BTEST( wall_flags_static_0(k,j,nx), 1 ) &
                                             )
                 ENDDO
@@ -1460,9 +1463,9 @@
                                               hom_sum(k,2,0) * dzw(k)          &        
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,ny,i), 2 ) &
+                                              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_0(k,ny,i), 2 ) &
+                                              BTEST( wall_flags_static_0(k,ny,i), 2 ) &
                                             )
                 ENDDO
@@ -1492,9 +1495,9 @@
                                               u(k,j,nx) * dzw(k)               &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,nx), 1 ) &
+                                              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_0(k,j,nx), 1 ) &
+                                              BTEST( wall_flags_static_0(k,j,nx), 1 ) &
                                             )
                 ENDDO
@@ -1508,9 +1511,9 @@
                                               v(k,ny,i) * dzw(k)               &        
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,ny,i), 2 ) &
+                                              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_0(k,ny,i), 2 ) &
+                                              BTEST( wall_flags_static_0(k,ny,i), 2 ) &
                                             )
                 ENDDO
@@ -1693,8 +1696,8 @@
 !--                xy-grid points above topography
                    ngp_2dh_outer_l(k,sr) = ngp_2dh_outer_l(k,sr)     +         &
-                                  MERGE( 1, 0, BTEST( wall_flags_0(k,j,i), 24 ) )
+                                  MERGE( 1, 0, BTEST( wall_flags_static_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_0(k,j,i), 22 ) )
+                                  MERGE( 1, 0, BTEST( wall_flags_static_0(k,j,i), 22 ) )
 
                 ENDDO
@@ -1792,5 +1795,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_0(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
+!$ACC COPYIN(wall_flags_static_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)) &
Index: /palm/trunk/SOURCE/init_grid.f90
===================================================================
--- /palm/trunk/SOURCE/init_grid.f90	(revision 4328)
+++ /palm/trunk/SOURCE/init_grid.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4328 2019-12-09 18:53:04Z suehring
 ! Minor change in nzb_max computation. Commentation added.
 ! 
@@ -673,5 +676,5 @@
 !
 !--    Determine local topography height on scalar and w-grid. Note, setting
-!--    lateral boundary values is not necessary, realized via wall_flags_0 
+!--    lateral boundary values is not necessary, realized via wall_flags_static_0 
 !--    array. Further, please note that loop bounds are different from 
 !--    nxl to nxr and nys to nyn on south and right model boundary, hence, 
@@ -2318,5 +2321,5 @@
     USE indices,                                                               &
         ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb,  &
-               nzt, topo_top_ind, wall_flags_0
+               nzt, topo_top_ind, wall_flags_static_0
 
     USE kinds
@@ -2331,6 +2334,6 @@
     INTEGER(iwp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  topo !< input array for 3D topography and dummy array for setting "outer"-flags
 
-    ALLOCATE( wall_flags_0(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
-    wall_flags_0 = 0
+    ALLOCATE( wall_flags_static_0(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
+    wall_flags_static_0 = 0
 !
 !-- Set-up topography flags. First, set flags only for s, u, v and w-grid.
@@ -2342,15 +2345,15 @@
 !--          scalar grid
              IF ( BTEST( topo(k,j,i), 0 ) )                                 &
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 0 )
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 0 )
 !
 !--          u grid
              IF ( BTEST( topo(k,j,i),   0 )  .AND.                          &
                   BTEST( topo(k,j,i-1), 0 ) )                               &
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 1 )
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 1 )
 !
 !--          v grid
              IF ( BTEST( topo(k,j,i),   0 )  .AND.                          &
                   BTEST( topo(k,j-1,i), 0 ) )                               &
-                 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 2 )
+                 wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 2 )
 
           ENDDO
@@ -2361,12 +2364,12 @@
              IF ( BTEST( topo(k,j,i),   0 )  .AND.                          &
                   BTEST( topo(k+1,j,i), 0 ) )                               &
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 3 )
-          ENDDO
-          wall_flags_0(nzt+1,j,i) = IBSET( wall_flags_0(nzt+1,j,i), 3 )
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 3 )
+          ENDDO
+          wall_flags_static_0(nzt+1,j,i) = IBSET( wall_flags_static_0(nzt+1,j,i), 3 )
 
        ENDDO
     ENDDO
 
-    CALL exchange_horiz_int( wall_flags_0, nys, nyn, nxl, nxr, nzt, nbgp )
+    CALL exchange_horiz_int( wall_flags_static_0, nys, nyn, nxl, nxr, nzt, nbgp )
 !
 !-- Set outer array for scalars to mask near-surface grid points. Note, on 
@@ -2376,13 +2379,13 @@
        DO j = nys, nyn
           DO k = nzb, nzt+1
-             IF ( BTEST( wall_flags_0(k,j-1,i), 0 )    .AND.                   &
-                  BTEST( wall_flags_0(k,j+1,i), 0 )    .AND.                   &
-                  BTEST( wall_flags_0(k,j,i-1), 0 )    .AND.                   &
-                  BTEST( wall_flags_0(k,j,i+1), 0 )    .AND.                   &
-                  BTEST( wall_flags_0(k,j-1,i-1), 0 )  .AND.                   &
-                  BTEST( wall_flags_0(k,j+1,i-1), 0 )  .AND.                   &
-                  BTEST( wall_flags_0(k,j-1,i+1), 0 )  .AND.                   &
-                  BTEST( wall_flags_0(k,j+1,i+1), 0 ) )                        &
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 24 )
+             IF ( BTEST( wall_flags_static_0(k,j-1,i), 0 )    .AND.                   &
+                  BTEST( wall_flags_static_0(k,j+1,i), 0 )    .AND.                   &
+                  BTEST( wall_flags_static_0(k,j,i-1), 0 )    .AND.                   &
+                  BTEST( wall_flags_static_0(k,j,i+1), 0 )    .AND.                   &
+                  BTEST( wall_flags_static_0(k,j-1,i-1), 0 )  .AND.                   &
+                  BTEST( wall_flags_static_0(k,j+1,i-1), 0 )  .AND.                   &
+                  BTEST( wall_flags_static_0(k,j-1,i+1), 0 )  .AND.                   &
+                  BTEST( wall_flags_static_0(k,j+1,i+1), 0 ) )                        &
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 24 )
           ENDDO
        ENDDO
@@ -2408,8 +2411,8 @@
 !--          effect on the flow is negligible. 
              IF ( constant_flux_layer  .OR.  use_surface_fluxes )  THEN
-                IF ( BTEST( wall_flags_0(k,j,i), 0 ) )                         &
-                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 8 )
+                IF ( BTEST( wall_flags_static_0(k,j,i), 0 ) )                         &
+                   wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 8 )
              ELSE
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 8 )
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 8 )
              ENDIF
 
@@ -2418,7 +2421,7 @@
 !--       Special flag to control vertical diffusion at model top - former 
 !--       nzt_diff
-          wall_flags_0(:,j,i) = IBSET( wall_flags_0(:,j,i), 9 )
+          wall_flags_static_0(:,j,i) = IBSET( wall_flags_static_0(:,j,i), 9 )
           IF ( use_top_fluxes )                                                &
-             wall_flags_0(nzt+1,j,i) = IBCLR( wall_flags_0(nzt+1,j,i), 9 )
+             wall_flags_static_0(nzt+1,j,i) = IBCLR( wall_flags_static_0(nzt+1,j,i), 9 )
 
 
@@ -2429,8 +2432,8 @@
 !--          topography, as well as initialize u with zero one grid point outside
 !--          of topography.
-             IF ( BTEST( wall_flags_0(k-1,j,i), 1 )  .AND.                     &
-                  BTEST( wall_flags_0(k,j,i),   1 )  .AND.                     &
-                  BTEST( wall_flags_0(k+1,j,i), 1 ) )                          &
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 20 )
+             IF ( BTEST( wall_flags_static_0(k-1,j,i), 1 )  .AND.                     &
+                  BTEST( wall_flags_static_0(k,j,i),   1 )  .AND.                     &
+                  BTEST( wall_flags_static_0(k+1,j,i), 1 ) )                          &
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 20 )
 !
 !--          Special flag on v grid, former nzb_v_inner + 1, required   
@@ -2438,26 +2441,26 @@
 !--          topography, as well as initialize v with zero one grid point outside
 !--          of topography.
-             IF ( BTEST( wall_flags_0(k-1,j,i), 2 )  .AND.                     &
-                  BTEST( wall_flags_0(k,j,i),   2 )  .AND.                     &
-                  BTEST( wall_flags_0(k+1,j,i), 2 ) )                          &
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 21 )
+             IF ( BTEST( wall_flags_static_0(k-1,j,i), 2 )  .AND.                     &
+                  BTEST( wall_flags_static_0(k,j,i),   2 )  .AND.                     &
+                  BTEST( wall_flags_static_0(k+1,j,i), 2 ) )                          &
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 21 )
 !
 !--          Special flag on scalar grid, former nzb_s_inner+1. Used for 
 !--          lpm_sgs_tke
-             IF ( BTEST( wall_flags_0(k,j,i),   0 )  .AND.                     &
-                  BTEST( wall_flags_0(k-1,j,i), 0 )  .AND.                     &
-                  BTEST( wall_flags_0(k+1,j,i), 0 ) )                          &
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 25 )
+             IF ( BTEST( wall_flags_static_0(k,j,i),   0 )  .AND.                     &
+                  BTEST( wall_flags_static_0(k-1,j,i), 0 )  .AND.                     &
+                  BTEST( wall_flags_static_0(k+1,j,i), 0 ) )                          &
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 25 )
 !
 !--          Special flag on scalar grid, nzb_diff_s_outer - 1, required in 
 !--          in production_e
              IF ( constant_flux_layer  .OR.  use_surface_fluxes )  THEN
-                IF ( BTEST( wall_flags_0(k,j,i),   24 )  .AND.                 &
-                     BTEST( wall_flags_0(k-1,j,i), 24 )  .AND.                 &
-                     BTEST( wall_flags_0(k+1,j,i), 0 ) )                       &
-                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 29 )
+                IF ( BTEST( wall_flags_static_0(k,j,i),   24 )  .AND.                 &
+                     BTEST( wall_flags_static_0(k-1,j,i), 24 )  .AND.                 &
+                     BTEST( wall_flags_static_0(k+1,j,i), 0 ) )                       &
+                   wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 29 )
              ELSE
-                IF ( BTEST( wall_flags_0(k,j,i), 0 ) )                         &
-                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 29 )
+                IF ( BTEST( wall_flags_static_0(k,j,i), 0 ) )                         &
+                   wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 29 )
              ENDIF
 !
@@ -2465,11 +2468,11 @@
 !--          in production_e
              IF ( constant_flux_layer  .OR.  use_surface_fluxes )  THEN
-                IF ( BTEST( wall_flags_0(k,j,i),   0 )  .AND.                  &
-                     BTEST( wall_flags_0(k-1,j,i), 0 )  .AND.                  &
-                     BTEST( wall_flags_0(k+1,j,i), 0 ) )                       &
-                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 30 )
+                IF ( BTEST( wall_flags_static_0(k,j,i),   0 )  .AND.                  &
+                     BTEST( wall_flags_static_0(k-1,j,i), 0 )  .AND.                  &
+                     BTEST( wall_flags_static_0(k+1,j,i), 0 ) )                       &
+                   wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 30 )
              ELSE
-                IF ( BTEST( wall_flags_0(k,j,i), 0 ) )                         &
-                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 30 )
+                IF ( BTEST( wall_flags_static_0(k,j,i), 0 ) )                         &
+                   wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 30 )
              ENDIF
           ENDDO
@@ -2479,22 +2482,22 @@
 !
 !--          Scalar grid
-             IF ( BTEST( wall_flags_0(k-1,j,i), 0 )  .AND.                     &
-            .NOT. BTEST( wall_flags_0(k,j,i), 0   ) )                          & 
-                 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 13 ) 
+             IF ( BTEST( wall_flags_static_0(k-1,j,i), 0 )  .AND.                     &
+            .NOT. BTEST( wall_flags_static_0(k,j,i), 0   ) )                          & 
+                 wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 13 ) 
 !
 !--          Downward facing wall on u grid
-             IF ( BTEST( wall_flags_0(k-1,j,i), 1 )  .AND.                     &
-            .NOT. BTEST( wall_flags_0(k,j,i), 1   ) )                          & 
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 15 )
+             IF ( BTEST( wall_flags_static_0(k-1,j,i), 1 )  .AND.                     &
+            .NOT. BTEST( wall_flags_static_0(k,j,i), 1   ) )                          & 
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 15 )
 !
 !--          Downward facing wall on v grid
-             IF ( BTEST( wall_flags_0(k-1,j,i), 2 )  .AND.                     &
-            .NOT. BTEST( wall_flags_0(k,j,i), 2   ) )                          & 
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 17 )
+             IF ( BTEST( wall_flags_static_0(k-1,j,i), 2 )  .AND.                     &
+            .NOT. BTEST( wall_flags_static_0(k,j,i), 2   ) )                          & 
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 17 )
 !
 !--          Downward facing wall on w grid
-             IF ( BTEST( wall_flags_0(k-1,j,i), 3 )  .AND.                     &
-            .NOT. BTEST( wall_flags_0(k,j,i), 3 ) )                            & 
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 19 )
+             IF ( BTEST( wall_flags_static_0(k-1,j,i), 3 )  .AND.                     &
+            .NOT. BTEST( wall_flags_static_0(k,j,i), 3 ) )                            & 
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 19 )
           ENDDO
 !
@@ -2503,46 +2506,46 @@
 !
 !--          Upward facing wall on scalar grid
-             IF ( .NOT. BTEST( wall_flags_0(k,j,i),   0 )  .AND.               &
-                        BTEST( wall_flags_0(k+1,j,i), 0 ) )                    & 
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 12 )
+             IF ( .NOT. BTEST( wall_flags_static_0(k,j,i),   0 )  .AND.               &
+                        BTEST( wall_flags_static_0(k+1,j,i), 0 ) )                    & 
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 12 )
 !
 !--          Upward facing wall on u grid
-             IF ( .NOT. BTEST( wall_flags_0(k,j,i),   1 )  .AND.               &
-                        BTEST( wall_flags_0(k+1,j,i), 1 ) )                    & 
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 14 )
+             IF ( .NOT. BTEST( wall_flags_static_0(k,j,i),   1 )  .AND.               &
+                        BTEST( wall_flags_static_0(k+1,j,i), 1 ) )                    & 
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 14 )
 
 !   
 !--          Upward facing wall on v grid
-             IF ( .NOT. BTEST( wall_flags_0(k,j,i),   2 )  .AND.               &
-                        BTEST( wall_flags_0(k+1,j,i), 2 ) )                    & 
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 16 )
+             IF ( .NOT. BTEST( wall_flags_static_0(k,j,i),   2 )  .AND.               &
+                        BTEST( wall_flags_static_0(k+1,j,i), 2 ) )                    & 
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 16 )
    
 !
 !--          Upward facing wall on w grid
-             IF ( .NOT. BTEST( wall_flags_0(k,j,i),   3 )  .AND.               &
-                        BTEST( wall_flags_0(k+1,j,i), 3 ) )                    & 
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 18 )
+             IF ( .NOT. BTEST( wall_flags_static_0(k,j,i),   3 )  .AND.               &
+                        BTEST( wall_flags_static_0(k+1,j,i), 3 ) )                    & 
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 18 )
 !
 !--          Special flag on scalar grid, former nzb_s_inner
-             IF ( BTEST( wall_flags_0(k,j,i), 0 )  .OR.                        &
-                  BTEST( wall_flags_0(k,j,i), 12 ) .OR.                        &
-                  BTEST( wall_flags_0(k,j,i), 13 ) )                           &
-                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 22 )
+             IF ( BTEST( wall_flags_static_0(k,j,i), 0 )  .OR.                        &
+                  BTEST( wall_flags_static_0(k,j,i), 12 ) .OR.                        &
+                  BTEST( wall_flags_static_0(k,j,i), 13 ) )                           &
+                   wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 22 )
 !
 !--          Special flag on scalar grid, nzb_diff_s_inner - 1, required for 
 !--          flow_statistics
              IF ( constant_flux_layer  .OR.  use_surface_fluxes )  THEN
-                IF ( BTEST( wall_flags_0(k,j,i),   0 )  .AND.                  &
-                     BTEST( wall_flags_0(k+1,j,i), 0 ) )                       &
-                  wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 23 )
+                IF ( BTEST( wall_flags_static_0(k,j,i),   0 )  .AND.                  &
+                     BTEST( wall_flags_static_0(k+1,j,i), 0 ) )                       &
+                  wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 23 )
              ELSE
-                IF ( BTEST( wall_flags_0(k,j,i), 22 ) )                        &
-                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 23 )
+                IF ( BTEST( wall_flags_static_0(k,j,i), 22 ) )                        &
+                   wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 23 )
              ENDIF
    
 
           ENDDO
-          wall_flags_0(nzt+1,j,i) = IBSET( wall_flags_0(nzt+1,j,i), 22 )
-          wall_flags_0(nzt+1,j,i) = IBSET( wall_flags_0(nzt+1,j,i), 23 )
+          wall_flags_static_0(nzt+1,j,i) = IBSET( wall_flags_static_0(nzt+1,j,i), 22 )
+          wall_flags_static_0(nzt+1,j,i) = IBSET( wall_flags_static_0(nzt+1,j,i), 23 )
 !
 !--       Set flags indicating that topography is close by in horizontal 
@@ -2555,19 +2558,19 @@
           IF ( scalar_advec == 'ws-scheme' )  THEN
              DO k = nzb, nzt
-                IF ( BTEST( wall_flags_0(k,j,i), 0 )  .AND. (                   &
-                     ANY( .NOT. BTEST( wall_flags_0(k,j-3:j+3,i-1), 0 ) )  .OR.&
-                     ANY( .NOT. BTEST( wall_flags_0(k,j-3:j+3,i-2), 0 ) )  .OR.&
-                     ANY( .NOT. BTEST( wall_flags_0(k,j-3:j+3,i-3), 0 ) )  .OR.&
-                     ANY( .NOT. BTEST( wall_flags_0(k,j-3:j+3,i+1), 0 ) )  .OR.&
-                     ANY( .NOT. BTEST( wall_flags_0(k,j-3:j+3,i+2), 0 ) )  .OR.&
-                     ANY( .NOT. BTEST( wall_flags_0(k,j-3:j+3,i+3), 0 ) )  .OR.&
-                     ANY( .NOT. BTEST( wall_flags_0(k,j-1,i-3:i+3), 0 ) )  .OR.&
-                     ANY( .NOT. BTEST( wall_flags_0(k,j-2,i-3:i+3), 0 ) )  .OR.&
-                     ANY( .NOT. BTEST( wall_flags_0(k,j-3,i-3:i+3), 0 ) )  .OR.&
-                     ANY( .NOT. BTEST( wall_flags_0(k,j+1,i-3:i+3), 0 ) )  .OR.&
-                     ANY( .NOT. BTEST( wall_flags_0(k,j+2,i-3:i+3), 0 ) )  .OR.&
-                     ANY( .NOT. BTEST( wall_flags_0(k,j+3,i-3:i+3), 0 ) )      &
+                IF ( BTEST( wall_flags_static_0(k,j,i), 0 )  .AND. (                   &
+                     ANY( .NOT. BTEST( wall_flags_static_0(k,j-3:j+3,i-1), 0 ) )  .OR.&
+                     ANY( .NOT. BTEST( wall_flags_static_0(k,j-3:j+3,i-2), 0 ) )  .OR.&
+                     ANY( .NOT. BTEST( wall_flags_static_0(k,j-3:j+3,i-3), 0 ) )  .OR.&
+                     ANY( .NOT. BTEST( wall_flags_static_0(k,j-3:j+3,i+1), 0 ) )  .OR.&
+                     ANY( .NOT. BTEST( wall_flags_static_0(k,j-3:j+3,i+2), 0 ) )  .OR.&
+                     ANY( .NOT. BTEST( wall_flags_static_0(k,j-3:j+3,i+3), 0 ) )  .OR.&
+                     ANY( .NOT. BTEST( wall_flags_static_0(k,j-1,i-3:i+3), 0 ) )  .OR.&
+                     ANY( .NOT. BTEST( wall_flags_static_0(k,j-2,i-3:i+3), 0 ) )  .OR.&
+                     ANY( .NOT. BTEST( wall_flags_static_0(k,j-3,i-3:i+3), 0 ) )  .OR.&
+                     ANY( .NOT. BTEST( wall_flags_static_0(k,j+1,i-3:i+3), 0 ) )  .OR.&
+                     ANY( .NOT. BTEST( wall_flags_static_0(k,j+2,i-3:i+3), 0 ) )  .OR.&
+                     ANY( .NOT. BTEST( wall_flags_static_0(k,j+3,i-3:i+3), 0 ) )      &
                                                             ) )                &
-                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 31 )
+                   wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 31 )
                      
              ENDDO
@@ -2585,5 +2588,5 @@
 !-- If no topography is initialized, the land-surface is at k = nzb.
     IF ( TRIM( topography ) /= 'read_from_file' )  THEN
-       wall_flags_0(nzb,:,:) = IBSET( wall_flags_0(nzb,:,:), 5 )
+       wall_flags_static_0(nzb,:,:) = IBSET( wall_flags_static_0(nzb,:,:), 5 )
     ELSE
        DO i = nxl, nxr
@@ -2593,5 +2596,5 @@
 !--             Natural terrain grid point
                 IF ( BTEST( topo(k,j,i), 1 ) )                                 &
-                   wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 5 )
+                   wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 5 )
              ENDDO
           ENDDO
@@ -2604,5 +2607,5 @@
           DO k = nzb, nzt+1
              IF ( BTEST( topo(k,j,i), 2 ) )                                    &
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 6 )
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 6 )
           ENDDO
        ENDDO
@@ -2614,5 +2617,5 @@
           DO k = nzb, nzt+1
              IF ( BTEST( topo(k,j,i), 4 ) )                                    &
-                wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 4 )
+                wall_flags_static_0(k,j,i) = IBSET( wall_flags_static_0(k,j,i), 4 )
           ENDDO
        ENDDO
@@ -2620,5 +2623,5 @@
 !
 !-- Exchange ghost points for wall flags
-    CALL exchange_horiz_int( wall_flags_0, nys, nyn, nxl, nxr, nzt, nbgp )
+    CALL exchange_horiz_int( wall_flags_static_0, nys, nyn, nxl, nxr, nzt, nbgp )
 !
 !-- Set boundary conditions also for flags. Can be interpreted as Neumann
@@ -2627,10 +2630,10 @@
        IF ( nys == 0  )  THEN
           DO  i = 1, nbgp     
-             wall_flags_0(:,nys-i,:)   = wall_flags_0(:,nys,:)
+             wall_flags_static_0(:,nys-i,:)   = wall_flags_static_0(:,nys,:)
           ENDDO
        ENDIF
        IF ( nyn == ny )  THEN
           DO  i = 1, nbgp  
-             wall_flags_0(:,nyn+i,:) = wall_flags_0(:,nyn,:)
+             wall_flags_static_0(:,nyn+i,:) = wall_flags_static_0(:,nyn,:)
           ENDDO
        ENDIF
@@ -2639,10 +2642,10 @@
        IF ( nxl == 0  )  THEN
           DO  i = 1, nbgp   
-             wall_flags_0(:,:,nxl-i)   = wall_flags_0(:,:,nxl)
+             wall_flags_static_0(:,:,nxl-i)   = wall_flags_static_0(:,:,nxl)
           ENDDO
        ENDIF
        IF ( nxr == nx )  THEN 
           DO  i = 1, nbgp   
-             wall_flags_0(:,:,nxr+i) = wall_flags_0(:,:,nxr)     
+             wall_flags_static_0(:,:,nxr+i) = wall_flags_static_0(:,:,nxr)     
           ENDDO
        ENDIF      
@@ -2657,5 +2660,5 @@
     topo_top_ind(:,:,0) = MAXLOC(                                              &
                                   MERGE( 1, 0,                                 &
-                                          BTEST( wall_flags_0(:,:,:), ibit )   &
+                                          BTEST( wall_flags_static_0(:,:,:), ibit )   &
                                        ), DIM = 1                              &
                                 ) - 1 
@@ -2665,5 +2668,5 @@
     topo_top_ind(:,:,1) = MAXLOC(                                              &
                                   MERGE( 1, 0,                                 &
-                                          BTEST( wall_flags_0(:,:,:), ibit )   &
+                                          BTEST( wall_flags_static_0(:,:,:), ibit )   &
                                        ), DIM = 1                              &
                                 ) - 1 
@@ -2673,5 +2676,5 @@
     topo_top_ind(:,:,2) = MAXLOC(                                              &
                                   MERGE( 1, 0,                                 &
-                                          BTEST( wall_flags_0(:,:,:), ibit )   &
+                                          BTEST( wall_flags_static_0(:,:,:), ibit )   &
                                        ), DIM = 1                              &
                                 ) - 1 
@@ -2681,5 +2684,5 @@
     topo_top_ind(:,:,3) = MAXLOC(                                              &
                                   MERGE( 1, 0,                                 &
-                                          BTEST( wall_flags_0(:,:,:), ibit )   &
+                                          BTEST( wall_flags_static_0(:,:,:), ibit )   &
                                        ), DIM = 1                              &
                                 ) - 1 
@@ -2689,5 +2692,5 @@
     topo_top_ind(:,:,4) = MAXLOC(                                              &
                                   MERGE( 1, 0,                                 &
-                                          BTEST( wall_flags_0(:,:,:), ibit )   &
+                                          BTEST( wall_flags_static_0(:,:,:), ibit )   &
                                        ), DIM = 1                              &
                                 ) - 1                            
Index: /palm/trunk/SOURCE/init_pt_anomaly.f90
===================================================================
--- /palm/trunk/SOURCE/init_pt_anomaly.f90	(revision 4328)
+++ /palm/trunk/SOURCE/init_pt_anomaly.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -50,5 +53,5 @@
 
     USE indices,                                                               &
-        ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nys, nzb, nzt, wall_flags_0
+        ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nys, nzb, nzt, wall_flags_static_0
 
     USE kinds
@@ -93,5 +96,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 x = ( i - ic ) * dx
@@ -126,5 +129,5 @@
 !
 !--             Predetermine flag to mask topography
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 pt(k,j,i) = pt(k,j,i) +                                        &
Index: /palm/trunk/SOURCE/lagrangian_particle_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/lagrangian_particle_model_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/lagrangian_particle_model_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4282 2019-10-29 16:18:46Z schwenkel
 ! Bugfix of particle timeseries in case of more than one particle group
 ! 
@@ -145,5 +148,5 @@
                nzb_max, nzt,nbgp, ngp_2dh_outer,                               &
                topo_top_ind,                                                   &
-               wall_flags_0
+               wall_flags_static_0
 
     USE kinds
@@ -1352,5 +1355,5 @@
 !--                               of overhanging structures.
                                   IF ( kp > nzt  .OR.                          &
-                                 .NOT. BTEST( wall_flags_0(kp,jp,ip), 0 ) )  THEN
+                                 .NOT. BTEST( wall_flags_static_0(kp,jp,ip), 0 ) )  THEN
                                      pos_x = pos_x + pdx(i)
                                      CYCLE xloop
@@ -1362,5 +1365,5 @@
                                ELSEIF ( .NOT. seed_follows_topography .AND.    &
                                          tmp_particle%z <= zw(k_surf)  .OR.    &
-                                        .NOT. BTEST( wall_flags_0(kp,jp,ip), 0 ) )&
+                                        .NOT. BTEST( wall_flags_static_0(kp,jp,ip), 0 ) )&
                                THEN
                                   pos_x = pos_x + pdx(i)
@@ -1518,5 +1521,5 @@
 !
 !--                Check if particle is within topography
-                   IF ( .NOT. BTEST( wall_flags_0(k,j,i), 0 ) )  THEN
+                   IF ( .NOT. BTEST( wall_flags_static_0(k,j,i), 0 ) )  THEN
                       particles(n)%particle_mask = .FALSE.
                       deleted_particles = deleted_particles + 1
@@ -1761,22 +1764,22 @@
           DO  k = nzb, nzt+1
 
-             IF ( .NOT. BTEST( wall_flags_0(k,j,i-1), 0 )  .AND.               &
-                        BTEST( wall_flags_0(k,j,i), 0   )  .AND.               &
-                        BTEST( wall_flags_0(k,j,i+1), 0 ) )                    &
+             IF ( .NOT. BTEST( wall_flags_static_0(k,j,i-1), 0 )  .AND.               &
+                        BTEST( wall_flags_static_0(k,j,i), 0   )  .AND.               &
+                        BTEST( wall_flags_static_0(k,j,i+1), 0 ) )                    &
              THEN
                 de_dx(k,j,i) = 2.0_wp * sgs_wf_part *                          &
                                ( e(k,j,i+1) - e(k,j,i) ) * ddx
-             ELSEIF ( BTEST( wall_flags_0(k,j,i-1), 0 )  .AND.                 &
-                      BTEST( wall_flags_0(k,j,i), 0   )  .AND.                 &
-                .NOT. BTEST( wall_flags_0(k,j,i+1), 0 ) )                      &
+             ELSEIF ( BTEST( wall_flags_static_0(k,j,i-1), 0 )  .AND.                 &
+                      BTEST( wall_flags_static_0(k,j,i), 0   )  .AND.                 &
+                .NOT. BTEST( wall_flags_static_0(k,j,i+1), 0 ) )                      &
              THEN
                 de_dx(k,j,i) = 2.0_wp * sgs_wf_part *                          &
                                ( e(k,j,i) - e(k,j,i-1) ) * ddx
-             ELSEIF ( .NOT. BTEST( wall_flags_0(k,j,i), 22   )  .AND.          &
-                      .NOT. BTEST( wall_flags_0(k,j,i+1), 22 ) )               &   
+             ELSEIF ( .NOT. BTEST( wall_flags_static_0(k,j,i), 22   )  .AND.          &
+                      .NOT. BTEST( wall_flags_static_0(k,j,i+1), 22 ) )               &   
              THEN
                 de_dx(k,j,i) = 0.0_wp
-             ELSEIF ( .NOT. BTEST( wall_flags_0(k,j,i-1), 22 )  .AND.          &
-                      .NOT. BTEST( wall_flags_0(k,j,i), 22   ) )               &
+             ELSEIF ( .NOT. BTEST( wall_flags_static_0(k,j,i-1), 22 )  .AND.          &
+                      .NOT. BTEST( wall_flags_static_0(k,j,i), 22   ) )               &
              THEN
                 de_dx(k,j,i) = 0.0_wp
@@ -1785,22 +1788,22 @@
              ENDIF
 
-             IF ( .NOT. BTEST( wall_flags_0(k,j-1,i), 0 )  .AND.               &
-                        BTEST( wall_flags_0(k,j,i), 0   )  .AND.               &
-                        BTEST( wall_flags_0(k,j+1,i), 0 ) )                    &
+             IF ( .NOT. BTEST( wall_flags_static_0(k,j-1,i), 0 )  .AND.               &
+                        BTEST( wall_flags_static_0(k,j,i), 0   )  .AND.               &
+                        BTEST( wall_flags_static_0(k,j+1,i), 0 ) )                    &
              THEN
                 de_dy(k,j,i) = 2.0_wp * sgs_wf_part *                          &
                                ( e(k,j+1,i) - e(k,j,i) ) * ddy
-             ELSEIF ( BTEST( wall_flags_0(k,j-1,i), 0 )  .AND.                 &
-                      BTEST( wall_flags_0(k,j,i), 0   )  .AND.                 &
-                .NOT. BTEST( wall_flags_0(k,j+1,i), 0 ) )                      &
+             ELSEIF ( BTEST( wall_flags_static_0(k,j-1,i), 0 )  .AND.                 &
+                      BTEST( wall_flags_static_0(k,j,i), 0   )  .AND.                 &
+                .NOT. BTEST( wall_flags_static_0(k,j+1,i), 0 ) )                      &
              THEN
                 de_dy(k,j,i) = 2.0_wp * sgs_wf_part *                          &
                                ( e(k,j,i) - e(k,j-1,i) ) * ddy
-             ELSEIF ( .NOT. BTEST( wall_flags_0(k,j,i), 22   )  .AND.          &
-                      .NOT. BTEST( wall_flags_0(k,j+1,i), 22 ) )               &   
+             ELSEIF ( .NOT. BTEST( wall_flags_static_0(k,j,i), 22   )  .AND.          &
+                      .NOT. BTEST( wall_flags_static_0(k,j+1,i), 22 ) )               &   
              THEN
                 de_dy(k,j,i) = 0.0_wp
-             ELSEIF ( .NOT. BTEST( wall_flags_0(k,j-1,i), 22 )  .AND.          &
-                      .NOT. BTEST( wall_flags_0(k,j,i), 22   ) )               &
+             ELSEIF ( .NOT. BTEST( wall_flags_static_0(k,j-1,i), 22 )  .AND.          &
+                      .NOT. BTEST( wall_flags_static_0(k,j,i), 22   ) )               &
              THEN
                 de_dy(k,j,i) = 0.0_wp
@@ -1820,5 +1823,5 @@
 !
 !--          Flag to mask topography
-             flag1 = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0  ) )
+             flag1 = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0  ) )
 
              de_dz(k,j,i) = 2.0_wp * sgs_wf_part *                             &
@@ -1895,5 +1898,5 @@
 !
 !--             Flag indicating vicinity of wall
-                flag1 = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 24 ) )
+                flag1 = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 24 ) )
 
                 sums_l(k,1,0)  = sums_l(k,1,0)  + u(k,j,i) * flag1
@@ -1935,5 +1938,5 @@
 !
 !--             Flag indicating vicinity of wall
-                flag1 = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 24 ) )
+                flag1 = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 24 ) )
 
                 sums_l(k,8,0)  = sums_l(k,8,0)  + e(k,j,i)                       * flag1
@@ -3666,7 +3669,7 @@
              j = jp + MERGE( -1_iwp , 1_iwp, BTEST( nb, 1 ) )
              k = kp + MERGE( -1_iwp , 1_iwp, BTEST( nb, 0 ) )
-             IF ( .NOT. BTEST(wall_flags_0(k,  jp, ip), 0) .OR.                &
-                  .NOT. BTEST(wall_flags_0(kp, j,  ip), 0) .OR.                &
-                  .NOT. BTEST(wall_flags_0(kp, jp, i ), 0) )                   &
+             IF ( .NOT. BTEST(wall_flags_static_0(k,  jp, ip), 0) .OR.                &
+                  .NOT. BTEST(wall_flags_static_0(kp, j,  ip), 0) .OR.                &
+                  .NOT. BTEST(wall_flags_static_0(kp, jp, i ), 0) )                   &
              THEN
                 subbox_at_wall = .TRUE.
@@ -4763,5 +4766,5 @@
                 IF ( reach_x(t_index)                      .AND.               & 
                      ABS( pos_x - xwall ) < eps            .AND.               &
-                     .NOT. BTEST(wall_flags_0(k3,j3,i3),0) .AND.               &
+                     .NOT. BTEST(wall_flags_static_0(k3,j3,i3),0) .AND.               &
                      .NOT. reflect_x )  THEN
 ! 
@@ -4803,5 +4806,5 @@
                 IF ( reach_y(t_index)                      .AND.               & 
                      ABS( pos_y - ywall ) < eps            .AND.               &
-                     .NOT. BTEST(wall_flags_0(k3,j3,i3),0) .AND.               &
+                     .NOT. BTEST(wall_flags_static_0(k3,j3,i3),0) .AND.               &
                      .NOT. reflect_y )  THEN
 ! 
@@ -4843,5 +4846,5 @@
                 IF ( reach_z(t_index)                      .AND.               & 
                      ABS( pos_z - zwall ) < eps            .AND.               &
-                     .NOT. BTEST(wall_flags_0(k3,j3,i3),0) .AND.               &
+                     .NOT. BTEST(wall_flags_static_0(k3,j3,i3),0) .AND.               &
                      .NOT. reflect_z )  THEN
 ! 
@@ -5201,5 +5204,5 @@
 !
 !--          Predetermine flag to mask topography
-             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
              q(k,j,i)  = q_p(k,j,i)  - ql_c(k,j,i) * flag
@@ -5231,5 +5234,5 @@
 !
 !--    Predetermine flag to mask topography
-       flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+       flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
        q(k,j,i)  = q(k,j,i)  - ql_c(k,j,i) * flag
Index: /palm/trunk/SOURCE/large_scale_forcing_nudging_mod.f90
===================================================================
--- /palm/trunk/SOURCE/large_scale_forcing_nudging_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/large_scale_forcing_nudging_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -71,5 +74,5 @@
     USE indices,                                                               &
         ONLY:  nbgp, ngp_sums_ls, nx, nxl, nxlg, nxlu, nxr, nxrg, ny, nys,     &
-               nysv, nysg, nyn, nyng, nzb, nz, nzt, wall_flags_0
+               nysv, nysg, nyn, nyng, nzb, nz, nzt, wall_flags_static_0
 
     USE kinds
@@ -799,5 +802,5 @@
                                     ( td_lsa_lpt(k,nt+1) - td_lsa_lpt(k,nt) ) *&
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
                    ENDDO
                 ENDDO
@@ -812,5 +815,5 @@
                                     ( td_lsa_q(k,nt+1) - td_lsa_q(k,nt) ) *    &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
                    ENDDO
                 ENDDO
@@ -833,5 +836,5 @@
                                      ( td_sub_lpt(k,nt+1) - td_sub_lpt(k,nt) )*&
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -846,5 +849,5 @@
                                        ( td_sub_q(k,nt+1) - td_sub_q(k,nt) ) * &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -899,5 +902,5 @@
                              + fac * ( td_lsa_lpt(k,nt+1) - td_lsa_lpt(k,nt) )*&
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
              ENDDO
 
@@ -908,5 +911,5 @@
                               + fac * ( td_lsa_q(k,nt+1) - td_lsa_q(k,nt) ) *  &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
              ENDDO
 
@@ -925,5 +928,5 @@
                                  ( td_sub_lpt(k,nt+1) - td_sub_lpt(k,nt) ) *   &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
                 ENDDO
   
@@ -934,5 +937,5 @@
                                  ( td_sub_q(k,nt+1) - td_sub_q(k,nt) ) *       &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
                 ENDDO
 
@@ -1178,5 +1181,5 @@
                       tend(k,j,i) = tend(k,j,i) + tmp_tend *                   &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 1 ) )
 
                       sums_ls_l(k,6) = sums_ls_l(k,6) + tmp_tend *             &
@@ -1201,5 +1204,5 @@
                       tend(k,j,i) = tend(k,j,i) + tmp_tend *                   &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 2 ) )
 
                       sums_ls_l(k,7) = sums_ls_l(k,7) + tmp_tend *             &
@@ -1224,5 +1227,5 @@
                       tend(k,j,i) = tend(k,j,i) + tmp_tend *                   &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                       sums_ls_l(k,4) = sums_ls_l(k,4) + tmp_tend *             &
@@ -1247,5 +1250,5 @@
                       tend(k,j,i) = tend(k,j,i) + tmp_tend *                   &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                       sums_ls_l(k,5) = sums_ls_l(k,5) + tmp_tend *             &
@@ -1313,5 +1316,5 @@
                 tend(k,j,i) = tend(k,j,i) + tmp_tend *                         &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 1 ) )
 
                 sums_ls_l(k,6) = sums_ls_l(k,6) + tmp_tend                     &
@@ -1330,5 +1333,5 @@
                 tend(k,j,i) = tend(k,j,i) + tmp_tend *                         &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 2 ) )
 
                 sums_ls_l(k,7) = sums_ls_l(k,7) + tmp_tend                     &
@@ -1347,5 +1350,5 @@
                 tend(k,j,i) = tend(k,j,i) + tmp_tend *                         &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 sums_ls_l(k,4) = sums_ls_l(k,4) + tmp_tend                     &
@@ -1365,5 +1368,5 @@
                 tend(k,j,i) = tend(k,j,i) + tmp_tend *                         &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 sums_ls_l(k,5) = sums_ls_l(k,5) + tmp_tend                     &
Index: /palm/trunk/SOURCE/modules.f90
===================================================================
--- /palm/trunk/SOURCE/modules.f90	(revision 4328)
+++ /palm/trunk/SOURCE/modules.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4301 2019-11-22 12:09:09Z oliver.maas
 ! removed recycling_yshift
 ! 
@@ -1110,5 +1113,5 @@
     INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  advc_flags_s            !< flags used to degrade order of advection scheme for scalar quantities
     INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  topo_top_ind            !< precalculated topography top indices
-    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  wall_flags_0            !< flags to mask topography and surface-bounded grid points
+    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  wall_flags_static_0            !< flags to mask topography and surface-bounded grid points
 
     SAVE
Index: /palm/trunk/SOURCE/multi_agent_system_mod.f90
===================================================================
--- /palm/trunk/SOURCE/multi_agent_system_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/multi_agent_system_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4307 2019-11-26 14:12:36Z maronga
 ! Activated output of iPT
 ! 
@@ -88,5 +91,5 @@
         ONLY:  nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb,        &
                topo_top_ind,                                                   &
-               wall_flags_0
+               wall_flags_static_0
 
     USE random_function_mod,                                                   &
Index: /palm/trunk/SOURCE/nesting_offl_mod.f90
===================================================================
--- /palm/trunk/SOURCE/nesting_offl_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/nesting_offl_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4286 2019-10-30 16:01:14Z resler
 ! Fix wrong checks of time from dynamic driver in nesting_offl_mod
 ! 
@@ -188,5 +191,5 @@
                nysv, nysg, nyn, nyng, nzb, nz, nzt,                            &
                topo_top_ind,                                                   &
-               wall_flags_0
+               wall_flags_static_0
 
     USE kinds
@@ -863,5 +866,5 @@
                 volume_flow_l(1) = volume_flow_l(1) + u(k,j,i) * dzw(k) * dy   &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 1 ) )
+                                              BTEST( wall_flags_static_0(k,j,i), 1 ) )
              ENDDO
           ENDDO
@@ -873,5 +876,5 @@
                 volume_flow_l(1) = volume_flow_l(1) - u(k,j,i) * dzw(k) * dy   &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 1 ) )
+                                              BTEST( wall_flags_static_0(k,j,i), 1 ) )
              ENDDO
           ENDDO
@@ -883,5 +886,5 @@
                 volume_flow_l(2) = volume_flow_l(2) + v(k,j,i) * dzw(k) * dx   &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 2 ) )
+                                              BTEST( wall_flags_static_0(k,j,i), 2 ) )
              ENDDO
           ENDDO
@@ -893,5 +896,5 @@
                 volume_flow_l(2) = volume_flow_l(2) - v(k,j,i) * dzw(k) * dx   &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 2 ) )
+                                              BTEST( wall_flags_static_0(k,j,i), 2 ) )
              ENDDO
           ENDDO
@@ -998,5 +1001,5 @@
                                                 fac_dt ) *                     &
                              MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j,0), 1 ) )
+                                    BTEST( wall_flags_static_0(k,j,0), 1 ) )
                 u(k,j,-1) = u(k,j,0)
              ENDDO
@@ -1010,5 +1013,5 @@
                                                  fac_dt ) *                    &
                             MERGE( 1.0_wp, 0.0_wp,                             &
-                                   BTEST( wall_flags_0(k,j,-1), 3 ) )
+                                   BTEST( wall_flags_static_0(k,j,-1), 3 ) )
              ENDDO
              w(nzt,j,-1) = w(nzt-1,j,-1)
@@ -1021,5 +1024,5 @@
                                                  fac_dt ) *                    &
                                MERGE( 1.0_wp, 0.0_wp,                          &
-                                      BTEST( wall_flags_0(k,j,-1), 2 ) )
+                                      BTEST( wall_flags_static_0(k,j,-1), 2 ) )
              ENDDO
              v_ref_l(nzb+1:nzt) = v_ref_l(nzb+1:nzt) + v(nzb+1:nzt,j,-1)
@@ -1077,5 +1080,5 @@
                                                     fac_dt ) *                 &
                              MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j,nxr+1), 1 ) )
+                                    BTEST( wall_flags_static_0(k,j,nxr+1), 1 ) )
              ENDDO
              u_ref_l(nzb+1:nzt) = u_ref_l(nzb+1:nzt) + u(nzb+1:nzt,j,nxr+1)
@@ -1087,5 +1090,5 @@
                                                     fac_dt ) *                 &
                              MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j,nxr+1), 3 ) )
+                                    BTEST( wall_flags_static_0(k,j,nxr+1), 3 ) )
              ENDDO
              w(nzt,j,nxr+1) = w(nzt-1,j,nxr+1)
@@ -1098,5 +1101,5 @@
                                                     fac_dt ) *                 &
                              MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(k,j,nxr+1), 2 ) )
+                                    BTEST( wall_flags_static_0(k,j,nxr+1), 2 ) )
              ENDDO
              v_ref_l(nzb+1:nzt) = v_ref_l(nzb+1:nzt) + v(nzb+1:nzt,j,nxr+1)
@@ -1155,5 +1158,5 @@
                                                 fac_dt ) *                     &
                            MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_0(k,0,i), 2 ) )
+                                  BTEST( wall_flags_static_0(k,0,i), 2 ) )
                 v(k,-1,i) = v(k,0,i) 
              ENDDO
@@ -1167,5 +1170,5 @@
                                                  fac_dt ) *                    &
                            MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_0(k,-1,i), 3 ) )
+                                  BTEST( wall_flags_static_0(k,-1,i), 3 ) )
              ENDDO
              w(nzt,-1,i) = w(nzt-1,-1,i)
@@ -1178,5 +1181,5 @@
                                                  fac_dt ) *                    &
                            MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_0(k,-1,i), 1 ) )
+                                  BTEST( wall_flags_static_0(k,-1,i), 1 ) )
              ENDDO
              u_ref_l(nzb+1:nzt) = u_ref_l(nzb+1:nzt) + u(nzb+1:nzt,-1,i)
@@ -1236,5 +1239,5 @@
                                                     fac_dt ) *                 &
                                MERGE( 1.0_wp, 0.0_wp,                          &
-                                      BTEST( wall_flags_0(k,nyn+1,i), 2 ) )
+                                      BTEST( wall_flags_static_0(k,nyn+1,i), 2 ) )
              ENDDO
              v_ref_l(nzb+1:nzt) = v_ref_l(nzb+1:nzt) + v(nzb+1:nzt,nyn+1,i)
@@ -1246,5 +1249,5 @@
                                                     fac_dt ) *                 &
                                MERGE( 1.0_wp, 0.0_wp,                          &
-                                      BTEST( wall_flags_0(k,nyn+1,i), 3 ) )
+                                      BTEST( wall_flags_static_0(k,nyn+1,i), 3 ) )
              ENDDO
              w(nzt,nyn+1,i) = w(nzt-1,nyn+1,i)
@@ -1257,5 +1260,5 @@
                                                     fac_dt ) *                 &
                                MERGE( 1.0_wp, 0.0_wp,                          &
-                                      BTEST( wall_flags_0(k,nyn+1,i), 1 ) )
+                                      BTEST( wall_flags_static_0(k,nyn+1,i), 1 ) )
 
              ENDDO
@@ -1315,5 +1318,5 @@
                                                  fac_dt ) *                    &
                            MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_0(nzt+1,j,i), 1 ) )
+                                  BTEST( wall_flags_static_0(nzt+1,j,i), 1 ) )
              u_ref_l(nzt+1) = u_ref_l(nzt+1) + u(nzt+1,j,i)
           ENDDO
@@ -1331,5 +1334,5 @@
                                                  fac_dt ) *                    &
                            MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_0(nzt+1,j,i), 2 ) )
+                                  BTEST( wall_flags_static_0(nzt+1,j,i), 2 ) )
              v_ref_l(nzt+1) = v_ref_l(nzt+1) + v(nzt+1,j,i)
           ENDDO
@@ -1347,5 +1350,5 @@
                                                fac_dt ) *                      &
                            MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_0(nzt,j,i), 3 ) )
+                                  BTEST( wall_flags_static_0(nzt,j,i), 3 ) )
              w(nzt+1,j,i) = w(nzt,j,i)
           ENDDO
@@ -2130,7 +2133,7 @@
 !--    After boundary data is initialized, mask topography at the 
 !--    boundaries for the velocity components.
-       u = MERGE( u, 0.0_wp, BTEST( wall_flags_0, 1 ) )
-       v = MERGE( v, 0.0_wp, BTEST( wall_flags_0, 2 ) )
-       w = MERGE( w, 0.0_wp, BTEST( wall_flags_0, 3 ) )
+       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 ) )
 !
 !--    Initial calculation of the boundary layer depth from the prescribed 
Index: /palm/trunk/SOURCE/netcdf_data_input_mod.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4321 2019-12-04 10:26:38Z pavelkrc
 ! Further revise check for surface fractions
 ! 
@@ -3401,5 +3404,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxl, nxr, nyn, nys, wall_flags_0
+           ONLY:  nxl, nxr, nyn, nys, wall_flags_static_0
 
        IMPLICIT NONE
@@ -3867,11 +3870,11 @@
 !--          Check if building_type is set at each building and vice versa. 
 !--          Please note, buildings are already processed and filtered.
-!--          For this reason, consistency checks are based on wall_flags_0 
+!--          For this reason, consistency checks are based on wall_flags_static_0 
 !--          rather than buildings_f (buildings are represented by bit 6 in 
-!--          wall_flags_0). 
+!--          wall_flags_static_0). 
              IF ( building_type_f%from_file  .AND.  buildings_f%from_file )  THEN
-                IF ( ANY( BTEST ( wall_flags_0(:,j,i), 6 ) )  .AND.            &
+                IF ( ANY( BTEST ( wall_flags_static_0(:,j,i), 6 ) )  .AND.            &
                      building_type_f%var(j,i) == building_type_f%fill  .OR.    &
-               .NOT. ANY( BTEST ( wall_flags_0(:,j,i), 6 ) )  .AND.            &
+               .NOT. ANY( BTEST ( wall_flags_static_0(:,j,i), 6 ) )  .AND.            &
                      building_type_f%var(j,i) /= building_type_f%fill )  THEN
                    WRITE( message_string, * ) 'Each location where a ' //      &
@@ -3888,7 +3891,7 @@
 !--          is set and vice versa.
              IF ( buildings_f%from_file )  THEN
-                IF ( ANY( BTEST ( wall_flags_0(:,j,i), 6 ) )  .AND.           &
+                IF ( ANY( BTEST ( wall_flags_static_0(:,j,i), 6 ) )  .AND.           &
                      building_id_f%var(j,i) == building_id_f%fill  .OR.       &
-               .NOT. ANY( BTEST ( wall_flags_0(:,j,i), 6 ) )  .AND.           &
+               .NOT. ANY( BTEST ( wall_flags_static_0(:,j,i), 6 ) )  .AND.           &
                      building_id_f%var(j,i) /= building_id_f%fill )  THEN
                    WRITE( message_string, * ) 'Each location where a ' //     &
@@ -3902,5 +3905,5 @@
 !--          Check if building ID is set where a bulding is defined.
              IF ( buildings_f%from_file )  THEN
-                IF ( ANY( BTEST ( wall_flags_0(:,j,i), 6 ) )  .AND.           &
+                IF ( ANY( BTEST ( wall_flags_static_0(:,j,i), 6 ) )  .AND.           &
                      building_id_f%var(j,i) == building_id_f%fill )  THEN
                    WRITE( message_string, * ) 'Each building grid point '//   &
Index: /palm/trunk/SOURCE/ocean_mod.f90
===================================================================
--- /palm/trunk/SOURCE/ocean_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/ocean_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4272 2019-10-23 15:18:57Z schwenkel
 ! Further modularization of boundary conditions: moved boundary conditions to
 ! respective modules
@@ -86,5 +89,5 @@
 
     USE indices,                                                               &
-        ONLY:  advc_flags_s, nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0
+        ONLY:  advc_flags_s, nxl, nxr, nyn, nys, nzb, nzt, wall_flags_static_0
 
     USE surface_mod,                                                           &
@@ -968,5 +971,5 @@
     USE indices,                                                               &
         ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt,            &
-              wall_flags_0
+              wall_flags_static_0
 
     IMPLICIT NONE
@@ -1037,5 +1040,5 @@
                 local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i),                &
                                          REAL( fill_value, KIND = wp ),        &
-                                         BTEST( wall_flags_0(k,j,i), flag_nr ) )
+                                         BTEST( wall_flags_static_0(k,j,i), flag_nr ) )
              ENDDO
           ENDDO
@@ -1063,5 +1066,5 @@
     USE indices,                                                               &
         ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt,           &
-               wall_flags_0
+               wall_flags_static_0
 
     IMPLICIT NONE
@@ -1129,5 +1132,5 @@
                 local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i),                &
                                          REAL( fill_value, KIND = wp ),        &
-                                         BTEST( wall_flags_0(k,j,i), flag_nr ) )
+                                         BTEST( wall_flags_static_0(k,j,i), flag_nr ) )
              ENDDO
           ENDDO
@@ -1679,5 +1682,5 @@
                                           )                                    &
                                             * MERGE( 1.0_wp, 0.0_wp,           &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) &
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) &
                                                    )
                 IF ( sa_p(k,j,i) < 0.0_wp )  sa_p(k,j,i) = 0.1_wp * sa(k,j,i)
@@ -1826,5 +1829,5 @@
                                              * ( sa(k,j,i) - sa_init(k) )      &
                                     ) * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
           IF ( sa_p(k,j,i) < 0.0_wp )  sa_p(k,j,i) = 0.1_wp * sa(k,j,i)
Index: /palm/trunk/SOURCE/plant_canopy_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 4329)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4314 2019-11-29 10:29:20Z suehring
 ! - Bugfix, plant canopy was still considered at building edges on for the u- 
 !   and v-component.
@@ -121,5 +124,5 @@
     USE indices,                                                               &
         ONLY:  nbgp, nxl, nxlg, nxlu, nxr, nxrg, nyn, nyng, nys, nysg, nysv,   &
-               nz, nzb, nzt, topo_top_ind, wall_flags_0
+               nz, nzb, nzt, topo_top_ind, wall_flags_static_0
 
     USE kinds
@@ -1125,6 +1128,6 @@
 !--                   an informative message is given.
                       IF ( ANY( lad_s(:,j,i) /= 0.0_wp )  .AND.                &
-                           ANY( BTEST( wall_flags_0(:,j,i), 6 ) ) .AND.        &
-                           ANY( BTEST( wall_flags_0(:,j,i), 4 ) ) )  THEN
+                           ANY( BTEST( wall_flags_static_0(:,j,i), 6 ) ) .AND.        &
+                           ANY( BTEST( wall_flags_static_0(:,j,i), 4 ) ) )  THEN
                          lad_s(:,j,i) = 0.0_wp
                          WRITE( message_string, * )                            &
@@ -1958,8 +1961,8 @@
 !--          of the potential rooftop grid point, while building_edge_e is
 !--          is set from the perspective of the non-building grid point.
-             building_edge_w = ANY( BTEST( wall_flags_0(:,j,i),   6 ) )  .AND. &
-                         .NOT. ANY( BTEST( wall_flags_0(:,j,i-1), 6 ) )
-             building_edge_e = ANY( BTEST( wall_flags_0(:,j,i-1), 6 ) )  .AND. &
-                         .NOT. ANY( BTEST( wall_flags_0(:,j,i),   6 ) )
+             building_edge_w = ANY( BTEST( wall_flags_static_0(:,j,i),   6 ) )  .AND. &
+                         .NOT. ANY( BTEST( wall_flags_static_0(:,j,i-1), 6 ) )
+             building_edge_e = ANY( BTEST( wall_flags_static_0(:,j,i-1), 6 ) )  .AND. &
+                         .NOT. ANY( BTEST( wall_flags_static_0(:,j,i),   6 ) )
 !
 !--          Determine topography-top index on u-grid
@@ -2038,8 +2041,8 @@
 !--          of the potential rooftop grid point, while building_edge_n is
 !--          is set from the perspective of the non-building grid point.
-             building_edge_s = ANY( BTEST( wall_flags_0(:,j,i),   6 ) )  .AND. &
-                         .NOT. ANY( BTEST( wall_flags_0(:,j-1,i), 6 ) )
-             building_edge_n = ANY( BTEST( wall_flags_0(:,j-1,i), 6 ) )  .AND. &
-                         .NOT. ANY( BTEST( wall_flags_0(:,j,i),   6 ) )
+             building_edge_s = ANY( BTEST( wall_flags_static_0(:,j,i),   6 ) )  .AND. &
+                         .NOT. ANY( BTEST( wall_flags_static_0(:,j-1,i), 6 ) )
+             building_edge_n = ANY( BTEST( wall_flags_static_0(:,j-1,i), 6 ) )  .AND. &
+                         .NOT. ANY( BTEST( wall_flags_static_0(:,j,i),   6 ) )
 !
 !--          Determine topography-top index on v-grid
Index: /palm/trunk/SOURCE/pmc_interface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4273 2019-10-24 13:40:54Z monakurppa
 ! Add a logical switch nesting_chem and rename nest_salsa to nesting_salsa
 ! 
@@ -205,5 +208,5 @@
     USE indices,                                                               &
         ONLY:  nbgp, nx, nxl, nxlg, nxlu, nxr, nxrg, ny, nyn, nyng, nys, nysg, &
-               nysv, nz, nzb, nzt, topo_top_ind, wall_flags_0
+               nysv, nz, nzb, nzt, topo_top_ind, wall_flags_static_0
 
     USE bulk_cloud_model_mod,                                                  &
@@ -1526,14 +1529,14 @@
        INTEGER(iwp) ::  istart    !<
        INTEGER(iwp) ::  ir        !<
-       INTEGER(iwp) ::  iw        !< Child-grid index limited to -1 <= iw <= nx+1 for wall_flags_0
+       INTEGER(iwp) ::  iw        !< Child-grid index limited to -1 <= iw <= nx+1 for wall_flags_static_0
        INTEGER(iwp) ::  j         !< Child-grid index in the y-direction
        INTEGER(iwp) ::  jj        !< Parent-grid index in the y-direction
        INTEGER(iwp) ::  jstart    !<
        INTEGER(iwp) ::  jr        !<
-       INTEGER(iwp) ::  jw        !< Child-grid index limited to -1 <= jw <= ny+1 for wall_flags_0
+       INTEGER(iwp) ::  jw        !< Child-grid index limited to -1 <= jw <= ny+1 for wall_flags_static_0
        INTEGER(iwp) ::  k         !< Child-grid index in the z-direction
        INTEGER(iwp) ::  kk        !< Parent-grid index in the z-direction
        INTEGER(iwp) ::  kstart    !<
-       INTEGER(iwp) ::  kw        !< Child-grid index limited to kw <= nzt+1 for wall_flags_0
+       INTEGER(iwp) ::  kw        !< Child-grid index limited to kw <= nzt+1 for wall_flags_static_0
 
        REAL(wp)     ::  tolex     !< Tolerance for grid-line matching in x-direction    
@@ -1776,5 +1779,5 @@
 !--    Note that ii, jj, and kk are parent-grid indices. 
 !--    This information is needed in the anterpolation. 
-!--    The indices for wall_flags_0 (kw,jw,iw) must be limited to the range 
+!--    The indices for wall_flags_static_0 (kw,jw,iw) must be limited to the range 
 !--    [-1,...,nx/ny/nzt+1] in order to avoid zero values on the outer ghost nodes.
        DO  ii = ipla, ipra
@@ -1790,5 +1793,5 @@
                          kw = MIN( k, nzt+1 )                
                          ijkfc_u(kk,jj,ii) = ijkfc_u(kk,jj,ii)                                      &
-                              + MERGE( 1, 0, BTEST( wall_flags_0(kw,jw,iw), 1 ) )
+                              + MERGE( 1, 0, BTEST( wall_flags_static_0(kw,jw,iw), 1 ) )
                       ENDDO
                    ENDDO
@@ -1803,5 +1806,5 @@
                          kw = MIN( k, nzt+1 )                                        
                          ijkfc_v(kk,jj,ii) = ijkfc_v(kk,jj,ii)                                      &
-                              + MERGE( 1, 0, BTEST( wall_flags_0(kw,jw,iw), 2 ) )
+                              + MERGE( 1, 0, BTEST( wall_flags_static_0(kw,jw,iw), 2 ) )
                       ENDDO
                    ENDDO
@@ -1816,5 +1819,5 @@
                          kw = MIN( k, nzt+1 )
                          ijkfc_s(kk,jj,ii) = ijkfc_s(kk,jj,ii)                                      &
-                              + MERGE( 1, 0, BTEST( wall_flags_0(kw,jw,iw), 0 ) )
+                              + MERGE( 1, 0, BTEST( wall_flags_static_0(kw,jw,iw), 0 ) )
                       ENDDO
                    ENDDO
@@ -1829,5 +1832,5 @@
                          kw = MIN( k, nzt+1 )
                          ijkfc_w(kk,jj,ii) = ijkfc_w(kk,jj,ii)                                      &
-                              + MERGE( 1, 0, BTEST( wall_flags_0(kw,jw,iw), 3 ) )
+                              + MERGE( 1, 0, BTEST( wall_flags_static_0(kw,jw,iw), 3 ) )
                       ENDDO
                    ENDDO
@@ -2750,10 +2753,10 @@
              DO  jc = nysg, nyng
                 DO  kc = nzb, nzt
-                   u(kc,jc,ic)   = MERGE( u(kc,jc,ic), 0.0_wp, BTEST( wall_flags_0(kc,jc,ic), 1 ) )
-                   v(kc,jc,ic)   = MERGE( v(kc,jc,ic), 0.0_wp, BTEST( wall_flags_0(kc,jc,ic), 2 ) )
-                   w(kc,jc,ic)   = MERGE( w(kc,jc,ic), 0.0_wp, BTEST( wall_flags_0(kc,jc,ic), 3 ) )
-                   u_p(kc,jc,ic) = MERGE( u_p(kc,jc,ic), 0.0_wp, BTEST( wall_flags_0(kc,jc,ic), 1 ) )
-                   v_p(kc,jc,ic) = MERGE( v_p(kc,jc,ic), 0.0_wp, BTEST( wall_flags_0(kc,jc,ic), 2 ) )
-                   w_p(kc,jc,ic) = MERGE( w_p(kc,jc,ic), 0.0_wp, BTEST( wall_flags_0(kc,jc,ic), 3 ) )
+                   u(kc,jc,ic)   = MERGE( u(kc,jc,ic), 0.0_wp, BTEST( wall_flags_static_0(kc,jc,ic), 1 ) )
+                   v(kc,jc,ic)   = MERGE( v(kc,jc,ic), 0.0_wp, BTEST( wall_flags_static_0(kc,jc,ic), 2 ) )
+                   w(kc,jc,ic)   = MERGE( w(kc,jc,ic), 0.0_wp, BTEST( wall_flags_static_0(kc,jc,ic), 3 ) )
+                   u_p(kc,jc,ic) = MERGE( u_p(kc,jc,ic), 0.0_wp, BTEST( wall_flags_static_0(kc,jc,ic), 1 ) )
+                   v_p(kc,jc,ic) = MERGE( v_p(kc,jc,ic), 0.0_wp, BTEST( wall_flags_static_0(kc,jc,ic), 2 ) )
+                   w_p(kc,jc,ic) = MERGE( w_p(kc,jc,ic), 0.0_wp, BTEST( wall_flags_static_0(kc,jc,ic), 3 ) )
                 ENDDO
              ENDDO
@@ -3268,7 +3271,7 @@
                 DO   j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      u(k,j,i) = MERGE( u(k,j,i), 0.0_wp, BTEST( wall_flags_0(k,j,i), 1 ) )
-                      v(k,j,i) = MERGE( v(k,j,i), 0.0_wp, BTEST( wall_flags_0(k,j,i), 2 ) )
-                      w(k,j,i) = MERGE( w(k,j,i), 0.0_wp, BTEST( wall_flags_0(k,j,i), 3 ) )
+                      u(k,j,i) = MERGE( u(k,j,i), 0.0_wp, BTEST( wall_flags_static_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 ) )
+                      w(k,j,i) = MERGE( w(k,j,i), 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 3 ) )
 !
 !--                 TO_DO: zero setting of temperature within topography creates
@@ -4630,5 +4633,5 @@
                      DO  kc = kfl(kp), kfu(kp)
                         cellsum = cellsum + MERGE( child_array(kc,jc,ic), 0.0_wp,                   &
-                             BTEST( wall_flags_0(kc,jc,ic), var_flag ) )
+                             BTEST( wall_flags_static_0(kc,jc,ic), var_flag ) )
                      ENDDO
                   ENDDO
@@ -4921,5 +4924,5 @@
           DO   k = nzb+1, nzt
              sub_sum = sub_sum + innor * u(k,j,i) * dzw(k)                                          &
-                               * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 1 ) )
+                               * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 1 ) )
           ENDDO
           volume_flux_local = volume_flux_local + sub_sum
@@ -4944,5 +4947,5 @@
           DO   k = nzb+1, nzt
              sub_sum = sub_sum + innor * u(k,j,i) * dzw(k)                                          &
-                               * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 1 ) )
+                               * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 1 ) )
           ENDDO
           volume_flux_local = volume_flux_local + sub_sum
@@ -4967,5 +4970,5 @@
           DO   k = nzb+1, nzt
              sub_sum = sub_sum + innor * v(k,j,i) * dzw(k)                                          &
-                               * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 2 ) )
+                               * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 2 ) )
           ENDDO
           volume_flux_local = volume_flux_local + sub_sum
@@ -4990,5 +4993,5 @@
           DO  k = nzb+1, nzt
              sub_sum = sub_sum + innor * v(k,j,i) * dzw(k)                                          &
-                               * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 2 ) )
+                               * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 2 ) )
           ENDDO
           volume_flux_local = volume_flux_local + sub_sum
@@ -5060,5 +5063,5 @@
              DO  k = nzb + 1, nzt
                 u(k,j,i) = u(k,j,i) + u_corr_left                              &
-                     * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 1 ) )
+                     * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 1 ) )
              ENDDO
           ENDDO
@@ -5072,5 +5075,5 @@
              DO  k = nzb + 1, nzt
                 u(k,j,i) = u(k,j,i) + u_corr_right                              &
-                      * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 1 ) )
+                      * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 1 ) )
              ENDDO
           ENDDO
@@ -5084,5 +5087,5 @@
              DO  k = nzb + 1, nzt
                 v(k,j,i) = v(k,j,i) + v_corr_south                              &
-                      * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 2 ) )
+                      * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 2 ) )
              ENDDO
           ENDDO
@@ -5096,5 +5099,5 @@
              DO  k = nzb + 1, nzt
                 v(k,j,i) = v(k,j,i) + v_corr_north                              &
-                      * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 2 ) )
+                      * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 2 ) )
              ENDDO
           ENDDO
Index: /palm/trunk/SOURCE/poismg_noopt_mod.f90
===================================================================
--- /palm/trunk/SOURCE/poismg_noopt_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/poismg_noopt_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -1652,5 +1655,5 @@
        USE indices,                                                            &
            ONLY:  flags, nxl_mg, nxr_mg, nyn_mg, nys_mg, nzb, nzt_mg,          &
-                  wall_flags_0, wall_flags_1,                                  &
+                  wall_flags_static_0, wall_flags_1,                                  &
                   wall_flags_10, wall_flags_2, wall_flags_3,  wall_flags_4,    &
                   wall_flags_5, wall_flags_6, wall_flags_7, wall_flags_8,      &
@@ -1736,5 +1739,5 @@
                 DO  j = nys_l, nyn_l
                    DO  k = nzb, nzt_l
-                      topo_tmp(k,j,i) = wall_flags_0(k*inc,j*inc,i*inc)
+                      topo_tmp(k,j,i) = wall_flags_static_0(k*inc,j*inc,i*inc)
                    ENDDO
                 ENDDO
Index: /palm/trunk/SOURCE/pres.f90
===================================================================
--- /palm/trunk/SOURCE/pres.f90	(revision 4328)
+++ /palm/trunk/SOURCE/pres.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -69,5 +72,5 @@
         ONLY:  nbgp, ngp_2dh_outer, nx, nxl, nxlg, nxl_mg, nxr, nxrg, nxr_mg,  &
                ny, nys, nysg, nys_mg, nyn, nyng, nyn_mg, nzb, nzt, nzt_mg,     &
-               wall_flags_0
+               wall_flags_static_0
 
     USE kinds
@@ -187,5 +190,5 @@
              volume_flow_l(1) = volume_flow_l(1) + u(k,j,i) * dzw(k)           &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 1 )  &
+                                              BTEST( wall_flags_static_0(k,j,i), 1 )  &
                                             )
           ENDDO
@@ -206,5 +209,5 @@
              u(k,j,i) = u(k,j,i) + volume_flow_offset(1)                       &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 1 )  &
+                                              BTEST( wall_flags_static_0(k,j,i), 1 )  &
                                             )
           ENDDO
@@ -232,5 +235,5 @@
              volume_flow_l(2) = volume_flow_l(2) + v(k,j,i) * dzw(k)           &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 2 )  &
+                                              BTEST( wall_flags_static_0(k,j,i), 2 )  &
                                             )
           ENDDO
@@ -251,5 +254,5 @@
              v(k,j,i) = v(k,j,i) + volume_flow_offset(2)                       &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 2 )  &
+                                              BTEST( wall_flags_static_0(k,j,i), 2 )  &
                                             )
           ENDDO
@@ -280,5 +283,5 @@
              DO  k = nzb+1, nzt
                 w_l_l(k) = w_l_l(k) + w(k,j,i)                                                     &
-                                     * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 3 ) )
+                                     * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 3 ) )
              ENDDO
           ENDDO
@@ -297,5 +300,5 @@
              DO  k = nzb+1, nzt
                 w(k,j,i) = w(k,j,i) - w_l(k)                                                       &
-                                     * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 3 ) )
+                                     * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 3 ) )
              ENDDO
           ENDDO
@@ -344,5 +347,5 @@
                         ) * ddt_3d * d_weight_pres                             &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                            BTEST( wall_flags_0(k,j,i), 0 )    &
+                                            BTEST( wall_flags_static_0(k,j,i), 0 )    &
                                           )
           ENDDO
@@ -352,5 +355,5 @@
              threadsum = threadsum + ABS( d(k,j,i) )                           &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                            BTEST( wall_flags_0(k,j,i), 0 )    &
+                                            BTEST( wall_flags_static_0(k,j,i), 0 )    &
                                           )
           ENDDO
@@ -369,5 +372,5 @@
     !$OMP DO SCHEDULE( STATIC )
     !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) &
-    !$ACC PRESENT(u, v, w, rho_air, rho_air_zw, ddzw, wall_flags_0) &
+    !$ACC PRESENT(u, v, w, rho_air, rho_air_zw, ddzw, wall_flags_static_0) &
     !$ACC PRESENT(d)
     DO  i = nxl, nxr
@@ -380,5 +383,5 @@
                         ) * ddt_3d * d_weight_pres                             &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                            BTEST( wall_flags_0(k,j,i), 0 )    &
+                                            BTEST( wall_flags_static_0(k,j,i), 0 )    &
                                           )     
           ENDDO
@@ -630,5 +633,5 @@
     !$OMP DO
     !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j, k) &
-    !$ACC PRESENT(u, v, w, tend, ddzu, wall_flags_0)
+    !$ACC PRESENT(u, v, w, tend, ddzu, wall_flags_static_0)
     DO  i = nxl, nxr   
        DO  j = nys, nyn
@@ -639,5 +642,5 @@
                                      * weight_pres_l                           &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 3 )  &
+                                              BTEST( wall_flags_static_0(k,j,i), 3 )  &
                                             )
           ENDDO
@@ -648,5 +651,5 @@
                                      * weight_pres_l                           &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 1 )  &
+                                              BTEST( wall_flags_static_0(k,j,i), 1 )  &
                                             )
           ENDDO
@@ -657,5 +660,5 @@
                                      * weight_pres_l                           &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 2 )  &
+                                              BTEST( wall_flags_static_0(k,j,i), 2 )  &
                                             )
           ENDDO                                                         
@@ -688,5 +691,5 @@
              volume_flow_l(1) = volume_flow_l(1) + u(k,j,nxr) * dzw(k)         &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,nxr), 1 )&
+                                              BTEST( wall_flags_static_0(k,j,nxr), 1 )&
                                             )
           ENDDO
@@ -707,5 +710,5 @@
              volume_flow_l(2) = volume_flow_l(2) + v(k,nyn,i) * dzw(k)         &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,nyn,i), 2 )&
+                                              BTEST( wall_flags_static_0(k,nyn,i), 2 )&
                                             )
            ENDDO
@@ -738,5 +741,5 @@
                 u(k,j,i) = u(k,j,i) + volume_flow_offset(1)                    &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 1 )  &
+                                              BTEST( wall_flags_static_0(k,j,i), 1 )  &
                                             )
              ENDDO
@@ -744,5 +747,5 @@
                 v(k,j,i) = v(k,j,i) + volume_flow_offset(2)                    &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 2 )  &
+                                              BTEST( wall_flags_static_0(k,j,i), 2 )  &
                                             )
              ENDDO
@@ -788,5 +791,5 @@
                             w(k-1,j,i) * rho_air_zw(k-1) ) * ddzw(k)           &
                         ) * MERGE( 1.0_wp, 0.0_wp,                             &
-                                   BTEST( wall_flags_0(k,j,i), 0 )             &
+                                   BTEST( wall_flags_static_0(k,j,i), 0 )             &
                                  )
              ENDDO
@@ -799,5 +802,5 @@
        !$OMP DO SCHEDULE( STATIC )
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) &
-       !$ACC PRESENT(u, v, w, rho_air, rho_air_zw, ddzw, wall_flags_0) &
+       !$ACC PRESENT(u, v, w, rho_air, rho_air_zw, ddzw, wall_flags_static_0) &
        !$ACC PRESENT(d)
        DO  i = nxl, nxr
@@ -809,5 +812,5 @@
                                w(k-1,j,i) * rho_air_zw(k-1) ) * ddzw(k)        &
                            ) * MERGE( 1.0_wp, 0.0_wp,                          &
-                                   BTEST( wall_flags_0(k,j,i), 0 )             &
+                                   BTEST( wall_flags_static_0(k,j,i), 0 )             &
                                     )
              ENDDO
Index: /palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- /palm/trunk/SOURCE/prognostic_equations.f90	(revision 4328)
+++ /palm/trunk/SOURCE/prognostic_equations.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -203,5 +206,5 @@
         ONLY:  advc_flags_s,                                                   &
                nbgp, nxl, nxlg, nxlu, nxr, nxrg, nyn, nyng, nys, nysg, nysv,   &
-               nzb, nzt, wall_flags_0
+               nzb, nzt, wall_flags_static_0
 
     USE kinds
@@ -373,5 +376,5 @@
                                                      * ( u(k,j,i) - u_init(k) ) &
                                         ) * MERGE( 1.0_wp, 0.0_wp,              &
-                                                   BTEST( wall_flags_0(k,j,i), 1 )&
+                                                   BTEST( wall_flags_static_0(k,j,i), 1 )&
                                                  )
              ENDDO
@@ -451,5 +454,5 @@
                                                      * ( v(k,j,i) - v_init(k) )&
                                         ) * MERGE( 1.0_wp, 0.0_wp,             &
-                                                   BTEST( wall_flags_0(k,j,i), 2 )&
+                                                   BTEST( wall_flags_static_0(k,j,i), 2 )&
                                                  )
              ENDDO
@@ -525,5 +528,5 @@
                                              - tsc(5) * rdf(k) * w(k,j,i)      &
                                      ) * MERGE( 1.0_wp, 0.0_wp,                &
-                                                BTEST( wall_flags_0(k,j,i), 3 )&
+                                                BTEST( wall_flags_static_0(k,j,i), 3 )&
                                               )
           ENDDO
@@ -623,5 +626,5 @@
                                           )                                    &
                                        * MERGE( 1.0_wp, 0.0_wp,                &
-                                                BTEST( wall_flags_0(k,j,i), 0 )&
+                                                BTEST( wall_flags_static_0(k,j,i), 0 )&
                                               )
              ENDDO
@@ -713,5 +716,5 @@
                                         )                                      &
                                        * MERGE( 1.0_wp, 0.0_wp,                &
-                                                BTEST( wall_flags_0(k,j,i), 0 )&
+                                                BTEST( wall_flags_static_0(k,j,i), 0 )&
                                               )                
                 IF ( q_p(k,j,i) < 0.0_wp )  q_p(k,j,i) = 0.1_wp * q(k,j,i)
@@ -811,5 +814,5 @@
                                         )                                      &
                                        * MERGE( 1.0_wp, 0.0_wp,                &
-                                                BTEST( wall_flags_0(k,j,i), 0 )&
+                                                BTEST( wall_flags_static_0(k,j,i), 0 )&
                                               )
                 IF ( s_p(k,j,i) < 0.0_wp )  s_p(k,j,i) = 0.1_wp * s(k,j,i)
@@ -924,5 +927,5 @@
 !-- Prognostic equation for u-velocity component
     !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) &
-    !$ACC PRESENT(u, tend, tu_m, u_init, rdf, wall_flags_0) &
+    !$ACC PRESENT(u, tend, tu_m, u_init, rdf, wall_flags_static_0) &
     !$ACC PRESENT(tsc(2:5)) &
     !$ACC PRESENT(u_p)
@@ -935,5 +938,5 @@
                                                         ( u(k,j,i) - u_init(k) ) &
                                      ) * MERGE( 1.0_wp, 0.0_wp,                  &
-                                                 BTEST( wall_flags_0(k,j,i), 1 ) &
+                                                 BTEST( wall_flags_static_0(k,j,i), 1 ) &
                                               )
           ENDDO
@@ -1027,5 +1030,5 @@
 !-- Prognostic equation for v-velocity component
     !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) &
-    !$ACC PRESENT(v, tend, tv_m, v_init, rdf, wall_flags_0) &
+    !$ACC PRESENT(v, tend, tv_m, v_init, rdf, wall_flags_static_0) &
     !$ACC PRESENT(tsc(2:5)) &
     !$ACC PRESENT(v_p)
@@ -1038,5 +1041,5 @@
                                                       ( v(k,j,i) - v_init(k) ) &
                                      ) * MERGE( 1.0_wp, 0.0_wp,                &
-                                                BTEST( wall_flags_0(k,j,i), 2 )&
+                                                BTEST( wall_flags_static_0(k,j,i), 2 )&
                                               )
           ENDDO
@@ -1126,5 +1129,5 @@
 !-- Prognostic equation for w-velocity component
     !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) &
-    !$ACC PRESENT(w, tend, tw_m, v_init, rdf, wall_flags_0) &
+    !$ACC PRESENT(w, tend, tw_m, v_init, rdf, wall_flags_static_0) &
     !$ACC PRESENT(tsc(2:5)) &
     !$ACC PRESENT(w_p)
@@ -1136,5 +1139,5 @@
                                                - tsc(5) * rdf(k) * w(k,j,i)    &
                                      ) * MERGE( 1.0_wp, 0.0_wp,                &
-                                                BTEST( wall_flags_0(k,j,i), 3 )&
+                                                BTEST( wall_flags_static_0(k,j,i), 3 )&
                                               )
           ENDDO
@@ -1264,5 +1267,5 @@
 !--    Prognostic equation for potential temperature
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) &
-       !$ACC PRESENT(pt, tend, tpt_m, wall_flags_0) &
+       !$ACC PRESENT(pt, tend, tpt_m, wall_flags_static_0) &
        !$ACC PRESENT(pt_init, rdf_sc, ptdf_x, ptdf_y) &
        !$ACC PRESENT(tsc(3:5)) &
@@ -1278,5 +1281,5 @@
                                           )                                    &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                             BTEST( wall_flags_0(k,j,i), 0 )   &
+                                             BTEST( wall_flags_static_0(k,j,i), 0 )   &
                                           )
              ENDDO
@@ -1399,5 +1402,5 @@
                                                       ( q(k,j,i) - q_init(k) ) &
                                         ) * MERGE( 1.0_wp, 0.0_wp,             &
-                                                   BTEST( wall_flags_0(k,j,i), 0 ) &
+                                                   BTEST( wall_flags_static_0(k,j,i), 0 ) &
                                                  )
                 IF ( q_p(k,j,i) < 0.0_wp )  q_p(k,j,i) = 0.1_wp * q(k,j,i)
@@ -1520,5 +1523,5 @@
                                         )                                      &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                             BTEST( wall_flags_0(k,j,i), 0 )   &
+                                             BTEST( wall_flags_static_0(k,j,i), 0 )   &
                                           )
                 IF ( s_p(k,j,i) < 0.0_wp )  s_p(k,j,i) = 0.1_wp * s(k,j,i)
Index: /palm/trunk/SOURCE/salsa_mod.f90
===================================================================
--- /palm/trunk/SOURCE/salsa_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/salsa_mod.f90	(revision 4329)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4315 2019-12-02 09:20:07Z monakurppa
 ! Add an additional check for the time dimension PIDS_SALSA in
 ! salsa_emission_setup and correct some error message identifiers.
@@ -253,5 +256,5 @@
 
     USE indices,                                                                                   &
-        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb, nz, nzt, wall_flags_0
+        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb, nz, nzt, wall_flags_static_0
 
     USE kinds
@@ -1649,8 +1652,8 @@
        ALLOCATE( salsa_advc_flags_s(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
 !
-!--    In case of decycling, set Neuman boundary conditions for wall_flags_0 bit 31 instead of
+!--    In case of decycling, set Neuman boundary conditions for wall_flags_static_0 bit 31 instead of
 !--    cyclic boundary conditions. Bit 31 is used to identify extended degradation zones (please see
 !--    the following comment). Note, since several also other modules may access this bit but may
-!--    have other boundary conditions, the original value of wall_flags_0 bit 31 must not be
+!--    have other boundary conditions, the original value of wall_flags_static_0 bit 31 must not be
 !--    modified. Hence, store the boundary conditions directly on salsa_advc_flags_s.
 !--    salsa_advc_flags_s will be later overwritten in ws_init_flags_scalar and bit 31 won't be used
@@ -1658,5 +1661,5 @@
 !--    Initialize with flag 31 only.
        salsa_advc_flags_s = 0
-       salsa_advc_flags_s = MERGE( IBSET( salsa_advc_flags_s, 31 ), 0, BTEST( wall_flags_0, 31 ) )
+       salsa_advc_flags_s = MERGE( IBSET( salsa_advc_flags_s, 31 ), 0, BTEST( wall_flags_static_0, 31 ) )
 
        IF ( decycle_salsa_ns )  THEN
@@ -1778,5 +1781,5 @@
        DO  j = nys, nyn
 
-          k_topo_top(j,i) = MAXLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,j,i), 12 ) ), DIM = 1 ) - 1
+          k_topo_top(j,i) = MAXLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,j,i), 12 ) ), DIM = 1 ) - 1
 
           CALL salsa_driver( i, j, 1 )
@@ -2304,5 +2307,5 @@
 !
 !--          Predetermine flag to mask topography
-             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 !
 !--          a) Number concentrations
@@ -2515,5 +2518,5 @@
 !
 !--          Predetermine flag to mask topography
-             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) ) 
+             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
 !
 !--          Regime 2a:
@@ -3062,5 +3065,5 @@
 !
 !--    Predetermine flag to mask topography
-       flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+       flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 !
 !--    Wind velocity for dry depositon on vegetation
@@ -7437,5 +7440,5 @@
 !
 !-- Predetermine flag to mask topography
-    flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(:,j,i), 0 ) )
+    flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(:,j,i), 0 ) )
 
     DO  ib = 1, nbins_aerosol   ! aerosol size bins
@@ -7853,5 +7856,5 @@
 
     USE indices,                                                                                   &
-        ONLY:  wall_flags_0
+        ONLY:  wall_flags_static_0
 
     USE surface_mod,                                                                               &
@@ -7945,8 +7948,8 @@
           tend(k,j,i) = tend(k,j,i) - MAX( 0.0_wp, ( rs(k+1,j,i) * sedim_vd(k+1,j,i,ib) -          &
                                                      rs(k,j,i) * sedim_vd(k,j,i,ib) ) * ddzu(k) )  &
-                                    * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k-1,j,i), 0 ) )
+                                    * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k-1,j,i), 0 ) )
           rs_p(k,j,i) = rs(k,j,i) + ( dt_3d * ( tsc(2) * tend(k,j,i) + tsc(3) * trs_m(k,j,i) )     &
                                       - tsc(5) * rdf_sc(k) * ( rs(k,j,i) - rs_init(k) ) )          &
-                                  * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                                  * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
           IF ( rs_p(k,j,i) < 0.0_wp )  rs_p(k,j,i) = 0.1_wp * rs(k,j,i)
        ENDDO
@@ -7958,5 +7961,5 @@
           rs_p(k,j,i) = rs(k,j,i) + ( dt_3d * ( tsc(2) * tend(k,j,i) + tsc(3) * trs_m(k,j,i) )     &
                                                 - tsc(5) * rdf_sc(k) * ( rs(k,j,i) - rs_init(k) ) )&
-                                  * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                                  * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
           IF ( rs_p(k,j,i) < 0.0_wp )  rs_p(k,j,i) = 0.1_wp * rs(k,j,i)
        ENDDO
@@ -7997,5 +8000,5 @@
         ONLY:  diffusion_s
     USE indices,                                                                                   &
-        ONLY:  wall_flags_0
+        ONLY:  wall_flags_static_0
     USE surface_mod,                                                                               &
         ONLY :  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h, surf_usm_v
@@ -8082,10 +8085,10 @@
                                    sedim_vd(nzb+2:nzt+1,j,i,ib) - rs(nzb+1:nzt,j,i) *              &
                                    sedim_vd(nzb+1:nzt,j,i,ib) ) * ddzu(nzb+1:nzt) ) *              &
-                                   MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(nzb:nzt-1,j,i), 0 ) )
+                                   MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(nzb:nzt-1,j,i), 0 ) )
           ENDIF
           DO  k = nzb+1, nzt
              rs_p(k,j,i) = rs(k,j,i) +  ( dt_3d  * ( tsc(2) * tend(k,j,i) + tsc(3) * trs_m(k,j,i) )&
                                                   - tsc(5) * rdf_sc(k) * ( rs(k,j,i) - rs_init(k) )&
-                                        ) * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                                        ) * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
              IF ( rs_p(k,j,i) < 0.0_wp )  rs_p(k,j,i) = 0.1_wp * rs(k,j,i)
           ENDDO
@@ -8418,5 +8421,5 @@
                 DO  j = nysg, nyng
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       sq(k,j,i) = sq_init(k) * flag
                    ENDDO
@@ -8443,5 +8446,5 @@
                 DO  j = nysg, nyng
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       sq(k,j,i) = sq(k,j,copied) * flag
                    ENDDO
@@ -8479,5 +8482,5 @@
                 DO  j = ss, ee
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       sq(k,j,i) = sq_init(k) * flag
                    ENDDO
@@ -8504,5 +8507,5 @@
                 DO  j = ss, ee
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       sq(k,j,i) = sq(k,copied,i) * flag
                    ENDDO
@@ -10000,5 +10003,5 @@
                          ENDDO
                          sums_l(k,ind,tn) = sums_l(k,ind,tn) + temp_bin * rmask(j,i,sr)  *         &
-                                           MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 22 ) )
+                                           MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
                       ENDDO
                    ENDDO
@@ -10015,5 +10018,5 @@
                          ENDDO
                          sums_l(k,ind,tn) = sums_l(k,ind,tn) + temp_bin * rmask(j,i,sr)  *         &
-                                           MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 22 ) )
+                                           MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
                       ENDDO
                    ENDDO
@@ -10029,5 +10032,5 @@
                          ENDDO
                          sums_l(k,ind,tn) = sums_l(k,ind,tn) + temp_bin * rmask(j,i,sr)  *         &
-                                           MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 22 ) )
+                                           MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
                       ENDDO
                    ENDDO
@@ -10047,5 +10050,5 @@
                          ENDDO
                          sums_l(k,ind,tn) = sums_l(k,ind,tn) + temp_bin * rmask(j,i,sr)  *         &
-                                           MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 22 ) )
+                                           MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
                       ENDDO
                    ENDDO
@@ -10065,5 +10068,5 @@
                          ENDDO
                          sums_l(k,ind,tn) = sums_l(k,ind,tn) + temp_bin * rmask(j,i,sr)  *         &
-                                           MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 22 ) )
+                                           MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
                       ENDDO
                    ENDDO
@@ -10083,5 +10086,5 @@
                          ENDDO
                          sums_l(k,ind,tn) = sums_l(k,ind,tn) + temp_bin * rmask(j,i,sr)  *         &
-                                           MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 22 ) )
+                                           MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 22 ) )
                       ENDDO
                    ENDDO
@@ -10698,5 +10701,5 @@
                    DO  k = nzb_do, nzt_do
                       local_pf(i,j,k) = MERGE( aerosol_number(ib)%conc(k,j,i), REAL( fill_value,   &
-                                               KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               KIND = wp ), BTEST( wall_flags_static_0(k,j,i), 0 ) )
                    ENDDO
                 ENDDO
@@ -10707,5 +10710,5 @@
                    DO  k = nzb_do, nzt_do
                       local_pf(i,j,k) = MERGE( nbins_av(k,j,i,ib), REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
                    ENDDO
                 ENDDO
@@ -10730,5 +10733,5 @@
                       ENDDO
                       local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),            &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
                    ENDDO
                 ENDDO
@@ -10739,5 +10742,5 @@
                    DO  k = nzb_do, nzt_do
                       local_pf(i,j,k) = MERGE( mbins_av(k,j,i,ib), REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
                    ENDDO
                 ENDDO
@@ -10764,5 +10767,5 @@
                          local_pf(i,j,k) = MERGE( salsa_gas(found_index)%conc(k,j,i),              &
                                                   REAL( fill_value,  KIND = wp ),                  &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10778,5 +10781,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), REAL( fill_value,         &
-                                                  KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  KIND = wp ), BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10808,5 +10811,5 @@
 
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10817,5 +10820,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( ldsa_av(k,j,i), REAL( fill_value, KIND = wp ),   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10838,5 +10841,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10847,5 +10850,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( nufp_av(k,j,i), REAL( fill_value, KIND = wp ),   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10866,5 +10869,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10875,5 +10878,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( ntot_av(k,j,i), REAL( fill_value, KIND = wp ),   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10897,5 +10900,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10906,5 +10909,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( pm01_av(k,j,i), REAL( fill_value, KIND = wp ),   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10928,5 +10931,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10937,5 +10940,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( pm25_av(k,j,i), REAL( fill_value, KIND = wp ),   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10959,5 +10962,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin,  REAL( fill_value, KIND = wp ),        &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10968,5 +10971,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( pm10_av(k,j,i), REAL( fill_value, KIND = wp ),   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -10989,5 +10992,5 @@
                             ENDDO
                             local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),      &
-                                                     BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                     BTEST( wall_flags_static_0(k,j,i), 0 ) )
                          ENDDO
                       ENDDO
@@ -11005,5 +11008,5 @@
                          DO  k = nzb_do, nzt_do
                             local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), REAL( fill_value,      &
-                                                     KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                     KIND = wp ), BTEST( wall_flags_static_0(k,j,i), 0 ) )
                          ENDDO
                       ENDDO
@@ -11027,5 +11030,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -11037,5 +11040,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), REAL( fill_value,         &
-                                                  KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  KIND = wp ), BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -11108,5 +11111,5 @@
                    DO  k = nzb_do, nzt_do
                       local_pf(i,j,k) = MERGE( aerosol_number(ib)%conc(k,j,i), REAL( fill_value,   &
-                                               KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               KIND = wp ), BTEST( wall_flags_static_0(k,j,i), 0 ) )
                    ENDDO
                 ENDDO
@@ -11117,5 +11120,5 @@
                    DO  k = nzb_do, nzt_do
                       local_pf(i,j,k) = MERGE( nbins_av(k,j,i,ib), REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
                    ENDDO
                 ENDDO
@@ -11138,5 +11141,5 @@
                       ENDDO
                       local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),            &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
                    ENDDO
                 ENDDO
@@ -11147,5 +11150,5 @@
                    DO  k = nzb_do, nzt_do
                       local_pf(i,j,k) = MERGE( mbins_av(k,j,i,ib), REAL( fill_value, KIND = wp ),  &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
                    ENDDO
                 ENDDO
@@ -11170,5 +11173,5 @@
                          local_pf(i,j,k) = MERGE( salsa_gas(found_index)%conc(k,j,i),              &
                                                   REAL( fill_value, KIND = wp ),                   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -11186,5 +11189,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), REAL( fill_value,         &
-                                                  KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  KIND = wp ), BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -11213,5 +11216,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -11222,5 +11225,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( ldsa_av(k,j,i), REAL( fill_value, KIND = wp ),   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
                       ENDDO
                    ENDDO
@@ -11240,5 +11243,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -11249,5 +11252,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( nufp_av(k,j,i), REAL( fill_value, KIND = wp ),   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
                       ENDDO
                    ENDDO
@@ -11265,5 +11268,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -11274,5 +11277,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( ntot_av(k,j,i), REAL( fill_value, KIND = wp ),   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
                       ENDDO
                    ENDDO
@@ -11294,5 +11297,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
                       ENDDO
                    ENDDO
@@ -11303,5 +11306,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( pm01_av(k,j,i), REAL( fill_value, KIND = wp ),   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
                       ENDDO
                    ENDDO
@@ -11323,5 +11326,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
                       ENDDO
                    ENDDO
@@ -11332,5 +11335,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( pm25_av(k,j,i), REAL( fill_value, KIND = wp ),   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
                       ENDDO
                    ENDDO
@@ -11352,5 +11355,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
                       ENDDO
                    ENDDO
@@ -11361,5 +11364,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( pm10_av(k,j,i), REAL( fill_value, KIND = wp ),   &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -11379,5 +11382,5 @@
                             ENDDO
                             local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),      &
-                                                     BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                                                     BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
                          ENDDO
                       ENDDO
@@ -11397,5 +11400,5 @@
                          DO  k = nzb_do, nzt_do
                             local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), REAL( fill_value,      &
-                                                     KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                     KIND = wp ), BTEST( wall_flags_static_0(k,j,i), 0 ) )
                          ENDDO
                       ENDDO
@@ -11415,5 +11418,5 @@
                          ENDDO
                          local_pf(i,j,k) = MERGE( temp_bin, REAL( fill_value, KIND = wp ),         &
-                                                  BTEST( wall_flags_0(k,j,i), 0 ) ) 
+                                                  BTEST( wall_flags_static_0(k,j,i), 0 ) ) 
                       ENDDO
                    ENDDO
@@ -11425,5 +11428,5 @@
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i), REAL( fill_value,         &
-                                                  KIND = wp ), BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                  KIND = wp ), BTEST( wall_flags_static_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -11515,10 +11518,10 @@
                       im = mask_i(mid,i)
                       jm = mask_j(mid,j)
-                      ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                      ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                       DO  k = 1, mask_size_l(mid,3)
                          kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !
 !--                      Set value if not in building
-                         IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                         IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                             local_pf(i,j,k) = fill_value
                          ELSE
@@ -11569,10 +11572,10 @@
                       im = mask_i(mid,i)
                       jm = mask_j(mid,j)
-                      ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                      ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                       DO  k = 1, mask_size_l(mid,3)
                          kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !
 !--                      Set value if not in building
-                         IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                         IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                             local_pf(i,j,k) = fill_value
                          ELSE
@@ -11648,10 +11651,10 @@
                          im = mask_i(mid,i)
                          jm = mask_j(mid,j)
-                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                          DO  k = 1, mask_size_l(mid,3)
                             kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !
 !--                         Set value if not in building
-                            IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                            IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                local_pf(i,j,k) = fill_value
                             ELSE
@@ -11697,10 +11700,10 @@
                          im = mask_i(mid,i)
                          jm = mask_j(mid,j)
-                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                          DO  k = 1, mask_size_l(mid,3)
                             kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !
 !--                         Set value if not in building
-                            IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                            IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                local_pf(i,j,k) = fill_value
                             ELSE
@@ -11744,10 +11747,10 @@
                          im = mask_i(mid,i)
                          jm = mask_j(mid,j)
-                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                          DO  k = 1, mask_size_l(mid,3)
                             kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !
 !--                         Set value if not in building
-                            IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                            IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                local_pf(i,j,k) = fill_value
                             ELSE
@@ -11795,10 +11798,10 @@
                          im = mask_i(mid,i)
                          jm = mask_j(mid,j)
-                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                          DO  k = 1, mask_size_l(mid,3)
                             kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !
 !--                         Set value if not in building
-                            IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                            IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                local_pf(i,j,k) = fill_value
                             ELSE
@@ -11846,10 +11849,10 @@
                          im = mask_i(mid,i)
                          jm = mask_j(mid,j)
-                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                          DO  k = 1, mask_size_l(mid,3)
                             kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !
 !--                         Set value if not in building
-                            IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                            IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                local_pf(i,j,k) = fill_value
                             ELSE
@@ -11897,10 +11900,10 @@
                          im = mask_i(mid,i)
                          jm = mask_j(mid,j)
-                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                          DO  k = 1, mask_size_l(mid,3)
                             kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !
 !--                         Set value if not in building
-                            IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                            IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                local_pf(i,j,k) = fill_value
                             ELSE
@@ -11949,10 +11952,10 @@
                          im = mask_i(mid,i)
                          jm = mask_j(mid,j)
-                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                          DO  k = 1, mask_size_l(mid,3)
                             kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !
 !--                         Set value if not in building
-                            IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                            IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                local_pf(i,j,k) = fill_value
                             ELSE
@@ -12005,10 +12008,10 @@
                          im = mask_i(mid,i)
                          jm = mask_j(mid,j)
-                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                         ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                          DO  k = 1, mask_size_l(mid,3)
                             kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !
 !--                         Set value if not in building
-                            IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                            IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                                local_pf(i,j,k) = fill_value
                             ELSE
@@ -12049,9 +12052,9 @@
                 im = mask_i(mid,i)
                 jm = mask_j(mid,j)
-                ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
                 DO  k = 1, mask_size_l(mid,3)
                    kk = MIN( ktt+mask_k(mid,k), nzt+1 )
 !--                Set value if not in building
-                   IF ( BTEST( wall_flags_0(kk,jm,im), 6 ) )  THEN
+                   IF ( BTEST( wall_flags_static_0(kk,jm,im), 6 ) )  THEN
                       local_pf(i,j,k) = fill_value
                    ELSE
Index: /palm/trunk/SOURCE/subsidence_mod.f90
===================================================================
--- /palm/trunk/SOURCE/subsidence_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/subsidence_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -152,5 +155,5 @@
        USE indices,                                                            &
            ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt,        &
-                  wall_flags_0
+                  wall_flags_static_0
 
        USE kinds
@@ -186,10 +189,10 @@
                               ( var(k+1,j,i) - var(k,j,i) ) * ddzu(k+1) *      &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
                 ELSE                               ! large-scale ascent
                    tmp_tend = - w_subs(k) *                                    &
                               ( var(k,j,i) - var(k-1,j,i) ) * ddzu(k) *        &
                                         MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 0 ) )
                 ENDIF
 
@@ -200,5 +203,5 @@
                                  * weight_substep(intermediate_timestep_count) &
                                  * MERGE( 1.0_wp, 0.0_wp,                      &
-                                          BTEST( wall_flags_0(k,j,i), 0 ) )
+                                          BTEST( wall_flags_static_0(k,j,i), 0 ) )
                 ENDIF
              ENDDO
@@ -266,5 +269,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxl, nxlg, nxrg, nyng, nys, nysg, nzb, nzt, wall_flags_0
+           ONLY:  nxl, nxlg, nxrg, nyng, nys, nysg, nzb, nzt, wall_flags_static_0
 
        USE kinds
@@ -297,9 +300,9 @@
                                     * ddzu(k+1)                                &
                                     * MERGE( 1.0_wp, 0.0_wp,                   &
-                                             BTEST( wall_flags_0(k,j,i), 0 ) )
+                                             BTEST( wall_flags_static_0(k,j,i), 0 ) )
           ELSE                                 ! large-scale ascent
              tmp_tend = - w_subs(k) * ( var(k,j,i) - var(k-1,j,i) ) * ddzu(k)  &
                                     * MERGE( 1.0_wp, 0.0_wp,                   &
-                                             BTEST( wall_flags_0(k,j,i), 0 ) )
+                                             BTEST( wall_flags_static_0(k,j,i), 0 ) )
           ENDIF
 
@@ -310,5 +313,5 @@
                                   * weight_substep(intermediate_timestep_count)&
                                   * MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_0(k,j,i), 0 ) )
+                                           BTEST( wall_flags_static_0(k,j,i), 0 ) )
           ENDIF
        ENDDO
Index: /palm/trunk/SOURCE/surface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/surface_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/surface_mod.f90	(revision 4329)
@@ -21,9 +21,12 @@
 ! Current revisions:
 ! ------------------
-!
+! 
 ! 
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4245 2019-09-30 08:40:37Z pavelkrc
 ! Corrected "Former revisions" section
 ! 
@@ -108,5 +111,5 @@
 
     USE indices,                                                               &
-        ONLY:  nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb, nzt, wall_flags_0
+        ONLY:  nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb, nzt, wall_flags_static_0
 
     USE grid_variables,                                                        &
@@ -585,6 +588,6 @@
 !         
 !--                Check if current gridpoint belongs to the atmosphere
-                   IF ( BTEST( wall_flags_0(k,j,i), 0 ) )  THEN
-                      IF ( .NOT. BTEST( wall_flags_0(k+bc_h(l)%koff,           &
+                   IF ( BTEST( wall_flags_static_0(k,j,i), 0 ) )  THEN
+                      IF ( .NOT. BTEST( wall_flags_static_0(k+bc_h(l)%koff,           &
                                                      j+bc_h(l)%joff,           &
                                                      i+bc_h(l)%ioff), 0 ) )    &
@@ -616,8 +619,8 @@
 !         
 !--                Check if current gridpoint belongs to the atmosphere
-                   IF ( BTEST( wall_flags_0(k,j,i), 0 ) )  THEN
+                   IF ( BTEST( wall_flags_static_0(k,j,i), 0 ) )  THEN
 !         
 !--                   Upward-facing
-                      IF ( .NOT. BTEST( wall_flags_0(k+bc_h(l)%koff,           &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k+bc_h(l)%koff,           &
                                                      j+bc_h(l)%joff,           &
                                                      i+bc_h(l)%ioff), 0 )      &
@@ -652,6 +655,6 @@
 !         
 !--                Check if current gridpoint belongs to the atmosphere
-                   IF ( BTEST( wall_flags_0(k,j,i), 0 ) )  THEN
-                      IF ( .NOT. BTEST( wall_flags_0(k+bc_v(l)%koff,           &
+                   IF ( BTEST( wall_flags_static_0(k,j,i), 0 ) )  THEN
+                      IF ( .NOT. BTEST( wall_flags_static_0(k+bc_v(l)%koff,           &
                                                      j+bc_v(l)%joff,           &
                                                      i+bc_v(l)%ioff), 0 ) )    &
@@ -685,8 +688,8 @@
 !         
 !--                Check if current gridpoint belongs to the atmosphere
-                   IF ( BTEST( wall_flags_0(k,j,i), 0 ) )  THEN
+                   IF ( BTEST( wall_flags_static_0(k,j,i), 0 ) )  THEN
 !         
 !--                   Upward-facing
-                      IF ( .NOT. BTEST( wall_flags_0(k+bc_v(l)%koff,           &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k+bc_v(l)%koff,           &
                                                      j+bc_v(l)%joff,           &
                                                      i+bc_v(l)%ioff), 0 )      &
@@ -765,16 +768,16 @@
 !
 !--             Check if current gridpoint belongs to the atmosphere
-                IF ( BTEST( wall_flags_0(k,j,i), 0 ) )  THEN
+                IF ( BTEST( wall_flags_static_0(k,j,i), 0 ) )  THEN
 !
 !--                Check if grid point adjoins to any upward-facing horizontal
 !--                surface, e.g. the Earth surface, plane roofs, or ceilings.
 
-                   IF ( .NOT. BTEST( wall_flags_0(k-1,j,i), 0 ) )  THEN
+                   IF ( .NOT. BTEST( wall_flags_static_0(k-1,j,i), 0 ) )  THEN
 !
 !--                   Determine flags indicating a terrain surface, a building
 !--                   surface, 
-                      terrain  = BTEST( wall_flags_0(k-1,j,i), 5 )  .OR.       &
+                      terrain  = BTEST( wall_flags_static_0(k-1,j,i), 5 )  .OR.       &
                                  topo_no_distinct
-                      building = BTEST( wall_flags_0(k-1,j,i), 6 )  .OR.       &
+                      building = BTEST( wall_flags_static_0(k-1,j,i), 6 )  .OR.       &
                                  topo_no_distinct
 !
@@ -782,6 +785,6 @@
 !--                   as terrain but with a non-grid resolved building on top.
 !--                   These surfaces will be flagged as urban surfaces.
-                      unresolved_building = BTEST( wall_flags_0(k-1,j,i), 5 )  &
-                                     .AND.  BTEST( wall_flags_0(k-1,j,i), 6 )
+                      unresolved_building = BTEST( wall_flags_static_0(k-1,j,i), 5 )  &
+                                     .AND.  BTEST( wall_flags_static_0(k-1,j,i), 6 )
 !
 !--                   Land-surface type
@@ -817,5 +820,5 @@
 !--                Check for any other downward-facing surface. So far only for 
 !--                default surface type.
-                   ELSEIF ( .NOT. BTEST( wall_flags_0(k+1,j,i), 0 ) )  THEN
+                   ELSEIF ( .NOT. BTEST( wall_flags_static_0(k+1,j,i), 0 ) )  THEN
                       num_def_h(1) = num_def_h(1) + 1
                    ENDIF 
@@ -830,18 +833,18 @@
           DO  j = nys, nyn
              DO  k = nzb+1, nzt
-                IF ( BTEST( wall_flags_0(k,j,i), 0 ) )  THEN
+                IF ( BTEST( wall_flags_static_0(k,j,i), 0 ) )  THEN
 !
 !--                Northward-facing
-                   IF ( .NOT. BTEST( wall_flags_0(k,j-1,i), 0 ) )  THEN
+                   IF ( .NOT. BTEST( wall_flags_static_0(k,j-1,i), 0 ) )  THEN
 !
 !--                   Determine flags indicating terrain or building
 
-                      terrain  = BTEST( wall_flags_0(k,j-1,i), 5 )  .OR.       &
+                      terrain  = BTEST( wall_flags_static_0(k,j-1,i), 5 )  .OR.       &
                                  topo_no_distinct
-                      building = BTEST( wall_flags_0(k,j-1,i), 6 )   .OR.      &
+                      building = BTEST( wall_flags_static_0(k,j-1,i), 6 )   .OR.      &
                                  topo_no_distinct
 
-                      unresolved_building = BTEST( wall_flags_0(k,j-1,i), 5 )  &
-                                     .AND.  BTEST( wall_flags_0(k,j-1,i), 6 )
+                      unresolved_building = BTEST( wall_flags_static_0(k,j-1,i), 5 )  &
+                                     .AND.  BTEST( wall_flags_static_0(k,j-1,i), 6 )
                                      
                       IF (  land_surface  .AND.  terrain  .AND.                &
@@ -868,14 +871,14 @@
 !
 !--                Southward-facing
-                   IF ( .NOT. BTEST( wall_flags_0(k,j+1,i), 0 ) )  THEN
+                   IF ( .NOT. BTEST( wall_flags_static_0(k,j+1,i), 0 ) )  THEN
 !
 !--                   Determine flags indicating terrain or building
-                      terrain  = BTEST( wall_flags_0(k,j+1,i), 5 )  .OR.       &
+                      terrain  = BTEST( wall_flags_static_0(k,j+1,i), 5 )  .OR.       &
                                  topo_no_distinct
-                      building = BTEST( wall_flags_0(k,j+1,i), 6 )  .OR.       &
+                      building = BTEST( wall_flags_static_0(k,j+1,i), 6 )  .OR.       &
                                  topo_no_distinct
                                  
-                      unresolved_building = BTEST( wall_flags_0(k,j+1,i), 5 )  &
-                                     .AND.  BTEST( wall_flags_0(k,j+1,i), 6 ) 
+                      unresolved_building = BTEST( wall_flags_static_0(k,j+1,i), 5 )  &
+                                     .AND.  BTEST( wall_flags_static_0(k,j+1,i), 6 ) 
                                 
                       IF (  land_surface  .AND.  terrain  .AND.                &
@@ -902,14 +905,14 @@
 !
 !--                Eastward-facing
-                   IF ( .NOT. BTEST( wall_flags_0(k,j,i-1), 0 ) )  THEN
+                   IF ( .NOT. BTEST( wall_flags_static_0(k,j,i-1), 0 ) )  THEN
 !
 !--                   Determine flags indicating terrain or building
-                      terrain  = BTEST( wall_flags_0(k,j,i-1), 5 )  .OR.       &
+                      terrain  = BTEST( wall_flags_static_0(k,j,i-1), 5 )  .OR.       &
                                  topo_no_distinct
-                      building = BTEST( wall_flags_0(k,j,i-1), 6 )  .OR.       &
+                      building = BTEST( wall_flags_static_0(k,j,i-1), 6 )  .OR.       &
                                  topo_no_distinct
                                  
-                      unresolved_building = BTEST( wall_flags_0(k,j,i-1), 5 )  &
-                                     .AND.  BTEST( wall_flags_0(k,j,i-1), 6 )
+                      unresolved_building = BTEST( wall_flags_static_0(k,j,i-1), 5 )  &
+                                     .AND.  BTEST( wall_flags_static_0(k,j,i-1), 6 )
                                      
                       IF (  land_surface  .AND.  terrain  .AND.                &
@@ -936,14 +939,14 @@
 !
 !--                Westward-facing
-                   IF ( .NOT. BTEST( wall_flags_0(k,j,i+1), 0 ) )  THEN
+                   IF ( .NOT. BTEST( wall_flags_static_0(k,j,i+1), 0 ) )  THEN
 !
 !--                   Determine flags indicating terrain or building
-                      terrain  = BTEST( wall_flags_0(k,j,i+1), 5 )  .OR.       &
+                      terrain  = BTEST( wall_flags_static_0(k,j,i+1), 5 )  .OR.       &
                                  topo_no_distinct
-                      building = BTEST( wall_flags_0(k,j,i+1), 6 )  .OR.       &
+                      building = BTEST( wall_flags_static_0(k,j,i+1), 6 )  .OR.       &
                                  topo_no_distinct
                                  
-                      unresolved_building = BTEST( wall_flags_0(k,j,i+1), 5 )  &
-                                     .AND.  BTEST( wall_flags_0(k,j,i+1), 6 )
+                      unresolved_building = BTEST( wall_flags_static_0(k,j,i+1), 5 )  &
+                                     .AND.  BTEST( wall_flags_static_0(k,j,i+1), 6 )
                                  
                       IF (  land_surface  .AND.  terrain  .AND.                &
@@ -2144,15 +2147,15 @@
 !
 !--             Check if current gridpoint belongs to the atmosphere
-                IF ( BTEST( wall_flags_0(k,j,i), 0 ) )  THEN
+                IF ( BTEST( wall_flags_static_0(k,j,i), 0 ) )  THEN
 !
 !--                Upward-facing surface. Distinguish between differet surface types.
 !--                To do, think about method to flag natural and non-natural 
 !--                surfaces. 
-                   IF ( .NOT. BTEST( wall_flags_0(k-1,j,i), 0 ) )  THEN 
+                   IF ( .NOT. BTEST( wall_flags_static_0(k-1,j,i), 0 ) )  THEN 
 !
 !--                   Determine flags indicating terrain or building
-                      terrain  = BTEST( wall_flags_0(k-1,j,i), 5 )  .OR.       &
+                      terrain  = BTEST( wall_flags_static_0(k-1,j,i), 5 )  .OR.       &
                                  topo_no_distinct
-                      building = BTEST( wall_flags_0(k-1,j,i), 6 )  .OR.       &
+                      building = BTEST( wall_flags_static_0(k-1,j,i), 6 )  .OR.       &
                                  topo_no_distinct
                                  
@@ -2161,6 +2164,6 @@
 !--                   as terrain but with a non-grid resolved building on top.
 !--                   These surfaces will be flagged as urban surfaces.
-                      unresolved_building = BTEST( wall_flags_0(k-1,j,i), 5 )  &
-                                     .AND.  BTEST( wall_flags_0(k-1,j,i), 6 )
+                      unresolved_building = BTEST( wall_flags_static_0(k-1,j,i), 5 )  &
+                                     .AND.  BTEST( wall_flags_static_0(k-1,j,i), 6 )
 !
 !--                   Natural surface type          
@@ -2200,5 +2203,5 @@
 !--                Check for any other downward-facing surface. So far only for 
 !--                default surface type.
-                   ELSEIF ( .NOT. BTEST( wall_flags_0(k+1,j,i), 0 ) )  THEN
+                   ELSEIF ( .NOT. BTEST( wall_flags_static_0(k+1,j,i), 0 ) )  THEN
                       CALL initialize_horizontal_surfaces( k, j, i,            &
                                                            surf_def_h(1),      &
@@ -2210,14 +2213,14 @@
 !--                Check for vertical walls and, if required, initialize it.
 !                  Start with northward-facing surface.
-                   IF ( .NOT. BTEST( wall_flags_0(k,j-1,i), 0 ) )  THEN
+                   IF ( .NOT. BTEST( wall_flags_static_0(k,j-1,i), 0 ) )  THEN
 !
 !--                   Determine flags indicating terrain or building
-                      terrain  = BTEST( wall_flags_0(k,j-1,i), 5 )  .OR.       &
+                      terrain  = BTEST( wall_flags_static_0(k,j-1,i), 5 )  .OR.       &
                                  topo_no_distinct
-                      building = BTEST( wall_flags_0(k,j-1,i), 6 )  .OR.       &
+                      building = BTEST( wall_flags_static_0(k,j-1,i), 6 )  .OR.       &
                                  topo_no_distinct
 
-                      unresolved_building = BTEST( wall_flags_0(k,j-1,i), 5 )  &
-                                     .AND.  BTEST( wall_flags_0(k,j-1,i), 6 )
+                      unresolved_building = BTEST( wall_flags_static_0(k,j-1,i), 5 )  &
+                                     .AND.  BTEST( wall_flags_static_0(k,j-1,i), 6 )
                                      
                       IF ( land_surface  .AND.  terrain  .AND.                 &
@@ -2247,14 +2250,14 @@
 !
 !--                southward-facing surface
-                   IF ( .NOT. BTEST( wall_flags_0(k,j+1,i), 0 ) )  THEN
+                   IF ( .NOT. BTEST( wall_flags_static_0(k,j+1,i), 0 ) )  THEN
 !
 !--                   Determine flags indicating terrain or building
-                      terrain  = BTEST( wall_flags_0(k,j+1,i), 5 )  .OR.       &
+                      terrain  = BTEST( wall_flags_static_0(k,j+1,i), 5 )  .OR.       &
                                  topo_no_distinct
-                      building = BTEST( wall_flags_0(k,j+1,i), 6 )  .OR.       &
+                      building = BTEST( wall_flags_static_0(k,j+1,i), 6 )  .OR.       &
                                  topo_no_distinct
                                  
-                      unresolved_building = BTEST( wall_flags_0(k,j+1,i), 5 )  &
-                                     .AND.  BTEST( wall_flags_0(k,j+1,i), 6 )
+                      unresolved_building = BTEST( wall_flags_static_0(k,j+1,i), 5 )  &
+                                     .AND.  BTEST( wall_flags_static_0(k,j+1,i), 6 )
                                      
                       IF ( land_surface  .AND.  terrain  .AND.                 &
@@ -2284,14 +2287,14 @@
 !
 !--                eastward-facing surface
-                   IF ( .NOT. BTEST( wall_flags_0(k,j,i-1), 0 ) )  THEN
+                   IF ( .NOT. BTEST( wall_flags_static_0(k,j,i-1), 0 ) )  THEN
 !
 !--                   Determine flags indicating terrain or building
-                      terrain  = BTEST( wall_flags_0(k,j,i-1), 5 )  .OR.       &
+                      terrain  = BTEST( wall_flags_static_0(k,j,i-1), 5 )  .OR.       &
                                  topo_no_distinct
-                      building = BTEST( wall_flags_0(k,j,i-1), 6 )  .OR.       &
+                      building = BTEST( wall_flags_static_0(k,j,i-1), 6 )  .OR.       &
                                  topo_no_distinct
                                  
-                      unresolved_building = BTEST( wall_flags_0(k,j,i-1), 5 )  &
-                                     .AND.  BTEST( wall_flags_0(k,j,i-1), 6 )
+                      unresolved_building = BTEST( wall_flags_static_0(k,j,i-1), 5 )  &
+                                     .AND.  BTEST( wall_flags_static_0(k,j,i-1), 6 )
                                  
                       IF ( land_surface  .AND.  terrain  .AND.                 &
@@ -2321,14 +2324,14 @@
 !   
 !--                westward-facing surface
-                   IF ( .NOT. BTEST( wall_flags_0(k,j,i+1), 0 ) )  THEN
+                   IF ( .NOT. BTEST( wall_flags_static_0(k,j,i+1), 0 ) )  THEN
 !
 !--                   Determine flags indicating terrain or building
-                      terrain  = BTEST( wall_flags_0(k,j,i+1), 5 )  .OR.       &
+                      terrain  = BTEST( wall_flags_static_0(k,j,i+1), 5 )  .OR.       &
                                  topo_no_distinct
-                      building = BTEST( wall_flags_0(k,j,i+1), 6 )  .OR.       &
+                      building = BTEST( wall_flags_static_0(k,j,i+1), 6 )  .OR.       &
                                  topo_no_distinct
                                  
-                      unresolved_building = BTEST( wall_flags_0(k,j,i+1), 5 )  &
-                                     .AND.  BTEST( wall_flags_0(k,j,i+1), 6 )
+                      unresolved_building = BTEST( wall_flags_static_0(k,j,i+1), 5 )  &
+                                     .AND.  BTEST( wall_flags_static_0(k,j,i+1), 6 )
                                   
                       IF ( land_surface  .AND.  terrain  .AND.                 &
Index: /palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90
===================================================================
--- /palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4309 2019-11-26 18:49:59Z suehring
 ! Computation of velocity seeds optimized. This implies that random numbers 
 ! are computed now using the parallel random number generator. Random numbers 
@@ -193,5 +196,5 @@
                nyng,                                                           &
                nysg,                                                           &
-               wall_flags_0
+               wall_flags_static_0
 
     USE kinds
@@ -972,5 +975,5 @@
        nr_non_topo_yz_l(1) = SUM(                                              &
                           MERGE( 1, 0,                                         &
-                                 BTEST( wall_flags_0(nzb:nzt,nys:nyn,i), 1 ) ) )
+                                 BTEST( wall_flags_static_0(nzb:nzt,nys:nyn,i), 1 ) ) )
 !
 !--    Number of grid points where perturbations are imposed on v and w                                   
@@ -980,8 +983,8 @@
        nr_non_topo_yz_l(2) = SUM(                                              &
                           MERGE( 1, 0,                                         &
-                                 BTEST( wall_flags_0(nzb:nzt,nysv:nyn,i), 2 ) ) )
+                                 BTEST( wall_flags_static_0(nzb:nzt,nysv:nyn,i), 2 ) ) )
        nr_non_topo_yz_l(3) = SUM(                                              &
                           MERGE( 1, 0,                                         &
-                                 BTEST( wall_flags_0(nzb:nzt,nys:nyn,i), 3 ) ) )
+                                 BTEST( wall_flags_static_0(nzb:nzt,nys:nyn,i), 3 ) ) )
                                     
 #if defined( __parallel )
@@ -1001,5 +1004,5 @@
        nr_non_topo_xz_l(2) = SUM(                                              &
                           MERGE( 1, 0,                                         &
-                                 BTEST( wall_flags_0(nzb:nzt,j,nxl:nxr), 2 ) ) )
+                                 BTEST( wall_flags_static_0(nzb:nzt,j,nxl:nxr), 2 ) ) )
 !
 !--    Number of grid points where perturbations are imposed on u and w 
@@ -1009,8 +1012,8 @@
        nr_non_topo_xz_l(1) = SUM(                                              &
                           MERGE( 1, 0,                                         &
-                                 BTEST( wall_flags_0(nzb:nzt,j,nxlu:nxr), 1 ) ) )
+                                 BTEST( wall_flags_static_0(nzb:nzt,j,nxlu:nxr), 1 ) ) )
        nr_non_topo_xz_l(3) = SUM(                                              &
                           MERGE( 1, 0,                                         &
-                                 BTEST( wall_flags_0(nzb:nzt,j,nxl:nxr), 3 ) ) )
+                                 BTEST( wall_flags_static_0(nzb:nzt,j,nxl:nxr), 3 ) ) )
                                     
 #if defined( __parallel )
@@ -1337,5 +1340,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_0(k,j,i), 1 ) )
+                                           BTEST( wall_flags_static_0(k,j,i), 1 ) )
              ENDDO
           ENDDO
@@ -1354,5 +1357,5 @@
                                          + a22(k) * fv_yz(k,j) ), 3.0_wp ) *   &
                                     MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_0(k,j,i), 2 ) )   
+                                           BTEST( wall_flags_static_0(k,j,i), 2 ) )   
                 dist_yz(k,j,3) = MIN( ( SQRT(a33(k) / MAXVAL(a33) )            &
                                       * 1.3_wp )                               &
@@ -1361,5 +1364,5 @@
                                         + a33(k) * fw_yz(k,j) ), 3.0_wp )  *   &
                                     MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_0(k,j,i), 3 ) )
+                                           BTEST( wall_flags_static_0(k,j,i), 3 ) )
              ENDDO
           ENDDO
@@ -1384,5 +1387,5 @@
           mc_factor_l(1) = SUM( dist_yz(nzb:nzt,nys:nyn,1)                     &
                          * MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_0(nzb:nzt,nys:nyn,i), 1 ) ) )
+                                  BTEST( wall_flags_static_0(nzb:nzt,nys:nyn,i), 1 ) ) )
         
           IF ( myidx == id_stg_left  )  i = nxl-1
@@ -1391,8 +1394,8 @@
           mc_factor_l(2) = SUM( dist_yz(nzb:nzt,nysv:nyn,2)                    &
                           * MERGE( 1.0_wp, 0.0_wp,                             &
-                                   BTEST( wall_flags_0(nzb:nzt,nysv:nyn,i), 2 ) ) )
+                                   BTEST( wall_flags_static_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_0(nzb:nzt,nys:nyn,i), 3 ) ) )
+                                   BTEST( wall_flags_static_0(nzb:nzt,nys:nyn,i), 3 ) ) )
           
 #if defined( __parallel )
@@ -1411,5 +1414,5 @@
           dist_yz(:,:,1) = ( dist_yz(:,:,1) - mc_factor(1) )                   &
                         * MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_0(:,:,i), 1 ) )             
+                                 BTEST( wall_flags_static_0(:,:,i), 1 ) )             
                                                                                
                                                                                
@@ -1419,9 +1422,9 @@
           dist_yz(:,:,2) = ( dist_yz(:,:,2) - mc_factor(2) )                   &
                         * MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_0(:,:,i), 2 ) )             
+                                 BTEST( wall_flags_static_0(:,:,i), 2 ) )             
                                                                                
           dist_yz(:,:,3) = ( dist_yz(:,:,3) - mc_factor(3) )                   &
                         * MERGE( 1.0_wp, 0.0_wp,                               &
-                                 BTEST( wall_flags_0(:,:,i), 3 ) )
+                                 BTEST( wall_flags_static_0(:,:,i), 3 ) )
 !      
 !--       Add disturbances
@@ -1439,12 +1442,12 @@
                                            dist_yz(k,j,1)             )        &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                            BTEST( wall_flags_0(k,j,0), 1 ) )  
+                                            BTEST( wall_flags_static_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_0(k,j,-1), 2 ) ) 
+                                            BTEST( wall_flags_static_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_0(k,j,-1), 3 ) )
+                                            BTEST( wall_flags_static_0(k,j,-1), 3 ) )
                    ENDDO
                 ENDDO
@@ -1455,12 +1458,12 @@
                       u(k,j,0)   = ( u(k,j,0) + dist_yz(k,j,1) )               &
                                  * MERGE( 1.0_wp, 0.0_wp,                      &
-                                          BTEST( wall_flags_0(k,j,0), 1 ) )
+                                          BTEST( wall_flags_static_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_0(k,j,-1), 2 ) )
+                                          BTEST( wall_flags_static_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_0(k,j,-1), 3 ) )
+                                          BTEST( wall_flags_static_0(k,j,-1), 3 ) )
                    ENDDO
                 ENDDO
@@ -1472,11 +1475,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_0(k,j,nxr+1), 1 ) ) 
+                                           BTEST( wall_flags_static_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_0(k,j,nxr+1), 2 ) )
+                                           BTEST( wall_flags_static_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_0(k,j,nxr+1), 3 ) )
+                                           BTEST( wall_flags_static_0(k,j,nxr+1), 3 ) )
                 ENDDO
              ENDDO
@@ -1537,5 +1540,5 @@
                                          + a22(k) * fv_xz(k,i) ), 3.0_wp ) *   &
                                     MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_0(k,j,i), 2 ) )
+                                           BTEST( wall_flags_static_0(k,j,i), 2 ) )
              ENDDO
           ENDDO
@@ -1550,5 +1553,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_0(k,j,i), 1 ) )   
+                                           BTEST( wall_flags_static_0(k,j,i), 1 ) )   
           
                 dist_xz(k,i,3) = MIN( ( SQRT(a33(k) / MAXVAL(a33) )            &
@@ -1558,5 +1561,5 @@
                                         + a33(k) * fw_xz(k,i) ), 3.0_wp )  *   &
                                     MERGE( 1.0_wp, 0.0_wp,                     &
-                                           BTEST( wall_flags_0(k,j,i), 3 ) ) 
+                                           BTEST( wall_flags_static_0(k,j,i), 3 ) ) 
              ENDDO
           ENDDO
@@ -1579,5 +1582,5 @@
           mc_factor_l(2) = SUM( dist_xz(nzb:nzt,nxl:nxr,2)                     &
                          * MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_0(nzb:nzt,j,nxl:nxr), 2 ) ) )
+                                  BTEST( wall_flags_static_0(nzb:nzt,j,nxl:nxr), 2 ) ) )
           
           IF ( myidy == id_stg_south  ) j = nys-1
@@ -1586,8 +1589,8 @@
           mc_factor_l(1) = SUM( dist_xz(nzb:nzt,nxlu:nxr,1)                    &
                          * MERGE( 1.0_wp, 0.0_wp,                              &
-                                  BTEST( wall_flags_0(nzb:nzt,j,nxlu:nxr), 1 ) ) )
+                                  BTEST( wall_flags_static_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_0(nzb:nzt,j,nxl:nxr), 3 ) ) )
+                                  BTEST( wall_flags_static_0(nzb:nzt,j,nxl:nxr), 3 ) ) )
           
 #if defined( __parallel )
@@ -1605,5 +1608,5 @@
           dist_xz(:,:,2)   = ( dist_xz(:,:,2) - mc_factor(2) )                 &
                            * MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(:,j,:), 2 ) )          
+                                    BTEST( wall_flags_static_0(:,j,:), 2 ) )          
                                                                                
                                                                                
@@ -1613,9 +1616,9 @@
           dist_xz(:,:,1)   = ( dist_xz(:,:,1) - mc_factor(1) )                 &
                            * MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(:,j,:), 1 ) )          
+                                    BTEST( wall_flags_static_0(:,j,:), 1 ) )          
                                                                                
           dist_xz(:,:,3)   = ( dist_xz(:,:,3) - mc_factor(3) )                 &
                            * MERGE( 1.0_wp, 0.0_wp,                            &
-                                    BTEST( wall_flags_0(:,j,:), 3 ) )      
+                                    BTEST( wall_flags_static_0(:,j,:), 3 ) )      
 !         
 !--       Add disturbances
@@ -1625,12 +1628,12 @@
                    u(k,-1,i) = ( u(k,-1,i) + dist_xz(k,i,1) )                  &
                                         * MERGE( 1.0_wp, 0.0_wp,               &
-                                                 BTEST( wall_flags_0(k,-1,i), 1 ) )
+                                                 BTEST( wall_flags_static_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_0(k,0,i), 2 ) )
+                                                 BTEST( wall_flags_static_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_0(k,-1,i), 3 ) )
+                                                 BTEST( wall_flags_static_0(k,-1,i), 3 ) )
                 ENDDO
              ENDDO
@@ -1642,11 +1645,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_0(k,nyn+1,i), 1 ) )
+                                             BTEST( wall_flags_static_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_0(k,nyn+1,i), 2 ) )
+                                              BTEST( wall_flags_static_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_0(k,nyn+1,i), 3 ) )
+                                              BTEST( wall_flags_static_0(k,nyn+1,i), 3 ) )
                 ENDDO
              ENDDO
Index: /palm/trunk/SOURCE/time_integration.f90
===================================================================
--- /palm/trunk/SOURCE/time_integration.f90	(revision 4328)
+++ /palm/trunk/SOURCE/time_integration.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4281 2019-10-29 15:15:39Z schwenkel
 ! Moved boundary conditions to module interface
 ! 
@@ -366,5 +369,5 @@
 
     USE indices,                                                                                   &
-        ONLY:  advc_flags_m, advc_flags_s, nyn, nyng, nys, nysg, nz, nzb_max, wall_flags_0
+        ONLY:  advc_flags_m, advc_flags_s, nyn, nyng, nys, nysg, nz, nzb_max, wall_flags_static_0
 
     USE statistics,                                                                                &
@@ -456,5 +459,5 @@
 !$ACC COPYIN(advc_flags_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
 !$ACC COPYIN(advc_flags_s(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
-!$ACC COPYIN(wall_flags_0(nzb:nzt+1,nysg:nyng,nxlg:nxrg))
+!$ACC COPYIN(wall_flags_static_0(nzb:nzt+1,nysg:nyng,nxlg:nxrg))
 
 !
Index: /palm/trunk/SOURCE/turbulence_closure_mod.f90
===================================================================
--- /palm/trunk/SOURCE/turbulence_closure_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/turbulence_closure_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
 ! 
@@ -137,5 +140,5 @@
                nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt,    &
                topo_top_ind,                                                  &
-               wall_flags_0
+               wall_flags_static_0
 
     USE kinds
@@ -923,5 +926,5 @@
                 local_pf(i,j,k) = MERGE( to_be_resorted(k,j,i),                &
                                          REAL( fill_value, KIND = wp ),        &
-                                         BTEST( wall_flags_0(k,j,i), flag_nr ) )
+                                         BTEST( wall_flags_static_0(k,j,i), flag_nr ) )
              ENDDO
           ENDDO
@@ -1019,5 +1022,5 @@
                                    to_be_resorted(k,j,i),                &
                                    REAL( fill_value, KIND = wp ),        &
-                                   BTEST( wall_flags_0(k,j,i), flag_nr ) )
+                                   BTEST( wall_flags_static_0(k,j,i), flag_nr ) )
              ENDDO
           ENDDO
@@ -1308,5 +1311,5 @@
                 DO  k = nzb, nzt
                    e(k,j,i)     = MERGE( e(k,j,i), 0.0_wp,                     &
-                                         BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         BTEST( wall_flags_static_0(k,j,i), 0 ) )
                 ENDDO
              ENDDO
@@ -1318,5 +1321,5 @@
                    DO  k = nzb, nzt
                       diss(k,j,i)    = MERGE( diss(k,j,i), 0.0_wp,             &
-                                              BTEST( wall_flags_0(k,j,i), 0 ) )
+                                              BTEST( wall_flags_static_0(k,j,i), 0 ) )
                    ENDDO
                 ENDDO
@@ -1364,5 +1367,5 @@
     USE indices,                                                               &
         ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb,  &
-               nzt, wall_flags_0
+               nzt, wall_flags_static_0
 
     USE kinds
@@ -1438,28 +1441,28 @@
 !
 !--                Check if current gridpoint belongs to the atmosphere
-                   IF ( BTEST( wall_flags_0(k,j,i), 0 ) )  THEN
+                   IF ( BTEST( wall_flags_static_0(k,j,i), 0 ) )  THEN
 !
 !--                   Check for neighbouring grid-points.
 !--                   Vertical distance, down
-                      IF ( .NOT. BTEST( wall_flags_0(k-1,j,i), 0 ) )             &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k-1,j,i), 0 ) )             &
                          l_wall(k,j,i) = MIN( l_grid(k), zu(k) - zw(k-1) )
 !
 !--                   Vertical distance, up
-                      IF ( .NOT. BTEST( wall_flags_0(k+1,j,i), 0 ) )             &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k+1,j,i), 0 ) )             &
                          l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k), zw(k) - zu(k) )
 !
 !--                   y-distance
-                      IF ( .NOT. BTEST( wall_flags_0(k,j-1,i), 0 )  .OR.         &
-                           .NOT. BTEST( wall_flags_0(k,j+1,i), 0 ) )             &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k,j-1,i), 0 )  .OR.         &
+                           .NOT. BTEST( wall_flags_static_0(k,j+1,i), 0 ) )             &
                          l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k), 0.5_wp * dy )
 !
 !--                   x-distance
-                      IF ( .NOT. BTEST( wall_flags_0(k,j,i-1), 0 )  .OR.         &
-                           .NOT. BTEST( wall_flags_0(k,j,i+1), 0 ) )             &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k,j,i-1), 0 )  .OR.         &
+                           .NOT. BTEST( wall_flags_static_0(k,j,i+1), 0 ) )             &
                          l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k), 0.5_wp * dx )
 !
 !--                   yz-distance (vertical edges, down)
-                      IF ( .NOT. BTEST( wall_flags_0(k-1,j-1,i), 0 )  .OR.       &
-                           .NOT. BTEST( wall_flags_0(k-1,j+1,i), 0 )  )          &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k-1,j-1,i), 0 )  .OR.       &
+                           .NOT. BTEST( wall_flags_static_0(k-1,j+1,i), 0 )  )          &
                          l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),          &
                                               SQRT( 0.25_wp * dy**2 +            &
@@ -1467,6 +1470,6 @@
 !
 !--                   yz-distance (vertical edges, up)
-                      IF ( .NOT. BTEST( wall_flags_0(k+1,j-1,i), 0 )  .OR.       &
-                           .NOT. BTEST( wall_flags_0(k+1,j+1,i), 0 )  )          &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k+1,j-1,i), 0 )  .OR.       &
+                           .NOT. BTEST( wall_flags_static_0(k+1,j+1,i), 0 )  )          &
                          l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),          &
                                               SQRT( 0.25_wp * dy**2 +            &
@@ -1474,6 +1477,6 @@
 !
 !--                   xz-distance (vertical edges, down)
-                      IF ( .NOT. BTEST( wall_flags_0(k-1,j,i-1), 0 )  .OR.       &
-                           .NOT. BTEST( wall_flags_0(k-1,j,i+1), 0 )  )          &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k-1,j,i-1), 0 )  .OR.       &
+                           .NOT. BTEST( wall_flags_static_0(k-1,j,i+1), 0 )  )          &
                          l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),          &
                                               SQRT( 0.25_wp * dx**2 +            &
@@ -1481,6 +1484,6 @@
 !
 !--                   xz-distance (vertical edges, up)
-                      IF ( .NOT. BTEST( wall_flags_0(k+1,j,i-1), 0 )  .OR.       &
-                           .NOT. BTEST( wall_flags_0(k+1,j,i+1), 0 )  )          &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k+1,j,i-1), 0 )  .OR.       &
+                           .NOT. BTEST( wall_flags_static_0(k+1,j,i+1), 0 )  )          &
                          l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),          &
                                               SQRT( 0.25_wp * dx**2 +            &
@@ -1488,16 +1491,16 @@
 !
 !--                   xy-distance (horizontal edges)
-                      IF ( .NOT. BTEST( wall_flags_0(k,j-1,i-1), 0 )  .OR.        &
-                           .NOT. BTEST( wall_flags_0(k,j+1,i-1), 0 )  .OR.        &
-                           .NOT. BTEST( wall_flags_0(k,j-1,i+1), 0 )  .OR.        &
-                           .NOT. BTEST( wall_flags_0(k,j+1,i+1), 0 ) )            &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k,j-1,i-1), 0 )  .OR.        &
+                           .NOT. BTEST( wall_flags_static_0(k,j+1,i-1), 0 )  .OR.        &
+                           .NOT. BTEST( wall_flags_static_0(k,j-1,i+1), 0 )  .OR.        &
+                           .NOT. BTEST( wall_flags_static_0(k,j+1,i+1), 0 ) )            &
                          l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),           &
                                               SQRT( 0.25_wp * ( dx**2 + dy**2 ) ) )
 !
 !--                   xyz distance (vertical and horizontal edges, down)
-                      IF ( .NOT. BTEST( wall_flags_0(k-1,j-1,i-1), 0 )  .OR.      &
-                           .NOT. BTEST( wall_flags_0(k-1,j+1,i-1), 0 )  .OR.      &
-                           .NOT. BTEST( wall_flags_0(k-1,j-1,i+1), 0 )  .OR.      &
-                           .NOT. BTEST( wall_flags_0(k-1,j+1,i+1), 0 ) )          &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k-1,j-1,i-1), 0 )  .OR.      &
+                           .NOT. BTEST( wall_flags_static_0(k-1,j+1,i-1), 0 )  .OR.      &
+                           .NOT. BTEST( wall_flags_static_0(k-1,j-1,i+1), 0 )  .OR.      &
+                           .NOT. BTEST( wall_flags_static_0(k-1,j+1,i+1), 0 ) )          &
                          l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),           &
                                               SQRT( 0.25_wp * ( dx**2 + dy**2 )   &
@@ -1505,8 +1508,8 @@
 !
 !--                   xyz distance (vertical and horizontal edges, up)
-                      IF ( .NOT. BTEST( wall_flags_0(k+1,j-1,i-1), 0 )  .OR.      &
-                           .NOT. BTEST( wall_flags_0(k+1,j+1,i-1), 0 )  .OR.      &
-                           .NOT. BTEST( wall_flags_0(k+1,j-1,i+1), 0 )  .OR.      &
-                           .NOT. BTEST( wall_flags_0(k+1,j+1,i+1), 0 ) )          &
+                      IF ( .NOT. BTEST( wall_flags_static_0(k+1,j-1,i-1), 0 )  .OR.      &
+                           .NOT. BTEST( wall_flags_static_0(k+1,j+1,i-1), 0 )  .OR.      &
+                           .NOT. BTEST( wall_flags_static_0(k+1,j-1,i+1), 0 )  .OR.      &
+                           .NOT. BTEST( wall_flags_static_0(k+1,j+1,i+1), 0 ) )          &
                          l_wall(k,j,i) = MIN( l_wall(k,j,i), l_grid(k),           &
                                               SQRT( 0.25_wp * ( dx**2 + dy**2 )   &
@@ -1550,5 +1553,5 @@
           DO  j = nysg, nyng
              DO  k = nzb+1, nzt-1
-                IF ( .NOT. BTEST( wall_flags_0(k,j,i), 0 ) .AND.  &
+                IF ( .NOT. BTEST( wall_flags_static_0(k,j,i), 0 ) .AND.  &
                      k > k_max_topo )  &
                    k_max_topo = k
@@ -1616,5 +1619,5 @@
 !
 !--                Start search only if (i/j/k) belongs to atmosphere
-                   IF ( BTEST( wall_flags_0(k,j,i), 0 )  )  THEN
+                   IF ( BTEST( wall_flags_static_0(k,j,i), 0 )  )  THEN
 !
 !--                   Reset topography within vicinity
@@ -1836,5 +1839,5 @@
 ! ------------
 !> Copy a subarray of size (kb:kt,js:jn,il:ir) centered around grid point
-!> (kp,jp,ip) containing the first bit of wall_flags_0 into the array
+!> (kp,jp,ip) containing the first bit of wall_flags_static_0 into the array
 !> 'vicinity'. Only copy first bit as this indicates the presence of topography.
 !------------------------------------------------------------------------------!
@@ -1861,5 +1864,5 @@
              DO  k = kb, kt
                 vicinity(k,j,i) = MERGE( 0, 1,               &
-                       BTEST( wall_flags_0(kp+k,jp+j,ip+i), 0 ) )
+                       BTEST( wall_flags_static_0(kp+k,jp+j,ip+i), 0 ) )
              ENDDO
           ENDDO
@@ -2260,5 +2263,5 @@
 !--    value is reduced by 90%.
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) &
-       !$ACC PRESENT(e, tend, te_m, wall_flags_0) &
+       !$ACC PRESENT(e, tend, te_m, wall_flags_static_0) &
        !$ACC PRESENT(tsc(3:3)) &
        !$ACC PRESENT(e_p)
@@ -2270,5 +2273,5 @@
                                         )                                      &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                             BTEST( wall_flags_0(k,j,i), 0 )   &
+                                             BTEST( wall_flags_static_0(k,j,i), 0 )   &
                                           )
                 IF ( e_p(k,j,i) < 0.0_wp )  e_p(k,j,i) = 0.1_wp * e(k,j,i)
@@ -2377,5 +2380,5 @@
                                         )                                      &
                                    * MERGE( 1.0_wp, 0.0_wp,                    &
-                                             BTEST( wall_flags_0(k,j,i), 0 )   &
+                                             BTEST( wall_flags_static_0(k,j,i), 0 )   &
                                           )
                 IF ( diss_p(k,j,i) < 0.0_wp )                                  &
@@ -2492,5 +2495,5 @@
                                   )                                            &
                                  * MERGE( 1.0_wp, 0.0_wp,                      &
-                                          BTEST( wall_flags_0(k,j,i), 0 )      &
+                                          BTEST( wall_flags_static_0(k,j,i), 0 )      &
                                         )
           IF ( e_p(k,j,i) <= 0.0_wp )  e_p(k,j,i) = 0.1_wp * e(k,j,i)
@@ -2559,5 +2562,5 @@
                                         )                                      &
                                         * MERGE( 1.0_wp, 0.0_wp,               &
-                                                BTEST( wall_flags_0(k,j,i), 0 )&
+                                                BTEST( wall_flags_static_0(k,j,i), 0 )&
                                                )
        ENDDO
@@ -2654,5 +2657,5 @@
     !$ACC PRIVATE(surf_s, surf_e) &
     !$ACC PRIVATE(dudx(:), dudy(:), dudz(:), dvdx(:), dvdy(:), dvdz(:), dwdx(:), dwdy(:), dwdz(:)) &
-    !$ACC PRESENT(e, u, v, w, diss, dd2zu, ddzw, km, wall_flags_0) &
+    !$ACC PRESENT(e, u, v, w, diss, dd2zu, ddzw, km, wall_flags_static_0) &
     !$ACC PRESENT(tend) &
     !$ACC PRESENT(surf_def_h(0:1), surf_def_v(0:3)) &
@@ -2714,5 +2717,5 @@
 !--                -1.0 for right-facing wall, 1.0 for left-facing wall
                    sign_dir = MERGE( 1.0_wp, -1.0_wp,                          &
-                                     BTEST( wall_flags_0(k,j-1,i), flag_nr ) )
+                                     BTEST( wall_flags_static_0(k,j-1,i), flag_nr ) )
                    dudy(k) = sign_dir * usvs / ( km_neutral + 1E-10_wp )
                    dwdy(k) = sign_dir * wsvs / ( km_neutral + 1E-10_wp )
@@ -2733,5 +2736,5 @@
 !--                -1.0 for right-facing wall, 1.0 for left-facing wall
                    sign_dir = MERGE( 1.0_wp, -1.0_wp,                          &
-                                     BTEST( wall_flags_0(k,j-1,i), flag_nr ) )
+                                     BTEST( wall_flags_static_0(k,j-1,i), flag_nr ) )
                    dudy(k) = sign_dir * usvs / ( km_neutral + 1E-10_wp )
                    dwdy(k) = sign_dir * wsvs / ( km_neutral + 1E-10_wp )
@@ -2752,5 +2755,5 @@
 !--                -1.0 for right-facing wall, 1.0 for left-facing wall
                    sign_dir = MERGE( 1.0_wp, -1.0_wp,                          &
-                                     BTEST( wall_flags_0(k,j-1,i), flag_nr ) )
+                                     BTEST( wall_flags_static_0(k,j-1,i), flag_nr ) )
                    dudy(k) = sign_dir * usvs / ( km_neutral + 1E-10_wp )
                    dwdy(k) = sign_dir * wsvs / ( km_neutral + 1E-10_wp )
@@ -2773,5 +2776,5 @@
 !--                -1.0 for right-facing wall, 1.0 for left-facing wall
                    sign_dir = MERGE( 1.0_wp, -1.0_wp,                          &
-                                     BTEST( wall_flags_0(k,j,i-1), flag_nr ) )
+                                     BTEST( wall_flags_static_0(k,j,i-1), flag_nr ) )
                    dvdx(k) = sign_dir * vsus / ( km_neutral + 1E-10_wp )
                    dwdx(k) = sign_dir * wsus / ( km_neutral + 1E-10_wp )
@@ -2792,5 +2795,5 @@
 !--                -1.0 for right-facing wall, 1.0 for left-facing wall
                    sign_dir = MERGE( 1.0_wp, -1.0_wp,                          &
-                                     BTEST( wall_flags_0(k,j,i-1), flag_nr ) )
+                                     BTEST( wall_flags_static_0(k,j,i-1), flag_nr ) )
                    dvdx(k) = sign_dir * vsus / ( km_neutral + 1E-10_wp )
                    dwdx(k) = sign_dir * wsus / ( km_neutral + 1E-10_wp )
@@ -2811,5 +2814,5 @@
 !--                -1.0 for right-facing wall, 1.0 for left-facing wall
                    sign_dir = MERGE( 1.0_wp, -1.0_wp,                          &
-                                     BTEST( wall_flags_0(k,j,i-1), flag_nr ) )
+                                     BTEST( wall_flags_static_0(k,j,i-1), flag_nr ) )
                    dvdx(k) = sign_dir * vsus / ( km_neutral + 1E-10_wp )
                    dwdx(k) = sign_dir * wsus / ( km_neutral + 1E-10_wp )
@@ -2886,5 +2889,5 @@
              IF ( def < 0.0_wp )  def = 0.0_wp
 
-             flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),flag_nr) )
+             flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),flag_nr) )
 
              IF ( .NOT. diss_production )  THEN
@@ -2950,5 +2953,5 @@
 !--                   Compute tendency for TKE-production from shear
                       DO  k = nzb+1, nzt
-                         flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) )
+                         flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),0) )
                          tend(k,j,i) = tend(k,j,i) + flag * tmp_flux(k) * ( g / &
                                        MERGE( rho_reference, prho(k,j,i),       &
@@ -2960,5 +2963,5 @@
 !--                   RANS mode: Compute tendency for dissipation-rate-production from shear
                       DO  k = nzb+1, nzt
-                         flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) )
+                         flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),0) )
                          tend(k,j,i) = tend(k,j,i) + flag * tmp_flux(k) * ( g / &
                                        MERGE( rho_reference, prho(k,j,i),       &
@@ -2978,5 +2981,5 @@
              !$ACC PRIVATE(surf_s, surf_e) &
              !$ACC PRIVATE(tmp_flux(nzb+1:nzt)) &
-             !$ACC PRESENT(e, diss, kh, pt, dd2zu, drho_air_zw, wall_flags_0) &
+             !$ACC PRESENT(e, diss, kh, pt, dd2zu, drho_air_zw, wall_flags_static_0) &
              !$ACC PRESENT(tend) &
              !$ACC PRESENT(surf_def_h(0:2)) &
@@ -3038,5 +3041,5 @@
                      !$ACC LOOP PRIVATE(k, flag)
                       DO  k = nzb+1, nzt
-                         flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) )
+                         flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),0) )
                          tend(k,j,i) = tend(k,j,i) + flag * tmp_flux(k) * ( g / &
                                        MERGE( pt_reference, pt(k,j,i),          &
@@ -3048,5 +3051,5 @@
 !--                   RANS mode: Compute tendency for dissipation-rate-production from shear
                       DO  k = nzb+1, nzt
-                         flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) )
+                         flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),0) )
                          tend(k,j,i) = tend(k,j,i) + flag * tmp_flux(k) * ( g / &
                                        MERGE( pt_reference, pt(k,j,i),          &
@@ -3253,5 +3256,5 @@
 !--                Compute tendency for TKE-production from shear
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),0) )
                       tend(k,j,i) = tend(k,j,i) + flag * tmp_flux(k) * ( g / &
                                     MERGE( vpt_reference, vpt(k,j,i),          &
@@ -3263,5 +3266,5 @@
 !--                RANS mode: Compute tendency for dissipation-rate-production from shear
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),0) )
                       tend(k,j,i) = tend(k,j,i) + flag * tmp_flux(k) * ( g /   &
                                     MERGE( vpt_reference, vpt(k,j,i),          &
@@ -3398,5 +3401,5 @@
 !--          -1.0 for right-facing wall, 1.0 for left-facing wall
              sign_dir = MERGE( 1.0_wp, -1.0_wp,                          &
-                               BTEST( wall_flags_0(k,j-1,i), flag_nr ) )
+                               BTEST( wall_flags_static_0(k,j-1,i), flag_nr ) )
              dudy(k) = sign_dir * usvs / ( km_neutral + 1E-10_wp )
              dwdy(k) = sign_dir * wsvs / ( km_neutral + 1E-10_wp )
@@ -3416,5 +3419,5 @@
 !--          -1.0 for right-facing wall, 1.0 for left-facing wall
              sign_dir = MERGE( 1.0_wp, -1.0_wp,                          &
-                               BTEST( wall_flags_0(k,j-1,i), flag_nr ) )
+                               BTEST( wall_flags_static_0(k,j-1,i), flag_nr ) )
              dudy(k) = sign_dir * usvs / ( km_neutral + 1E-10_wp )
              dwdy(k) = sign_dir * wsvs / ( km_neutral + 1E-10_wp )
@@ -3434,5 +3437,5 @@
 !--          -1.0 for right-facing wall, 1.0 for left-facing wall
              sign_dir = MERGE( 1.0_wp, -1.0_wp,                          &
-                               BTEST( wall_flags_0(k,j-1,i), flag_nr ) )
+                               BTEST( wall_flags_static_0(k,j-1,i), flag_nr ) )
              dudy(k) = sign_dir * usvs / ( km_neutral + 1E-10_wp )
              dwdy(k) = sign_dir * wsvs / ( km_neutral + 1E-10_wp )
@@ -3454,5 +3457,5 @@
 !--          -1.0 for right-facing wall, 1.0 for left-facing wall
              sign_dir = MERGE( 1.0_wp, -1.0_wp,                          &
-                               BTEST( wall_flags_0(k,j,i-1), flag_nr ) )
+                               BTEST( wall_flags_static_0(k,j,i-1), flag_nr ) )
              dvdx(k) = sign_dir * vsus / ( km_neutral + 1E-10_wp )
              dwdx(k) = sign_dir * wsus / ( km_neutral + 1E-10_wp )
@@ -3472,5 +3475,5 @@
 !--          -1.0 for right-facing wall, 1.0 for left-facing wall
              sign_dir = MERGE( 1.0_wp, -1.0_wp,                          &
-                               BTEST( wall_flags_0(k,j,i-1), flag_nr ) )
+                               BTEST( wall_flags_static_0(k,j,i-1), flag_nr ) )
              dvdx(k) = sign_dir * vsus / ( km_neutral + 1E-10_wp )
              dwdx(k) = sign_dir * wsus / ( km_neutral + 1E-10_wp )
@@ -3490,5 +3493,5 @@
 !--          -1.0 for right-facing wall, 1.0 for left-facing wall
              sign_dir = MERGE( 1.0_wp, -1.0_wp,                          &
-                               BTEST( wall_flags_0(k,j,i-1), flag_nr ) )
+                               BTEST( wall_flags_static_0(k,j,i-1), flag_nr ) )
              dvdx(k) = sign_dir * vsus / ( km_neutral + 1E-10_wp )
              dwdx(k) = sign_dir * wsus / ( km_neutral + 1E-10_wp )
@@ -3558,5 +3561,5 @@
        IF ( def < 0.0_wp )  def = 0.0_wp
 
-       flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),flag_nr) )
+       flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),flag_nr) )
 
        IF ( .NOT. diss_production )  THEN
@@ -3615,5 +3618,5 @@
 !--             Compute tendency for TKE-production from shear
                 DO  k = nzb+1, nzt
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),0) )
                    tend(k,j,i) = tend(k,j,i) + flag * tmp_flux(k) * ( g / &
                                  MERGE( rho_reference, prho(k,j,i),       &
@@ -3625,5 +3628,5 @@
 !--             RANS mode: Compute tendency for dissipation-rate-production from shear
                 DO  k = nzb+1, nzt
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),0) )
                    tend(k,j,i) = tend(k,j,i) + flag * tmp_flux(k) * ( g / &
                                  MERGE( rho_reference, prho(k,j,i),       &
@@ -3684,5 +3687,5 @@
 !--             Compute tendency for TKE-production from shear
                 DO  k = nzb+1, nzt
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),0) )
                    tend(k,j,i) = tend(k,j,i) + flag * tmp_flux(k) * ( g / &
                                  MERGE( pt_reference, pt(k,j,i),          &
@@ -3694,5 +3697,5 @@
 !--             RANS mode: Compute tendency for dissipation-rate-production from shear
                 DO  k = nzb+1, nzt
-                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) )
+                   flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),0) )
                    tend(k,j,i) = tend(k,j,i) + flag * tmp_flux(k) * ( g / &
                                  MERGE( pt_reference, pt(k,j,i),          &
@@ -3893,5 +3896,5 @@
 !--          Compute tendency for TKE-production from shear
              DO  k = nzb+1, nzt
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),0) )
                 tend(k,j,i) = tend(k,j,i) + flag * tmp_flux(k) * ( g / &
                               MERGE( vpt_reference, vpt(k,j,i),          &
@@ -3903,5 +3906,5 @@
 !--          RANS mode: Compute tendency for dissipation-rate-production from shear
              DO  k = nzb+1, nzt
-                flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) )
+                flag = MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_static_0(k,j,i),0) )
                 tend(k,j,i) = tend(k,j,i) + flag * tmp_flux(k) * ( g /   &
                               MERGE( vpt_reference, vpt(k,j,i),          &
@@ -3969,5 +3972,5 @@
        !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j) &
        !$ACC PRIVATE(l, l_stable, dvar_dz) &
-       !$ACC PRESENT(diss, e, var, wall_flags_0) &
+       !$ACC PRESENT(diss, e, var, wall_flags_static_0) &
        !$ACC PRESENT(dd2zu, l_grid, l_wall)
        DO  i = nxl, nxr
@@ -3999,5 +4002,5 @@
                 diss(k,j,i) = ( 0.19_wp + 0.74_wp * l / l_wall(k,j,i) )                &
                               * e(k,j,i) * SQRT( e(k,j,i) ) / l                        &
-                              * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                              * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
              ENDDO
@@ -4010,5 +4013,5 @@
       !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j) &
       !$ACC PRIVATE(l_stable, duv2_dz2, rif, dvar_dz) &
-      !$ACC PRESENT(diss, e, u, v, var, wall_flags_0) &
+      !$ACC PRESENT(diss, e, u, v, var, wall_flags_static_0) &
       !$ACC PRESENT(dd2zu, l_black, l_wall)
        DO  i = nxl, nxr
@@ -4057,5 +4060,5 @@
 
                 diss(k,j,i) = c_0**3 * e(k,j,i) * SQRT( e(k,j,i) ) / l_stable(k)     &
-                            * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                            * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
              ENDDO
@@ -4069,5 +4072,5 @@
 
     !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) &
-    !$ACC PRESENT(diss, e, km, tend, wall_flags_0) &
+    !$ACC PRESENT(diss, e, km, tend, wall_flags_static_0) &
     !$ACC PRESENT(ddzu, ddzw, rho_air_zw, drho_air)
     DO  i = nxl, nxr
@@ -4092,5 +4095,5 @@
                                          ) * dsig_e                                   &
                                            * MERGE( 1.0_wp, 0.0_wp,                   &
-                                                    BTEST( wall_flags_0(k,j,i), 0 ) ) &
+                                                    BTEST( wall_flags_static_0(k,j,i), 0 ) ) &
                           - diss(k,j,i)
 
@@ -4198,5 +4201,5 @@
           diss(k,j,i) = ( 0.19_wp + 0.74_wp * l / l_wall(k,j,i) )              &
                         * e(k,j,i) * SQRT( e(k,j,i) ) / l                      &
-                        * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                        * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
        ENDDO
 
@@ -4242,5 +4245,5 @@
        DO  k = nzb+1, nzt
           diss(k,j,i) = c_0**3 * e(k,j,i) * SQRT( e(k,j,i) ) / l_stable(k)     &
-                      * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                      * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
        ENDDO
 
@@ -4271,5 +4274,5 @@
                                    ) * dsig_e                                  &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                              BTEST( wall_flags_0(k,j,i), 0 ) )&
+                                              BTEST( wall_flags_static_0(k,j,i), 0 ) )&
                                  - diss(k,j,i)
 
@@ -4334,5 +4337,5 @@
 !
 !--          Predetermine flag to mask topography
-             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
              tend(k,j,i) = tend(k,j,i) +                                       &
@@ -4390,5 +4393,5 @@
 !
 !--    Predetermine flag to mask topography
-       flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+       flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
 !
@@ -4451,5 +4454,5 @@
              DO  k = nzb+1, nzt
                 e(k,j,i) = MAX( e(k,j,i), e_min ) *                            &
-                        MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                        MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
              ENDDO
           ENDDO
@@ -4662,5 +4665,5 @@
        !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j) &
        !$ACC PRIVATE(dvar_dz, l, l_stable, l_v) &
-       !$ACC PRESENT(wall_flags_0, var, dd2zu, e, l_wall, l_grid, rmask) &
+       !$ACC PRESENT(wall_flags_static_0, var, dd2zu, e, l_wall, l_grid, rmask) &
        !$ACC PRESENT(kh, km, sums_l_l)
        DO  i = nxlg, nxrg
@@ -4694,5 +4697,5 @@
 
                 l_v(k) = MIN( l_wall(k,j,i), l_stable(k) )                      &
-                       * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                       * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
                 l = l_v(k)
 !
@@ -4719,5 +4722,5 @@
        !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j) &
        !$ACC PRIVATE(dvar_dz, duv2_dz2, l_stable, l_v, rif) &
-       !$ACC PRESENT(wall_flags_0, var, dd2zu, e, u, v, l_wall, l_black, rmask) &
+       !$ACC PRESENT(wall_flags_static_0, var, dd2zu, e, u, v, l_wall, l_black, rmask) &
        !$ACC PRESENT(kh, km, sums_l_l)
        DO  i = nxlg, nxrg
@@ -4767,5 +4770,5 @@
              !DIR$ IVDEP
              DO  k = nzb+1, nzt
-                l_v(k)    = l_stable(k) * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                l_v(k)    = l_stable(k) * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
                 km(k,j,i) = c_0 * l_v(k) * SQRT( e(k,j,i) )
                 kh(k,j,i) = km(k,j,i) / prandtl_number
@@ -4788,5 +4791,5 @@
        !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j) &
        !$ACC PRIVATE(l_v) &
-       !$ACC PRESENT(wall_flags_0, e, diss, rmask) &
+       !$ACC PRESENT(wall_flags_static_0, e, diss, rmask) &
        !$ACC PRESENT(kh, km, sums_l_l)
        DO  i = nxlg, nxrg
@@ -4799,5 +4802,5 @@
 
                 l_v(k) = c_0**3 * e(k,j,i) * SQRT(e(k,j,i)) / ( diss(k,j,i) + 1.0E-30_wp ) &
-                       * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+                       * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
                 km(k,j,i) = c_0 * SQRT( e(k,j,i) ) * l_v(k)
@@ -4936,5 +4939,5 @@
           DO  k = nzb+1, nzt
 
-             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
+             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
 
 !
Index: /palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4329)
@@ -28,4 +28,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4309 2019-11-26 18:49:59Z suehring
 ! - Bugfix, include m_liq into restarts
 ! - Remove unused arrays for liquid water and saturation moisture at vertical
@@ -258,5 +261,5 @@
     USE indices,                                                               &
         ONLY:  nx, ny, nnx, nny, nnz, nxl, nxlg, nxr, nxrg, nyn, nyng, nys,    &
-               nysg, nzb, nzt, nbgp, topo_top_ind, wall_flags_0
+               nysg, nzb, nzt, nbgp, topo_top_ind, wall_flags_static_0
 
     USE, INTRINSIC :: iso_c_binding 
Index: /palm/trunk/SOURCE/user_module.f90
===================================================================
--- /palm/trunk/SOURCE/user_module.f90	(revision 4328)
+++ /palm/trunk/SOURCE/user_module.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4287 2019-11-01 14:50:20Z raasch
 ! reading of namelist file and actions in case of namelist errors revised so that statement labels
 ! and goto statements are not required any more; this revision also removes a previous bug
@@ -1050,5 +1053,5 @@
 !                                     * rmask(j,i,sr)                          &
 !                                     * MERGE( 1.0_wp, 0.0_wp,                 &
-!                                              BTEST( wall_flags_0(k,j,i), 0 ) )
+!                                              BTEST( wall_flags_static_0(k,j,i), 0 ) )
 !!
 !!--             Further profiles can be defined and calculated by increasing
Index: /palm/trunk/SOURCE/vdi_internal_controls.f90
===================================================================
--- /palm/trunk/SOURCE/vdi_internal_controls.f90	(revision 4328)
+++ /palm/trunk/SOURCE/vdi_internal_controls.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4182 2019-08-22 15:20:23Z scharf
 ! added "Authors" section
 ! 
@@ -80,5 +83,5 @@
                nzb,                         &
                nzt,                         &
-               wall_flags_0
+               wall_flags_static_0
 
     USE kinds
@@ -202,5 +205,5 @@
 !
 !--    If the grid point lies in a building, a new point is defined
-       DO WHILE ( .NOT. BTEST( wall_flags_0(cgp_k,cgp_j,cgp_i), 1 ) )
+       DO WHILE ( .NOT. BTEST( wall_flags_static_0(cgp_k,cgp_j,cgp_i), 1 ) )
           CALL RANDOM_NUMBER( random )
           cgp_k = cgp_k + FLOOR( ( nzt - cgp_k ) * random )   !< Random number upon cgp_k
@@ -451,5 +454,5 @@
        DO  j = nys, nyn
           DO  k = nzb+1, nzt+1
-             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), quant_type ) )
+             flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), quant_type ) )
              quant_av_k_l(k) = quant_av_k_l(k) + quant(k,j,i) * flag
              count_2d_l(k)   = count_2d_l(k) + INT( flag, KIND=iwp )
@@ -479,5 +482,5 @@
                                 + ( quant(k,j,i) - quant_av_k(k) )**2 &
                                 * MERGE( 1.0_wp, 0.0_wp,              &
-                                         BTEST( wall_flags_0(k,j,i), quant_type ) )
+                                         BTEST( wall_flags_static_0(k,j,i), quant_type ) )
           ENDDO
        ENDDO
@@ -719,5 +722,5 @@
       DO  j = nys, nyn
          DO  k = nzb, nzt+1
-            flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), quant_type ) )
+            flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), quant_type ) )
             quant_av_l = quant_av_l + quant(k,j,i) * flag
             average_count_l = average_count_l + INT( flag, KIND=iwp )
@@ -771,5 +774,5 @@
                               + u(k,j,i) * dzw(k) * dy                  &
                               * MERGE( 1.0_wp, 0.0_wp,                  &
-                                       BTEST( wall_flags_0(k,j,i), 1 )  &
+                                       BTEST( wall_flags_static_0(k,j,i), 1 )  &
                                      )
           ENDDO
@@ -785,5 +788,5 @@
                               - u(k,j,i) * dzw(k) * dy                  &
                               * MERGE( 1.0_wp, 0.0_wp,                  &
-                                       BTEST( wall_flags_0(k,j,i), 1 )  &
+                                       BTEST( wall_flags_static_0(k,j,i), 1 )  &
                                      )
           ENDDO
@@ -800,5 +803,5 @@
                               + v(k,j,i) * dzw(k) * dx                  &
                               * MERGE( 1.0_wp, 0.0_wp,                  &
-                                       BTEST( wall_flags_0(k,j,i), 2 )  &
+                                       BTEST( wall_flags_static_0(k,j,i), 2 )  &
                                      )
           ENDDO
@@ -814,5 +817,5 @@
                               - v(k,j,i) * dzw(k) * dx                  &
                               * MERGE( 1.0_wp, 0.0_wp,                  &
-                                       BTEST( wall_flags_0(k,j,i), 2 )  &
+                                       BTEST( wall_flags_static_0(k,j,i), 2 )  &
                                      )
           ENDDO
Index: /palm/trunk/SOURCE/virtual_measurement_mod.f90
===================================================================
--- /palm/trunk/SOURCE/virtual_measurement_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/virtual_measurement_mod.f90	(revision 4329)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4226 2019-09-10 17:03:24Z suehring
 ! Netcdf input routine for dimension length renamed
 ! 
@@ -121,5 +124,5 @@
 
     USE indices,                                                               &
-        ONLY:  nzb, nzt, nxl, nxr, nys, nyn, nx, ny, topo_top_ind, wall_flags_0
+        ONLY:  nzb, nzt, nxl, nxr, nys, nyn, nx, ny, topo_top_ind, wall_flags_static_0
 
     USE kinds
@@ -783,5 +786,5 @@
                                              IBSET( meas_flag(k,j,i), 0 ),     &
                                              0,                                &
-                                             BTEST( wall_flags_0(k,j,i), 0 )   &
+                                             BTEST( wall_flags_static_0(k,j,i), 0 )   &
                                                     )
                          ENDDO
Index: /palm/trunk/SOURCE/wind_turbine_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/wind_turbine_model_mod.f90	(revision 4328)
+++ /palm/trunk/SOURCE/wind_turbine_model_mod.f90	(revision 4329)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! Renamed wall_flags_0 to wall_flags_static_0
+! 
+! 4326 2019-12-06 14:16:14Z oliver.maas
 ! changed format of turbine control output to allow for higher 
 ! torque and power values
@@ -111,5 +114,5 @@
     USE indices,                                                               &
         ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nz,   &
-               nzb, nzt, wall_flags_0
+               nzb, nzt, wall_flags_static_0
 
     USE kinds
@@ -2221,5 +2224,5 @@
 !
 !--                         Predetermine flag to mask topography
-                            flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 1 ) )
+                            flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 1 ) )
       
 !
@@ -2695,5 +2698,5 @@
                                   - tend_nac_x - tend_tow_x )                  &
                                       * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 1 ) )
                    ENDDO
                 ENDDO
@@ -2715,5 +2718,5 @@
                                   - tend_nac_y - tend_tow_y )                  &
                                       * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 2 ) )
                    ENDDO
                 ENDDO
@@ -2730,5 +2733,5 @@
                       tend(k,j,i) = tend(k,j,i) - rot_tend_z(k,j,i)            &
                                       * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 3 ) )
                    ENDDO
                 ENDDO
@@ -2781,5 +2784,5 @@
                             - tend_nac_x - tend_tow_x )                        &
                                       * MERGE( 1.0_wp, 0.0_wp,                 &
-                                            BTEST( wall_flags_0(k,j,i), 1 ) )
+                                            BTEST( wall_flags_static_0(k,j,i), 1 ) )
              ENDDO
           ENDIF
@@ -2797,5 +2800,5 @@
                             - tend_nac_y - tend_tow_y )                        &
                                       * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 2 ) )
                 ENDDO
           ENDIF
@@ -2808,5 +2811,5 @@
                 tend(k,j,i) = tend(k,j,i) - rot_tend_z(k,j,i)                  &
                                       * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                               BTEST( wall_flags_static_0(k,j,i), 3 ) )
              ENDDO
           ENDIF
