Index: palm/trunk/SOURCE/pmc_interface_mod.f90
===================================================================
--- palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 2216)
+++ palm/trunk/SOURCE/pmc_interface_mod.f90	(revision 2219)
@@ -680,5 +680,5 @@
           
 !
-!--       Check that the children domain is completely inside the parent domain. 
+!--       Check that the child domain is completely inside the parent domain. 
              xez = ( nbgp + 1 ) * dx 
              yez = ( nbgp + 1 ) * dy 
@@ -2166,5 +2166,5 @@
      
 !
-!--    Default values:
+!--    Default values for under-relaxation lengths:
        IF ( anterp_relax_length_l < 0.0_wp )  THEN
           anterp_relax_length_l = 0.1_wp * ( nx + 1 ) * dx
@@ -4123,6 +4123,6 @@
 !--   valid anyway in such locations.
       IF ( topography /= 'flat' )  THEN
+
          IF ( var == 'u' .OR. var == 'w' )  THEN                 
-
 !
 !--         Solid surface only on south/north side of the node                   
@@ -4130,5 +4130,4 @@
                DO  k = kb(j,i)+1, nzt_topo_nestbc
                   IF ( ( logc(2,k,j) /= 0 )  .AND.  ( logc(1,k,j) == 0 ) )  THEN
-
 !
 !--                  Direction of the wall-normal index is carried in as the
@@ -4138,5 +4137,7 @@
                      DO  jcorr = 0, ncorr-1
                         jco = j + jinc * jcorr
-                        f(k,jco,i) = logc_ratio(2,jcorr,k,j) * f(k,j1,i)
+                        IF ( jco >= nys .AND. jco <= nyn )  THEN
+                           f(k,jco,i) = logc_ratio(2,jcorr,k,j) * f(k,j1,i)
+                        ENDIF
                      ENDDO
                   ENDIF
@@ -4144,5 +4145,4 @@
             ENDDO
          ENDIF
-
 !
 !--      Solid surface on both below and on south/north side of the node           
@@ -4156,11 +4156,13 @@
                   DO  jcorr = 0, ncorr-1
                      jco = j + jinc * jcorr
-                     DO  kcorr = 0, ncorr-1
-                        kco = k + kcorr
-                        f(kco,jco,i) = 0.5_wp * ( logc_ratio(1,kcorr,k,j) *     &
-                                                  f(k1,j,i)                     &
-                                                + logc_ratio(2,jcorr,k,j) *     &
-                                                  f(k,j1,i) )
-                     ENDDO
+                     IF ( jco >= nys .AND. jco <= nyn )  THEN
+                        DO  kcorr = 0, ncorr-1
+                           kco = k + kcorr
+                           f(kco,jco,i) = 0.5_wp * ( logc_ratio(1,kcorr,k,j) *  &
+                                                     f(k1,j,i)                  &
+                                                   + logc_ratio(2,jcorr,k,j) *  &
+                                                     f(k,j1,i) )
+                        ENDDO
+                     ENDIF
                   ENDDO
                ENDIF
@@ -4324,12 +4326,11 @@
 !--   locations.
       IF ( topography /= 'flat' )  THEN
+
          IF ( var == 'v' .OR. var == 'w' )  THEN
             DO  i = nxl, nxr
                DO  k = kb(j,i), nzt_topo_nestbc
-
 !
 !--               Solid surface only on left/right side of the node           
                   IF ( ( logc(2,k,i) /= 0 )  .AND.  ( logc(1,k,i) == 0 ) )  THEN
-
 !
 !--                  Direction of the wall-normal index is carried in as the
@@ -4339,5 +4340,7 @@
                      DO  icorr = 0, ncorr-1
                         ico = i + iinc * icorr
-                        f(k,j,ico) = logc_ratio(2,icorr,k,i) * f(k,j,i1)
+                        IF ( ico >= nxl .AND. ico <= nxr )  THEN
+                           f(k,j,ico) = logc_ratio(2,icorr,k,i) * f(k,j,i1)
+                        ENDIF
                      ENDDO
                   ENDIF
@@ -4345,5 +4348,4 @@
             ENDDO
          ENDIF
-
 !
 !--      Solid surface on both below and on left/right side of the node           
@@ -4357,11 +4359,13 @@
                   DO  icorr = 0, ncorr-1
                      ico = i + iinc * icorr
-                     DO  kcorr = 0, ncorr-1
-                        kco = k + kcorr
-                        f(kco,i,ico) = 0.5_wp * ( logc_ratio(1,kcorr,k,i) *     &
-                                                  f(k1,j,i)  &
-                                                + logc_ratio(2,icorr,k,i) *     &
-                                                  f(k,j,i1) )
-                     ENDDO
+                     IF ( ico >= nxl .AND. ico <= nxr )  THEN
+                        DO  kcorr = 0, ncorr-1
+                           kco = k + kcorr
+                           f(kco,j,ico) = 0.5_wp * ( logc_ratio(1,kcorr,k,i) *  &
+                                                     f(k1,j,i)                  &
+                                                   + logc_ratio(2,icorr,k,i) *  &
+                                                     f(k,j,i1) )
+                        ENDDO
+                     ENDIF
                   ENDDO
                ENDIF
@@ -4797,5 +4801,6 @@
           DO  jj = jcsp, jcnm
 !
-!--          For simplicity anterpolate within buildings too
+!--          For simplicity anterpolate within buildings and under elevated
+!--          terrain too
              DO  kk = kcb, kct
 !
