Index: palm/trunk/SOURCE/bulk_cloud_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4329)
+++ palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4346)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Introduction of wall_flags_total_0, which currently sets bits based on static
+! topography information used in wall_flags_static_0
+! 
+! 4329 2019-12-10 15:46:36Z motisi
 ! Renamed wall_flags_0 to wall_flags_static_0
 ! 
@@ -144,5 +148,5 @@
                nbgp, nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb, nzt,     &
                topo_top_ind,                                                   &
-               wall_flags_static_0
+               wall_flags_total_0
 
     USE kinds
@@ -152,5 +156,6 @@
 
     USE statistics,                                                            &
-        ONLY:  weight_pres, weight_substep, sums_wsncs_ws_l, sums_wsnrs_ws_l, sums_wsqcs_ws_l, sums_wsqrs_ws_l
+        ONLY:  weight_pres, weight_substep, sums_wsncs_ws_l, sums_wsnrs_ws_l,  &
+               sums_wsqcs_ws_l, sums_wsqrs_ws_l
 
     USE surface_mod,                                                           &
@@ -1399,5 +1404,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 )   &
                                           )
                    IF ( qc_p(k,j,i) < 0.0_wp )  qc_p(k,j,i) = 0.0_wp
@@ -1489,5 +1494,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 )   &
                                           )
                    IF ( nc_p(k,j,i) < 0.0_wp )  nc_p(k,j,i) = 0.0_wp
@@ -1586,5 +1591,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 )   &
                                           )
                    IF ( qr_p(k,j,i) < 0.0_wp )  qr_p(k,j,i) = 0.0_wp
@@ -1676,5 +1681,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 )   &
                                           )
                    IF ( nr_p(k,j,i) < 0.0_wp )  nr_p(k,j,i) = 0.0_wp
@@ -1773,5 +1778,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 )&
                                         )
              IF ( qc_p(k,j,i) < 0.0_wp )  qc_p(k,j,i) = 0.0_wp
@@ -1832,5 +1837,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 )&
                                         )
              IF ( nc_p(k,j,i) < 0.0_wp )  nc_p(k,j,i) = 0.0_wp
@@ -1897,5 +1902,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 )&
                                         )
              IF ( qr_p(k,j,i) < 0.0_wp )  qr_p(k,j,i) = 0.0_wp
@@ -1956,5 +1961,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 )&
                                         )
              IF ( nr_p(k,j,i) < 0.0_wp )  nr_p(k,j,i) = 0.0_wp
@@ -2502,7 +2507,7 @@
              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_static_0(k,j,i), flag_nr )     &
+                                     to_be_resorted(k,j,i),                      &
+                                     REAL( fill_value, KIND = wp ),              &
+                                     BTEST( wall_flags_total_0(k,j,i), flag_nr ) &
                                   )
              ENDDO
@@ -2643,8 +2648,8 @@
           DO  j = nys, nyn
              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_static_0(k,j,i), flag_nr )     &
+                local_pf(i,j,k) = MERGE(                                         &
+                                     to_be_resorted(k,j,i),                      &
+                                     REAL( fill_value, KIND = wp ),              &
+                                     BTEST( wall_flags_total_0(k,j,i), flag_nr ) &
                                   )
              ENDDO
@@ -3046,5 +3051,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 
                 IF ( qr(k,j,i) <= eps_sb )  THEN
@@ -3100,5 +3105,5 @@
 !
 !--       Predetermine flag to mask topography
-          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 ) )
 
           IF ( qr(k,j,i) <= eps_sb )  THEN
@@ -3168,5 +3173,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 
 !
@@ -3269,5 +3274,5 @@
 !
 !--       Predetermine flag to mask topography
-          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 ) )
 !
 !--       Call calculation of supersaturation
@@ -3369,5 +3374,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 !
 !--             Call calculation of supersaturation 
@@ -3456,5 +3461,5 @@
 !
 !--       Predetermine flag to mask topography
-          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 ) )
 !
 !--       Call calculation of supersaturation
@@ -3545,5 +3550,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 
                 IF ( microphysics_morrison ) THEN
@@ -3671,5 +3676,5 @@
 !
 !--       Predetermine flag to mask topography
-          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 ) )
           IF ( microphysics_morrison ) THEN
              nc_auto = nc(k,j,i)
@@ -3782,5 +3787,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 
                 IF ( qc(k,j,i) > ql_crit )  THEN
@@ -3829,5 +3834,5 @@
 !
 !--       Predetermine flag to mask topography
-          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 ) )
 
           IF ( qc(k,j,i) > ql_crit )  THEN
@@ -3880,5 +3885,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 
                 IF ( microphysics_morrison ) THEN
@@ -3961,5 +3966,5 @@
 !
 !--       Predetermine flag to mask topography
-          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 ) )
           IF ( microphysics_morrison ) THEN
              nc_accr = nc(k,j,i)
@@ -4041,5 +4046,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 
                 IF ( qr(k,j,i) > eps_sb )  THEN
@@ -4096,5 +4101,5 @@
 !
 !--       Predetermine flag to mask topography
-          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 ) )
 
           IF ( qr(k,j,i) > eps_sb )  THEN
@@ -4158,5 +4163,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 
                 IF ( qr(k,j,i) > eps_sb )  THEN
@@ -4280,5 +4285,5 @@
 !
 !--       Predetermine flag to mask topography
-          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 ) )
 
           IF ( qr(k,j,i) > eps_sb )  THEN
@@ -4394,5 +4399,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 
                 IF ( microphysics_morrison ) THEN
@@ -4488,5 +4493,5 @@
 !
 !--       Predetermine flag to mask topography
-          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 ) )
           IF ( microphysics_morrison ) THEN
              nc_sedi = nc(k,j,i)
@@ -4594,5 +4599,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 
                 IF ( qr(k,j,i) > eps_sb )  THEN
@@ -4659,5 +4664,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 
                 c_nr(k) = 0.25_wp * ( w_nr(k-1) +                              &
@@ -4675,5 +4680,5 @@
 !
 !--                Predetermine flag to mask topography
-                   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 ) )
 
                    d_mean = 0.5_wp * ( qr(k+1,j,i) - qr(k-1,j,i) )
@@ -4709,5 +4714,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 !
 !--             Sum up all rain drop number densities which contribute to the flux
@@ -4836,5 +4841,5 @@
 !
 !--       Predetermine flag to mask topography
-          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 ) )
 
           IF ( qr(k,j,i) > eps_sb )  THEN
@@ -4896,5 +4901,5 @@
 !
 !--       Predetermine flag to mask topography
-          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 ) )
 
           c_nr(k) = 0.25_wp * ( w_nr(k-1) + 2.0_wp * w_nr(k) + w_nr(k+1) ) *   &
@@ -4910,5 +4915,5 @@
 !
 !--          Predetermine flag to mask topography
-             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 ) )
 
              d_mean = 0.5_wp * ( qr(k+1,j,i) - qr(k-1,j,i) )
@@ -4943,5 +4948,5 @@
 !
 !--       Predetermine flag to mask topography
-          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 ) )
 !
 !--       Sum up all rain drop number densities which contribute to the flux
@@ -5153,5 +5158,5 @@
 !
 !--             Predetermine flag to mask topography
-                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 ) )
 
 !
