Index: palm/trunk/SOURCE/diffusion_w.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_w.f90	(revision 668)
+++ palm/trunk/SOURCE/diffusion_w.f90	(revision 978)
@@ -4,4 +4,7 @@
 ! Current revisions:
 ! -----------------
+! outflow damping layer removed
+! kmxm_x/_z and kmxp_x/_z change to kmxm and kmxp
+! kmym_y/_z and kmyp_y/_z change to kmym and kmyp
 !
 ! Former revisions:
@@ -54,6 +57,5 @@
 ! Call for all grid points
 !------------------------------------------------------------------------------!
-    SUBROUTINE diffusion_w( ddzu, ddzw, km, km_damp_x, km_damp_y, tend, u, v, &
-                            w )
+    SUBROUTINE diffusion_w( ddzu, ddzw, km, tend, u, v, w )
 
        USE control_parameters
@@ -64,8 +66,6 @@
 
        INTEGER ::  i, j, k
-       REAL    ::  kmxm_x, kmxm_z, kmxp_x, kmxp_z, kmym_y, kmym_z, kmyp_y, &
-                   kmyp_z
-       REAL    ::  ddzu(1:nzt+1), ddzw(1:nzt+1), km_damp_x(nxlg:nxrg),        & 
-                   km_damp_y(nysg:nyng)
+       REAL    ::  kmxm, kmxp, kmym, kmyp
+       REAL    ::  ddzu(1:nzt+1), ddzw(1:nzt+1)
        REAL    ::  tend(nzb:nzt+1,nysg:nyng,nxlg:nxrg)
        REAL, DIMENSION(:,:,:), POINTER ::  km, u, v, w
@@ -88,40 +88,23 @@
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
-                kmxp_x = 0.25 * &
-                         ( km(k,j,i)+km(k,j,i+1)+km(k+1,j,i)+km(k+1,j,i+1) )
-                kmxm_x = 0.25 * &
-                         ( km(k,j,i)+km(k,j,i-1)+km(k+1,j,i)+km(k+1,j,i-1) )
-                kmxp_z = kmxp_x
-                kmxm_z = kmxm_x
-                kmyp_y = 0.25 * &
-                         ( km(k,j,i)+km(k+1,j,i)+km(k,j+1,i)+km(k+1,j+1,i) )
-                kmym_y = 0.25 * &
-                         ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
-                kmyp_z = kmyp_y
-                kmym_z = kmym_y
-!
-!--             Increase diffusion at the outflow boundary in case of
-!--             non-cyclic lateral boundaries. Damping is only needed for
-!--             velocity components parallel to the outflow boundary in
-!--             the direction normal to the outflow boundary.
-                IF ( .NOT. bc_lr_cyc )  THEN
-                   kmxp_x = MAX( kmxp_x, km_damp_x(i) )
-                   kmxm_x = MAX( kmxm_x, km_damp_x(i) )
-                ENDIF
-                IF ( .NOT. bc_ns_cyc )  THEN
-                   kmyp_y = MAX( kmyp_y, km_damp_y(j) )
-                   kmym_y = MAX( kmym_y, km_damp_y(j) )
-                ENDIF
+                kmxp = 0.25 * &
+                       ( km(k,j,i)+km(k,j,i+1)+km(k+1,j,i)+km(k+1,j,i+1) )
+                kmxm = 0.25 * &
+                       ( km(k,j,i)+km(k,j,i-1)+km(k+1,j,i)+km(k+1,j,i-1) )
+                kmyp = 0.25 * &
+                       ( km(k,j,i)+km(k+1,j,i)+km(k,j+1,i)+km(k+1,j+1,i) )
+                kmym = 0.25 * &
+                       ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
 
                 tend(k,j,i) = tend(k,j,i)                                      &
-                      & + ( kmxp_x * ( w(k,j,i+1)   - w(k,j,i)   ) * ddx       &
-                      &   + kmxp_z * ( u(k+1,j,i+1) - u(k,j,i+1) ) * ddzu(k+1) &
-                      &   - kmxm_x * ( w(k,j,i)   - w(k,j,i-1) ) * ddx         &
-                      &   - kmxm_z * ( u(k+1,j,i) - u(k,j,i)   ) * ddzu(k+1)   &
+                      & + ( kmxp * ( w(k,j,i+1)   - w(k,j,i)   ) * ddx         &
+                      &   + kmxp * ( u(k+1,j,i+1) - u(k,j,i+1) ) * ddzu(k+1)   &
+                      &   - kmxm * ( w(k,j,i)   - w(k,j,i-1) ) * ddx           &
+                      &   - kmxm * ( u(k+1,j,i) - u(k,j,i)   ) * ddzu(k+1)     &
                       &   ) * ddx                                              &
-                      & + ( kmyp_y * ( w(k,j+1,i)   - w(k,j,i)   ) * ddy       &
-                      &   + kmyp_z * ( v(k+1,j+1,i) - v(k,j+1,i) ) * ddzu(k+1) &
-                      &   - kmym_y * ( w(k,j,i)   - w(k,j-1,i) ) * ddy         &
-                      &   - kmym_z * ( v(k+1,j,i) - v(k,j,i)   ) * ddzu(k+1)   &
+                      & + ( kmyp * ( w(k,j+1,i)   - w(k,j,i)   ) * ddy         &
+                      &   + kmyp * ( v(k+1,j+1,i) - v(k,j+1,i) ) * ddzu(k+1)   &
+                      &   - kmym * ( w(k,j,i)   - w(k,j-1,i) ) * ddy           &
+                      &   - kmym * ( v(k+1,j,i) - v(k,j,i)   ) * ddzu(k+1)     &
                       &   ) * ddy                                              &
                       & + 2.0 * (                                              &
@@ -138,48 +121,31 @@
 !
 !--                Interpolate eddy diffusivities on staggered gridpoints
-                   kmxp_x = 0.25 * &
-                            ( km(k,j,i)+km(k,j,i+1)+km(k+1,j,i)+km(k+1,j,i+1) )
-                   kmxm_x = 0.25 * &
-                            ( km(k,j,i)+km(k,j,i-1)+km(k+1,j,i)+km(k+1,j,i-1) )
-                   kmxp_z = kmxp_x
-                   kmxm_z = kmxm_x
-                   kmyp_y = 0.25 * &
-                            ( km(k,j,i)+km(k+1,j,i)+km(k,j+1,i)+km(k+1,j+1,i) )
-                   kmym_y = 0.25 * &
-                            ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
-                   kmyp_z = kmyp_y
-                   kmym_z = kmym_y
-!
-!--                Increase diffusion at the outflow boundary in case of
-!--                non-cyclic lateral boundaries. Damping is only needed for
-!--                velocity components parallel to the outflow boundary in
-!--                the direction normal to the outflow boundary.
-                   IF ( .NOT. bc_lr_cyc )  THEN
-                      kmxp_x = MAX( kmxp_x, km_damp_x(i) )
-                      kmxm_x = MAX( kmxm_x, km_damp_x(i) )
-                   ENDIF
-                   IF ( .NOT. bc_ns_cyc )  THEN
-                      kmyp_y = MAX( kmyp_y, km_damp_y(j) )
-                      kmym_y = MAX( kmym_y, km_damp_y(j) )
-                   ENDIF
+                   kmxp = 0.25 * &
+                          ( km(k,j,i)+km(k,j,i+1)+km(k+1,j,i)+km(k+1,j,i+1) )
+                   kmxm = 0.25 * &
+                          ( km(k,j,i)+km(k,j,i-1)+km(k+1,j,i)+km(k+1,j,i-1) )
+                   kmyp = 0.25 * &
+                          ( km(k,j,i)+km(k+1,j,i)+km(k,j+1,i)+km(k+1,j+1,i) )
+                   kmym = 0.25 * &
+                          ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
 
                    tend(k,j,i) = tend(k,j,i)                                   &
                                  + (   fwxp(j,i) * (                           &
-                            kmxp_x * ( w(k,j,i+1)   - w(k,j,i)   ) * ddx       &
-                          + kmxp_z * ( u(k+1,j,i+1) - u(k,j,i+1) ) * ddzu(k+1) &
+                            kmxp * ( w(k,j,i+1)   - w(k,j,i)   ) * ddx         &
+                          + kmxp * ( u(k+1,j,i+1) - u(k,j,i+1) ) * ddzu(k+1)   &
                                                    )                           &
                                      - fwxm(j,i) * (                           &
-                            kmxm_x * ( w(k,j,i)     - w(k,j,i-1) ) * ddx       &
-                          + kmxm_z * ( u(k+1,j,i)   - u(k,j,i)   ) * ddzu(k+1) &
+                            kmxm * ( w(k,j,i)     - w(k,j,i-1) ) * ddx         &
+                          + kmxm * ( u(k+1,j,i)   - u(k,j,i)   ) * ddzu(k+1)   &
                                                    )                           &
                                      + wall_w_x(j,i) * wsus(k,j,i)             &
                                    ) * ddx                                     &
                                  + (   fwyp(j,i) * (                           &
-                            kmyp_y * ( w(k,j+1,i)   - w(k,j,i)   ) * ddy       &
-                          + kmyp_z * ( v(k+1,j+1,i) - v(k,j+1,i) ) * ddzu(k+1) &
+                            kmyp * ( w(k,j+1,i)   - w(k,j,i)   ) * ddy         &
+                          + kmyp * ( v(k+1,j+1,i) - v(k,j+1,i) ) * ddzu(k+1)   &
                                                    )                           &
                                      - fwym(j,i) * (                           &
-                            kmym_y * ( w(k,j,i)     - w(k,j-1,i) ) * ddy       &
-                          + kmym_z * ( v(k+1,j,i)   - v(k,j,i)   ) * ddzu(k+1) &
+                            kmym * ( w(k,j,i)     - w(k,j-1,i) ) * ddy         &
+                          + kmym * ( v(k+1,j,i)   - v(k,j,i)   ) * ddzu(k+1)   &
                                                    )                           &
                                      + wall_w_y(j,i) * wsvs(k,j,i)             &
@@ -201,6 +167,5 @@
 ! Call for grid point i,j
 !------------------------------------------------------------------------------!
-    SUBROUTINE diffusion_w_ij( i, j, ddzu, ddzw, km, km_damp_x, km_damp_y, &
-                               tend, u, v, w )
+    SUBROUTINE diffusion_w_ij( i, j, ddzu, ddzw, km, tend, u, v, w )
 
        USE control_parameters
@@ -211,8 +176,6 @@
 
        INTEGER ::  i, j, k
-       REAL    ::  kmxm_x, kmxm_z, kmxp_x, kmxp_z, kmym_y, kmym_z, kmyp_y, &
-                   kmyp_z
-       REAL    ::  ddzu(1:nzt+1), ddzw(1:nzt+1), km_damp_x(nxlg:nxrg),        & 
-                   km_damp_y(nysg:nyng)
+       REAL    ::  kmxm, kmxp, kmym, kmyp
+       REAL    ::  ddzu(1:nzt+1), ddzw(1:nzt+1)
        REAL    ::  tend(nzb:nzt+1,nysg:nyng,nxlg:nxrg)
        REAL, DIMENSION(nzb:nzt+1)      ::  wsus, wsvs
@@ -223,36 +186,19 @@
 !
 !--       Interpolate eddy diffusivities on staggered gridpoints
-          kmxp_x = 0.25 * ( km(k,j,i)+km(k,j,i+1)+km(k+1,j,i)+km(k+1,j,i+1) )
-          kmxm_x = 0.25 * ( km(k,j,i)+km(k,j,i-1)+km(k+1,j,i)+km(k+1,j,i-1) )
-          kmxp_z = kmxp_x
-          kmxm_z = kmxm_x
-          kmyp_y = 0.25 * ( km(k,j,i)+km(k+1,j,i)+km(k,j+1,i)+km(k+1,j+1,i) )
-          kmym_y = 0.25 * ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
-          kmyp_z = kmyp_y
-          kmym_z = kmym_y
-!
-!--       Increase diffusion at the outflow boundary in case of non-cyclic
-!--       lateral boundaries. Damping is only needed for velocity components
-!--       parallel to the outflow boundary in the direction normal to the
-!--       outflow boundary.
-          IF ( .NOT. bc_lr_cyc )  THEN
-             kmxp_x = MAX( kmxp_x, km_damp_x(i) )
-             kmxm_x = MAX( kmxm_x, km_damp_x(i) )
-          ENDIF
-          IF ( .NOT. bc_ns_cyc )  THEN
-             kmyp_y = MAX( kmyp_y, km_damp_y(j) )
-             kmym_y = MAX( kmym_y, km_damp_y(j) )
-          ENDIF
+          kmxp = 0.25 * ( km(k,j,i)+km(k,j,i+1)+km(k+1,j,i)+km(k+1,j,i+1) )
+          kmxm = 0.25 * ( km(k,j,i)+km(k,j,i-1)+km(k+1,j,i)+km(k+1,j,i-1) )
+          kmyp = 0.25 * ( km(k,j,i)+km(k+1,j,i)+km(k,j+1,i)+km(k+1,j+1,i) )
+          kmym = 0.25 * ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
 
           tend(k,j,i) = tend(k,j,i)                                            &
-                      & + ( kmxp_x * ( w(k,j,i+1)   - w(k,j,i)   ) * ddx       &
-                      &   + kmxp_z * ( u(k+1,j,i+1) - u(k,j,i+1) ) * ddzu(k+1) &
-                      &   - kmxm_x * ( w(k,j,i)   - w(k,j,i-1) ) * ddx         &
-                      &   - kmxm_z * ( u(k+1,j,i) - u(k,j,i)   ) * ddzu(k+1)   &
+                      & + ( kmxp * ( w(k,j,i+1)   - w(k,j,i)   ) * ddx         &
+                      &   + kmxp * ( u(k+1,j,i+1) - u(k,j,i+1) ) * ddzu(k+1)   &
+                      &   - kmxm * ( w(k,j,i)   - w(k,j,i-1) ) * ddx           &
+                      &   - kmxm * ( u(k+1,j,i) - u(k,j,i)   ) * ddzu(k+1)     &
                       &   ) * ddx                                              &
-                      & + ( kmyp_y * ( w(k,j+1,i)   - w(k,j,i)   ) * ddy       &
-                      &   + kmyp_z * ( v(k+1,j+1,i) - v(k,j+1,i) ) * ddzu(k+1) &
-                      &   - kmym_y * ( w(k,j,i)   - w(k,j-1,i) ) * ddy         &
-                      &   - kmym_z * ( v(k+1,j,i) - v(k,j,i)   ) * ddzu(k+1)   &
+                      & + ( kmyp * ( w(k,j+1,i)   - w(k,j,i)   ) * ddy         &
+                      &   + kmyp * ( v(k+1,j+1,i) - v(k,j+1,i) ) * ddzu(k+1)   &
+                      &   - kmym * ( w(k,j,i)   - w(k,j-1,i) ) * ddy           &
+                      &   - kmym * ( v(k+1,j,i) - v(k,j,i)   ) * ddzu(k+1)     &
                       &   ) * ddy                                              &
                       & + 2.0 * (                                              &
@@ -285,44 +231,27 @@
 !
 !--          Interpolate eddy diffusivities on staggered gridpoints
-             kmxp_x = 0.25 * ( km(k,j,i)+km(k,j,i+1)+km(k+1,j,i)+km(k+1,j,i+1) )
-             kmxm_x = 0.25 * ( km(k,j,i)+km(k,j,i-1)+km(k+1,j,i)+km(k+1,j,i-1) )
-             kmxp_z = kmxp_x
-             kmxm_z = kmxm_x
-             kmyp_y = 0.25 * ( km(k,j,i)+km(k+1,j,i)+km(k,j+1,i)+km(k+1,j+1,i) )
-             kmym_y = 0.25 * ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
-             kmyp_z = kmyp_y
-             kmym_z = kmym_y
-!
-!--          Increase diffusion at the outflow boundary in case of
-!--          non-cyclic lateral boundaries. Damping is only needed for
-!--          velocity components parallel to the outflow boundary in
-!--          the direction normal to the outflow boundary.
-             IF ( .NOT. bc_lr_cyc )  THEN
-                kmxp_x = MAX( kmxp_x, km_damp_x(i) )
-                kmxm_x = MAX( kmxm_x, km_damp_x(i) )
-             ENDIF
-             IF ( .NOT. bc_ns_cyc )  THEN
-                kmyp_y = MAX( kmyp_y, km_damp_y(j) )
-                kmym_y = MAX( kmym_y, km_damp_y(j) )
-             ENDIF
+             kmxp = 0.25 * ( km(k,j,i)+km(k,j,i+1)+km(k+1,j,i)+km(k+1,j,i+1) )
+             kmxm = 0.25 * ( km(k,j,i)+km(k,j,i-1)+km(k+1,j,i)+km(k+1,j,i-1) )
+             kmyp = 0.25 * ( km(k,j,i)+km(k+1,j,i)+km(k,j+1,i)+km(k+1,j+1,i) )
+             kmym = 0.25 * ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
 
              tend(k,j,i) = tend(k,j,i)                                         &
                                  + (   fwxp(j,i) * (                           &
-                            kmxp_x * ( w(k,j,i+1)   - w(k,j,i)   ) * ddx       &
-                          + kmxp_z * ( u(k+1,j,i+1) - u(k,j,i+1) ) * ddzu(k+1) &
+                            kmxp * ( w(k,j,i+1)   - w(k,j,i)   ) * ddx         &
+                          + kmxp * ( u(k+1,j,i+1) - u(k,j,i+1) ) * ddzu(k+1)   &
                                                    )                           &
                                      - fwxm(j,i) * (                           &
-                            kmxm_x * ( w(k,j,i)     - w(k,j,i-1) ) * ddx       &
-                          + kmxm_z * ( u(k+1,j,i)   - u(k,j,i)   ) * ddzu(k+1) &
+                            kmxm * ( w(k,j,i)     - w(k,j,i-1) ) * ddx         &
+                          + kmxm * ( u(k+1,j,i)   - u(k,j,i)   ) * ddzu(k+1)   &
                                                    )                           &
                                      + wall_w_x(j,i) * wsus(k)                 &
                                    ) * ddx                                     &
                                  + (   fwyp(j,i) * (                           &
-                            kmyp_y * ( w(k,j+1,i)   - w(k,j,i)   ) * ddy       &
-                          + kmyp_z * ( v(k+1,j+1,i) - v(k,j+1,i) ) * ddzu(k+1) &
+                            kmyp * ( w(k,j+1,i)   - w(k,j,i)   ) * ddy         &
+                          + kmyp * ( v(k+1,j+1,i) - v(k,j+1,i) ) * ddzu(k+1)   &
                                                    )                           &
                                      - fwym(j,i) * (                           &
-                            kmym_y * ( w(k,j,i)     - w(k,j-1,i) ) * ddy       &
-                          + kmym_z * ( v(k+1,j,i)   - v(k,j,i)   ) * ddzu(k+1) &
+                            kmym * ( w(k,j,i)     - w(k,j-1,i) ) * ddy         &
+                          + kmym * ( v(k+1,j,i)   - v(k,j,i)   ) * ddzu(k+1)   &
                                                    )                           &
                                      + wall_w_y(j,i) * wsvs(k)                 &
