Index: palm/trunk/SOURCE/Makefile
===================================================================
--- palm/trunk/SOURCE/Makefile	(revision 1127)
+++ palm/trunk/SOURCE/Makefile	(revision 1128)
@@ -20,5 +20,5 @@
 # Current revisions:
 # ------------------
-# 
+# dependencies for time_integration modified
 #
 # Former revisions:
@@ -353,12 +353,9 @@
 production_e.o: modules.o wall_fluxes.o
 prognostic_equations.o: modules.o advec_s_pw.o advec_s_up.o advec_u_pw.o \
-        advec_ws.o \
 	advec_u_up.o advec_v_pw.o advec_v_up.o advec_w_pw.o advec_w_up.o  \
-	buoyancy.o calc_precipitation.o calc_radiation.o coriolis.o \
+        advec_ws.o buoyancy.o calc_precipitation.o calc_radiation.o coriolis.o \
 	diffusion_e.o diffusion_s.o diffusion_u.o diffusion_v.o diffusion_w.o \
-	eqn_state_seawater.o impact_of_latent_heat.o \
-        plant_canopy_model.o production_e.o \
-	subsidence.o user_actions.o \
-	microphysics.o
+	eqn_state_seawater.o impact_of_latent_heat.o microphysics.o \
+        plant_canopy_model.o production_e.o subsidence.o user_actions.o
 random_gauss.o: random_function.o
 read_3d_binary.o: modules.o random_function.o
@@ -373,6 +370,6 @@
 swap_timelevel.o: modules.o
 temperton_fft.o: modules.o
-time_integration.o: modules.o prognostic_equations.o user_actions.o \
-	interaction_droplets_ptq.o
+time_integration.o: modules.o advec_ws.o buoyancy.o interaction_droplets_ptq.o \
+	production_e.o prognostic_equations.o user_actions.o
 timestep.o: modules.o
 timestep_scheme_steering.o: modules.o
Index: palm/trunk/SOURCE/advec_ws.f90
===================================================================
--- palm/trunk/SOURCE/advec_ws.f90	(revision 1127)
+++ palm/trunk/SOURCE/advec_ws.f90	(revision 1128)
@@ -20,4 +20,6 @@
 ! Current revisions:
 ! ------------------
+! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
+! j_north
 !
 !
@@ -2452,6 +2454,6 @@
        !$acc kernels present( ddzw, sk, tend, u, v, w, wall_flags_0 )
        !$acc loop
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
              !$acc loop vector( 32 )
              DO  k = nzb+1, nzt
@@ -3153,6 +3155,6 @@
        !$acc  kernels present( ddzw, tend, u, v, w, wall_flags_0 )
        !$acc  loop
-       DO i = nxlu, nxr
-          DO  j = nys, nyn
+       DO i = i_left, i_right
+          DO  j = j_south, j_north
              !$acc  loop vector( 32 )
              DO  k = nzb+1, nzt
@@ -3870,6 +3872,6 @@
        !$acc kernels present( ddzw, tend, u, v, w, wall_flags_0 )
        !$acc loop
-       DO  i = nxl, nxr
-          DO  j = nysv, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
              !$acc loop vector( 32 )
              DO  k = nzb+1, nzt
@@ -4565,6 +4567,6 @@
        !$acc kernels present( ddzu, tend, u, v, w, wall_flags_0 )
        !$acc loop
-       DO i = nxl, nxr
-          DO  j = nys, nyn
+       DO i = i_left, i_right
+          DO  j = j_south, j_north
              !$acc loop vector( 32 )
              DO  k = nzb+1, nzt
Index: palm/trunk/SOURCE/buoyancy.f90
===================================================================
--- palm/trunk/SOURCE/buoyancy.f90	(revision 1127)
+++ palm/trunk/SOURCE/buoyancy.f90	(revision 1128)
@@ -20,5 +20,6 @@
 ! Currrent revisions:
 ! -----------------
-!
+! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
+! j_north
 !
 ! Former revisions:
@@ -218,6 +219,6 @@
 !--       Normal case: horizontal surface
           IF ( use_reference )  THEN
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
+             DO  i = i_left, i_right
+                DO  j = j_south, j_north
                    DO  k = nzb_s_inner(j,i)+1, nzt-1
                       tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5 * &
@@ -232,6 +233,6 @@
              !$acc kernels present( nzb_s_inner, hom, tend, var )
              !$acc loop
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
+             DO  i = i_left, i_right
+                DO  j = j_south, j_north
                    !$acc loop vector(32)
                    DO  k = 1, nzt-1
Index: palm/trunk/SOURCE/coriolis.f90
===================================================================
--- palm/trunk/SOURCE/coriolis.f90	(revision 1127)
+++ palm/trunk/SOURCE/coriolis.f90	(revision 1128)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-!
+! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
+! j_north
 !
 ! Former revisions:
@@ -167,6 +168,6 @@
              !$acc  kernels present( nzb_u_inner, tend, v, vg, w )
              !$acc  loop
-             DO  i = nxlu, nxr
-                DO  j = nys, nyn
+             DO  i = i_left, i_right
+                DO  j = j_south, j_north
                    !$acc loop vector( 32 )
                    DO  k = 1, nzt
@@ -190,6 +191,6 @@
              !$acc  kernels present( nzb_v_inner, tend, u, ug )
              !$acc  loop
-             DO  i = nxl, nxr
-                DO  j = nysv, nyn
+             DO  i = i_left, i_right
+                DO  j = j_south, j_north
                    !$acc loop vector( 32 )
                    DO  k = 1, nzt
@@ -209,6 +210,6 @@
              !$acc  kernels present( nzb_w_inner, tend, u )
              !$acc  loop
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
+             DO  i = i_left, i_right
+                DO  j = j_south, j_north
                    !$acc loop vector( 32 )
                    DO  k = 1, nzt
Index: palm/trunk/SOURCE/diffusion_e.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_e.f90	(revision 1127)
+++ palm/trunk/SOURCE/diffusion_e.f90	(revision 1128)
@@ -20,4 +20,6 @@
 ! Current revisions:
 ! -----------------
+! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
+! j_north
 !
 ! Former revisions:
@@ -312,5 +314,5 @@
 !--    runtime errors occur with -C hopt on NEC
        IF ( use_reference )  THEN
-          STOP '+++ use_reference in diffusion_e not implemented'
+          STOP '+++ use_reference not implemented in diffusion_e_acc'
 !          DO  i = nxl, nxr
 !             DO  j = nys, nyn
@@ -387,6 +389,6 @@
           !$acc         present( nzb_s_inner, rif, tend, var, zu, zw )
           !$acc loop
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
+          DO  i = i_left, i_right
+             DO  j = j_south, j_north
                 !$acc loop vector( 32 )
                 DO  k = 1, nzt
@@ -458,7 +460,7 @@
           !$acc kernels present( diss, nzb_s_inner )
           !$acc loop
-          DO  i = nxl, nxr
+          DO  i = i_left, i_right
              !$acc loop vector( 32 )
-             DO  j = nys, nyn
+             DO  j = j_south, j_north
                 diss(nzb_s_inner(j,i),j,i) = diss(nzb_s_inner(j,i)+1,j,i)
              ENDDO
Index: palm/trunk/SOURCE/diffusion_s.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_s.f90	(revision 1127)
+++ palm/trunk/SOURCE/diffusion_s.f90	(revision 1128)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! ------------------
-! 
+! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
+! j_north
 !
 ! Former revisions:
@@ -226,6 +227,6 @@
        !$acc         present( wall_w_x, wall_w_y )
        !$acc loop
-       DO  i = nxl, nxr
-          DO  j = nys,nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
 !
 !--          Compute horizontal diffusion
Index: palm/trunk/SOURCE/diffusion_u.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_u.f90	(revision 1127)
+++ palm/trunk/SOURCE/diffusion_u.f90	(revision 1128)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-!
+! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
+! j_north
 !
 ! Former revisions:
@@ -275,6 +276,6 @@
        !$acc         present ( nzb_u_inner, nzb_u_outer, nzb_diff_u )
        !$acc loop
-       DO  i = nxlu, nxr
-          DO  j = nys, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
 !
 !--          Compute horizontal diffusion
@@ -372,7 +373,7 @@
 
           !$acc loop
-          DO  i = nxlu, nxr
+          DO  i = i_left, i_right
              !$acc loop vector(32)
-             DO  j = nys, nyn
+             DO  j = j_south, j_north
           
                 k = nzb_u_inner(j,i)+1
@@ -403,7 +404,7 @@
 
           !$acc loop
-          DO  i = nxlu, nxr
+          DO  i = i_left, i_right
              !$acc loop vector(32)
-             DO  j = nys, nyn
+             DO  j = j_south, j_north
 
 !
Index: palm/trunk/SOURCE/diffusion_v.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_v.f90	(revision 1127)
+++ palm/trunk/SOURCE/diffusion_v.f90	(revision 1128)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-!
+! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
+! j_north
 !
 ! Former revisions:
@@ -273,6 +274,6 @@
        !$acc         present ( nzb_v_inner, nzb_v_outer, nzb_diff_v )
        !$acc loop
-       DO  i = nxl, nxr
-          DO  j = nysv, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
 !
 !--          Compute horizontal diffusion
@@ -370,7 +371,7 @@
 
           !$acc loop
-          DO  i = nxl, nxr
+          DO  i = i_left, i_right
              !$acc loop vector(32)
-             DO  j = nysv, nyn
+             DO  j = j_south, j_north
           
                 k = nzb_v_inner(j,i)+1
@@ -401,7 +402,7 @@
 
           !$acc loop
-          DO  i = nxl, nxr
+          DO  i = i_left, i_right
              !$acc loop vector(32)
-             DO  j = nysv, nyn
+             DO  j = j_south, j_north
 
 !
Index: palm/trunk/SOURCE/diffusion_w.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_w.f90	(revision 1127)
+++ palm/trunk/SOURCE/diffusion_w.f90	(revision 1128)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-!
+! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
+! j_north
 !
 ! Former revisions:
@@ -228,6 +229,6 @@
        !$acc         present ( nzb_w_inner, nzb_w_outer )
        !$acc loop
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
              !$acc loop vector( 32 )
              DO  k = 1, nzt
Index: palm/trunk/SOURCE/exchange_horiz.f90
===================================================================
--- palm/trunk/SOURCE/exchange_horiz.f90	(revision 1127)
+++ palm/trunk/SOURCE/exchange_horiz.f90	(revision 1128)
@@ -20,5 +20,7 @@
 ! Current revisions:
 ! -----------------
-! 
+! modifications for asynchronous transfer,
+! local variables req, wait_stat are global now, and have been moved to module
+! pegrid
 !
 ! Former revisions:
@@ -90,16 +92,11 @@
 
 #if ! defined( __check )
+
+    CALL cpu_log( log_point_s(2), 'exchange_horiz', 'start' )
+
 #if defined( __parallel )
-    INTEGER, DIMENSION(4)                 ::  req
-    INTEGER, DIMENSION(MPI_STATUS_SIZE,4) ::  wait_stat
-#endif
-
-
-    CALL cpu_log( log_point_s(2), 'exchange_horiz', 'start' )
-
-#if defined( __parallel )
-
-!
-!-- Exchange of lateral boundary values
+
+!
+!-- Exchange in x-direction of lateral boundaries
     IF ( pdims(1) == 1  .OR.  mg_switch_to_pe0 )  THEN
 !
@@ -130,19 +127,35 @@
        ELSE
 
-          req = 0
-!
-!--       Send left boundary, receive right one (asynchronous)
-          CALL MPI_ISEND( ar(nzb,nys-nbgp_local,nxl),   1, type_yz(grid_level), &
-                          pleft, 0, comm2d, req(1), ierr )
-          CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxr+1), 1, type_yz(grid_level), &
-                          pright, 0, comm2d, req(2), ierr )
-!
-!--       Send right boundary, receive left one (asynchronous)
-          CALL MPI_ISEND( ar(nzb,nys-nbgp_local,nxr+1-nbgp_local), 1,          &
-                          type_yz(grid_level), pright, 1, comm2d, req(3), ierr )
-          CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,          &
-                          type_yz(grid_level), pleft,  1, comm2d, req(4), ierr )
-
-          CALL MPI_WAITALL( 4, req, wait_stat, ierr )
+!
+!--       In case of background communication switched on, exchange is done
+!--       either along x or along y
+          IF ( send_receive == 'lr'  .OR.  send_receive == 'al' )  THEN
+
+             IF ( .NOT. sendrecv_in_background )  THEN
+                req(1:4)  = 0
+                req_count = 0
+             ENDIF
+!
+!--          Send left boundary, receive right one (asynchronous)
+             CALL MPI_ISEND( ar(nzb,nys-nbgp_local,nxl),   1, type_yz(grid_level), &
+                             pleft, req_count, comm2d, req(req_count+1), ierr )
+             CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxr+1), 1, type_yz(grid_level), &
+                             pright, req_count, comm2d, req(req_count+2), ierr )
+!
+!--          Send right boundary, receive left one (asynchronous)
+             CALL MPI_ISEND( ar(nzb,nys-nbgp_local,nxr+1-nbgp_local), 1,          &
+                             type_yz(grid_level), pright, req_count+1, comm2d,    &
+                             req(req_count+3), ierr )
+             CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,          &
+                             type_yz(grid_level), pleft,  req_count+1, comm2d,    &
+                             req(req_count+4), ierr )
+
+             IF ( .NOT. sendrecv_in_background )  THEN
+                CALL MPI_WAITALL( 4, req, wait_stat, ierr )
+             ELSE
+                req_count = req_count + 4
+             ENDIF
+
+          ENDIF
 
        ENDIF
@@ -179,19 +192,36 @@
        ELSE
 
-          req = 0
-!
-!--       Send front boundary, receive rear one (asynchronous)
-          CALL MPI_ISEND( ar(nzb,nys,nxl-nbgp_local),   1, type_xz(grid_level), &
-                          psouth, 0, comm2d, req(1), ierr )
-          CALL MPI_IRECV( ar(nzb,nyn+1,nxl-nbgp_local), 1, type_xz(grid_level), &
-                          pnorth, 0, comm2d, req(2), ierr )
-!
-!--       Send rear boundary, receive front one (asynchronous)
-          CALL MPI_ISEND( ar(nzb,nyn-nbgp_local+1,nxl-nbgp_local), 1,          &
-                          type_xz(grid_level), pnorth, 1, comm2d, req(3), ierr )
-          CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,          &
-                          type_xz(grid_level), psouth, 1, comm2d, req(4), ierr )
-
-          CALL MPI_WAITALL( 4, req, wait_stat, ierr )
+!
+!--       In case of background communication switched on, exchange is done
+!--       either along x or along y
+          IF ( send_receive == 'lr'  .OR.  send_receive == 'al' )  THEN
+
+             IF ( .NOT. sendrecv_in_background )  THEN
+                req(1:4)  = 0
+                req_count = 0
+             ENDIF
+
+!
+!--          Send front boundary, receive rear one (asynchronous)
+             CALL MPI_ISEND( ar(nzb,nys,nxl-nbgp_local),   1, type_xz(grid_level), &
+                             psouth, req_count, comm2d, req(req_count+1), ierr )
+             CALL MPI_IRECV( ar(nzb,nyn+1,nxl-nbgp_local), 1, type_xz(grid_level), &
+                             pnorth, req_count, comm2d, req(req_count+2), ierr )
+!
+!--          Send rear boundary, receive front one (asynchronous)
+             CALL MPI_ISEND( ar(nzb,nyn-nbgp_local+1,nxl-nbgp_local), 1,          &
+                             type_xz(grid_level), pnorth, req_count+1, comm2d,    &
+                             req(req_count+3), ierr )
+             CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,          &
+                             type_xz(grid_level), psouth, req_count+1, comm2d,    &
+                             req(req_count+4), ierr )
+
+             IF ( .NOT. sendrecv_in_background )  THEN
+                CALL MPI_WAITALL( 4, req, wait_stat, ierr )
+             ELSE
+                req_count = req_count + 4
+             ENDIF
+
+          ENDIF
 
        ENDIF
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 1127)
+++ palm/trunk/SOURCE/modules.f90	(revision 1128)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! ------------------
-!
+! +background_communication, i_left, i_right, j_north, j_south, req, req_count,
+! send_receive, sendrecv_in_background, wait_stat
 !
 ! Former revisions:
@@ -1071,8 +1072,8 @@
 !------------------------------------------------------------------------------!
 
-    INTEGER ::  nbgp = 3, ngp_sums, nnx, nx = 0, nx_a, nx_o, nxl, nxlg,   &
-                nxlu, nxr, nxrg, nx_on_file, nny, ny = 0, ny_a, ny_o,    &
-                nyn, nyng, nys, nysg, nysv, ny_on_file, nnz, nz = 0,&
-                nzb, nzb_diff, nzb_max, nzt, nzt_diff
+    INTEGER ::  i_left, i_right, j_north, j_south, nbgp = 3, ngp_sums, nnx,    &
+                nx = 0, nx_a, nx_o, nxl, nxlg, nxlu, nxr, nxrg, nx_on_file,    &
+                nny, ny = 0, ny_a, ny_o, nyn, nyng, nys, nysg, nysv,           &
+                ny_on_file, nnz, nz = 0, nzb, nzb_diff, nzb_max, nzt, nzt_diff
 
 
@@ -1471,17 +1472,19 @@
 #endif
 #endif
+    CHARACTER(LEN=2) ::  send_receive = 'al'
     CHARACTER(LEN=5) ::  myid_char = ''
     INTEGER          ::  acc_rank, id_inflow = 0, id_recycling = 0,      &
-                         myid = 0, num_acc_per_node = 0,                 &
+                         myid = 0, num_acc_per_node = 0, req_count = 0,  &
                          target_id, npex = -1, npey = -1, numprocs = 1,  &
                          numprocs_previous_run = -1,                     &
                          tasks_per_node = -9999, threads_per_task = 1
 
-    INTEGER          ::  pdims(2) = 1
+    INTEGER          ::  pdims(2) = 1, req(100)
 
     INTEGER, DIMENSION(:,:), ALLOCATABLE ::  hor_index_bounds, &
                                              hor_index_bounds_previous_run
 
-    LOGICAL ::  collective_wait = .FALSE.
+    LOGICAL ::  background_communication =.FALSE., collective_wait = .FALSE., &
+                sendrecv_in_background = .FALSE.
 
 #if defined( __parallel )
@@ -1500,4 +1503,5 @@
 #if ! defined ( __check )
     INTEGER ::  status(MPI_STATUS_SIZE)
+    INTEGER, DIMENSION(MPI_STATUS_SIZE,100) ::  wait_stat
 #endif
 
Index: palm/trunk/SOURCE/parin.f90
===================================================================
--- palm/trunk/SOURCE/parin.f90	(revision 1127)
+++ palm/trunk/SOURCE/parin.f90	(revision 1128)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! +background_communication in inipar
 !
 ! Former revisions:
@@ -203,5 +203,5 @@
 
 
-    NAMELIST /inipar/  alpha_surface, bc_e_b, bc_lr, &
+    NAMELIST /inipar/  alpha_surface, background_communication, bc_e_b, bc_lr, &
                        bc_ns, bc_p_b, bc_p_t, bc_pt_b, bc_pt_t, bc_q_b, &
              bc_q_t,bc_s_b, bc_s_t, bc_sa_t, bc_uv_b, bc_uv_t, &
Index: palm/trunk/SOURCE/production_e.f90
===================================================================
--- palm/trunk/SOURCE/production_e.f90	(revision 1127)
+++ palm/trunk/SOURCE/production_e.f90	(revision 1128)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-!
+! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
+! j_north
 !
 ! Former revisions:
@@ -743,6 +744,6 @@
        !$acc         copyin( u_0, v_0 )
        !$acc loop
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
              !$acc loop vector( 32 )
              DO  k = 1, nzt
@@ -789,6 +790,6 @@
 !--       'bottom and wall: use u_0,v_0 and wall functions'
           !$acc loop
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
+          DO  i = i_left, i_right
+             DO  j = j_south, j_north
                 !$acc loop vector( 32 )
                 DO  k = 1, nzt
@@ -1001,6 +1002,6 @@
 !--       'bottom only: use u_0,v_0'
           !$acc loop
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
+          DO  i = i_left, i_right
+             DO  j = j_south, j_north
                 !$acc loop vector( 32 )
                 DO  k = 1, nzt
@@ -1048,6 +1049,6 @@
 
           !$acc loop
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
+          DO  i = i_left, i_right
+             DO  j = j_south, j_north
                 !$acc loop vector(32)
                 DO  k = 1, nzt
@@ -1102,6 +1103,6 @@
 !--                in the bottom and top surface layer
                    !$acc loop
-                   DO  i = nxl, nxr
-                      DO  j = nys, nyn
+                   DO  i = i_left, i_right
+                      DO  j = j_south, j_north
                          !$acc loop vector( 32 )
                          DO  k = 1, nzt
@@ -1119,6 +1120,6 @@
 
                    !$acc loop
-                   DO  i = nxl, nxr
-                      DO  j = nys, nyn
+                   DO  i = i_left, i_right
+                      DO  j = j_south, j_north
                          !$acc loop vector( 32 )
                          DO  k = 1, nzt_diff
@@ -1153,6 +1154,6 @@
 !--                in the bottom and top surface layer
                    !$acc loop
-                   DO  i = nxl, nxr
-                      DO  j = nys, nyn
+                   DO  i = i_left, i_right
+                      DO  j = j_south, j_north
                          !$acc loop vector( 32 )
                          DO  k = 1, nzt
@@ -1170,6 +1171,6 @@
 
                    !$acc loop
-                   DO  i = nxl, nxr
-                      DO  j = nys, nyn
+                   DO  i = i_left, i_right
+                      DO  j = j_south, j_north
                          !$acc loop vector( 32 )
                          DO  k = 1, nzt_diff
Index: palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- palm/trunk/SOURCE/prognostic_equations.f90	(revision 1127)
+++ palm/trunk/SOURCE/prognostic_equations.f90	(revision 1128)
@@ -20,5 +20,7 @@
 ! Current revisions:
 ! ------------------
-!
+! those parts requiring global communication moved to time_integration,
+! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
+! j_north
 !
 ! Former revisions:
@@ -223,14 +225,4 @@
     CALL cpu_log( log_point(32), 'all progn.equations', 'start' )
 
-
-!
-!-- Calculate those variables needed in the tendency terms which need
-!-- global communication
-    IF ( .NOT. neutral )  CALL calc_mean_profile( pt, 4 )
-    IF ( ocean         )  CALL calc_mean_profile( rho, 64 )
-    IF ( humidity      )  CALL calc_mean_profile( vpt, 44 )
-    IF ( .NOT. constant_diffusion )  CALL production_e_init
-    IF ( ( ws_scheme_mom .OR. ws_scheme_sca )  .AND.  &
-         intermediate_timestep_count == 1 )  CALL ws_statistics
 !
 !-- Loop over all prognostic equations
@@ -724,5 +716,6 @@
              ENDIF
 
-         ENDIF
+          ENDIF
+
 !
 !--       If required, compute prognostic equation for turbulent kinetic 
@@ -811,12 +804,4 @@
     REAL    ::  sbt
 
-!
-!-- Calculate those variables needed in the tendency terms which need
-!-- global communication
-    IF ( .NOT. neutral )  CALL calc_mean_profile( pt, 4 )
-    IF ( ocean         )  CALL calc_mean_profile( rho, 64 )
-    IF ( humidity      )  CALL calc_mean_profile( vpt, 44 )
-    IF ( ( ws_scheme_mom .OR. ws_scheme_sca )  .AND.  &
-         intermediate_timestep_count == 1 )  CALL ws_statistics
 
 !
@@ -1337,8 +1322,4 @@
 
        CALL cpu_log( log_point(16), 'tke-equation', 'start' )
-
-!
-!--    TKE-tendency terms with communication
-       CALL production_e_init
 
        sbt = tsc(2)
@@ -1464,13 +1445,4 @@
 
 !
-!-- Calculate those variables needed in the tendency terms which need
-!-- global communication
-    IF ( .NOT. neutral )  CALL calc_mean_profile( pt, 4 )
-    IF ( ocean         )  CALL calc_mean_profile( rho, 64 )
-    IF ( humidity      )  CALL calc_mean_profile( vpt, 44 )
-    IF ( ( ws_scheme_mom .OR. ws_scheme_sca )  .AND.  &
-         intermediate_timestep_count == 1 )  CALL ws_statistics
-
-!
 !-- u-velocity component
 !++ Statistics still not ported to accelerators
@@ -1501,6 +1473,6 @@
 !-- External pressure gradient
     IF ( dp_external )  THEN
-       DO  i = nxlu, nxr
-          DO  j = nys, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
              DO  k = dp_level_ind_b+1, nzt
                 tend(k,j,i) = tend(k,j,i) - dpdxy(1) * dp_smooth_factor(k)
@@ -1516,6 +1488,6 @@
     !$acc kernels present( nzb_u_inner, rdf, tend, tu_m, u, ug, u_p )
     !$acc loop
-    DO  i = nxlu, nxr
-       DO  j = nys, nyn
+    DO  i = i_left, i_right
+       DO  j = j_south, j_north
           !$acc loop vector( 32 )
           DO  k = 1, nzt
@@ -1563,6 +1535,6 @@
 !-- External pressure gradient
     IF ( dp_external )  THEN
-       DO  i = nxl, nxr
-          DO  j = nysv, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
              DO  k = dp_level_ind_b+1, nzt
                 tend(k,j,i) = tend(k,j,i) - dpdxy(2) * dp_smooth_factor(k)
@@ -1578,6 +1550,6 @@
     !$acc kernels present( nzb_v_inner, rdf, tend, tv_m, v, vg, v_p )
     !$acc loop
-    DO  i = nxl, nxr
-       DO  j = nysv, nyn
+    DO  i = i_left, i_right
+       DO  j = j_south, j_north
           !$acc loop vector( 32 )
           DO  k = 1, nzt
@@ -1640,6 +1612,6 @@
     !$acc kernels present( nzb_w_inner, rdf, tend, tw_m, w, w_p )
     !$acc loop
-    DO  i = nxl, nxr
-       DO  j = nys, nyn
+    DO  i = i_left, i_right
+       DO  j = j_south, j_north
           !$acc loop vector( 32 )
           DO  k = 1, nzt-1
@@ -1734,6 +1706,6 @@
        !$acc         present( tend, tpt_m, pt, pt_p )
        !$acc loop
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
              !$acc loop vector( 32 )
              DO  k = 1, nzt
@@ -1802,6 +1774,6 @@
 !
 !--    Prognostic equation for salinity
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
              DO  k = nzb_s_inner(j,i)+1, nzt
                 sa_p(k,j,i) = sa(k,j,i) + dt_3d * ( sbt * tend(k,j,i) +        &
@@ -1890,6 +1862,6 @@
 !
 !--    Prognostic equation for total water content / scalar
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
              DO  k = nzb_s_inner(j,i)+1, nzt
                 q_p(k,j,i) = q(k,j,i) + dt_3d * ( sbt * tend(k,j,i) +          &
@@ -1919,8 +1891,4 @@
 
        CALL cpu_log( log_point(16), 'tke-equation', 'start' )
-
-!
-!--    TKE-tendency terms with communication
-       CALL production_e_init
 
        sbt = tsc(2)
@@ -1984,6 +1952,6 @@
        !$acc kernels present( e, e_p, nzb_s_inner, tend, te_m )
        !$acc loop
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
              !$acc loop vector( 32 )
              DO  k = 1, nzt
Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 1127)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 1128)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! ------------------
-!
+! asynchronous transfer of ghost point data realized for acc-optimized version:
+! prognostic_equations are first called two times for those points required for
+! the left-right and north-south exchange, respectively, and then for the
+! remaining points,
+! those parts requiring global communication moved from prognostic_equations to
+! here
 !
 ! Former revisions:
@@ -134,6 +139,8 @@
 !------------------------------------------------------------------------------!
 
+    USE advec_ws
     USE arrays_3d
     USE averaging
+    USE buoyancy_mod
     USE control_parameters
     USE cpulog
@@ -147,4 +154,5 @@
     USE particle_attributes
     USE pegrid
+    USE production_e_mod
     USE prognostic_equations_mod
     USE statistics
@@ -212,4 +220,14 @@
 !--       on the timestep scheme
           CALL timestep_scheme_steering
+
+!
+!--       Calculate those variables needed in the tendency terms which need
+!--       global communication
+          IF ( .NOT. neutral )  CALL calc_mean_profile( pt, 4 )
+          IF ( ocean         )  CALL calc_mean_profile( rho, 64 )
+          IF ( humidity      )  CALL calc_mean_profile( vpt, 44 )
+          IF ( .NOT. constant_diffusion )  CALL production_e_init
+          IF ( ( ws_scheme_mom .OR. ws_scheme_sca )  .AND.  &
+               intermediate_timestep_count == 1 )  CALL ws_statistics
 
 !
@@ -224,5 +242,146 @@
              CALL prognostic_equations_vector
           ELSEIF ( loop_optimization == 'acc' )  THEN
+!             i_left  = nxl;         i_right = nxr
+!             j_south = nys;         j_north = nyn
+!             CALL prognostic_equations_acc
+
+             i_left  = nxl;         i_right = nxl+nbgp-1
+             j_south = nys;         j_north = nyn
              CALL prognostic_equations_acc
+             i_left  = nxr-nbgp+1;  i_right = nxr
+             j_south = nys;         j_north = nyn
+             CALL prognostic_equations_acc
+
+!
+!--          Exchange of ghost points (lateral boundary conditions)
+             IF ( background_communication )  THEN
+
+                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' )
+                
+                send_receive = 'lr'
+                sendrecv_in_background = .TRUE.
+                req          = 0
+                req_count    = 0
+
+                IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
+                   on_device = .TRUE.         ! to be removed after complete porting
+                ELSE                          ! of ghost point exchange
+                   !$acc update host( e_p, pt_p, u_p, v_p, w_p )
+                ENDIF
+
+                CALL exchange_horiz( u_p, nbgp )
+                CALL exchange_horiz( v_p, nbgp )
+                CALL exchange_horiz( w_p, nbgp )
+                CALL exchange_horiz( pt_p, nbgp )
+                IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
+                IF ( ocean )  THEN
+                   CALL exchange_horiz( sa_p, nbgp )
+                   CALL exchange_horiz( rho, nbgp )
+                  CALL exchange_horiz( prho, nbgp )
+                ENDIF
+                IF (humidity  .OR.  passive_scalar)  THEN
+                   CALL exchange_horiz( q_p, nbgp )
+                   IF ( cloud_physics .AND. icloud_scheme == 0 )  THEN
+                      CALL exchange_horiz( qr_p, nbgp )
+                      CALL exchange_horiz( nr_p, nbgp )
+                   ENDIF
+                ENDIF
+                IF ( cloud_droplets )  THEN
+                   CALL exchange_horiz( ql, nbgp )
+                   CALL exchange_horiz( ql_c, nbgp )
+                   CALL exchange_horiz( ql_v, nbgp )
+                   CALL exchange_horiz( ql_vp, nbgp )
+                ENDIF
+                IF ( wang_kernel  .OR.  turbulence )  CALL exchange_horiz( diss, nbgp )
+
+                IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
+                   on_device = .FALSE.        ! to be removed after complete porting
+                ELSE                          ! of ghost point exchange
+                   !$acc update device( e_p, pt_p, u_p, v_p, w_p )
+                ENDIF
+
+                sendrecv_in_background = .FALSE.
+
+                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'pause' )
+
+             ENDIF
+
+             i_left  = nxl+nbgp;    i_right = nxr-nbgp
+             j_south = nys;         j_north = nys+nbgp-1
+             CALL prognostic_equations_acc
+             i_left  = nxl+nbgp;    i_right = nxr-nbgp
+             j_south = nyn-nbgp+1;  j_north = nyn
+             CALL prognostic_equations_acc
+
+             IF ( background_communication )  THEN
+                CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'start' )
+#if defined( __parallel )
+                CALL MPI_WAITALL( req_count, req, wait_stat, ierr )
+#endif
+                CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'pause' )
+
+                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'continue' )
+
+                send_receive = 'ns'
+                sendrecv_in_background = .TRUE.
+                req          = 0
+                req_count    = 0
+
+                IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
+                   on_device = .TRUE.         ! to be removed after complete porting
+                ELSE                          ! of ghost point exchange
+                   !$acc update host( e_p, pt_p, u_p, v_p, w_p )
+                ENDIF
+
+                CALL exchange_horiz( u_p, nbgp )
+                CALL exchange_horiz( v_p, nbgp )
+                CALL exchange_horiz( w_p, nbgp )
+                CALL exchange_horiz( pt_p, nbgp )
+                IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
+                IF ( ocean )  THEN
+                   CALL exchange_horiz( sa_p, nbgp )
+                   CALL exchange_horiz( rho, nbgp )
+                  CALL exchange_horiz( prho, nbgp )
+                ENDIF
+                IF (humidity  .OR.  passive_scalar)  THEN
+                   CALL exchange_horiz( q_p, nbgp )
+                   IF ( cloud_physics .AND. icloud_scheme == 0 )  THEN
+                      CALL exchange_horiz( qr_p, nbgp )
+                      CALL exchange_horiz( nr_p, nbgp )
+                   ENDIF
+                ENDIF
+                IF ( cloud_droplets )  THEN
+                   CALL exchange_horiz( ql, nbgp )
+                   CALL exchange_horiz( ql_c, nbgp )
+                   CALL exchange_horiz( ql_v, nbgp )
+                   CALL exchange_horiz( ql_vp, nbgp )
+                ENDIF
+                IF ( wang_kernel  .OR.  turbulence )  CALL exchange_horiz( diss, nbgp )
+
+                IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
+                   on_device = .FALSE.        ! to be removed after complete porting
+                ELSE                          ! of ghost point exchange
+                   !$acc update device( e_p, pt_p, u_p, v_p, w_p )
+                ENDIF
+
+                sendrecv_in_background = .FALSE.
+
+                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
+
+             ENDIF
+
+             i_left  = nxl+nbgp;    i_right = nxr-nbgp
+             j_south = nys+nbgp;    j_north = nyn-nbgp
+             CALL prognostic_equations_acc
+
+             IF ( background_communication )  THEN
+                CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'continue' )
+#if defined( __parallel )
+                CALL MPI_WAITALL( req_count, req, wait_stat, ierr )
+#endif
+                send_receive = 'al'
+                CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'stop' )
+             ENDIF
+
           ENDIF
 
@@ -230,4 +389,6 @@
 !--       Particle transport/physics with the Lagrangian particle model
 !--       (only once during intermediate steps, because it uses an Euler-step)
+!--       ### particle model should be moved before prognostic_equations, in order
+!--       to regard droplet interactions directly
           IF ( particle_advection  .AND.                         &
                simulated_time >= particle_advection_start  .AND. &
@@ -249,45 +410,48 @@
 !
 !--       Exchange of ghost points (lateral boundary conditions)
-          CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' )
-
-          IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
-             on_device = .TRUE.         ! to be removed after complete porting
-          ELSE                          ! of ghost point exchange
-             !$acc update host( e_p, pt_p, u_p, v_p, w_p )
-          ENDIF
-
-          CALL exchange_horiz( u_p, nbgp )
-          CALL exchange_horiz( v_p, nbgp )
-          CALL exchange_horiz( w_p, nbgp )
-          CALL exchange_horiz( pt_p, nbgp )
-          IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
-          IF ( ocean )  THEN
-             CALL exchange_horiz( sa_p, nbgp )
-             CALL exchange_horiz( rho, nbgp )
-             CALL exchange_horiz( prho, nbgp )
-          ENDIF
-          IF (humidity  .OR.  passive_scalar)  THEN
-             CALL exchange_horiz( q_p, nbgp )
-             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.              &
-                  precipitation)  THEN
-                CALL exchange_horiz( qr_p, nbgp )
-                CALL exchange_horiz( nr_p, nbgp )
-             ENDIF
-          ENDIF
-          IF ( cloud_droplets )  THEN
-             CALL exchange_horiz( ql, nbgp )
-             CALL exchange_horiz( ql_c, nbgp )
-             CALL exchange_horiz( ql_v, nbgp )
-             CALL exchange_horiz( ql_vp, nbgp )
-          ENDIF
-          IF ( wang_kernel  .OR.  turbulence )  CALL exchange_horiz( diss, nbgp )
-
-          IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
-             on_device = .FALSE.        ! to be removed after complete porting
-          ELSE                          ! of ghost point exchange
-             !$acc update device( e_p, pt_p, u_p, v_p, w_p )
-          ENDIF
-
-          CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
+          IF ( .NOT. background_communication )  THEN
+
+             CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' )
+
+             IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
+                on_device = .TRUE.         ! to be removed after complete porting
+             ELSE                          ! of ghost point exchange
+                !$acc update host( e_p, pt_p, u_p, v_p, w_p )
+             ENDIF
+
+             CALL exchange_horiz( u_p, nbgp )
+             CALL exchange_horiz( v_p, nbgp )
+             CALL exchange_horiz( w_p, nbgp )
+             CALL exchange_horiz( pt_p, nbgp )
+             IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
+             IF ( ocean )  THEN
+                CALL exchange_horiz( sa_p, nbgp )
+                CALL exchange_horiz( rho, nbgp )
+                CALL exchange_horiz( prho, nbgp )
+             ENDIF
+             IF (humidity  .OR.  passive_scalar)  THEN
+                CALL exchange_horiz( q_p, nbgp )
+                IF ( cloud_physics .AND. icloud_scheme == 0 )  THEN
+                   CALL exchange_horiz( qr_p, nbgp )
+                   CALL exchange_horiz( nr_p, nbgp )
+                ENDIF
+             ENDIF
+             IF ( cloud_droplets )  THEN
+                CALL exchange_horiz( ql, nbgp )
+                CALL exchange_horiz( ql_c, nbgp )
+                CALL exchange_horiz( ql_v, nbgp )
+                CALL exchange_horiz( ql_vp, nbgp )
+             ENDIF
+             IF ( wang_kernel  .OR.  turbulence )  CALL exchange_horiz( diss, nbgp )
+
+             IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
+                on_device = .FALSE.        ! to be removed after complete porting
+             ELSE                          ! of ghost point exchange
+                !$acc update device( e_p, pt_p, u_p, v_p, w_p )
+             ENDIF
+
+             CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
+
+          ENDIF
 
 !
Index: palm/trunk/SOURCE/wall_fluxes.f90
===================================================================
--- palm/trunk/SOURCE/wall_fluxes.f90	(revision 1127)
+++ palm/trunk/SOURCE/wall_fluxes.f90	(revision 1128)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-!
+! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
+! j_north
 !
 ! Former revisions:
@@ -256,6 +257,6 @@
        !$acc         present( u, v, w, wall, wall_flux, z0 )
        !$acc loop
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
              !$acc loop vector( 32 )
              DO  k = min_inner, max_outer
@@ -666,6 +667,6 @@
        !$acc         present( u, v, w, wall, wall_flux, z0 )
        !$acc loop
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
+       DO  i = i_left, i_right
+          DO  j = j_south, j_north
              !$acc loop vector(32)
              DO  k = min_inner, max_outer
