Index: palm/trunk/SOURCE/advec_v_up.f90
===================================================================
--- palm/trunk/SOURCE/advec_v_up.f90	(revision 2101)
+++ palm/trunk/SOURCE/advec_v_up.f90	(revision 2232)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! topography representation via flags
 ! 
 ! Former revisions:
@@ -95,5 +95,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxl, nxr, nyn, nysv, nzb_v_inner, nzt
+           ONLY:  nxl, nxr, nyn, nysv, nzb, nzt, wall_flags_0
 
        USE kinds
@@ -113,5 +113,5 @@
        DO  i = nxl, nxr
           DO  j = nysv, nyn
-             DO  k = nzb_v_inner(j,i)+1, nzt
+             DO  k = nzb+1, nzt
 !
 !--             x-direction
@@ -120,8 +120,12 @@
                 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
+                                         ( 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 ) )
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - ukomp *                         &
-                                         ( v(k,j,i+1) - v(k,j,i) ) * ddx
+                                         ( 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 ) )
                 ENDIF
 !
@@ -130,8 +134,12 @@
                 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
+                                         ( 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 ) )
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - vkomp *                         &
-                                         ( v(k,j+1,i) - v(k,j,i) ) * ddy
+                                         ( 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 ) )
                 ENDIF
 !
@@ -141,8 +149,12 @@
                 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)
+                                         ( 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 ) )
                 ELSE
                    tend(k,j,i) = tend(k,j,i) - wkomp *                         &
-                                         ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)
+                                         ( 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 ) )
                 ENDIF
 
@@ -171,5 +183,5 @@
 
        USE indices,                                                            &
-           ONLY:  nzb_v_inner, nzt
+           ONLY:  nzb, nzt, wall_flags_0
 
        USE kinds
@@ -187,5 +199,5 @@
 
 
-       DO  k = nzb_v_inner(j,i)+1, nzt
+       DO  k = nzb+1, nzt
 !
 !--       x-direction
@@ -194,8 +206,12 @@
           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
+                                         ( 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 ) )
           ELSE
              tend(k,j,i) = tend(k,j,i) - ukomp *                               &
-                                         ( v(k,j,i+1) - v(k,j,i) ) * ddx
+                                         ( 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 ) )
           ENDIF
 !
@@ -204,8 +220,12 @@
           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
+                                         ( 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 ) )
           ELSE
              tend(k,j,i) = tend(k,j,i) - vkomp *                               &
-                                         ( v(k,j+1,i) - v(k,j,i) ) * ddy
+                                         ( 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 ) )
           ENDIF
 !
@@ -214,8 +234,12 @@
           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)
+                                         ( 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 ) )
           ELSE
              tend(k,j,i) = tend(k,j,i) - wkomp *                               &
-                                         ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)
+                                         ( 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 ) )
           ENDIF
 
