Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 1805)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 1806)
@@ -19,6 +19,6 @@
 ! Current revisions:
 ! -----------------
-! 
-! 
+! Check for recycling_yshift
+!
 ! Former revisions:
 ! -----------------
@@ -4148,4 +4148,11 @@
 !--    Calculate the index
        recycling_plane = recycling_width / dx
+!
+!--    Because the y-shift is done with a distance of INT( npey / 2 ) no shift
+!--    is possible if there is only one PE in y direction.
+       IF ( recycling_yshift .AND. pdims(2) < 2 )  THEN
+          WRITE( message_string, * )  'recycling_yshift = .T. requires more',  &
+                                      ' than one processor in y direction'
+          CALL message( 'check_parameters', 'PA0421', 1, 2, 0, 6, 0 )
     ENDIF
 
Index: palm/trunk/SOURCE/inflow_turbulence.f90
===================================================================
--- palm/trunk/SOURCE/inflow_turbulence.f90	(revision 1805)
+++ palm/trunk/SOURCE/inflow_turbulence.f90	(revision 1806)
@@ -19,5 +19,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! Added comments to variables and code segments. Removed code redundancies.
 ! 
 ! Former revisions:
@@ -76,7 +76,4 @@
         ONLY:  cpu_log, log_point
         
-    USE grid_variables,                                                        &
-        ONLY:  
-        
     USE indices,                                                               &
         ONLY:  nbgp, nxl, ny, nyn, nys, nyng, nysg, nzb, nzt
@@ -89,17 +86,21 @@
     IMPLICIT NONE
 
-    INTEGER(iwp) ::  i        !<
-    INTEGER(iwp) ::  j        !<
-    INTEGER(iwp) ::  k        !<
-    INTEGER(iwp) ::  l        !<
-    INTEGER(iwp) ::  next     !<
-    INTEGER(iwp) ::  ngp_ifd  !<
-    INTEGER(iwp) ::  ngp_pr   !<
-    INTEGER(iwp) ::  prev     !<
+    INTEGER(iwp) ::  i        !< loop index
+    INTEGER(iwp) ::  j        !< loop index
+    INTEGER(iwp) ::  k        !< loop index
+    INTEGER(iwp) ::  l        !< loop index
+    INTEGER(iwp) ::  next     !< ID of receiving PE for y-shift
+    INTEGER(iwp) ::  ngp_ifd  !< number of grid points stored in avpr
+    INTEGER(iwp) ::  ngp_pr   !< number of grid points stored in inflow_dist
+    INTEGER(iwp) ::  prev     !< ID of sending PE for y-shift
 
     REAL(wp), DIMENSION(nzb:nzt+1,6,nbgp)           ::                         &
-       avpr, avpr_l  !<
+       avpr               !< stores averaged profiles at recycling plane
+    REAL(wp), DIMENSION(nzb:nzt+1,6,nbgp)           ::                         &
+       avpr_l             !< auxiliary variable to calculate avpr
     REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,6,nbgp) ::                         &
-       inflow_dist, local_inflow_dist  !<
+       inflow_dist        !< turbulence signal of vars, added at inflow boundary
+    REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,6,nbgp) ::                         &
+       local_inflow_dist  !< auxiliary variable for inflow_dist, used for yshift
 
     CALL cpu_log( log_point(40), 'inflow_turbulence', 'start' )
@@ -222,29 +223,31 @@
     ENDIF
 
-    
+!
+!-- y-shift for inflow_dist
+!-- Shift inflow_dist in positive y direction by a distance of INT( npey / 2 )
     IF ( recycling_yshift .AND. myidx == id_inflow ) THEN
-
-       IF ( pdims(2) >= 2 ) THEN
- 
-          IF ( myidy >= INT( pdims(2) / 2 ) ) THEN
-             prev = myidy - INT( pdims(2) / 2 )
-          ELSE
-             prev = pdims(2) - ( INT( pdims(2) / 2 ) - myidy )
-          ENDIF
-        
-          IF ( myidy < pdims(2) - INT( pdims(2) / 2 ) ) THEN
-             next = myidy + INT( pdims(2) / 2 )
-          ELSE
-             next = INT( pdims(2) / 2 ) - ( pdims(2) - myidy )
-          ENDIF
-
+!
+!--    Calculate the ID of the PE which sends data to this PE (prev) and of the
+!--    PE which receives data from this PE (next).
+       IF ( myidy >= INT( pdims(2) / 2 ) ) THEN
+          prev = myidy - INT( pdims(2) / 2 )
+       ELSE
+          prev = pdims(2) - ( INT( pdims(2) / 2 ) - myidy )
        ENDIF
+     
+       IF ( myidy < pdims(2) - INT( pdims(2) / 2 ) ) THEN
+          next = myidy + INT( pdims(2) / 2 )
+       ELSE
+          next = INT( pdims(2) / 2 ) - ( pdims(2) - myidy )
+       ENDIF
 
        local_inflow_dist = 0.0_wp
-    
+
        CALL MPI_SENDRECV( inflow_dist(nzb,nysg,1,1), ngp_ifd, MPI_REAL,        &
                           next, 1, local_inflow_dist(nzb,nysg,1,1), ngp_ifd,   &
                           MPI_REAL, prev, 1, comm1dy, status, ierr )
-       
+
+       inflow_dist = local_inflow_dist
+
     ENDIF
 
@@ -254,61 +257,27 @@
 !-- Add the disturbance at the inflow
     IF ( nxl == 0 )  THEN
-       
-       IF ( recycling_yshift ) THEN       
-
-          DO  j = nysg, nyng
-             DO  k = nzb, nzt + 1
-
-                u(k,j,-nbgp+1:0) = mean_inflow_profiles(k,1) +                 &
-                                   local_inflow_dist(k,j,1,1:nbgp) *           &
-                                   inflow_damping_factor(k)
-                v(k,j,-nbgp:-1)  = mean_inflow_profiles(k,2) +                 &
-                                   local_inflow_dist(k,j,2,1:nbgp) *           &
-                                   inflow_damping_factor(k)
-                w(k,j,-nbgp:-1)  =                                             &
-                                   local_inflow_dist(k,j,3,1:nbgp) *           &
-                                   inflow_damping_factor(k)
-                pt(k,j,-nbgp:-1) = mean_inflow_profiles(k,4) +                 &
-                                   local_inflow_dist(k,j,4,1:nbgp) *           &
-                                   inflow_damping_factor(k)
-                e(k,j,-nbgp:-1)  = mean_inflow_profiles(k,5) +                 &
-                                   local_inflow_dist(k,j,5,1:nbgp) *           &
-                                   inflow_damping_factor(k)
-                e(k,j,-nbgp:-1)  = MAX( e(k,j,-nbgp:-1), 0.0_wp )
-
-                IF ( humidity  .OR.  passive_scalar )                          &
-                   q(k,j,-nbgp:-1)  = mean_inflow_profiles(k,6) +              &
-                                      local_inflow_dist(k,j,6,1:nbgp) *        &
-                                      inflow_damping_factor(k)
-
-             ENDDO
-          ENDDO
-
-       ELSE
-
-          DO  j = nysg, nyng
-             DO  k = nzb, nzt + 1
- 
-                u(k,j,-nbgp+1:0) = mean_inflow_profiles(k,1) +                 &
-                           inflow_dist(k,j,1,1:nbgp) * inflow_damping_factor(k)
-                v(k,j,-nbgp:-1)  = mean_inflow_profiles(k,2) +                 &
-                           inflow_dist(k,j,2,1:nbgp) * inflow_damping_factor(k)
-                w(k,j,-nbgp:-1)  =                                             &
-                           inflow_dist(k,j,3,1:nbgp) * inflow_damping_factor(k)
-                pt(k,j,-nbgp:-1) = mean_inflow_profiles(k,4) +                 &
-                           inflow_dist(k,j,4,1:nbgp) * inflow_damping_factor(k)
-                e(k,j,-nbgp:-1)  = mean_inflow_profiles(k,5) +                 &
-                           inflow_dist(k,j,5,1:nbgp) * inflow_damping_factor(k)
-                e(k,j,-nbgp:-1)  = MAX( e(k,j,-nbgp:-1), 0.0_wp )
-
-                IF ( humidity  .OR.  passive_scalar )                          &
-                   q(k,j,-nbgp:-1)  = mean_inflow_profiles(k,6) +              &
-                           inflow_dist(k,j,6,1:nbgp) * inflow_damping_factor(k)
-
-             ENDDO
-          ENDDO
-
-       ENDIF
-    
+
+       DO  j = nysg, nyng
+          DO  k = nzb, nzt + 1
+
+             u(k,j,-nbgp+1:0) = mean_inflow_profiles(k,1) +                 &
+                        inflow_dist(k,j,1,1:nbgp) * inflow_damping_factor(k)
+             v(k,j,-nbgp:-1)  = mean_inflow_profiles(k,2) +                 &
+                        inflow_dist(k,j,2,1:nbgp) * inflow_damping_factor(k)
+             w(k,j,-nbgp:-1)  =                                             &
+                        inflow_dist(k,j,3,1:nbgp) * inflow_damping_factor(k)
+             pt(k,j,-nbgp:-1) = mean_inflow_profiles(k,4) +                 &
+                        inflow_dist(k,j,4,1:nbgp) * inflow_damping_factor(k)
+             e(k,j,-nbgp:-1)  = mean_inflow_profiles(k,5) +                 &
+                        inflow_dist(k,j,5,1:nbgp) * inflow_damping_factor(k)
+             e(k,j,-nbgp:-1)  = MAX( e(k,j,-nbgp:-1), 0.0_wp )
+
+             IF ( humidity  .OR.  passive_scalar )                          &
+                q(k,j,-nbgp:-1)  = mean_inflow_profiles(k,6) +              &
+                        inflow_dist(k,j,6,1:nbgp) * inflow_damping_factor(k)
+
+          ENDDO
+       ENDDO
+
     ENDIF
 
