Index: palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4329)
+++ palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4346)
@@ -27,4 +27,8 @@
 ! -----------------
 ! $Id$
+! Introduction of wall_flags_total_0, which currently sets bits based on static
+! topography information used in wall_flags_static_0
+! 
+! 4329 2019-12-10 15:46:36Z motisi
 ! Renamed wall_flags_0 to wall_flags_static_0
 ! 
@@ -249,5 +253,6 @@
     USE indices,                                                                                   &
          ONLY:  advc_flags_s,                                                                      &
-                nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nz, nzb, nzt, wall_flags_static_0
+                nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nz, nzb, nzt,            &
+                wall_flags_total_0
 
     USE pegrid,                                                                                    &
@@ -920,5 +925,5 @@
                 DO  j = nysg, nyng
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
                       cs_3d(k,j,i) = cs_pr_init(k) * flag
                    ENDDO
@@ -945,5 +950,5 @@
                 DO  j = nysg, nyng
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
                       cs_3d(k,j,i) = cs_3d(k,j,copied) * flag
                    ENDDO
@@ -982,5 +987,5 @@
                 DO  j = ss, ee
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
                       cs_3d(k,j,i) = cs_pr_init(k) * flag
                    ENDDO
@@ -1008,5 +1013,5 @@
                 DO  j = ss, ee
                    DO  k = nzb+1, nzt
-                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
+                      flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
                       cs_3d(k,j,i) = cs_3d(k,copied,i) * flag
                    ENDDO
@@ -1331,5 +1336,5 @@
                                               chem_species(lsp)%conc(k,j,i),                       &
                                               REAL( fill_value, KIND = wp ),                       &
-                                              BTEST( wall_flags_static_0(k,j,i), 0 ) )
+                                              BTEST( wall_flags_total_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -1343,5 +1348,5 @@
                                               chem_species(lsp)%conc_av(k,j,i),                    &
                                               REAL( fill_value, KIND = wp ),                       &
-                                              BTEST( wall_flags_static_0(k,j,i), 0 ) )
+                                              BTEST( wall_flags_total_0(k,j,i), 0 ) )
                       ENDDO
                    ENDDO
@@ -1439,5 +1444,5 @@
                                              chem_species(lsp)%conc(k,j,i),   &
                                              REAL( fill_value, KIND = wp ),   &
-                                             BTEST( wall_flags_static_0(k,j,i), 0 ) )
+                                             BTEST( wall_flags_total_0(k,j,i), 0 ) )
                      ENDDO
                   ENDDO
@@ -1452,5 +1457,5 @@
                                              chem_species(lsp)%conc_av(k,j,i),&
                                              REAL( fill_value, KIND = wp ),   &
-                                             BTEST( wall_flags_static_0(k,j,i), 0 ) )
+                                             BTEST( wall_flags_total_0(k,j,i), 0 ) )
                      ENDDO
                   ENDDO
@@ -1532,9 +1537,9 @@
                       im = mask_i(mid,i)
                       jm = mask_j(mid,j)
-                      ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                      ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_total_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_static_0(kk,jm,im), 6 ) )  THEN
+                         IF ( BTEST( wall_flags_total_0(kk,jm,im), 6 ) )  THEN
                             local_pf(i,j,k) = fill_value
                          ELSE
@@ -1568,9 +1573,9 @@
                       im = mask_i(mid,i)
                       jm = mask_j(mid,j)
-                      ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_static_0(:,jm,im), 5 )), DIM = 1 ) - 1
+                      ktt = MINLOC( MERGE( 1, 0, BTEST( wall_flags_total_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_static_0(kk,jm,im), 6 ) )  THEN
+                         IF ( BTEST( wall_flags_total_0(kk,jm,im), 6 ) )  THEN
                             local_pf(i,j,k) = fill_value
                          ELSE
@@ -1895,5 +1900,5 @@
        ALLOCATE( cs_advc_flags_s(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
 !
-!--    In case of decyling, set Neumann boundary conditions for wall_flags_static_0 
+!--    In case of decyling, set Neumann boundary conditions for wall_flags_total_0 
 !--    bit 31 instead of cyclic boundary conditions.
 !--    Bit 31 is used to identify extended degradation zones (please see
@@ -1901,5 +1906,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_static_0 bit 31 must not be modified. Hence, 
+!--    original value of wall_flags_total_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
@@ -1908,5 +1913,5 @@
        cs_advc_flags_s = 0
        cs_advc_flags_s = MERGE( IBSET( cs_advc_flags_s, 31 ), 0,               &
-                                BTEST( wall_flags_static_0, 31 ) )
+                                BTEST( wall_flags_total_0, 31 ) )
 
        IF ( decycle_chem_ns )  THEN
@@ -2748,5 +2753,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_static_0(k,j,i), 0 ) )
+                     * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 
                 IF ( chem_species(ilsp)%conc_p(k,j,i) < 0.0_wp )  THEN
@@ -2858,5 +2863,5 @@
                )                                                                                   &
                * MERGE( 1.0_wp, 0.0_wp,                                                            &
-               BTEST( wall_flags_static_0(k,j,i), 0 )                                                     &
+               BTEST( wall_flags_total_0(k,j,i), 0 )                                               &
                )
 
@@ -3000,5 +3005,5 @@
                         rmask(j,i,sr)  *                                   &
                         MERGE( 1.0_wp, 0.0_wp,                             &
-                        BTEST( wall_flags_static_0(k,j,i), 22 ) )
+                        BTEST( wall_flags_total_0(k,j,i), 22 ) )
                 ENDDO
              ENDDO
