Index: /palm/trunk/SCRIPTS/testsuite
===================================================================
--- /palm/trunk/SCRIPTS/testsuite	(revision 2371)
+++ /palm/trunk/SCRIPTS/testsuite	(revision 2372)
@@ -65,5 +65,5 @@
       sed -i -e "s/<replace_with_your_hostname>/${HOSTNAME}/g" ${tester_prefix}/.mrun.config
       sed -i -e "s/<replace_with_your_local_username>/${USER}/g" ${tester_prefix}/.mrun.config
-      sed -i -e "s/<hi>/lcmuk/g" ${tester_prefix}/.mrun.config
+      sed -i -e "s/<hi>/lclocal/g" ${tester_prefix}/.mrun.config
       sed -i -e "s#%base_directory    \$HOME/palm/current_version#%base_directory    ${tester_prefix}#g" ${tester_prefix}/.mrun.config
       sed -i -e "s#%base_data         ~/palm/current_version/JOBS#%base_data         ${tester_prefix}/JOBS#g" ${tester_prefix}/.mrun.config
@@ -81,6 +81,6 @@
    rm -rf ${tester_prefix}/MAKE_DEPOSITORY*
    rm -rf ${tester_prefix}/SOURCES_FOR_RUN_*
-   bash ${trunk_dir}/SCRIPTS/mbuild -h "lcmuk" -K "parallel" -v -u
-   bash ${trunk_dir}/SCRIPTS/mbuild -h "lcmuk" -K "parallel" -v
+   bash ${trunk_dir}/SCRIPTS/mbuild -h "lclocal" -K "parallel" -v -u
+   bash ${trunk_dir}/SCRIPTS/mbuild -h "lclocal" -K "parallel" -v
 }
 
@@ -101,5 +101,5 @@
    cp ${test_dir}/${1}_rc ${monitoring_dir}/${1}_rc_reference
    [[ -f ${test_dir}/${1}_topo ]] && cp ${test_dir}/${1}_topo ${input_dir}/
-   bash ${trunk_dir}/SCRIPTS/mrun -d ${1} -r "d3#" -h "lcmuk" -K "parallel" -X "$NUM_PROC" -T "$NUM_PROC" -v -B > ${monitoring_dir}/${1}_stdout 2>&1
+   bash ${trunk_dir}/SCRIPTS/mrun -d ${1} -r "d3#" -h "lclocal" -K "parallel" -X "$NUM_PROC" -T "$NUM_PROC" -v -B > ${monitoring_dir}/${1}_stdout 2>&1
    grep -A 99999 "Run-control output" ${monitoring_dir}/${1}_rc 1> ${monitoring_dir}/RC 2> /dev/null
    grep -A 99999 "Run-control output" ${monitoring_dir}/${1}_rc_reference 1> ${monitoring_dir}/RC_REF 2> /dev/null
Index: /palm/trunk/SOURCE/init_pegrid.f90
===================================================================
--- /palm/trunk/SOURCE/init_pegrid.f90	(revision 2371)
+++ /palm/trunk/SOURCE/init_pegrid.f90	(revision 2372)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Shifted cyclic boundary conditions implemented
+! 
+! 2365 2017-08-21 14:59:59Z kanani
 ! Vertical nesting implemented (SadiqHuq)
 ! 
@@ -206,5 +209,5 @@
                psolver, outflow_l, outflow_n, outflow_r, outflow_s,            &
                outflow_source_plane, recycling_width, scalar_advec,            &
-               subdomain_size, turbulent_outflow
+               subdomain_size, turbulent_outflow, y_shift
 
     USE grid_variables,                                                        &
@@ -271,5 +274,7 @@
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  nysf    !<
 
-    INTEGER(iwp), DIMENSION(2) :: pdims_remote          !<
+    INTEGER(iwp), DIMENSION(2) ::  pdims_remote         !<
+    INTEGER(iwp)               ::  lcoord(2)            !< PE coordinates of left neighbor along x and y
+    INTEGER(iwp)               ::  rcoord(2)            !< PE coordinates of right neighbor along x and y
 
 !
@@ -339,4 +344,57 @@
     CALL MPI_CART_SHIFT( comm2d, 0, 1, pleft, pright, ierr )
     CALL MPI_CART_SHIFT( comm2d, 1, 1, psouth, pnorth, ierr )
+
+!
+!-- In case of cyclic boundary conditions, a y-shift at the boundaries in
+!-- x-direction can be introduced via parameter y_shift. The shift is done
+!-- by modifying the processor grid in such a way that processors located
+!-- at the x-boundary communicate across it to processors with y-coordinate
+!-- shifted by y_shift relative to their own. This feature can not be used
+!-- in combination with an fft pressure solver. It has been implemented to
+!-- counter the effect of streak structures in case of cyclic boundary
+!-- conditions. For a description of these see Munters
+!-- (2016; dx.doi.org/10.1063/1.4941912)
+!--
+!-- Get coordinates of left and right neighbor on PE grid
+    IF ( y_shift /= 0 ) THEN
+
+       IF ( bc_lr /= 'cyclic'  .OR.  bc_ns /= 'cyclic' )  THEN
+          message_string = 'y_shift /= 0 is only allowed for cyclic ' //       &
+                           'boundary conditions in both directions '
+          CALL message( 'check_parameters', 'PA0467', 1, 2, 0, 6, 0 )
+       ENDIF
+       IF ( TRIM( psolver ) /= 'multigrid' .AND.                               &
+            TRIM( psolver ) /= 'multigrid_noopt')                              &
+       THEN
+          message_string = 'y_shift /= 0 requires a multigrid pressure solver '
+          CALL message( 'check_parameters', 'PA0468', 1, 2, 0, 6, 0 )
+       ENDIF
+
+       CALL MPI_CART_COORDS( comm2d, pright, ndim, rcoord, ierr )
+       CALL MPI_CART_COORDS( comm2d, pleft, ndim, lcoord, ierr )
+
+!
+!--    If the x(y)-coordinate of the right (left) neighbor is smaller (greater)
+!--    than that of the calling process, then the calling process is located on
+!--    the right (left) boundary of the processor grid. In that case,
+!--    the y-coordinate of that neighbor is increased (decreased) by y_shift.
+!--    The rank of the process with that coordinate is then inquired and the
+!--    neighbor rank for MPI_SENDRECV, pright (pleft) is set to it.
+!--    In this way, the calling process receives a new right (left) neighbor
+!--    for all future MPI_SENDRECV calls. That neighbor has a y-coordinate
+!--    of y+(-)y_shift, where y is the original right (left) neighbor's
+!--    y-coordinate. The modulo-operation ensures that if the neighbor's
+!--    y-coordinate exceeds the grid-boundary, it will be relocated to
+!--    the opposite part of the grid cyclicly.
+       IF ( rcoord(1) < pcoord(1) ) THEN
+          rcoord(2) = MODULO( rcoord(2) + y_shift, pdims(2) )
+          CALL MPI_CART_RANK( comm2d, rcoord, pright, ierr )
+       ENDIF
+
+       IF ( lcoord(1) > pcoord(1) ) THEN
+          lcoord(2) = MODULO( lcoord(2) - y_shift, pdims(2) )
+          CALL MPI_CART_RANK( comm2d, lcoord, pleft, ierr )
+       ENDIF
+    ENDIF
 
 !
Index: /palm/trunk/SOURCE/modules.f90
===================================================================
--- /palm/trunk/SOURCE/modules.f90	(revision 2371)
+++ /palm/trunk/SOURCE/modules.f90	(revision 2372)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! y_shift namelist parameter added
+! 
+! 2339 2017-08-07 13:55:26Z gronemeier
 ! corrected timestamp in header
 ! 
@@ -1074,4 +1077,5 @@
     INTEGER(iwp) ::  terminate_coupled_remote = 0      !< switch for steering termination in case of coupled runs (condition of the remote model)
     INTEGER(iwp) ::  timestep_count = 0                !< number of timesteps carried out since the beginning of the initial run
+    INTEGER(iwp) ::  y_shift = 0                       !< namelist parameter
     INTEGER(iwp) ::  dist_nxl(0:1)                               !< left boundary of disturbance region
     INTEGER(iwp) ::  dist_nxr(0:1)                               !< right boundary of disturbance region
Index: /palm/trunk/SOURCE/parin.f90
===================================================================
--- /palm/trunk/SOURCE/parin.f90	(revision 2371)
+++ /palm/trunk/SOURCE/parin.f90	(revision 2372)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! y_shift added to namelist
+! 
+! 2365 2017-08-21 14:59:59Z kanani
 ! Vertical grid nesting: add vnest_start_time to d3par (SadiqHuq)
 ! 
@@ -429,5 +432,6 @@
              vg_vertical_gradient_level, v_bulk, v_profile, ventilation_effect,&
              wall_adjustment, wall_heatflux, wall_humidityflux,                &
-             wall_salinityflux, wall_scalarflux, zeta_max, zeta_min, z0h_factor
+             wall_salinityflux, wall_scalarflux, y_shift, zeta_max, zeta_min,  &
+             z0h_factor
       
     NAMELIST /d3par/  averaging_interval, averaging_interval_pr,               &
Index: /palm/trunk/SOURCE/read_var_list.f90
===================================================================
--- /palm/trunk/SOURCE/read_var_list.f90	(revision 2371)
+++ /palm/trunk/SOURCE/read_var_list.f90	(revision 2372)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! y_shift added to vars, version no. increased
+! 
+! 2365 2017-08-21 14:59:59Z kanani
 ! Vertical grid nesting implemented (SadiqHuq)
 ! 
@@ -269,5 +272,5 @@
 !-- Make version number check first
     READ ( 13 )  version_on_file
-    binary_version = '4.1'
+    binary_version = '4.2'
     IF ( TRIM( version_on_file ) /= TRIM( binary_version ) )  THEN
        WRITE( message_string, * ) 'version mismatch concerning control ', &
@@ -818,4 +821,6 @@
           CASE ( 'w_max_ijk' )
              READ ( 13 )  w_max_ijk
+          CASE ( 'y_shift' )
+             READ ( 13 )  y_shift
           CASE ( 'zeta_max' )
              READ ( 13 )  zeta_max
Index: /palm/trunk/SOURCE/write_var_list.f90
===================================================================
--- /palm/trunk/SOURCE/write_var_list.f90	(revision 2371)
+++ /palm/trunk/SOURCE/write_var_list.f90	(revision 2372)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! y_shift added to vars, version no. increased
+! 
+! 2365 2017-08-21 14:59:59Z kanani
 ! Vertical nesting implemented (SadiqHuq)
 ! 
@@ -235,5 +238,5 @@
 
 
-    binary_version = '4.1'
+    binary_version = '4.2'
 
     WRITE ( 14 )  binary_version
@@ -726,4 +729,6 @@
     WRITE ( 14 )  'w_max_ijk                     '
     WRITE ( 14 )  w_max_ijk
+    WRITE ( 14 )  'y_shift                       '
+    WRITE ( 14 )  y_shift
     WRITE ( 14 )  'zeta_max                      '
     WRITE ( 14 )  zeta_max
