Index: palm/trunk/SOURCE/subsidence_mod.f90
===================================================================
--- palm/trunk/SOURCE/subsidence_mod.f90	(revision 2101)
+++ palm/trunk/SOURCE/subsidence_mod.f90	(revision 2232)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! Adjustments to new topography and surface concept
 ! 
 ! Former revisions:
@@ -195,6 +195,6 @@
 
        USE indices,                                                            &
-           ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzb_s_inner,&
-                  nzt
+           ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt,        &
+                  wall_flags_0
 
        USE kinds
@@ -225,11 +225,15 @@
           DO  j = nys, nyn
 
-             DO  k = nzb_s_inner(j,i)+1, nzt 
+             DO  k = nzb+1, nzt 
                 IF ( w_subs(k) < 0.0_wp )  THEN    ! large-scale subsidence
                    tmp_tend = - w_subs(k) *                                    &
-                              ( var(k+1,j,i) - var(k,j,i) ) * ddzu(k+1)
+                              ( 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 ) )
                 ELSE                               ! large-scale ascent
                    tmp_tend = - w_subs(k) *                                    &
-                              ( var(k,j,i) - var(k-1,j,i) ) * ddzu(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 ) )
                 ENDIF
 
@@ -238,5 +242,7 @@
                 IF ( large_scale_forcing )  THEN
                    sums_ls_l(k,ls_index) = sums_ls_l(k,ls_index) + tmp_tend    &
-                                   * weight_substep(intermediate_timestep_count)
+                                 * weight_substep(intermediate_timestep_count) &
+                                 * MERGE( 1.0_wp, 0.0_wp,                      &
+                                          BTEST( wall_flags_0(k,j,i), 0 ) )
                 ENDIF
              ENDDO
@@ -304,5 +310,5 @@
 
        USE indices,                                                            &
-           ONLY:  nxl, nxlg, nxrg, nyng, nys, nysg, nzb_s_inner, nzb, nzt
+           ONLY:  nxl, nxlg, nxrg, nyng, nys, nysg, nzb, nzt, wall_flags_0
 
        USE kinds
@@ -330,9 +336,14 @@
 !
 !--    Influence of w_subsidence on the current tendency term
-       DO  k = nzb_s_inner(j,i)+1, nzt 
+       DO  k = nzb+1, nzt 
           IF ( w_subs(k) < 0.0_wp )  THEN      ! large-scale subsidence
-             tmp_tend = - w_subs(k) * ( var(k+1,j,i) - var(k,j,i) ) * ddzu(k+1)
+             tmp_tend = - w_subs(k) * ( 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 ) )
           ELSE                                 ! large-scale ascent
-             tmp_tend = - w_subs(k) * ( var(k,j,i) - var(k-1,j,i) ) * ddzu(k)
+             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 ) )
           ENDIF
 
@@ -341,5 +352,7 @@
           IF ( large_scale_forcing )  THEN
              sums_ls_l(k,ls_index) = sums_ls_l(k,ls_index) + tmp_tend          &
-                                   * weight_substep(intermediate_timestep_count)
+                                  * weight_substep(intermediate_timestep_count)&
+                                  * MERGE( 1.0_wp, 0.0_wp,                     &
+                                           BTEST( wall_flags_0(k,j,i), 0 ) )
           ENDIF
        ENDDO
