Index: palm/trunk/SOURCE/inflow_turbulence.f90
===================================================================
--- palm/trunk/SOURCE/inflow_turbulence.f90	(revision 1354)
+++ palm/trunk/SOURCE/inflow_turbulence.f90	(revision 1560)
@@ -20,5 +20,7 @@
 ! Current revisions:
 ! -----------------
-! 
+! Option recycling_yshift added. If this option is switched on, the turbulence
+! data, which is mapped from the recycling plane to the inflow, is shifted in
+! y direction (by ny * dy / 2 )
 ! 
 ! Former revisions:
@@ -59,5 +61,5 @@
         
     USE control_parameters,                                                    &
-        ONLY:  recycling_plane
+        ONLY:  recycling_plane, recycling_yshift
         
     USE cpulog,                                                                &
@@ -81,11 +83,13 @@
     INTEGER(iwp) ::  k        !:
     INTEGER(iwp) ::  l        !:
+    INTEGER(iwp) ::  next     !:
     INTEGER(iwp) ::  ngp_ifd  !:
     INTEGER(iwp) ::  ngp_pr   !:
+    INTEGER(iwp) ::  prev     !:
 
     REAL(wp), DIMENSION(nzb:nzt+1,5,nbgp)           ::                         &
        avpr, avpr_l  !:
     REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,5,nbgp) ::                         &
-       inflow_dist   !:
+       inflow_dist, local_inflow_dist  !:
 
     CALL cpu_log( log_point(40), 'inflow_turbulence', 'start' )
@@ -190,5 +194,5 @@
     IF ( myidx == id_recycling  .AND.  myidx /= id_inflow )  THEN
 
-       CALL MPI_SEND( inflow_dist(nzb,nysg,1,1), ngp_ifd, MPI_REAL, &
+       CALL MPI_SEND( inflow_dist(nzb,nysg,1,1), ngp_ifd, MPI_REAL,            &
                       id_inflow, 1, comm1dx, ierr )
 
@@ -196,8 +200,36 @@
 
        inflow_dist = 0.0_wp
-       CALL MPI_RECV( inflow_dist(nzb,nysg,1,1), ngp_ifd, MPI_REAL, &
+       CALL MPI_RECV( inflow_dist(nzb,nysg,1,1), ngp_ifd, MPI_REAL,            &
                       id_recycling, 1, comm1dx, status, ierr )
 
     ENDIF
+
+    
+    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
+
+       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 )
+       
+    ENDIF
+
 #endif
 
@@ -205,24 +237,54 @@
 !-- Add the disturbance at the inflow
     IF ( nxl == 0 )  THEN
-
-       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)  =                             &
+       
+       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 )
+
+             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) + &
+                 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) + &
+                 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 )
-
-          ENDDO
-       ENDDO
-
-    ENDIF
+                 e(k,j,-nbgp:-1)  = MAX( e(k,j,-nbgp:-1), 0.0_wp )
+
+             ENDDO
+          ENDDO
+
+       ENDIF
+    
+    ENDIF
+
 
     CALL cpu_log( log_point(40), 'inflow_turbulence', 'stop' )
