Index: /palm/trunk/SOURCE/advec_s_pw.f90
===================================================================
--- /palm/trunk/SOURCE/advec_s_pw.f90	(revision 3537)
+++ /palm/trunk/SOURCE/advec_s_pw.f90	(revision 3538)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Remove unnecessary double-masking of topography
+! 
+! 3302 2018-10-03 02:39:40Z raasch
 ! Stokes drift velocity added
 ! 
@@ -116,6 +119,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
 
        USE kinds
@@ -163,6 +165,5 @@
                                                    ( sk(k-1,j,i) - sk(k,j,i) ) &
                                                  ) * dd2zu(k)                  &
-                                      ) * MERGE( 1.0_wp, 0.0_wp,               &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                      )
              ENDDO
           ENDDO
@@ -189,5 +190,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt, wall_flags_0
+           ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt
 
        USE kinds
@@ -233,6 +234,5 @@
                                                   ( sk(k-1,j,i) - sk(k,j,i) )  &
                                                 ) * dd2zu(k)                   &
-                                    ) * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                    )
        ENDDO
 
Index: /palm/trunk/SOURCE/advec_s_up.f90
===================================================================
--- /palm/trunk/SOURCE/advec_s_up.f90	(revision 3537)
+++ /palm/trunk/SOURCE/advec_s_up.f90	(revision 3538)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Remove unnecessary double-masking of topography
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -113,6 +116,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
 
        USE kinds
@@ -143,12 +145,8 @@
                 IF ( ukomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
-                                         ( sk(k,j,i) - sk(k,j,i-1) ) * ddx     &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         ( sk(k,j,i) - sk(k,j,i-1) ) * ddx
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
-                                         ( sk(k,j,i+1) - sk(k,j,i) ) * ddx     &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         ( sk(k,j,i+1) - sk(k,j,i) ) * ddx
                 ENDIF
 !
@@ -157,12 +155,8 @@
                 IF ( vkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
-                                         ( sk(k,j,i) - sk(k,j-1,i) ) * ddy     &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         ( sk(k,j,i) - sk(k,j-1,i) ) * ddy
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
-                                         ( sk(k,j+1,i) - sk(k,j,i) ) * ddy     &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         ( sk(k,j+1,i) - sk(k,j,i) ) * ddy
                 ENDIF
 !
@@ -171,12 +165,8 @@
                 IF ( wkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - wkomp *                         &
-                                         ( sk(k,j,i) - sk(k-1,j,i) ) * ddzu(k) &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         ( sk(k,j,i) - sk(k-1,j,i) ) * ddzu(k)
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - wkomp *                         &
-                                         ( sk(k+1,j,i)-sk(k,j,i) ) * ddzu(k+1) &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         ( sk(k+1,j,i)-sk(k,j,i) ) * ddzu(k+1)
                 ENDIF
 
@@ -205,5 +195,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt, wall_flags_0
+           ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt
 
        USE kinds
@@ -233,12 +223,8 @@
           IF ( ukomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
-                                         ( sk(k,j,i) - sk(k,j,i-1) ) * ddx     &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         ( sk(k,j,i) - sk(k,j,i-1) ) * ddx
           ELSE
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
-                                         ( sk(k,j,i+1) - sk(k,j,i) ) * ddx     &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         ( sk(k,j,i+1) - sk(k,j,i) ) * ddx
           ENDIF
 !
@@ -247,12 +233,8 @@
           IF ( vkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
-                                         ( sk(k,j,i) - sk(k,j-1,i) ) * ddy     &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         ( sk(k,j,i) - sk(k,j-1,i) ) * ddy
           ELSE
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
-                                         ( sk(k,j+1,i) - sk(k,j,i) ) * ddy     &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         ( sk(k,j+1,i) - sk(k,j,i) ) * ddy
           ENDIF
 !
@@ -261,12 +243,8 @@
           IF ( wkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - wkomp *                               &
-                                         ( sk(k,j,i) - sk(k-1,j,i) ) * ddzu(k) &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         ( sk(k,j,i) - sk(k-1,j,i) ) * ddzu(k)
           ELSE
              tend(k,j,i) = tend(k,j,i) - wkomp *                               &
-                                         ( sk(k+1,j,i)-sk(k,j,i) ) * ddzu(k+1) &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                         ( sk(k+1,j,i)-sk(k,j,i) ) * ddzu(k+1)
           ENDIF
 
Index: /palm/trunk/SOURCE/advec_u_pw.f90
===================================================================
--- /palm/trunk/SOURCE/advec_u_pw.f90	(revision 3537)
+++ /palm/trunk/SOURCE/advec_u_pw.f90	(revision 3538)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Remove unnecessary double-masking of topography
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -105,5 +108,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxlu, nxr, nyn, nys, nzb, nzt, wall_flags_0
+           ONLY:  nxlu, nxr, nyn, nys, nzb, nzt
 
        USE kinds
@@ -132,7 +135,5 @@
                          - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) )        &
                                                                   * ddzw(k)    &
-                                                      )                        &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                                      )
              ENDDO
           ENDDO
@@ -159,5 +160,5 @@
 
        USE indices,                                                            &
-           ONLY:  nzb, nzt, wall_flags_0
+           ONLY:  nzb, nzt
 
        USE kinds
@@ -184,7 +185,5 @@
                          - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) )        &
                                                                   * ddzw(k)    &
-                                                )                              &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                                )
        ENDDO
 
Index: /palm/trunk/SOURCE/advec_u_up.f90
===================================================================
--- /palm/trunk/SOURCE/advec_u_up.f90	(revision 3537)
+++ /palm/trunk/SOURCE/advec_u_up.f90	(revision 3538)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Remove unnecessary double-masking of topography
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -104,5 +107,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxlu, nxr, nyn, nys, nzb, nzt, wall_flags_0
+           ONLY:  nxlu, nxr, nyn, nys, nzb, nzt
 
        USE kinds
@@ -128,12 +131,8 @@
                 IF ( ukomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
-                                         ( u(k,j,i) - u(k,j,i-1) ) * ddx       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                         ( u(k,j,i) - u(k,j,i-1) ) * ddx
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
-                                          ( u(k,j,i+1) - u(k,j,i) ) * ddx      &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                          ( u(k,j,i+1) - u(k,j,i) ) * ddx
                 ENDIF
 !
@@ -143,12 +142,8 @@
                 IF ( vkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
-                                         ( u(k,j,i) - u(k,j-1,i) ) * ddy       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                         ( u(k,j,i) - u(k,j-1,i) ) * ddy
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
-                                         ( u(k,j+1,i) - u(k,j,i) ) * ddy       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                         ( u(k,j+1,i) - u(k,j,i) ) * ddy
                 ENDIF
 !
@@ -158,12 +153,8 @@
                 IF ( wkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - wkomp *                         &
-                                         ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k)   &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                         ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k)
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - wkomp *                         &
-                                         ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                         ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1)
                 ENDIF
 
@@ -192,5 +183,5 @@
 
        USE indices,                                                            &
-           ONLY:  nzb, nzt, wall_flags_0
+           ONLY:  nzb, nzt
 
        USE kinds
@@ -214,12 +205,8 @@
           IF ( ukomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
-                                         ( u(k,j,i) - u(k,j,i-1) ) * ddx       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                         ( u(k,j,i) - u(k,j,i-1) ) * ddx
           ELSE
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
-                                         ( u(k,j,i+1) - u(k,j,i) ) * ddx       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                         ( u(k,j,i+1) - u(k,j,i) ) * ddx
           ENDIF
 !
@@ -229,12 +216,8 @@
           IF ( vkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
-                                         ( u(k,j,i) - u(k,j-1,i) ) * ddy       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                         ( u(k,j,i) - u(k,j-1,i) ) * ddy
           ELSE
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
-                                         ( u(k,j+1,i) - u(k,j,i) ) * ddy       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                         ( u(k,j+1,i) - u(k,j,i) ) * ddy
           ENDIF
 !
@@ -243,12 +226,8 @@
           IF ( wkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - wkomp *                               &
-                                         ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k)   &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                         ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k)
           ELSE
              tend(k,j,i) = tend(k,j,i) - wkomp *                               &
-                                         ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 1 ) )
+                                         ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1)
           ENDIF
 
Index: /palm/trunk/SOURCE/advec_v_pw.f90
===================================================================
--- /palm/trunk/SOURCE/advec_v_pw.f90	(revision 3537)
+++ /palm/trunk/SOURCE/advec_v_pw.f90	(revision 3538)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! Remove unnecessary double-masking of topography
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -106,5 +109,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxl, nxr, nyn, nysv, nzb, nzt, wall_flags_0
+           ONLY:  nxl, nxr, nyn, nysv, nzb, nzt
 
        USE kinds
@@ -134,7 +137,5 @@
                          - v(k-1,j,i) * ( w(k-1,j-1,i) + w(k-1,j,i) ) )        &
                                                                   * ddzw(k)    &
-                                                      )                        &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                                      )
              ENDDO
           ENDDO
@@ -161,5 +162,5 @@
 
        USE indices,                                                            &
-           ONLY:  nzb, nzt, wall_flags_0
+           ONLY:  nzb, nzt
 
        USE kinds
@@ -187,7 +188,5 @@
                          - v(k-1,j,i) * ( w(k-1,j-1,i) + w(k-1,j,i) ) )        &
                                                                   * ddzw(k)    &
-                                                )                              &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                                )
        ENDDO
  
Index: /palm/trunk/SOURCE/advec_v_up.f90
===================================================================
--- /palm/trunk/SOURCE/advec_v_up.f90	(revision 3537)
+++ /palm/trunk/SOURCE/advec_v_up.f90	(revision 3538)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Remove unnecessary double-masking of topography
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -104,5 +107,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxl, nxr, nyn, nysv, nzb, nzt, wall_flags_0
+           ONLY:  nxl, nxr, nyn, nysv, nzb, nzt
 
        USE kinds
@@ -129,12 +132,8 @@
                 IF ( ukomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
-                                         ( v(k,j,i) - v(k,j,i-1) ) * ddx       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         ( v(k,j,i) - v(k,j,i-1) ) * ddx
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
-                                         ( v(k,j,i+1) - v(k,j,i) ) * ddx       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         ( v(k,j,i+1) - v(k,j,i) ) * ddx
                 ENDIF
 !
@@ -143,12 +142,8 @@
                 IF ( vkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
-                                         ( v(k,j,i) - v(k,j-1,i) ) * ddy       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         ( v(k,j,i) - v(k,j-1,i) ) * ddy
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
-                                         ( v(k,j+1,i) - v(k,j,i) ) * ddy       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         ( v(k,j+1,i) - v(k,j,i) ) * ddy
                 ENDIF
 !
@@ -158,12 +153,8 @@
                 IF ( wkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - wkomp *                         &
-                                         ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k)   &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k)
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - wkomp *                         &
-                                         ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)
                 ENDIF
 
@@ -192,5 +183,5 @@
 
        USE indices,                                                            &
-           ONLY:  nzb, nzt, wall_flags_0
+           ONLY:  nzb, nzt
 
        USE kinds
@@ -215,12 +206,8 @@
           IF ( ukomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
-                                         ( v(k,j,i) - v(k,j,i-1) ) * ddx       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         ( v(k,j,i) - v(k,j,i-1) ) * ddx
           ELSE
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
-                                         ( v(k,j,i+1) - v(k,j,i) ) * ddx       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         ( v(k,j,i+1) - v(k,j,i) ) * ddx
           ENDIF
 !
@@ -229,12 +216,8 @@
           IF ( vkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
-                                         ( v(k,j,i) - v(k,j-1,i) ) * ddy       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         ( v(k,j,i) - v(k,j-1,i) ) * ddy
           ELSE
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
-                                         ( v(k,j+1,i) - v(k,j,i) ) * ddy       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         ( v(k,j+1,i) - v(k,j,i) ) * ddy
           ENDIF
 !
@@ -243,12 +226,8 @@
           IF ( wkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - wkomp *                               &
-                                         ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k)   &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k)
           ELSE
              tend(k,j,i) = tend(k,j,i) - wkomp *                               &
-                                         ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1) &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 2 ) )
+                                         ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)
           ENDIF
 
Index: /palm/trunk/SOURCE/advec_w_pw.f90
===================================================================
--- /palm/trunk/SOURCE/advec_w_pw.f90	(revision 3537)
+++ /palm/trunk/SOURCE/advec_w_pw.f90	(revision 3538)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Remove unnecessary double-masking of topography
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -105,5 +108,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0
+           ONLY:  nxl, nxr, nyn, nys, nzb, nzt
 
        USE kinds
@@ -133,7 +136,5 @@
                          - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) )            &
                                                                   * ddzu(k+1)  &
-                                                      )                        &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                                      )
              ENDDO
           ENDDO
@@ -160,5 +161,5 @@
 
        USE indices,                                                            &
-           ONLY:  nzb, nzt, wall_flags_0
+           ONLY:  nzb, nzt
 
        USE kinds
@@ -185,7 +186,5 @@
                          - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) )            &
                                                                   * ddzu(k+1)  &
-                                                )                              &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                                )
        ENDDO
     END SUBROUTINE advec_w_pw_ij
Index: /palm/trunk/SOURCE/advec_w_up.f90
===================================================================
--- /palm/trunk/SOURCE/advec_w_up.f90	(revision 3537)
+++ /palm/trunk/SOURCE/advec_w_up.f90	(revision 3538)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Remove unnecessary double-masking of topography
+! 
+! 3255 2018-09-17 11:57:36Z suehring
 ! Missing wall flags added
 ! 
@@ -107,5 +110,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0
+           ONLY:  nxl, nxr, nyn, nys, nzb, nzt
 
        USE kinds
@@ -131,12 +134,8 @@
                 IF ( ukomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
-                                         ( w(k,j,i) - w(k,j,i-1) ) * ddx       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         ( w(k,j,i) - w(k,j,i-1) ) * ddx
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
-                                         ( w(k,j,i+1) - w(k,j,i) ) * ddx       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         ( w(k,j,i+1) - w(k,j,i) ) * ddx
                 ENDIF
 !
@@ -146,12 +145,8 @@
                 IF ( vkomp > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
-                                         ( w(k,j,i) - w(k,j-1,i) ) * ddy       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         ( w(k,j,i) - w(k,j-1,i) ) * ddy
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
-                                         ( w(k,j+1,i) - w(k,j,i) ) * ddy       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         ( w(k,j+1,i) - w(k,j,i) ) * ddy
                 ENDIF
 !
@@ -159,12 +154,8 @@
                 IF ( w(k,j,i) > 0.0_wp )  THEN
                    tend(k,j,i) = tend(k,j,i) - w(k,j,i) *                      &
-                                         ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k)   &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k)
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - w(k,j,i) *                      &
-                                         ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1)
                 ENDIF
 
@@ -193,5 +184,5 @@
 
        USE indices,                                                            &
-           ONLY:  nzb, nzt, wall_flags_0
+           ONLY:  nzb, nzt
 
        USE kinds
@@ -215,12 +206,8 @@
           IF ( ukomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
-                                         ( w(k,j,i) - w(k,j,i-1) ) * ddx       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         ( w(k,j,i) - w(k,j,i-1) ) * ddx
           ELSE
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
-                                         ( w(k,j,i+1) - w(k,j,i) ) * ddx       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         ( w(k,j,i+1) - w(k,j,i) ) * ddx
           ENDIF
 !
@@ -230,12 +217,8 @@
           IF ( vkomp > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
-                                         ( w(k,j,i) - w(k,j-1,i) ) * ddy       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         ( w(k,j,i) - w(k,j-1,i) ) * ddy
           ELSE
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
-                                         ( w(k,j+1,i) - w(k,j,i) ) * ddy       &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         ( w(k,j+1,i) - w(k,j,i) ) * ddy
           ENDIF
 !
@@ -243,12 +226,8 @@
           IF ( w(k,j,i) > 0.0_wp )  THEN
              tend(k,j,i) = tend(k,j,i) - w(k,j,i) *                            &
-                                         ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k)   &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k)
           ELSE
              tend(k,j,i) = tend(k,j,i) - w(k,j,i) *                            &
-                                         ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 3 ) )
+                                         ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1)
           ENDIF
 
Index: /palm/trunk/SOURCE/buoyancy.f90
===================================================================
--- /palm/trunk/SOURCE/buoyancy.f90	(revision 3537)
+++ /palm/trunk/SOURCE/buoyancy.f90	(revision 3538)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Remove unnecessary double-masking of topography
+! 
+! 3294 2018-10-01 02:37:10Z raasch
 ! module use statements moved to global declaration section
 ! 
@@ -152,5 +155,5 @@
        USE indices,                                                            &
            ONLY:  nxl, nxlg, nxlu, nxr, nxrg, nyn, nyng, nys, nysg, nzb,       &
-                  nzt, wall_flags_0
+                  nzt
 
 
@@ -179,6 +182,5 @@
                              ( var(k,j,i)   - ref_state(k) )   / ref_state(k) + &
                              ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1) &
-                          ) * MERGE( 1.0_wp, 0.0_wp,                            &
-                                     BTEST( wall_flags_0(k,j,i), 0 ) )
+                          )
                 ENDDO
              ENDDO
@@ -200,7 +202,5 @@
                            0.5_wp * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
                                     - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
-                                    ) / pt_surface                                &
-                                      * MERGE( 1.0_wp, 0.0_wp,                    &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                    ) / pt_surface
                    ENDDO
                 ENDDO
@@ -215,7 +215,5 @@
                            0.5_wp * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
                                     - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
-                                    ) / pt_surface                                &
-                                      * MERGE( 1.0_wp, 0.0_wp,                    &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                    ) / pt_surface
                    ENDDO
                 ENDDO
@@ -247,5 +245,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt, wall_flags_0
+           ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt
 
        IMPLICIT NONE
@@ -270,7 +268,5 @@
                         ( var(k,j,i)   - ref_state(k)   ) / ref_state(k)   +   &
                         ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1)     &
-                                                                          )    &
-                                      * MERGE( 1.0_wp, 0.0_wp,                 &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                                                          )
           ENDDO
 
@@ -288,7 +284,5 @@
                            0.5_wp * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
                                     - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
-                                    ) / pt_surface                                &
-                                      * MERGE( 1.0_wp, 0.0_wp,                    &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                    ) / pt_surface
              ENDDO
 
@@ -299,7 +293,5 @@
                            0.5_wp * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
                                     - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
-                                    ) / pt_surface                                &
-                                      * MERGE( 1.0_wp, 0.0_wp,                    &
-                                               BTEST( wall_flags_0(k,j,i), 0 ) )
+                                    ) / pt_surface
              ENDDO
 
Index: /palm/trunk/SOURCE/coriolis.f90
===================================================================
--- /palm/trunk/SOURCE/coriolis.f90	(revision 3537)
+++ /palm/trunk/SOURCE/coriolis.f90	(revision 3538)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Note concerning topography masking added
+! 
+! 3241 2018-09-12 15:02:00Z raasch
 ! unused variables removed
 ! 
@@ -89,4 +92,8 @@
 ! ------------
 !> Computation of all Coriolis terms in the equations of motion.
+!> 
+!> @note In this routine the topography is masked, even though this 
+!>       is again done in prognostic_equations. However, omitting the masking 
+!>       here lead to slightly different results. Reason unknown. 
 !------------------------------------------------------------------------------!
  MODULE coriolis_mod
Index: /palm/trunk/SOURCE/init_grid.f90
===================================================================
--- /palm/trunk/SOURCE/init_grid.f90	(revision 3537)
+++ /palm/trunk/SOURCE/init_grid.f90	(revision 3538)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Comment added
+! 
+! 3294 2018-10-01 02:37:10Z raasch
 ! ocean renamed ocean_mode
 ! 
@@ -1647,7 +1650,11 @@
           DO  j = nys, nyn
              DO  k = nzb, nzt
+!
+!--             Flag topography for all grid points which are below
+!--             the local topography height. 
+!--             Note, each topography is flagged as building. 
                 IF ( zu(k) - ocean_offset <= buildings_f%var_2d(j,i) )  THEN
                     topo_3d(k,j,i) = IBCLR( topo_3d(k,j,i), 0 )
-                    topo_3d(k,j,i) = IBSET( topo_3d(k,j,i), 2 ) !indicates terrain
+                    topo_3d(k,j,i) = IBSET( topo_3d(k,j,i), 2 ) !indicates building
                 ENDIF
              ENDDO
