Index: /palm/trunk/SOURCE/pmc_interface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 2811)
+++ /palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 2812)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Bugfixes in computation of the interpolation loglaw-correction parameters
+! 
+! 2809 2018-02-15 09:55:58Z schwenkel
 ! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE
 ! 
@@ -415,4 +418,16 @@
     INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::  logc_w_r   !<
     INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::  logc_w_s   !<
+    INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  logc_kbounds_u_l !<
+    INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  logc_kbounds_u_n !<
+    INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  logc_kbounds_u_r !<
+    INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  logc_kbounds_u_s !<
+    INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  logc_kbounds_v_l !<    
+    INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  logc_kbounds_v_n !<
+    INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  logc_kbounds_v_r !<    
+    INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  logc_kbounds_v_s !<
+    INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  logc_kbounds_w_l !<    
+    INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  logc_kbounds_w_n !<
+    INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  logc_kbounds_w_r !<    
+    INTEGER(iwp), SAVE, ALLOCATABLE, DIMENSION(:,:)   ::  logc_kbounds_w_s !<        
     REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:,:,:)   ::  logc_ratio_u_l   !<
     REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:,:,:)   ::  logc_ratio_u_n   !<
@@ -629,5 +644,5 @@
     IF ( TRIM( nesting_mode ) /= 'one-way'  .AND.                              &
          TRIM( nesting_mode ) /= 'two-way'  .AND.                              &
-         TRIM( nesting_mode ) /= 'vertical' )                                  &                 
+         TRIM( nesting_mode ) /= 'vertical' )                                  &
     THEN
        message_string = 'illegal nesting mode: ' // TRIM( nesting_mode )
@@ -1184,6 +1199,8 @@
 
        IF( particle_advection )  THEN
-          CALL pmc_set_dataarray_name( 'coarse', 'nr_part'  ,'fine', 'nr_part',  ierr )
-          CALL pmc_set_dataarray_name( 'coarse', 'part_adr'  ,'fine', 'part_adr',  ierr )
+          CALL pmc_set_dataarray_name( 'coarse', 'nr_part'  ,'fine',           &
+               'nr_part',  ierr )
+          CALL pmc_set_dataarray_name( 'coarse', 'part_adr'  ,'fine',          &
+               'part_adr',  ierr )
        ENDIF
        
@@ -1599,17 +1616,17 @@
 !--             Determine largest topography index on scalar grid
                 nzt_topo_nestbc_l = MAX( nzt_topo_nestbc_l,                    &
-                                         get_topography_top_index_ji( j, i, 's' ) )
+                                    get_topography_top_index_ji( j, i, 's' ) )
 !
 !--             Determine largest topography index on u grid
                 nzt_topo_nestbc_l = MAX( nzt_topo_nestbc_l,                    &
-                                         get_topography_top_index_ji( j, i, 'u' ) )
+                                    get_topography_top_index_ji( j, i, 'u' ) )
 !
 !--             Determine largest topography index on v grid
                 nzt_topo_nestbc_l = MAX( nzt_topo_nestbc_l,                    &
-                                         get_topography_top_index_ji( j, i, 'v' ) )
+                                    get_topography_top_index_ji( j, i, 'v' ) )
 !
 !--             Determine largest topography index on w grid
                 nzt_topo_nestbc_l = MAX( nzt_topo_nestbc_l,                    &
-                                         get_topography_top_index_ji( j, i, 'w' ) )
+                                    get_topography_top_index_ji( j, i, 'w' ) )
              ENDDO
           ENDDO
@@ -1625,17 +1642,17 @@
 !--             Determine largest topography index on scalar grid
                 nzt_topo_nestbc_r = MAX( nzt_topo_nestbc_r,                    &
-                                         get_topography_top_index_ji( j, i, 's' ) )
+                                    get_topography_top_index_ji( j, i, 's' ) )
 !
 !--             Determine largest topography index on u grid
                 nzt_topo_nestbc_r = MAX( nzt_topo_nestbc_r,                    &
-                                         get_topography_top_index_ji( j, i, 'u' ) )
+                                    get_topography_top_index_ji( j, i, 'u' ) )
 !
 !--             Determine largest topography index on v grid
                 nzt_topo_nestbc_r = MAX( nzt_topo_nestbc_r,                    &
-                                         get_topography_top_index_ji( j, i, 'v' ) )
+                                    get_topography_top_index_ji( j, i, 'v' ) )
 !
 !--             Determine largest topography index on w grid
                 nzt_topo_nestbc_r = MAX( nzt_topo_nestbc_r,                    &
-                                         get_topography_top_index_ji( j, i, 'w' ) )
+                                    get_topography_top_index_ji( j, i, 'w' ) )
           ENDDO
           nzt_topo_nestbc_r = nzt_topo_nestbc_r + 1
@@ -1650,17 +1667,17 @@
 !--             Determine largest topography index on scalar grid
                 nzt_topo_nestbc_s = MAX( nzt_topo_nestbc_s,                    &
-                                         get_topography_top_index_ji( j, i, 's' ) )
+                                    get_topography_top_index_ji( j, i, 's' ) )
 !
 !--             Determine largest topography index on u grid
                 nzt_topo_nestbc_s = MAX( nzt_topo_nestbc_s,                    &
-                                         get_topography_top_index_ji( j, i, 'u' ) )
+                                    get_topography_top_index_ji( j, i, 'u' ) )
 !
 !--             Determine largest topography index on v grid
                 nzt_topo_nestbc_s = MAX( nzt_topo_nestbc_s,                    &
-                                         get_topography_top_index_ji( j, i, 'v' ) )
+                                    get_topography_top_index_ji( j, i, 'v' ) )
 !
 !--             Determine largest topography index on w grid
                 nzt_topo_nestbc_s = MAX( nzt_topo_nestbc_s,                    &
-                                         get_topography_top_index_ji( j, i, 'w' ) )
+                                    get_topography_top_index_ji( j, i, 'w' ) )
              ENDDO
           ENDDO
@@ -1676,17 +1693,17 @@
 !--             Determine largest topography index on scalar grid
                 nzt_topo_nestbc_n = MAX( nzt_topo_nestbc_n,                    &
-                                         get_topography_top_index_ji( j, i, 's' ) )
+                                    get_topography_top_index_ji( j, i, 's' ) )
 !
 !--             Determine largest topography index on u grid
                 nzt_topo_nestbc_n = MAX( nzt_topo_nestbc_n,                    &
-                                         get_topography_top_index_ji( j, i, 'u' ) )
+                                    get_topography_top_index_ji( j, i, 'u' ) )
 !
 !--             Determine largest topography index on v grid
                 nzt_topo_nestbc_n = MAX( nzt_topo_nestbc_n,                    &
-                                         get_topography_top_index_ji( j, i, 'v' ) )
+                                    get_topography_top_index_ji( j, i, 'v' ) )
 !
 !--             Determine largest topography index on w grid
                 nzt_topo_nestbc_n = MAX( nzt_topo_nestbc_n,                    &
-                                         get_topography_top_index_ji( j, i, 'w' ) )
+                                    get_topography_top_index_ji( j, i, 'w' ) )
           ENDDO
           nzt_topo_nestbc_n = nzt_topo_nestbc_n + 1
@@ -1695,5 +1712,5 @@
 !--    Then determine the maximum number of near-wall nodes per wall point based
 !--    on the grid-spacing ratios.
-       nzt_topo_max = MAX( nzt_topo_nestbc_l, nzt_topo_nestbc_r,                &
+       nzt_topo_max = MAX( nzt_topo_nestbc_l, nzt_topo_nestbc_r,               &
                            nzt_topo_nestbc_s, nzt_topo_nestbc_n )
 !
@@ -1713,6 +1730,6 @@
        z0_topo = roughness_length
 !
-!--    First horizontal walls. Note that also logc_w_? and logc_ratio_w_? need to 
-!--    be allocated and initialized here.
+!--    First horizontal walls. Note that also logc_w_? and logc_ratio_w_? and
+!--    logc_kbounds_* need to be allocated and initialized here.
 !--    Left boundary
        IF ( nest_bound_l )  THEN
@@ -1721,4 +1738,7 @@
           ALLOCATE( logc_v_l(1:2,nzb:nzt_topo_nestbc_l,nys:nyn) )
           ALLOCATE( logc_w_l(1:2,nzb:nzt_topo_nestbc_l,nys:nyn) )
+          ALLOCATE( logc_kbounds_u_l(1:2,nys:nyn) )
+          ALLOCATE( logc_kbounds_v_l(1:2,nys:nyn) )
+          ALLOCATE( logc_kbounds_w_l(1:2,nys:nyn) )
           ALLOCATE( logc_ratio_u_l(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_l,nys:nyn) )
           ALLOCATE( logc_ratio_v_l(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_l,nys:nyn) )
@@ -1778,5 +1798,8 @@
           ALLOCATE( logc_u_r(1:2,nzb:nzt_topo_nestbc_r,nys:nyn) )
           ALLOCATE( logc_v_r(1:2,nzb:nzt_topo_nestbc_r,nys:nyn) )
-          ALLOCATE( logc_w_r(1:2,nzb:nzt_topo_nestbc_r,nys:nyn) )
+          ALLOCATE( logc_w_r(1:2,nzb:nzt_topo_nestbc_r,nys:nyn) )          
+          ALLOCATE( logc_kbounds_u_r(1:2,nys:nyn) )
+          ALLOCATE( logc_kbounds_v_r(1:2,nys:nyn) )
+          ALLOCATE( logc_kbounds_w_r(1:2,nys:nyn) )
           ALLOCATE( logc_ratio_u_r(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_r,nys:nyn) )
           ALLOCATE( logc_ratio_v_r(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_r,nys:nyn) )
@@ -1838,4 +1861,7 @@
           ALLOCATE( logc_v_s(1:2,nzb:nzt_topo_nestbc_s,nxl:nxr) )
           ALLOCATE( logc_w_s(1:2,nzb:nzt_topo_nestbc_s,nxl:nxr) )
+          ALLOCATE( logc_kbounds_u_s(1:2,nxl:nxr) )
+          ALLOCATE( logc_kbounds_v_s(1:2,nxl:nxr) )
+          ALLOCATE( logc_kbounds_w_s(1:2,nxl:nxr) )
           ALLOCATE( logc_ratio_u_s(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_s,nxl:nxr) )
           ALLOCATE( logc_ratio_v_s(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_s,nxl:nxr) )
@@ -1894,4 +1920,7 @@
           ALLOCATE( logc_v_n(1:2,nzb:nzt_topo_nestbc_n,nxl:nxr) )
           ALLOCATE( logc_w_n(1:2,nzb:nzt_topo_nestbc_n,nxl:nxr) )
+          ALLOCATE( logc_kbounds_u_n(1:2,nxl:nxr) )
+          ALLOCATE( logc_kbounds_v_n(1:2,nxl:nxr) )
+          ALLOCATE( logc_kbounds_w_n(1:2,nxl:nxr) )
           ALLOCATE( logc_ratio_u_n(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_n,nxl:nxr) )
           ALLOCATE( logc_ratio_v_n(1:2,0:ncorr-1,nzb:nzt_topo_nestbc_n,nxl:nxr) )
@@ -1955,37 +1984,35 @@
           z0_topo = roughness_length
 
-          kb = 0       ! kb is not used when direction > 1
+          kb = 0       ! kb is not used when direction > 1        
 !        
 !--       Left boundary
-
-!
-!--       Are loglaw-correction parameters also calculated inside topo? 
           IF ( nest_bound_l )  THEN
-
+             logc_kbounds_u_l(1:2,nys:nyn) = 0
+             logc_kbounds_v_l(1:2,nys:nyn) = 0             
+             logc_kbounds_w_l(1:2,nys:nyn) = 0
+             
              direction  = 2
 
              DO  j = nys, nyn
 !
-!--             Determine lowest grid on outer grids for u and w. 
-                k_wall_u_ji   = get_topography_top_index_ji( j,   0, 'u_out' )
-                k_wall_u_ji_p = get_topography_top_index_ji( j+1, 0, 'u_out' )
-                k_wall_u_ji_m = get_topography_top_index_ji( j-1, 0, 'u_out' )
-
-                k_wall_w_ji   = get_topography_top_index_ji( j,   -1, 'w_out' )
-                k_wall_w_ji_p = get_topography_top_index_ji( j+1, -1, 'w_out' )
-                k_wall_w_ji_m = get_topography_top_index_ji( j-1, -1, 'w_out' )
-
-                DO  k = nzb, nzt_topo_nestbc_l
-
-                   i            = 0
-!
-!--                Wall for u on the south side, but not on the north side
-                   IF ( ( k_wall_u_ji > k_wall_u_ji_p ) .AND.                  &
-                        ( k_wall_u_ji == k_wall_u_ji_m ) )                     &
-                   THEN
-                      inc        =  1
-                      wall_index =  j
+!--             Determine the lowest k-indices for u at j,i, j+1,i and j-1,i. 
+                i             = 0
+                k_wall_u_ji   = get_topography_top_index_ji( j,   i, 'u' )
+                k_wall_u_ji_p = get_topography_top_index_ji( j+1, i, 'u' )
+                k_wall_u_ji_m = get_topography_top_index_ji( j-1, i, 'u' )
+!
+!--             Wall for u on the south side.
+                IF ( ( k_wall_u_ji <  k_wall_u_ji_m ) .AND.                    &
+                     ( k_wall_u_ji >= k_wall_u_ji_p ) )  THEN
+                   inc        =  1
+                   wall_index =  j
+!
+!--                Store the kbounds for use in pmci_interp_tril_lr.
+                   logc_kbounds_u_l(1,j) = k_wall_u_ji + 1
+                   logc_kbounds_u_l(2,j) = k_wall_u_ji_m
+                   DO  k = logc_kbounds_u_l(1,j), logc_kbounds_u_l(2,j)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, j, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, j, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -1994,13 +2021,20 @@
                       logc_ratio_u_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-!
-!--                Wall for u on the north side, but not on the south side
-                   IF ( ( k_wall_u_ji > k_wall_u_ji_m ) .AND.                  &
-                        ( k_wall_u_ji == k_wall_u_ji_p ) )  THEN
-                      inc        = -1
-                      wall_index =  j + 1
+                   ENDDO
+                ENDIF
+!
+!--             Wall for u on the north side.
+                IF ( ( k_wall_u_ji <  k_wall_u_ji_p ) .AND.                    &
+                     ( k_wall_u_ji >= k_wall_u_ji_m ) )  THEN
+                   inc        = -1
+                   wall_index =  j + 1
+!
+!--                Store the kbounds for use in pmci_interp_tril_lr.                   
+                   logc_kbounds_u_l(1,j) = k_wall_u_ji + 1
+                   logc_kbounds_u_l(2,j) = k_wall_u_ji_p
+                   DO  k = logc_kbounds_u_l(1,j), logc_kbounds_u_l(2,j)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, j, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, j, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2009,16 +2043,26 @@
                       logc_ratio_u_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-
-                   i  = -1
-!
-!--                Wall for w on the south side, but not on the north side.
-
-                   IF ( ( k_wall_w_ji > k_wall_w_ji_p )  .AND.                 & 
-                        ( k_wall_w_ji == k_wall_w_ji_m ) )  THEN    
-                      inc        =  1
-                      wall_index =  j
+                   ENDDO
+                ENDIF
+!
+!--             Determine the lowest k-indices for w at j,i, j+1,i and j-1,i. 
+                i             = -1
+                k_wall_w_ji   = get_topography_top_index_ji( j,   i, 'w' )
+                k_wall_w_ji_p = get_topography_top_index_ji( j+1, i, 'w' )
+                k_wall_w_ji_m = get_topography_top_index_ji( j-1, i, 'w' )
+!
+!--             Wall for w on the south side.                
+                IF ( ( k_wall_w_ji <  k_wall_w_ji_m ) .AND.                    &
+                     ( k_wall_w_ji >= k_wall_w_ji_p ) )  THEN
+                   inc        =  1
+                   wall_index =  j
+!
+!--                Store the kbounds for use in pmci_interp_tril_lr.
+                   logc_kbounds_w_l(1,j) = k_wall_w_ji + 1
+                   logc_kbounds_w_l(2,j) = k_wall_w_ji_m
+                   DO  k = logc_kbounds_w_l(1,j), logc_kbounds_w_l(2,j)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, j, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, j, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2027,13 +2071,20 @@
                       logc_ratio_w_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-!
-!--                Wall for w on the north side, but not on the south side.
-                   IF ( ( k_wall_w_ji > k_wall_w_ji_m )  .AND.                 &
-                        ( k_wall_w_ji == k_wall_w_ji_p ) )  THEN
-                      inc        = -1
-                      wall_index =  j+1
+                   ENDDO
+                ENDIF
+!
+!--             Wall for w on the north side.
+                IF ( ( k_wall_w_ji <  k_wall_w_ji_p ) .AND.                    &
+                     ( k_wall_w_ji >= k_wall_w_ji_m ) )  THEN
+                   inc        = -1
+                   wall_index =  j+1
+!
+!--                Store the kbounds for use in pmci_interp_tril_lr.
+                   logc_kbounds_w_l(1,j) = k_wall_w_ji + 1
+                   logc_kbounds_w_l(2,j) = k_wall_w_ji_p
+                   DO  k = logc_kbounds_w_l(1,j), logc_kbounds_w_l(2,j)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, j, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, j, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2042,7 +2093,7 @@
                       logc_ratio_w_l(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-
-                ENDDO
+                   ENDDO
+                ENDIF
+                   
              ENDDO
 
@@ -2051,28 +2102,30 @@
 !--       Right boundary
           IF ( nest_bound_r )  THEN
+             logc_kbounds_u_r(1:2,nys:nyn) = 0
+             logc_kbounds_v_r(1:2,nys:nyn) = 0             
+             logc_kbounds_w_r(1:2,nys:nyn) = 0
 
              direction  = 2
-             i  = nxr + 1
+             i  = nx + 1
 
              DO  j = nys, nyn
 !
-!--             Determine lowest grid on outer grids for u and w. 
-                k_wall_u_ji   = get_topography_top_index_ji( j,   i, 'u_out' )
-                k_wall_u_ji_p = get_topography_top_index_ji( j+1, i, 'u_out' )
-                k_wall_u_ji_m = get_topography_top_index_ji( j-1, i, 'u_out' )
-
-                k_wall_w_ji   = get_topography_top_index_ji( j,   i, 'w_out' )
-                k_wall_w_ji_p = get_topography_top_index_ji( j+1, i, 'w_out' )
-                k_wall_w_ji_m = get_topography_top_index_ji( j-1, i, 'w_out' )
-
-                DO  k = nzb, nzt_topo_nestbc_r
-!
-!--                Wall for u on the south side, but not on the north side
-                   IF ( ( k_wall_u_ji > k_wall_u_ji_p )  .AND.                 &
-                        ( k_wall_u_ji == k_wall_u_ji_m ) )  THEN
-                      inc        = 1
-                      wall_index = j
+!--             Determine the lowest k-indices for u at j,i, j+1,i and j-1,i. 
+                k_wall_u_ji   = get_topography_top_index_ji( j,   i, 'u' )
+                k_wall_u_ji_p = get_topography_top_index_ji( j+1, i, 'u' )
+                k_wall_u_ji_m = get_topography_top_index_ji( j-1, i, 'u' )
+!
+!--             Wall for u on the south side.
+                IF ( ( k_wall_u_ji <  k_wall_u_ji_m ) .AND.                    &
+                     ( k_wall_u_ji >= k_wall_u_ji_p ) )  THEN
+                   inc        =  1
+                   wall_index =  j
+!
+!--                Store the kbounds for use in pmci_interp_tril_lr.                  
+                   logc_kbounds_u_r(1,j) = k_wall_u_ji + 1
+                   logc_kbounds_u_r(2,j) = k_wall_u_ji_m
+                   DO  k = logc_kbounds_u_r(1,j), logc_kbounds_u_r(2,j)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, j, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, j, inc, wall_index, z0_topo, kb, direction, ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2081,13 +2134,20 @@
                       logc_ratio_u_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-!
-!--                Wall for u on the north side, but not on the south side
-                   IF ( ( k_wall_u_ji > k_wall_u_ji_m )  .AND.                  &
-                        ( k_wall_u_ji == k_wall_u_ji_p ) )  THEN
-                      inc        = -1
-                      wall_index =  j+1
-                      CALL pmci_define_loglaw_correction_parameters( lc, lcr,   &
-                          k, j, inc, wall_index, z0_topo, kb, direction, ncorr )
+                   ENDDO
+                ENDIF
+!
+!--             Wall for u on the south side.
+                IF ( ( k_wall_u_ji <  k_wall_u_ji_p ) .AND.                    &
+                     ( k_wall_u_ji >= k_wall_u_ji_m ) )  THEN
+                   inc        = -1
+                   wall_index =  j + 1                 
+!
+!--                Store the kbounds for use in pmci_interp_tril_lr.                   
+                   logc_kbounds_u_r(1,j) = k_wall_u_ji + 1
+                   logc_kbounds_u_r(2,j) = k_wall_u_ji_p
+                   DO  k = logc_kbounds_u_r(1,j), logc_kbounds_u_r(2,j)
+                      CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
+                           k, j, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2096,13 +2156,25 @@
                       logc_ratio_u_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-!
-!--                Wall for w on the south side, but not on the north side
-                   IF ( ( k_wall_w_ji > k_wall_w_ji_p )  .AND.                 &
-                        ( k_wall_w_ji == k_wall_w_ji_m ) )  THEN
-                      inc        =  1
-                      wall_index =  j
+                   ENDDO
+                ENDIF
+!
+!--             Determine the lowest k-indices for w at j,i, j+1,i and j-1,i. 
+                k_wall_w_ji   = get_topography_top_index_ji( j,   i, 'w' )
+                k_wall_w_ji_p = get_topography_top_index_ji( j+1, i, 'w' )
+                k_wall_w_ji_m = get_topography_top_index_ji( j-1, i, 'w' )
+!
+!--             Wall for w on the south side.                
+                IF ( ( k_wall_w_ji <  k_wall_w_ji_m ) .AND.                    &
+                     ( k_wall_w_ji >= k_wall_w_ji_p ) )  THEN
+                   inc        =  1
+                   wall_index =  j
+!
+!--                Store the kbounds for use in pmci_interp_tril_lr.                    
+                   logc_kbounds_w_r(1,j) = k_wall_w_ji + 1
+                   logc_kbounds_w_r(2,j) = k_wall_w_ji_m
+                   DO  k = logc_kbounds_w_r(1,j), logc_kbounds_w_r(2,j)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, j, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, j, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2111,13 +2183,20 @@
                       logc_ratio_w_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-!
-!--                Wall for w on the north side, but not on the south side
-                   IF ( ( k_wall_w_ji > k_wall_w_ji_m )  .AND.                 &
-                        ( k_wall_w_ji == k_wall_w_ji_p ) )  THEN
-                      inc        = -1
-                      wall_index =  j+1
+                   ENDDO
+                ENDIF
+!
+!--             Wall for w on the north side.
+                IF ( ( k_wall_w_ji <  k_wall_w_ji_p ) .AND.                    &
+                     ( k_wall_w_ji >= k_wall_w_ji_m ) )  THEN
+                   inc        = -1
+                   wall_index =  j+1
+!
+!--                Store the kbounds for use in pmci_interp_tril_lr.                   
+                   logc_kbounds_w_r(1,j) = k_wall_w_ji + 1
+                   logc_kbounds_w_r(2,j) = k_wall_w_ji_p
+                   DO  k = logc_kbounds_w_r(1,j), logc_kbounds_w_r(2,j)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, j, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, j, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2126,13 +2205,16 @@
                       logc_ratio_w_r(2,0:ncorr-1,k,j) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-
-                ENDDO
+                   ENDDO
+                ENDIF
+                   
              ENDDO
-
+             
           ENDIF   !  IF ( nest_bound_r )
 !        
 !--       South boundary
           IF ( nest_bound_s )  THEN
+             logc_kbounds_u_s(1:2,nxl:nxr) = 0
+             logc_kbounds_v_s(1:2,nxl:nxr) = 0
+             logc_kbounds_w_s(1:2,nxl:nxr) = 0
 
              direction  = 3
@@ -2140,23 +2222,23 @@
              DO  i = nxl, nxr
 !
-!--             Determine lowest grid on outer grids for v and w. 
-                k_wall_v_ji   = get_topography_top_index_ji( 0, i,   'v_out' )
-                k_wall_v_ji_p = get_topography_top_index_ji( 0, i+1, 'v_out' )
-                k_wall_v_ji_m = get_topography_top_index_ji( 0, i-1, 'v_out' )
-
-                k_wall_w_ji   = get_topography_top_index_ji( -1, i,   'w_out' )
-                k_wall_w_ji_p = get_topography_top_index_ji( -1, i+1, 'w_out' )
-                k_wall_w_ji_m = get_topography_top_index_ji( -1, i-1, 'w_out' )
-
-                DO  k = nzb, nzt_topo_nestbc_s
-!
-!--                Wall for v on the left side, but not on the right side
-                   j  = 0
-                   IF ( ( k_wall_v_ji > k_wall_v_ji_p )  .AND.                 &
-                        ( k_wall_v_ji == k_wall_v_ji_m ) )  THEN
-                      inc        =  1
-                      wall_index =  i
+!--             Determine the lowest k-indices for v at j,i, j,i+1 and j,i-1.
+                j             = 0                
+                k_wall_v_ji   = get_topography_top_index_ji( j, i,   'v' )
+                k_wall_v_ji_p = get_topography_top_index_ji( j, i+1, 'v' )
+                k_wall_v_ji_m = get_topography_top_index_ji( j, i-1, 'v' )
+!
+!--             Wall for v on the left side.
+                IF ( ( k_wall_v_ji <  k_wall_v_ji_m ) .AND.                    &
+                     ( k_wall_v_ji >= k_wall_v_ji_p ) )  THEN
+                   inc        =  1
+                   wall_index =  i
+!
+!--                Store the kbounds for use in pmci_interp_tril_sn.                    
+                   logc_kbounds_v_s(1,i) = k_wall_v_ji + 1
+                   logc_kbounds_v_s(2,i) = k_wall_v_ji_m
+                   DO  k = logc_kbounds_v_s(1,i), logc_kbounds_v_s(2,i)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, i, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, i, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2165,14 +2247,20 @@
                       logc_ratio_v_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-!
-!--                Wall for v on the right side, but not on the left side
-                   j  = 0
-                   IF ( ( k_wall_v_ji > k_wall_v_ji_m )  .AND.                 &
-                        ( k_wall_v_ji == k_wall_v_ji_p ) )  THEN
-                      inc        = -1
-                      wall_index =  i+1
+                   ENDDO
+                ENDIF
+!
+!--             Wall for v on the right side.
+                IF ( ( k_wall_v_ji <  k_wall_v_ji_p ) .AND.                    &
+                     ( k_wall_v_ji >= k_wall_v_ji_m ) )  THEN
+                   inc        = -1
+                   wall_index =  i+1
+!
+!--                Store the kbounds for use in pmci_interp_tril_sn.                   
+                   logc_kbounds_v_s(1,i) = k_wall_v_ji + 1
+                   logc_kbounds_v_s(2,i) = k_wall_v_ji_p
+                   DO  k = logc_kbounds_v_s(1,i), logc_kbounds_v_s(2,i)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, i, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, i, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2181,14 +2269,26 @@
                       logc_ratio_v_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-!
-!--                Wall for w on the left side, but not on the right side
-                   j  = -1
-                   IF ( ( k_wall_w_ji > k_wall_w_ji_p )  .AND.                 &
-                        ( k_wall_w_ji == k_wall_w_ji_m ) )  THEN
-                      inc        =  1
-                      wall_index =  i
+                   ENDDO
+                ENDIF
+!
+!--             Determine the lowest k-indices for w at j,i, j,i+1 and j,i-1. 
+                j             = -1
+                k_wall_w_ji   = get_topography_top_index_ji( j, i,   'w' )
+                k_wall_w_ji_p = get_topography_top_index_ji( j, i+1, 'w' )
+                k_wall_w_ji_m = get_topography_top_index_ji( j, i-1, 'w' )
+!
+!--             Wall for w on the left side.
+                IF ( ( k_wall_w_ji <  k_wall_w_ji_m ) .AND.                    &
+                     ( k_wall_w_ji >= k_wall_w_ji_p ) )  THEN
+                   inc        =  1
+                   wall_index =  i
+!
+!--                Store the kbounds for use in pmci_interp_tril_sn.
+                   logc_kbounds_w_s(1,i) = k_wall_w_ji + 1
+                   logc_kbounds_w_s(2,i) = k_wall_w_ji_m
+                   DO  k = logc_kbounds_w_s(1,i), logc_kbounds_w_s(2,i)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, i, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, i, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2197,15 +2297,20 @@
                       logc_ratio_w_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-
-!
-!--                Wall for w on the right side, but not on the left side
-                   j  = -1
-                   IF ( ( k_wall_w_ji > k_wall_w_ji_m )  .AND.                 &
-                        ( k_wall_w_ji == k_wall_w_ji_p ) )  THEN
-                      inc        = -1
-                      wall_index =  i+1
+                   ENDDO
+                ENDIF
+!
+!--             Wall for w on the right side.
+                IF ( ( k_wall_w_ji <  k_wall_w_ji_p ) .AND.                    &
+                     ( k_wall_w_ji >= k_wall_w_ji_m ) )  THEN
+                   inc        = -1
+                   wall_index =  i+1
+!
+!--                Store the kbounds for use in pmci_interp_tril_sn.
+                   logc_kbounds_w_s(1,i) = k_wall_w_ji + 1
+                   logc_kbounds_w_s(2,i) = k_wall_w_ji_p
+                   DO  k = logc_kbounds_w_s(1,i), logc_kbounds_w_s(2,i)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, i, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, i, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2214,7 +2319,7 @@
                       logc_ratio_w_s(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-
-                ENDDO
+                   ENDDO
+                ENDIF
+
              ENDDO
 
@@ -2223,28 +2328,31 @@
 !--       North boundary
           IF ( nest_bound_n )  THEN
+             logc_kbounds_u_n(1:2,nxl:nxr) = 0             
+             logc_kbounds_v_n(1:2,nxl:nxr) = 0
+             logc_kbounds_w_n(1:2,nxl:nxr) = 0
 
              direction  = 3
-             j  = nyn + 1
+             j  = ny + 1
 
              DO  i = nxl, nxr
 !
-!--             Determine lowest grid on outer grids for v and w. 
-                k_wall_v_ji   = get_topography_top_index_ji( j, i,   'v_out' )
-                k_wall_v_ji_p = get_topography_top_index_ji( j, i+1, 'v_out' )
-                k_wall_v_ji_m = get_topography_top_index_ji( j, i-1, 'v_out' )
-
-                k_wall_w_ji   = get_topography_top_index_ji( j, i,   'w_out' )
-                k_wall_w_ji_p = get_topography_top_index_ji( j, i+1, 'w_out' )
-                k_wall_w_ji_m = get_topography_top_index_ji( j, i-1, 'w_out' )
-
-                DO  k = nzb, nzt_topo_nestbc_n
-!
-!--                Wall for v on the left side, but not on the right side
-                   IF ( ( k_wall_v_ji > k_wall_v_ji_p )  .AND.                 &
-                        ( k_wall_v_ji == k_wall_v_ji_m ) )  THEN
-                      inc        = 1
-                      wall_index = i
+!--             Determine the lowest k-indices for v at j,i, j,i+1 and j,i-1
+                k_wall_v_ji   = get_topography_top_index_ji( j, i,   'v' )
+                k_wall_v_ji_p = get_topography_top_index_ji( j, i+1, 'v' )
+                k_wall_v_ji_m = get_topography_top_index_ji( j, i-1, 'v' )
+!
+!--             Wall for v on the left side.
+                IF ( ( k_wall_v_ji <  k_wall_v_ji_m ) .AND.                    &
+                     ( k_wall_v_ji >= k_wall_v_ji_p ) )  THEN
+                   inc        = 1
+                   wall_index = i                   
+!
+!--                Store the kbounds for use in pmci_interp_tril_sn.
+                   logc_kbounds_v_n(1,i) = k_wall_v_ji + 1
+                   logc_kbounds_v_n(2,i) = k_wall_v_ji_m
+                   DO  k = logc_kbounds_v_n(1,i), logc_kbounds_v_n(2,i)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, i, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, i, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2253,13 +2361,20 @@
                       logc_ratio_v_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-!
-!--                Wall for v on the right side, but not on the left side
-                   IF ( ( k_wall_v_ji > k_wall_v_ji_m )  .AND.                 &
-                        ( k_wall_v_ji == k_wall_v_ji_p ) )  THEN
-                      inc        = -1
-                      wall_index =  i + 1
+                   ENDDO
+                ENDIF
+!
+!--             Wall for v on the right side.
+                IF ( ( k_wall_v_ji <  k_wall_v_ji_p ) .AND.                    &
+                     ( k_wall_v_ji >= k_wall_v_ji_m ) )  THEN
+                   inc        = -1
+                   wall_index =  i + 1
+!
+!--                Store the kbounds for use in pmci_interp_tril_sn.
+                   logc_kbounds_v_n(1,i) = k_wall_v_ji + 1
+                   logc_kbounds_v_n(2,i) = k_wall_v_ji_p
+                   DO  k = logc_kbounds_v_n(1,i), logc_kbounds_v_n(2,i)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, i, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, i, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2268,13 +2383,25 @@
                       logc_ratio_v_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-!
-!--                Wall for w on the left side, but not on the right side
-                   IF ( ( k_wall_v_ji > k_wall_v_ji_p )  .AND.                 &
-                        ( k_wall_v_ji == k_wall_v_ji_m ) )  THEN
-                      inc        = 1
-                      wall_index = i
+                   ENDDO
+                ENDIF
+!
+!--             Determine the lowest k-indices for w at j,i, j,i+1 and j,i-1.
+                k_wall_w_ji   = get_topography_top_index_ji( j, i,   'w' )
+                k_wall_w_ji_p = get_topography_top_index_ji( j, i+1, 'w' )
+                k_wall_w_ji_m = get_topography_top_index_ji( j, i-1, 'w' )                   
+!
+!--             Wall for w on the left side.
+                IF ( ( k_wall_w_ji <  k_wall_w_ji_m ) .AND.                    &
+                     ( k_wall_w_ji >= k_wall_w_ji_p ) )  THEN
+                   inc        = 1
+                   wall_index = i
+!
+!--                Store the kbounds for use in pmci_interp_tril_sn.
+                   logc_kbounds_w_n(1,i) = k_wall_w_ji + 1
+                   logc_kbounds_w_n(2,i) = k_wall_w_ji_m
+                   DO  k = logc_kbounds_w_n(1,i), logc_kbounds_w_n(2,i)
                       CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
-                          k, i, inc, wall_index, z0_topo, kb, direction, ncorr )
+                           k, i, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2283,13 +2410,20 @@
                       logc_ratio_w_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-!
-!--                Wall for w on the right side, but not on the left side
-                   IF ( ( k_wall_v_ji > k_wall_v_ji_m )  .AND.                 &
-                        ( k_wall_v_ji == k_wall_v_ji_p ) )  THEN
-                      inc        = -1
-                      wall_index =  i+1
-                      CALL pmci_define_loglaw_correction_parameters( lc, lcr,   &
-                          k, i, inc, wall_index, z0_topo, kb, direction, ncorr )
+                   ENDDO
+                ENDIF
+!
+!--             Wall for w on the right side, but not on the left side
+                IF ( ( k_wall_w_ji <  k_wall_w_ji_p ) .AND.                    &
+                     ( k_wall_w_ji >= k_wall_w_ji_m ) )  THEN
+                   inc        = -1
+                   wall_index =  i+1
+!
+!--                Store the kbounds for use in pmci_interp_tril_sn.
+                   logc_kbounds_w_n(1,i) = k_wall_w_ji + 1
+                   logc_kbounds_w_n(2,i) = k_wall_w_ji_p
+                   DO  k = logc_kbounds_w_n(1,i), logc_kbounds_w_n(2,i)
+                      CALL pmci_define_loglaw_correction_parameters( lc, lcr,  &
+                           k, i, inc, wall_index, z0_topo, kb, direction,      &
+                           ncorr )
 !
 !--                   The direction of the wall-normal index is stored as the
@@ -2298,7 +2432,7 @@
                       logc_ratio_w_n(2,0:ncorr-1,k,i) = lcr(0:ncorr-1)
                       lcr(0:ncorr-1) = 1.0_wp
-                   ENDIF
-
-                ENDDO
+                   ENDDO
+                ENDIF
+
              ENDDO
 
@@ -2311,6 +2445,6 @@
 
 
-    SUBROUTINE pmci_define_loglaw_correction_parameters( lc, lcr, k, ij, inc,   &
-                                        wall_index, z0_l, kb, direction, ncorr )
+    SUBROUTINE pmci_define_loglaw_correction_parameters( lc, lcr, k, ij, inc,  &
+         wall_index, z0_l, kb, direction, ncorr )
 
        IMPLICIT NONE
@@ -2365,5 +2499,5 @@
                 corr_index = ij + lcorr   ! In this case (direction = 2) ij is j
                 IF ( lcorr == 0 )  THEN
-                   CALL pmci_find_logc_pivot_j( lc, logvelc1, ij, wall_index,   &
+                   CALL pmci_find_logc_pivot_j( lc, logvelc1, ij, wall_index,  &
                                                 z0_l, inc )
                 ENDIF
@@ -2372,6 +2506,6 @@
 !--             valid in both directions
                 IF ( inc * corr_index < inc * lc )  THEN
-                   lcr(alcorr) = LOG( ABS( coord_y(corr_index) + 0.5_wp * dy    &
-                                         - coord_y(wall_index) ) / z0_l )       &
+                   lcr(alcorr) = LOG( ABS( coord_y(corr_index) + 0.5_wp * dy   &
+                                         - coord_y(wall_index) ) / z0_l )      &
                                  / logvelc1
                    more = .TRUE.
@@ -2391,5 +2525,5 @@
                 corr_index = ij + lcorr   ! In this case (direction = 3) ij is i
                 IF ( lcorr == 0 )  THEN
-                   CALL pmci_find_logc_pivot_i( lc, logvelc1, ij, wall_index,   &
+                   CALL pmci_find_logc_pivot_i( lc, logvelc1, ij, wall_index,  &
                                                 z0_l, inc )
                 ENDIF
@@ -2398,6 +2532,6 @@
 !--             valid in both directions
                 IF ( inc * corr_index < inc * lc )  THEN
-                   lcr(alcorr) = LOG( ABS( coord_x(corr_index) + 0.5_wp * dx    &
-                                         - coord_x(wall_index) ) / z0_l )       &
+                   lcr(alcorr) = LOG( ABS( coord_x(corr_index) + 0.5_wp * dx   &
+                                         - coord_x(wall_index) ) / z0_l )      &
                                  / logvelc1
                    more = .TRUE.
@@ -3995,4 +4129,5 @@
                                        r1yo, r2yo, r1zo, r2zo,                 &
                                        logc_u_l, logc_ratio_u_l,               &
+                                       logc_kbounds_u_l,                       &
                                        nzt_topo_nestbc_l, 'l', 'u' )
 
@@ -4000,4 +4135,5 @@
                                        r1yv, r2yv, r1zo, r2zo,                 &
                                        logc_v_l, logc_ratio_v_l,               &
+                                       logc_kbounds_v_l,                       &               
                                        nzt_topo_nestbc_l, 'l', 'v' )
 
@@ -4005,9 +4141,11 @@
                                        r1yo, r2yo, r1zw, r2zw,                 &
                                        logc_w_l, logc_ratio_w_l,               &
+                                       logc_kbounds_w_l,                       &
                                        nzt_topo_nestbc_l, 'l', 'w' )
 
              CALL pmci_interp_tril_lr( e,  ec,  ico, jco, kco, r1xo, r2xo,     &
                                        r1yo, r2yo, r1zo, r2zo,                 &
-                                       logc_u_l, logc_ratio_u_l,               &
+                                       logc_w_l, logc_ratio_w_l,               &
+                                       logc_kbounds_w_l,                       &
                                        nzt_topo_nestbc_l, 'l', 'e' )
 
@@ -4015,5 +4153,6 @@
                 CALL pmci_interp_tril_lr( pt, ptc, ico, jco, kco, r1xo, r2xo,  &
                                           r1yo, r2yo, r1zo, r2zo,              &
-                                          logc_u_l, logc_ratio_u_l,            &
+                                          logc_w_l, logc_ratio_w_l,            &
+                                          logc_kbounds_w_l,                    &                
                                           nzt_topo_nestbc_l, 'l', 's' )
              ENDIF
@@ -4023,33 +4162,34 @@
                 CALL pmci_interp_tril_lr( q, q_c, ico, jco, kco, r1xo, r2xo,   &
                                           r1yo, r2yo, r1zo, r2zo,              &
-                                          logc_u_l, logc_ratio_u_l,            &
+                                          logc_w_l, logc_ratio_w_l,            &
+                                          logc_kbounds_w_l,                    &
                                           nzt_topo_nestbc_l, 'l', 's' )
 
                 IF ( cloud_physics  .AND.  microphysics_morrison )  THEN
-                   CALL pmci_interp_tril_lr( qc, qcc, ico, jco, kco, r1xo, r2xo,&
-                                             r1yo, r2yo, r1zo, r2zo,            &
-                                             logc_u_l,                          &
-                                             logc_ratio_u_l, nzt_topo_nestbc_l, &
-                                             'l', 's' )  
-
-                   CALL pmci_interp_tril_lr( nc, ncc, ico, jco, kco, r1xo, r2xo,&
-                                             r1yo, r2yo, r1zo, r2zo,            &
-                                             logc_u_l,                          &
-                                             logc_ratio_u_l, nzt_topo_nestbc_l, &
-                                             'l', 's' )          
+                   CALL pmci_interp_tril_lr( qc, qcc, ico, jco, kco, r1xo,     &
+                                             r2xo, r1yo, r2yo, r1zo, r2zo,     &
+                                             logc_w_l, logc_ratio_w_l,         &
+                                             logc_kbounds_w_l,                 &
+                                             nzt_topo_nestbc_l, 'l', 's' )  
+
+                   CALL pmci_interp_tril_lr( nc, ncc, ico, jco, kco, r1xo,     &
+                                             r2xo, r1yo, r2yo, r1zo, r2zo,     &
+                                             logc_w_l, logc_ratio_w_l,         &
+                                             logc_kbounds_w_l,                 &
+                                             nzt_topo_nestbc_l, 'l', 's' )          
                 ENDIF
 
                 IF ( cloud_physics  .AND.  microphysics_seifert )  THEN
-                   CALL pmci_interp_tril_lr( qr, qrc, ico, jco, kco, r1xo, r2xo,&
-                                             r1yo, r2yo, r1zo, r2zo,            &
-                                             logc_u_l,                          &
-                                             logc_ratio_u_l, nzt_topo_nestbc_l, &
-                                             'l', 's' ) 
-
-                   CALL pmci_interp_tril_lr( nr, nrc, ico, jco, kco, r1xo, r2xo,&
-                                             r1yo, r2yo, r1zo, r2zo,            &
-                                             logc_u_l,                          &
-                                             logc_ratio_u_l, nzt_topo_nestbc_l, &
-                                             'l', 's' )             
+                   CALL pmci_interp_tril_lr( qr, qrc, ico, jco, kco, r1xo,     &
+                                             r2xo, r1yo, r2yo, r1zo, r2zo,     &
+                                             logc_w_l, logc_ratio_w_l,         &
+                                             logc_kbounds_w_l,                 &
+                                             nzt_topo_nestbc_l, 'l', 's' ) 
+
+                   CALL pmci_interp_tril_lr( nr, nrc, ico, jco, kco, r1xo,     &
+                                             r2xo, r1yo, r2yo, r1zo, r2zo,     &
+                                             logc_w_l, logc_ratio_w_l,         &
+                                             logc_kbounds_w_l,                 &                
+                                             nzt_topo_nestbc_l, 'l', 's' )             
                 ENDIF
 
@@ -4059,5 +4199,6 @@
                 CALL pmci_interp_tril_lr( s, sc, ico, jco, kco, r1xo, r2xo,    &
                                           r1yo, r2yo, r1zo, r2zo,              &
-                                          logc_u_l, logc_ratio_u_l,            &
+                                          logc_w_l, logc_ratio_w_l,            &
+                                          logc_kbounds_w_l,                    & 
                                           nzt_topo_nestbc_l, 'l', 's' )
              ENDIF
@@ -4065,9 +4206,10 @@
              IF ( air_chemistry )  THEN
                 DO  n = 1, nspec
-                   CALL pmci_interp_tril_lr( chem_species(n)%conc,              &
-                                             chem_spec_c(:,:,:,n),              &
-                                             ico, jco, kco, r1xo, r2xo,         &
-                                             r1yo, r2yo, r1zo, r2zo,            &
-                                             logc_u_l, logc_ratio_u_l,          &
+                   CALL pmci_interp_tril_lr( chem_species(n)%conc,             &
+                                             chem_spec_c(:,:,:,n),             &
+                                             ico, jco, kco, r1xo, r2xo,        &
+                                             r1yo, r2yo, r1zo, r2zo,           &
+                                             logc_w_l, logc_ratio_w_l,         &
+                                             logc_kbounds_w_l,                 & 
                                              nzt_topo_nestbc_l, 'l', 's' )
                 ENDDO
@@ -4123,4 +4265,5 @@
                                        r1yo, r2yo, r1zo, r2zo,                 &
                                        logc_u_r, logc_ratio_u_r,               &
+                                       logc_kbounds_u_r,                       &
                                        nzt_topo_nestbc_r, 'r', 'u' )
 
@@ -4128,4 +4271,5 @@
                                        r1yv, r2yv, r1zo, r2zo,                 &
                                        logc_v_r, logc_ratio_v_r,               &
+                                       logc_kbounds_v_r,                       &
                                        nzt_topo_nestbc_r, 'r', 'v' )
 
@@ -4133,9 +4277,11 @@
                                        r1yo, r2yo, r1zw, r2zw,                 &
                                        logc_w_r, logc_ratio_w_r,               &
+                                       logc_kbounds_w_r,                       &
                                        nzt_topo_nestbc_r, 'r', 'w' )
 
              CALL pmci_interp_tril_lr( e,  ec,  ico, jco, kco, r1xo, r2xo,     &
                                        r1yo,r2yo, r1zo, r2zo,                  &
-                                       logc_u_r, logc_ratio_u_r,               &
+                                       logc_w_r, logc_ratio_w_r,               &
+                                       logc_kbounds_w_r,                       &
                                        nzt_topo_nestbc_r, 'r', 'e' )
 
@@ -4144,5 +4290,6 @@
                 CALL pmci_interp_tril_lr( pt, ptc, ico, jco, kco, r1xo, r2xo,  &
                                           r1yo, r2yo, r1zo, r2zo,              &
-                                          logc_u_r, logc_ratio_u_r,            &
+                                          logc_w_r, logc_ratio_w_r,            &
+                                          logc_kbounds_w_r,                    &
                                           nzt_topo_nestbc_r, 'r', 's' )
 
@@ -4152,5 +4299,6 @@
                 CALL pmci_interp_tril_lr( q, q_c, ico, jco, kco, r1xo, r2xo,   &
                                           r1yo, r2yo, r1zo, r2zo,              &
-                                          logc_u_r, logc_ratio_u_r,            &
+                                          logc_w_r, logc_ratio_w_r,            &
+                                          logc_kbounds_w_r,                    &
                                           nzt_topo_nestbc_r, 'r', 's' )
 
@@ -4159,13 +4307,13 @@
                    CALL pmci_interp_tril_lr( qc, qcc, ico, jco, kco, r1xo,     &
                                              r2xo, r1yo, r2yo, r1zo, r2zo,     &
-                                             logc_u_r,                         &
-                                             logc_ratio_u_r, nzt_topo_nestbc_r,&
-                                             'r', 's' ) 
+                                             logc_w_r, logc_ratio_w_r,         &
+                                             logc_kbounds_w_r,                 &
+                                             nzt_topo_nestbc_r, 'r', 's' ) 
      
                    CALL pmci_interp_tril_lr( nc, ncc, ico, jco, kco, r1xo,     &
                                              r2xo, r1yo, r2yo, r1zo, r2zo,     &
-                                             logc_u_r,                         &
-                                             logc_ratio_u_r, nzt_topo_nestbc_r,&
-                                             'r', 's' ) 
+                                             logc_w_r, logc_ratio_w_r,         &
+                                             logc_kbounds_w_r,                 &
+                                             nzt_topo_nestbc_r, 'r', 's' )
 
 
@@ -4177,13 +4325,13 @@
                    CALL pmci_interp_tril_lr( qr, qrc, ico, jco, kco, r1xo,     &
                                              r2xo, r1yo, r2yo, r1zo, r2zo,     &
-                                             logc_u_r,                         &
-                                             logc_ratio_u_r, nzt_topo_nestbc_r,&
-                                             'r', 's' ) 
+                                             logc_w_r, logc_ratio_w_r,         &
+                                             logc_kbounds_w_r,                 &
+                                             nzt_topo_nestbc_r, 'r', 's' ) 
 
                    CALL pmci_interp_tril_lr( nr, nrc, ico, jco, kco, r1xo,     &
                                              r2xo, r1yo, r2yo, r1zo, r2zo,     &
-                                             logc_u_r,                         &
-                                             logc_ratio_u_r, nzt_topo_nestbc_r,&
-                                             'r', 's' ) 
+                                             logc_w_r, logc_ratio_w_r,         &
+                                             logc_kbounds_w_r,                 &
+                                             nzt_topo_nestbc_r, 'r', 's' ) 
 
                 ENDIF
@@ -4194,5 +4342,6 @@
                 CALL pmci_interp_tril_lr( s, sc, ico, jco, kco, r1xo, r2xo,    &
                                           r1yo, r2yo, r1zo, r2zo,              &
-                                          logc_u_r, logc_ratio_u_r,            &
+                                          logc_w_r, logc_ratio_w_r,            &
+                                          logc_kbounds_w_r,                    &
                                           nzt_topo_nestbc_r, 'r', 's' )
 
@@ -4203,5 +4352,6 @@
                                              ico, jco, kco, r1xo, r2xo,        &
                                              r1yo, r2yo, r1zo, r2zo,           &
-                                             logc_u_r, logc_ratio_u_r,         &
+                                             logc_w_r, logc_ratio_w_r,         &
+                                             logc_kbounds_w_r,                 &
                                              nzt_topo_nestbc_r, 'r', 's' )
                 ENDDO
@@ -4254,16 +4404,20 @@
                                        r1yo, r2yo, r1zo, r2zo,                 &
                                        logc_u_s, logc_ratio_u_s,               &
+                                       logc_kbounds_u_s,                       &
                                        nzt_topo_nestbc_s, 's', 'u' )
              CALL pmci_interp_tril_sn( v,  vc,  ico, jcv, kco, r1xo, r2xo,     &
                                        r1yv, r2yv, r1zo, r2zo,                 &
                                        logc_v_s, logc_ratio_v_s,               &
+                                       logc_kbounds_v_s,                       &
                                        nzt_topo_nestbc_s, 's', 'v' )
              CALL pmci_interp_tril_sn( w,  wc,  ico, jco, kcw, r1xo, r2xo,     &
                                        r1yo, r2yo, r1zw, r2zw,                 &
                                        logc_w_s, logc_ratio_w_s,               &
+                                       logc_kbounds_w_s,                       &
                                        nzt_topo_nestbc_s, 's','w' )
              CALL pmci_interp_tril_sn( e,  ec,  ico, jco, kco, r1xo, r2xo,     &
                                        r1yo, r2yo, r1zo, r2zo,                 &
-                                       logc_u_s, logc_ratio_u_s,               &
+                                       logc_w_s, logc_ratio_w_s,               &
+                                       logc_kbounds_w_s,                       &
                                        nzt_topo_nestbc_s, 's', 'e' )
 
@@ -4271,5 +4425,6 @@
                 CALL pmci_interp_tril_sn( pt, ptc, ico, jco, kco, r1xo, r2xo,  &
                                           r1yo, r2yo, r1zo, r2zo,              &
-                                          logc_u_s, logc_ratio_u_s,            &
+                                          logc_w_s, logc_ratio_w_s,            &
+                                          logc_kbounds_w_s,                    &
                                           nzt_topo_nestbc_s, 's', 's' )
              ENDIF
@@ -4278,5 +4433,6 @@
                 CALL pmci_interp_tril_sn( q, q_c, ico, jco, kco, r1xo, r2xo,   &
                                           r1yo,r2yo, r1zo, r2zo,               &
-                                          logc_u_s, logc_ratio_u_s,            &
+                                          logc_w_s, logc_ratio_w_s,            &
+                                          logc_kbounds_w_s,                    &
                                           nzt_topo_nestbc_s, 's', 's' )
 
@@ -4285,13 +4441,13 @@
                    CALL pmci_interp_tril_sn( qc, qcc, ico, jco, kco, r1xo,     &
                                              r2xo, r1yo,r2yo, r1zo, r2zo,      &
-                                             logc_u_s,                         &
-                                             logc_ratio_u_s, nzt_topo_nestbc_s,&
-                                             's', 's' )
+                                             logc_w_s, logc_ratio_w_s,         &
+                                             logc_kbounds_w_s,                 &
+                                             nzt_topo_nestbc_s, 's', 's' )
 
                    CALL pmci_interp_tril_sn( nc, ncc, ico, jco, kco, r1xo,     &
                                              r2xo, r1yo,r2yo, r1zo, r2zo,      &
-                                             logc_u_s,                         &
-                                             logc_ratio_u_s, nzt_topo_nestbc_s,&
-                                             's', 's' )
+                                             logc_w_s, logc_ratio_w_s,         &
+                                             logc_kbounds_w_s,                 &
+                                             nzt_topo_nestbc_s, 's', 's' )
 
                 ENDIF
@@ -4301,13 +4457,13 @@
                    CALL pmci_interp_tril_sn( qr, qrc, ico, jco, kco, r1xo,     &
                                              r2xo, r1yo,r2yo, r1zo, r2zo,      &
-                                             logc_u_s,                         &
-                                             logc_ratio_u_s, nzt_topo_nestbc_s,&
-                                             's', 's' )
+                                             logc_w_s, logc_ratio_w_s,         &
+                                             logc_kbounds_w_s,                 &
+                                             nzt_topo_nestbc_s, 's', 's' )
 
                    CALL pmci_interp_tril_sn( nr, nrc, ico, jco, kco, r1xo,     &
                                              r2xo, r1yo,r2yo, r1zo, r2zo,      &
-                                             logc_u_s,                         &
-                                             logc_ratio_u_s, nzt_topo_nestbc_s,&
-                                             's', 's' )
+                                             logc_w_s, logc_ratio_w_s,         &
+                                             logc_kbounds_w_s,                 &
+                                             nzt_topo_nestbc_s, 's', 's' )
 
                 ENDIF
@@ -4318,5 +4474,6 @@
                 CALL pmci_interp_tril_sn( s, sc, ico, jco, kco, r1xo, r2xo,    &
                                           r1yo,r2yo, r1zo, r2zo,               &
-                                          logc_u_s, logc_ratio_u_s,            &
+                                          logc_w_s, logc_ratio_w_s,            &
+                                          logc_kbounds_w_s,                    &
                                           nzt_topo_nestbc_s, 's', 's' )
              ENDIF
@@ -4328,5 +4485,6 @@
                                              ico, jco, kco, r1xo, r2xo,        &
                                              r1yo, r2yo, r1zo, r2zo,           &
-                                             logc_u_s, logc_ratio_u_s,         &
+                                             logc_w_s, logc_ratio_w_s,         &
+                                             logc_kbounds_w_s,                 &
                                              nzt_topo_nestbc_s, 's', 's' )
                 ENDDO
@@ -4379,9 +4537,11 @@
                                        r1yo, r2yo, r1zo, r2zo,                 &
                                        logc_u_n, logc_ratio_u_n,               &
+                                       logc_kbounds_u_n,                       &
                                        nzt_topo_nestbc_n, 'n', 'u' )
 
              CALL pmci_interp_tril_sn( v,  vc,  ico, jcv, kco, r1xo, r2xo,     &
                                        r1yv, r2yv, r1zo, r2zo,                 &
-                                       logc_v_n, logc_ratio_v_n,               & 
+                                       logc_v_n, logc_ratio_v_n,               &
+                                       logc_kbounds_v_n,                       &
                                        nzt_topo_nestbc_n, 'n', 'v' )
 
@@ -4389,9 +4549,11 @@
                                        r1yo, r2yo, r1zw, r2zw,                 &
                                        logc_w_n, logc_ratio_w_n,               &
+                                       logc_kbounds_w_n,                       &
                                        nzt_topo_nestbc_n, 'n', 'w' )
 
              CALL pmci_interp_tril_sn( e,  ec,  ico, jco, kco, r1xo, r2xo,     &
                                        r1yo, r2yo, r1zo, r2zo,                 &
-                                       logc_u_n, logc_ratio_u_n,               &
+                                       logc_w_n, logc_ratio_w_n,               &
+                                       logc_kbounds_w_n,                       &
                                        nzt_topo_nestbc_n, 'n', 'e' )
 
@@ -4399,5 +4561,6 @@
                 CALL pmci_interp_tril_sn( pt, ptc, ico, jco, kco, r1xo, r2xo,  &
                                           r1yo, r2yo, r1zo, r2zo,              &
-                                          logc_u_n, logc_ratio_u_n,            &
+                                          logc_w_n, logc_ratio_w_n,            &
+                                          logc_kbounds_w_n,                    &
                                           nzt_topo_nestbc_n, 'n', 's' )
              ENDIF
@@ -4406,5 +4569,6 @@
                 CALL pmci_interp_tril_sn( q, q_c, ico, jco, kco, r1xo, r2xo,   &
                                           r1yo, r2yo, r1zo, r2zo,              &
-                                          logc_u_n, logc_ratio_u_n,            &
+                                          logc_w_n, logc_ratio_w_n,            &
+                                          logc_kbounds_w_n,                    &
                                           nzt_topo_nestbc_n, 'n', 's' )
 
@@ -4413,13 +4577,13 @@
                    CALL pmci_interp_tril_sn( qc, qcc, ico, jco, kco, r1xo,     &
                                              r2xo, r1yo, r2yo, r1zo, r2zo,     &
-                                             logc_u_n,                         &
-                                             logc_ratio_u_n, nzt_topo_nestbc_n,& 
-                                             'n', 's' )
+                                             logc_w_n, logc_ratio_w_n,         &
+                                             logc_kbounds_w_n,                 &
+                                             nzt_topo_nestbc_n, 'n', 's' )
 
                    CALL pmci_interp_tril_sn( nc, ncc, ico, jco, kco, r1xo,     &
                                              r2xo, r1yo, r2yo, r1zo, r2zo,     &
-                                             logc_u_n,                         &
-                                             logc_ratio_u_n, nzt_topo_nestbc_n,& 
-                                             'n', 's' )
+                                             logc_u_n, logc_ratio_u_n,         &
+                                             logc_kbounds_w_n,                 &
+                                             nzt_topo_nestbc_n, 'n', 's' )
 
                 ENDIF
@@ -4429,13 +4593,13 @@
                    CALL pmci_interp_tril_sn( qr, qrc, ico, jco, kco, r1xo,     &
                                              r2xo, r1yo, r2yo, r1zo, r2zo,     &
-                                             logc_u_n,                         &
-                                             logc_ratio_u_n, nzt_topo_nestbc_n,& 
-                                             'n', 's' )
+                                             logc_w_n, logc_ratio_w_n,         &
+                                             logc_kbounds_w_n,                 &
+                                             nzt_topo_nestbc_n, 'n', 's' )
 
                    CALL pmci_interp_tril_sn( nr, nrc, ico, jco, kco, r1xo,     &
                                              r2xo, r1yo, r2yo, r1zo, r2zo,     &
-                                             logc_u_n,                         &
-                                             logc_ratio_u_n, nzt_topo_nestbc_n,& 
-                                             'n', 's' )
+                                             logc_w_n, logc_ratio_w_n,         &
+                                             logc_kbounds_w_n,                 &
+                                             nzt_topo_nestbc_n, 'n', 's' )
 
                 ENDIF
@@ -4446,5 +4610,6 @@
                 CALL pmci_interp_tril_sn( s, sc, ico, jco, kco, r1xo, r2xo,    &
                                           r1yo, r2yo, r1zo, r2zo,              &
-                                          logc_u_n, logc_ratio_u_n,            &
+                                          logc_w_n, logc_ratio_w_n,            &
+                                          logc_kbounds_w_n,                    &
                                           nzt_topo_nestbc_n, 'n', 's' )
              ENDIF
@@ -4452,9 +4617,10 @@
              IF ( air_chemistry )  THEN
                 DO  n = 1, nspec
-                   CALL pmci_interp_tril_sn( chem_species(n)%conc,              &
-                                             chem_spec_c(:,:,:,n),              &
-                                             ico, jco, kco, r1xo, r2xo,         &
-                                             r1yo, r2yo, r1zo, r2zo,            &
-                                             logc_u_n, logc_ratio_u_n,          &
+                   CALL pmci_interp_tril_sn( chem_species(n)%conc,             &
+                                             chem_spec_c(:,:,:,n),             &
+                                             ico, jco, kco, r1xo, r2xo,        &
+                                             r1yo, r2yo, r1zo, r2zo,           &
+                                             logc_w_n, logc_ratio_w_n,         &
+                                             logc_kbounds_w_n,                 &
                                              nzt_topo_nestbc_n, 'n', 's' )
                 ENDDO
@@ -4673,7 +4839,7 @@
 
 
-   SUBROUTINE pmci_interp_tril_lr( f, fc, ic, jc, kc, r1x, r2x, r1y, r2y, r1z,  &
-                                   r2z, logc, logc_ratio, nzt_topo_nestbc,      &
-                                   edge, var )
+   SUBROUTINE pmci_interp_tril_lr( f, fc, ic, jc, kc, r1x, r2x, r1y, r2y, r1z, &
+                                   r2z, logc, logc_ratio, logc_kbounds,        &
+                                   nzt_topo_nestbc, edge, var )
 !
 !--   Interpolation of ghost-node values used as the child-domain boundary
@@ -4701,4 +4867,5 @@
       INTEGER(iwp), DIMENSION(1:2,nzb:nzt_topo_nestbc,nys:nyn),                &
                                           INTENT(IN)           ::  logc   !<
+      INTEGER(iwp), DIMENSION(1:2,nys:nyn), INTENT(IN)         ::  logc_kbounds !<
       INTEGER(iwp) ::  nzt_topo_nestbc   !<
 
@@ -4805,9 +4972,5 @@
 !--         Solid surface only on south/north side of the node                   
             DO  j = nys, nyn
-!
-!--            Determine vertical index of topography top at grid point (j,i)
-               k_wall = get_topography_top_index_ji( j, i, TRIM ( var ) )
-
-               DO  k = k_wall+1, nzt_topo_nestbc
+               DO  k = logc_kbounds(1,j), logc_kbounds(2,j)   
                   IF ( ( logc(2,k,j) /= 0 )  .AND.  ( logc(1,k,j) == 0 ) )  THEN
 !
@@ -4830,9 +4993,5 @@
          IF ( var == 'u' )  THEN
             DO  j = nys, nyn
-!
-!--            Determine vertical index of topography top at grid point (j,i)
-               k_wall = get_topography_top_index_ji( j, i, TRIM ( var ) )
-
-               k = k_wall + 1
+               k = logc_kbounds(1,j)
                IF ( ( logc(2,k,j) /= 0 )  .AND.  ( logc(1,k,j) /= 0 ) )  THEN
                   k1   = logc(1,k,j)                 
@@ -4900,5 +5059,5 @@
 
    SUBROUTINE pmci_interp_tril_sn( f, fc, ic, jc, kc, r1x, r2x, r1y, r2y, r1z, &
-                                   r2z, logc, logc_ratio,                   &
+                                   r2z, logc, logc_ratio, logc_kbounds,        &
                                    nzt_topo_nestbc, edge, var )
 
@@ -4928,4 +5087,5 @@
       INTEGER(iwp), DIMENSION(1:2,nzb:nzt_topo_nestbc,nxl:nxr),                &
                                           INTENT(IN)           ::  logc  !<
+      INTEGER(iwp), DIMENSION(1:2,nxl:nxr), INTENT(IN)         ::  logc_kbounds  !< 
       INTEGER(iwp) ::  nzt_topo_nestbc   !<
 
@@ -5028,9 +5188,5 @@
          IF ( var == 'v' .OR. var == 'w' )  THEN
             DO  i = nxl, nxr
-!
-!--            Determine vertical index of topography top at grid point (j,i)
-               k_wall = get_topography_top_index_ji( j, i, TRIM( var ) )
-
-               DO  k = k_wall, nzt_topo_nestbc
+               DO  k = logc_kbounds(1,i), logc_kbounds(2,i)
 !
 !--               Solid surface only on left/right side of the node           
@@ -5055,9 +5211,5 @@
          IF ( var == 'v' )  THEN
             DO  i = nxl, nxr
-!
-!--            Determine vertical index of topography top at grid point (j,i)
-               k_wall = get_topography_top_index_ji( j, i, TRIM( var ) )
-
-               k = k_wall + 1
+               k = logc_kbounds(1,i)
                IF ( ( logc(2,k,i) /= 0 )  .AND.  ( logc(1,k,i) /= 0 ) )  THEN
                   k1   = logc(1,k,i)         
Index: /palm/trunk/SOURCE/surface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/surface_mod.f90	(revision 2811)
+++ /palm/trunk/SOURCE/surface_mod.f90	(revision 2812)
@@ -26,4 +26,8 @@
 ! -----------------
 ! $Id$
+! Entries 'u_out', 'v_out' and 'w_out' removed from the functions
+! get_topography_top_index and get_topography_top_index_ji  
+! 
+! 2805 2018-02-14 17:00:09Z suehring
 ! Bugfix in re-mapping surface elements in case of restart runs 
 ! 
@@ -2103,10 +2107,4 @@
           CASE ( 's_out' )
              ibit = 24
-          CASE ( 'u_out' )
-             ibit = 26
-          CASE ( 'v_out' )
-             ibit = 27
-          CASE ( 'w_out' )
-             ibit = 28
           CASE DEFAULT
 !
@@ -2151,10 +2149,4 @@
           CASE ( 's_out' )
              ibit = 24
-          CASE ( 'u_out' )
-             ibit = 26
-          CASE ( 'v_out' )
-             ibit = 27
-          CASE ( 'w_out' )
-             ibit = 28
           CASE DEFAULT
 !
