Index: /palm/trunk/SOURCE/Makefile
===================================================================
--- /palm/trunk/SOURCE/Makefile	(revision 2117)
+++ /palm/trunk/SOURCE/Makefile	(revision 2118)
@@ -20,5 +20,5 @@
 # Current revisions:
 # ------------------
-# 
+# -cuda_fft_interfaces_mod
 # 
 # Former revisions:
@@ -312,5 +312,5 @@
 	check_for_restart.f90 check_open.f90 check_parameters.f90 \
 	close_file.f90 compute_vpt.f90 coriolis.f90 cpulog_mod.f90 \
-	cuda_fft_interfaces_mod.f90 data_log.f90 data_output_dvrp.f90 \
+	data_log.f90 data_output_dvrp.f90 \
 	data_output_mask.f90 data_output_profiles.f90 \
 	data_output_ptseries.f90 data_output_spectra.f90 data_output_flight.f90\
@@ -426,5 +426,4 @@
 cpulog_mod.o: modules.o mod_kinds.o
 cpu_statistics.o: modules.o mod_kinds.o
-cuda_fft_interfaces_mod.o: cuda_fft_interfaces_mod.f90 modules.o mod_kinds.o
 data_log.o: modules.o mod_kinds.o
 data_output_dvrp.o: modules.o cpulog_mod.o mod_kinds.o
@@ -456,5 +455,5 @@
 exchange_horiz.o: modules.o cpulog_mod.o mod_kinds.o
 exchange_horiz_2d.o: modules.o cpulog_mod.o mod_kinds.o pmc_interface_mod.o
-fft_xy_mod.o: cuda_fft_interfaces_mod.o modules.o mod_kinds.o singleton_mod.o temperton_fft_mod.o
+fft_xy_mod.o: modules.o mod_kinds.o singleton_mod.o temperton_fft_mod.o
 flow_statistics.o: modules.o cpulog_mod.o mod_kinds.o land_surface_model_mod.o \
    netcdf_interface_mod.o radiation_model_mod.o
Index: /palm/trunk/SOURCE/advec_ws.f90
===================================================================
--- /palm/trunk/SOURCE/advec_ws.f90	(revision 2117)
+++ /palm/trunk/SOURCE/advec_ws.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! OpenACC version of subroutines removed
 ! 
 ! Former revisions:
@@ -181,7 +181,6 @@
 
     PRIVATE
-    PUBLIC   advec_s_ws, advec_s_ws_acc, advec_u_ws, advec_u_ws_acc,          &
-             advec_v_ws, advec_v_ws_acc, advec_w_ws, advec_w_ws_acc,          &
-             ws_init, ws_init_flags, ws_statistics
+    PUBLIC   advec_s_ws, advec_u_ws, advec_v_ws, advec_w_ws, ws_init,          &
+             ws_init_flags, ws_statistics
 
     INTERFACE ws_init
@@ -207,8 +206,4 @@
     END INTERFACE advec_u_ws
 
-    INTERFACE advec_u_ws_acc
-       MODULE PROCEDURE advec_u_ws_acc
-    END INTERFACE advec_u_ws_acc
-
     INTERFACE advec_v_ws
        MODULE PROCEDURE advec_v_ws
@@ -216,16 +211,8 @@
     END INTERFACE advec_v_ws
 
-    INTERFACE advec_v_ws_acc
-       MODULE PROCEDURE advec_v_ws_acc
-    END INTERFACE advec_v_ws_acc
-
     INTERFACE advec_w_ws
        MODULE PROCEDURE advec_w_ws
        MODULE PROCEDURE advec_w_ws_ij
     END INTERFACE advec_w_ws
-
-    INTERFACE advec_w_ws_acc
-       MODULE PROCEDURE advec_w_ws_acc
-    END INTERFACE advec_w_ws_acc
 
  CONTAINS
@@ -4029,514 +4016,4 @@
 
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Scalar advection - Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE advec_s_ws_acc ( sk, sk_char )
-
-       USE arrays_3d,                                                         &
-           ONLY:  ddzw, drho_air, tend, u, v, w, rho_air, rho_air_zw
-
-       USE constants,                                                         &
-           ONLY:  adv_sca_1, adv_sca_3, adv_sca_5
-
-       USE control_parameters,                                                &
-           ONLY:  intermediate_timestep_count, monotonic_adjustment, u_gtrans,&
-                  v_gtrans
-
-       USE grid_variables,                                                    &
-           ONLY:  ddx, ddy
-
-       USE indices,                                                           &
-           ONLY:  i_left, i_right, j_north, j_south, nxlg, nxrg, nyng, nysg,  &
-                  nzb, nzb_max, nzt, wall_flags_0
-
-       USE kinds
-       
-!        USE statistics,                                                       &
-!            ONLY:  sums_wspts_ws_l, sums_wsqs_ws_l, sums_wssas_ws_l,          &
-!                   sums_wsqrs_ws_l, sums_wsnrs_ws_l, weight_substep
-
-       IMPLICIT NONE
-
-       CHARACTER (LEN = *), INTENT(IN)    :: sk_char !<
-
-       INTEGER(iwp) ::  i      !<
-       INTEGER(iwp) ::  ibit0  !<
-       INTEGER(iwp) ::  ibit1  !<
-       INTEGER(iwp) ::  ibit2  !<
-       INTEGER(iwp) ::  ibit3  !<
-       INTEGER(iwp) ::  ibit4  !<
-       INTEGER(iwp) ::  ibit5  !<
-       INTEGER(iwp) ::  ibit6  !<
-       INTEGER(iwp) ::  ibit7  !<
-       INTEGER(iwp) ::  ibit8  !<
-       INTEGER(iwp) ::  j      !<
-       INTEGER(iwp) ::  k      !<
-       INTEGER(iwp) ::  k_mm   !<
-       INTEGER(iwp) ::  k_mmm  !<
-       INTEGER(iwp) ::  k_pp   !<
-       INTEGER(iwp) ::  k_ppp  !<
-       INTEGER(iwp) ::  tn = 0 !<
-
-       REAL(wp)    ::  diss_d !<
-       REAL(wp)    ::  diss_l !<
-       REAL(wp)    ::  diss_n !<
-       REAL(wp)    ::  diss_r !<
-       REAL(wp)    ::  diss_s !<
-       REAL(wp)    ::  diss_t !<
-       REAL(wp)    ::  div    !<
-       REAL(wp)    ::  flux_d !<
-       REAL(wp)    ::  flux_l !<
-       REAL(wp)    ::  flux_n !<
-       REAL(wp)    ::  flux_r !<
-       REAL(wp)    ::  flux_s !<
-       REAL(wp)    ::  flux_t !<
-       REAL(wp)    ::  fd_1   !<
-       REAL(wp)    ::  fl_1   !<
-       REAL(wp)    ::  fn_1   !<
-       REAL(wp)    ::  fr_1   !<
-       REAL(wp)    ::  fs_1   !<
-       REAL(wp)    ::  ft_1   !<
-       REAL(wp)    ::  phi_d  !<
-       REAL(wp)    ::  phi_l  !<
-       REAL(wp)    ::  phi_n  !<
-       REAL(wp)    ::  phi_r  !<
-       REAL(wp)    ::  phi_s  !<
-       REAL(wp)    ::  phi_t  !<
-       REAL(wp)    ::  rd     !<
-       REAL(wp)    ::  rl     !<
-       REAL(wp)    ::  rn     !<
-       REAL(wp)    ::  rr     !<
-       REAL(wp)    ::  rs     !<
-       REAL(wp)    ::  rt     !<
-       REAL(wp)    ::  u_comp !<
-       REAL(wp)    ::  v_comp !<
-
-       REAL(wp), INTENT(IN), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg)  ::  sk !<
-
-!
-!--    Computation of fluxes and tendency terms
-       !$acc kernels present( ddzw, sk, tend, u, v, w, wall_flags_0 )
-       DO  i = i_left, i_right
-          DO  j = j_south, j_north
-             DO  k = nzb+1, nzt
-
-                ibit2 = IBITS(wall_flags_0(k,j,i-1),2,1)
-                ibit1 = IBITS(wall_flags_0(k,j,i-1),1,1)
-                ibit0 = IBITS(wall_flags_0(k,j,i-1),0,1)
-
-                u_comp              = u(k,j,i) - u_gtrans
-                flux_l              = u_comp * (                              &
-                                               ( 37.0_wp * ibit2 * adv_sca_5  &
-                                            +     7.0_wp * ibit1 * adv_sca_3  &
-                                            +              ibit0 * adv_sca_1  &
-                                               ) *                            &
-                                         ( sk(k,j,i)   + sk(k,j,i-1)    )     &
-                                        -      (  8.0_wp * ibit2 * adv_sca_5  &
-                                            +              ibit1 * adv_sca_3  &
-                                               ) *                            &
-                                         ( sk(k,j,i+1) + sk(k,j,i-2)    )     &
-                                        +      (           ibit2 * adv_sca_5  &
-                                               ) *                            &
-                                         ( sk(k,j,i+2) + sk(k,j,i-3)    )     &
-                                               )
-
-                diss_l              = -ABS( u_comp ) * (                      &
-                                               ( 10.0_wp * ibit2 * adv_sca_5  &
-                                            +     3.0_wp * ibit1 * adv_sca_3  &
-                                            +              ibit0 * adv_sca_1  &
-                                               ) *                            &
-                                         ( sk(k,j,i)   - sk(k,j,i-1)    )     &
-                                        -      (  5.0_wp * ibit2 * adv_sca_5  &
-                                            +              ibit1 * adv_sca_3  &
-                                               ) *                            &
-                                         ( sk(k,j,i+1) - sk(k,j,i-2)    )     &
-                                        +      (           ibit2 * adv_sca_5  &
-                                               ) *                            &
-                                         ( sk(k,j,i+2) - sk(k,j,i-3)    )     &
-                                                        )
-
-                ibit2 = IBITS(wall_flags_0(k,j,i),2,1)
-                ibit1 = IBITS(wall_flags_0(k,j,i),1,1)
-                ibit0 = IBITS(wall_flags_0(k,j,i),0,1)
-
-                u_comp    = u(k,j,i+1) - u_gtrans
-                flux_r    = u_comp * (                                        &
-                          ( 37.0_wp * ibit2 * adv_sca_5                       &
-                      +      7.0_wp * ibit1 * adv_sca_3                       &
-                      +               ibit0 * adv_sca_1                       &
-                          ) *                                                 &
-                             ( sk(k,j,i+1) + sk(k,j,i)   )                    &
-                   -      (  8.0_wp * ibit2 * adv_sca_5                       &
-                       +              ibit1 * adv_sca_3                       &
-                          ) *                                                 &
-                             ( sk(k,j,i+2) + sk(k,j,i-1) )                    &
-                   +      (           ibit2 * adv_sca_5                       &
-                          ) *                                                 &
-                             ( sk(k,j,i+3) + sk(k,j,i-2) )                    &
-                                     )
-
-                diss_r    = -ABS( u_comp ) * (                                &
-                          ( 10.0_wp * ibit2 * adv_sca_5                       &
-                       +     3.0_wp * ibit1 * adv_sca_3                       &
-                       +              ibit0 * adv_sca_1                       &
-                          ) *                                                 &
-                             ( sk(k,j,i+1) - sk(k,j,i)   )                    &
-                   -      (  5.0_wp * ibit2 * adv_sca_5                       &
-                       +              ibit1 * adv_sca_3                       &
-                          ) *                                                 &
-                             ( sk(k,j,i+2) - sk(k,j,i-1) )                    &
-                   +      (           ibit2 * adv_sca_5                       &
-                          ) *                                                 &
-                             ( sk(k,j,i+3) - sk(k,j,i-2) )                    &
-                                             )
-
-                ibit5 = IBITS(wall_flags_0(k,j-1,i),5,1)
-                ibit4 = IBITS(wall_flags_0(k,j-1,i),4,1)
-                ibit3 = IBITS(wall_flags_0(k,j-1,i),3,1)
-
-                v_comp    = v(k,j,i) - v_gtrans
-                flux_s    = v_comp * (                                        &
-                          ( 37.0_wp * ibit5 * adv_sca_5                       &
-                       +     7.0_wp * ibit4 * adv_sca_3                       &
-                       +              ibit3 * adv_sca_1                       &
-                          ) *                                                 &
-                             ( sk(k,j,i)  + sk(k,j-1,i)     )                 &
-                    -     (  8.0_wp * ibit5 * adv_sca_5                       &
-                       +              ibit4 * adv_sca_3                       &
-                          ) *                                                 &
-                             ( sk(k,j+1,i) + sk(k,j-2,i)    )                 &
-                   +      (           ibit5 * adv_sca_5                       &
-                          ) *                                                 &
-                             ( sk(k,j+2,i) + sk(k,j-3,i)    )                 &
-                                     )
-
-                diss_s    = -ABS( v_comp ) * (                                &
-                          ( 10.0_wp * ibit5 * adv_sca_5                       &
-                       +     3.0_wp * ibit4 * adv_sca_3                       &
-                       +              ibit3 * adv_sca_1                       &
-                          ) *                                                 &
-                             ( sk(k,j,i)   - sk(k,j-1,i)  )                   &
-                   -      (  5.0_wp * ibit5 * adv_sca_5                       &
-                       +              ibit4 * adv_sca_3                       &
-                          ) *                                                 &
-                             ( sk(k,j+1,i) - sk(k,j-2,i)  )                   &
-                   +      (           ibit5 * adv_sca_5                       &
-                          ) *                                                 &
-                             ( sk(k,j+2,i) - sk(k,j-3,i)  )                   &
-                                             )
-
-                ibit5 = IBITS(wall_flags_0(k,j,i),5,1)
-                ibit4 = IBITS(wall_flags_0(k,j,i),4,1)
-                ibit3 = IBITS(wall_flags_0(k,j,i),3,1)
-
-                v_comp    = v(k,j+1,i) - v_gtrans
-                flux_n    = v_comp * (                                        &
-                          ( 37.0_wp * ibit5 * adv_sca_5                       &
-                       +     7.0_wp * ibit4 * adv_sca_3                       &
-                       +              ibit3 * adv_sca_1                       &
-                          ) *                                                 &
-                             ( sk(k,j+1,i) + sk(k,j,i)   )                    &
-                   -      (  8.0_wp * ibit5 * adv_sca_5                       &
-                       +              ibit4 * adv_sca_3                       &
-                          ) *                                                 &
-                             ( sk(k,j+2,i) + sk(k,j-1,i) )                    &
-                   +      (           ibit5 * adv_sca_5                       &
-                          ) *                                                 &
-                             ( sk(k,j+3,i) + sk(k,j-2,i) )                    &
-                                     )
-
-                diss_n    = -ABS( v_comp ) * (                                &
-                          ( 10.0_wp * ibit5 * adv_sca_5                       &
-                       +     3.0_wp * ibit4 * adv_sca_3                       &
-                       +              ibit3 * adv_sca_1                       &
-                          ) *                                                 &
-                             ( sk(k,j+1,i) - sk(k,j,i)    )                   &
-                   -      (  5.0_wp * ibit5 * adv_sca_5                       &
-                       +              ibit4 * adv_sca_3                       &
-                          ) *                                                 &
-                             ( sk(k,j+2,i) - sk(k,j-1,i)  )                   &
-                   +      (           ibit5 * adv_sca_5                       &
-                          ) *                                                 &
-                             ( sk(k,j+3,i) - sk(k,j-2,i)  )                   &
-                                             )
-
-!
-!--             indizes k_m, k_mm, ... should be known at these point
-                ibit8 = IBITS(wall_flags_0(k-1,j,i),8,1)
-                ibit7 = IBITS(wall_flags_0(k-1,j,i),7,1)
-                ibit6 = IBITS(wall_flags_0(k-1,j,i),6,1)
-
-                k_pp  = k + 2 * ibit8
-                k_mm  = k - 2 * ( ibit7 + ibit8 )
-                k_mmm = k - 3 * ibit8
-
-                flux_d    = w(k-1,j,i) * (                                    &
-                           ( 37.0_wp * ibit8 * adv_sca_5                      &
-                        +     7.0_wp * ibit7 * adv_sca_3                      &
-                        +              ibit6 * adv_sca_1                      &
-                           ) *                                                &
-                                   ( sk(k,j,i)    + sk(k-1,j,i)  )            &
-                    -      (  8.0_wp * ibit8 * adv_sca_5                      &
-                          +            ibit7 * adv_sca_3                      &
-                           ) *                                                &
-                                   ( sk(k+1,j,i) + sk(k_mm,j,i)  )            &
-                    +      (           ibit8 * adv_sca_5                      &
-                           ) *     ( sk(k_pp,j,i)+ sk(k_mmm,j,i) )            &
-                                         )
-
-                diss_d    = -ABS( w(k-1,j,i) ) * (                            &
-                           ( 10.0_wp * ibit8 * adv_sca_5                      &
-                        +     3.0_wp * ibit7 * adv_sca_3                      &
-                        +              ibit6 * adv_sca_1                      &
-                           ) *                                                &
-                                   ( sk(k,j,i)    - sk(k-1,j,i)   )           &
-                    -      (  5.0_wp * ibit8 * adv_sca_5                      &
-                        +              ibit7 * adv_sca_3                      &
-                           ) *                                                &
-                                   ( sk(k+1,j,i)  - sk(k_mm,j,i)  )           &
-                    +      (           ibit8 * adv_sca_5                      &
-                           ) *                                                &
-                                   ( sk(k_pp,j,i) - sk(k_mmm,j,i) )           &
-                                                 )
-
-                ibit8 = IBITS(wall_flags_0(k,j,i),8,1)
-                ibit7 = IBITS(wall_flags_0(k,j,i),7,1)
-                ibit6 = IBITS(wall_flags_0(k,j,i),6,1)
-
-                k_ppp = k + 3 * ibit8
-                k_pp  = k + 2 * ( 1 - ibit6  )
-                k_mm  = k - 2 * ibit8
-
-                flux_t    = w(k,j,i) * rho_air_zw(k) * (                      &
-                           ( 37.0_wp * ibit8 * adv_sca_5                      &
-                        +     7.0_wp * ibit7 * adv_sca_3                      &
-                        +              ibit6 * adv_sca_1                      &
-                           ) *                                                &
-                                   ( sk(k+1,j,i)  + sk(k,j,i)    )            &
-                    -      (  8.0_wp * ibit8 * adv_sca_5                      &
-                        +              ibit7 * adv_sca_3                      &
-                           ) *                                                &
-                                   ( sk(k_pp,j,i) + sk(k-1,j,i)  )            &
-                    +      (           ibit8 * adv_sca_5                      &
-                           ) *     ( sk(k_ppp,j,i)+ sk(k_mm,j,i) )            &
-                                       )
-
-                diss_t    = -ABS( w(k,j,i) ) * rho_air_zw(k) * (              &
-                           ( 10.0_wp * ibit8 * adv_sca_5                      &
-                        +     3.0_wp * ibit7 * adv_sca_3                      &
-                        +              ibit6 * adv_sca_1                      &
-                           ) *                                                &
-                                   ( sk(k+1,j,i)   - sk(k,j,i)    )           &
-                    -      (  5.0_wp * ibit8 * adv_sca_5                      &
-                        +              ibit7 * adv_sca_3                      &
-                           ) *                                                &
-                                   ( sk(k_pp,j,i)  - sk(k-1,j,i)  )           &
-                    +      (           ibit8 * adv_sca_5                      &
-                           ) *                                                &
-                                   ( sk(k_ppp,j,i) - sk(k_mm,j,i) )           &
-                                         )
-!
-!--             Apply monotonic adjustment.
-                IF ( monotonic_adjustment )  THEN
-!
-!--                At first, calculate first order fluxes.
-                   u_comp = u(k,j,i) - u_gtrans
-                   fl_1   =  ( u_comp   * ( sk(k,j,i) + sk(k,j,i-1) )         &
-                         -ABS( u_comp ) * ( sk(k,j,i) - sk(k,j,i-1) )         &
-                             ) * adv_sca_1 
-
-                   u_comp = u(k,j,i+1) - u_gtrans
-                   fr_1   =  ( u_comp   * ( sk(k,j,i+1) + sk(k,j,i) )         &
-                         -ABS( u_comp ) * ( sk(k,j,i+1) - sk(k,j,i) )         &
-                             ) * adv_sca_1 
-
-                   v_comp = v(k,j,i) - v_gtrans
-                   fs_1   =  ( v_comp   * ( sk(k,j,i) + sk(k,j-1,i) )         &
-                         -ABS( v_comp ) * ( sk(k,j,i) - sk(k,j-1,i) )         &
-                             ) * adv_sca_1 
-
-                   v_comp = v(k,j+1,i) - v_gtrans
-                   fn_1   =  ( v_comp   * ( sk(k,j+1,i) + sk(k,j,i) )         &
-                         -ABS( v_comp ) * ( sk(k,j+1,i) - sk(k,j,i) )         &
-                             ) * adv_sca_1 
-
-                   fd_1   = (  w(k-1,j,i)   * ( sk(k,j,i) + sk(k-1,j,i) )     &
-                        -ABS( w(k-1,j,i) ) * ( sk(k,j,i) - sk(k-1,j,i) )      &
-                            ) * adv_sca_1 * rho_air_zw(k)
-
-                   ft_1   = (  w(k,j,i)   * ( sk(k+1,j,i) + sk(k,j,i) )       &
-                        -ABS( w(k,j,i) ) * ( sk(k+1,j,i) - sk(k,j,i) )        &
-                            ) * adv_sca_1 * rho_air_zw(k)
-!
-!--                Calculate ratio of upwind gradients. Note, Min/Max is just
-!--                to avoid if statements.
-                   rl     = ( MAX( 0.0_wp, u(k,j,i) - u_gtrans ) *            & 
-                               ABS( ( sk(k,j,i-1) - sk(k,j,i-2)            ) /&
-                                    ( sk(k,j,i)   - sk(k,j,i-1) + 1E-20_wp )  &
-                                  ) +                                         & 
-                              MIN( 0.0_wp, u(k,j,i) - u_gtrans ) *            &
-                               ABS( ( sk(k,j,i)   - sk(k,j,i+1)            ) /&
-                                    ( sk(k,j,i-1) - sk(k,j,i)   + 1E-20_wp )  &
-                                  )                                           &
-                            ) / ABS( u(k,j,i) - u_gtrans + 1E-20_wp )
-
-                   rr     = ( MAX( 0.0_wp, u(k,j,i+1) - u_gtrans ) *          & 
-                               ABS( ( sk(k,j,i)   - sk(k,j,i-1)            ) /&
-                                    ( sk(k,j,i+1) - sk(k,j,i)   + 1E-20_wp )  &
-                                  ) +                                         & 
-                              MIN( 0.0_wp, u(k,j,i+1) - u_gtrans ) *          &
-                               ABS( ( sk(k,j,i+1) - sk(k,j,i+2)            ) /&
-                                    ( sk(k,j,i)   - sk(k,j,i+1) + 1E-20_wp )  &
-                                  )                                           &
-                            ) / ABS( u(k,j,i+1) - u_gtrans + 1E-20_wp )
-
-                   rs     = ( MAX( 0.0_wp, v(k,j,i) - v_gtrans ) *            & 
-                               ABS( ( sk(k,j-1,i) - sk(k,j-2,i)            ) /&
-                                    ( sk(k,j,i)   - sk(k,j-1,i) + 1E-20_wp )  &
-                                  ) +                                         & 
-                              MIN( 0.0_wp, v(k,j,i) - v_gtrans ) *            &
-                               ABS( ( sk(k,j,i)   - sk(k,j+1,i)            ) /&
-                                    ( sk(k,j-1,i) - sk(k,j,i)   + 1E-20_wp )  &
-                                  )                                           &
-                            ) / ABS( v(k,j,i) - v_gtrans + 1E-20_wp )
-
-                   rn     = ( MAX( 0.0_wp, v(k,j+1,i) - v_gtrans ) *          & 
-                               ABS( ( sk(k,j,i)   - sk(k,j-1,i)            ) /&
-                                    ( sk(k,j+1,i) - sk(k,j,i)   + 1E-20_wp )  &
-                                  ) +                                         & 
-                              MIN( 0.0_wp, v(k,j+1,i) - v_gtrans ) *          &
-                               ABS( ( sk(k,j+1,i) - sk(k,j+2,i)            ) /&
-                                    ( sk(k,j,i)   - sk(k,j+1,i) + 1E-20_wp )  &
-                                  )                                           &
-                            ) / ABS( v(k,j+1,i) - v_gtrans + 1E-20_wp )     
-!   
-!--                Reuse k_mm and compute k_mmm for the vertical gradient ratios. 
-!--                Note, for vertical advection below the third grid point above 
-!--                surface ( or below the model top) rd and rt are set to 0, i.e. 
-!--                use of first order scheme is enforced.
-                   k_mmm  = k - 3 * ibit8
-
-                   rd     = ( MAX( 0.0_wp, w(k-1,j,i) ) *                     & 
-                            ABS( ( sk(k_mm,j,i) - sk(k_mmm,j,i)           ) / &
-                                 ( sk(k-1,j,i)  - sk(k_mm,j,i) + 1E-20_wp )   &
-                               ) +                                            & 
-                              MIN( 0.0_wp, w(k-1,j,i) ) *                     &
-                            ABS( ( sk(k-1,j,i) - sk(k,j,i)            ) /     &
-                                 ( sk(k_mm,j,i) - sk(k-1,j,i)   + 1E-20_wp )  &
-                               )                                              &
-                            ) * ibit8 / ABS( w(k-1,j,i) + 1E-20_wp ) 
- 
-                   rt     = ( MAX( 0.0_wp, w(k,j,i) ) *                       & 
-                            ABS( ( sk(k,j,i)   - sk(k-1,j,i)            ) /   &
-                                 ( sk(k+1,j,i) - sk(k,j,i)   + 1E-20_wp )     &
-                               ) +                                            & 
-                              MIN( 0.0_wp, w(k,j,i) ) *                       &
-                            ABS( ( sk(k+1,j,i) - sk(k_pp,j,i)           ) /   &
-                                 ( sk(k,j,i)   - sk(k+1,j,i) + 1E-20_wp )     &
-                               )                                              &
-                            ) * ibit8 / ABS( w(k,j,i) + 1E-20_wp )
-!
-!--                Calculate empirical limiter function (van Albada2 limiter).
-                   phi_l = MIN( 1.0_wp, ( 2.0_wp * ABS( rl ) ) /              &
-                                        ( rl**2 + 1.0_wp ) ) 
-                   phi_r = MIN( 1.0_wp, ( 2.0_wp * ABS( rr ) ) /              &
-                                        ( rr**2 + 1.0_wp ) ) 
-                   phi_s = MIN( 1.0_wp, ( 2.0_wp * ABS( rs ) ) /              &
-                                        ( rs**2 + 1.0_wp ) ) 
-                   phi_n = MIN( 1.0_wp, ( 2.0_wp * ABS( rn ) ) /              &
-                                        ( rn**2 + 1.0_wp ) ) 
-                   phi_d = MIN( 1.0_wp, ( 2.0_wp * ABS( rd ) ) /              &
-                                        ( rd**2 + 1.0_wp ) ) 
-                   phi_t = MIN( 1.0_wp, ( 2.0_wp * ABS( rt ) ) /              &
-                                        ( rt**2 + 1.0_wp ) ) 
-!
-!--                Calculate the resulting monotone flux. 
-                   flux_l = fl_1 - phi_l * ( fl_1 - flux_l )
-                   flux_r = fr_1 - phi_r * ( fr_1 - flux_r )
-                   flux_s = fs_1 - phi_s * ( fs_1 - flux_s )
-                   flux_n = fn_1 - phi_n * ( fn_1 - flux_n )
-                   flux_d = fd_1 - phi_d * ( fd_1 - flux_d )
-                   flux_t = ft_1 - phi_t * ( ft_1 - flux_t )
-!
-!--                Moreover, modify dissipation flux according to the limiter. 
-                   diss_l = diss_l * phi_l
-                   diss_r = diss_r * phi_r
-                   diss_s = diss_s * phi_s
-                   diss_n = diss_n * phi_n
-                   diss_d = diss_d * phi_d
-                   diss_t = diss_t * phi_t
-
-                ENDIF
-!
-!--             Calculate the divergence of the velocity field. A respective
-!--             correction is needed to overcome numerical instabilities caused
-!--             by a not sufficient reduction of divergences near topography.
-                div   =   ( u(k,j,i+1) * ( ibit0 + ibit1 + ibit2 )             &
-                          - u(k,j,i)   * ( IBITS(wall_flags_0(k,j,i-1),0,1)    &
-                                         + IBITS(wall_flags_0(k,j,i-1),1,1)    &
-                                         + IBITS(wall_flags_0(k,j,i-1),2,1)    &
-                                         )                                     &
-                          ) * rho_air(k) * ddx                                 &
-                        + ( v(k,j+1,i) * ( ibit3 + ibit4 + ibit5 )             &
-                          - v(k,j,i)   * ( IBITS(wall_flags_0(k,j-1,i),3,1)    &
-                                         + IBITS(wall_flags_0(k,j-1,i),4,1)    &
-                                         + IBITS(wall_flags_0(k,j-1,i),5,1)    &
-                                         )                                     &
-                          ) * rho_air(k) * ddy                                 &
-                        + ( w(k,j,i) * rho_air_zw(k) *                         &
-                                         ( ibit6 + ibit7 + ibit8 )             &
-                          - w(k-1,j,i) * rho_air_zw(k-1) *                     &
-                                         ( IBITS(wall_flags_0(k-1,j,i),6,1)    &
-                                         + IBITS(wall_flags_0(k-1,j,i),7,1)    &
-                                         + IBITS(wall_flags_0(k-1,j,i),8,1)    &
-                                         )                                     &      
-                          ) * ddzw(k)
-
-
-                tend(k,j,i) = - (                                             &
-                               ( flux_r + diss_r - flux_l - diss_l ) * ddx    &
-                             + ( flux_n + diss_n - flux_s - diss_s ) * ddy    &
-                             + ( ( flux_t + diss_t ) -                        &
-                                 ( flux_d + diss_d )                          &
-                                                    ) * drho_air(k) * ddzw(k) &
-                                ) + div * sk(k,j,i)
-
-!++
-!--             Evaluation of statistics
-!                SELECT CASE ( sk_char )
-!
-!                   CASE ( 'pt' )
-!                      sums_wspts_ws_l(k,tn) = sums_wspts_ws_l(k,tn)         &
-!                       + ( flux_t + diss_t )                                &
-!                       *   weight_substep(intermediate_timestep_count)
-!                   CASE ( 'sa' )
-!                      sums_wssas_ws_l(k,tn) = sums_wssas_ws_l(k,tn)         &
-!                       + ( flux_t + diss_t )                                &
-!                       *   weight_substep(intermediate_timestep_count)
-!                   CASE ( 'q' )
-!                      sums_wsqs_ws_l(k,tn) = sums_wsqs_ws_l(k,tn)           &
-!                      + ( flux_t + diss_t )                                 &
-!                      *   weight_substep(intermediate_timestep_count)
-!                   CASE ( 'qr' )
-!                      sums_wsqrs_ws_l(k,tn) = sums_wsqrs_ws_l(k,tn)         &
-!                      + ( flux_t + diss_t )                                 &
-!                      *   weight_substep(intermediate_timestep_count)
-!                   CASE ( 'nr' )
-!                      sums_wsnrs_ws_l(k,tn) = sums_wsnrs_ws_l(k,tn)         &
-!                      + ( flux_t + diss_t )                                 &
-!                      *   weight_substep(intermediate_timestep_count)
-!
-!                END SELECT
-
-             ENDDO
-         ENDDO
-      ENDDO
-      !$acc end kernels
-
-    END SUBROUTINE advec_s_ws_acc
-
 
 !------------------------------------------------------------------------------!
@@ -5039,367 +4516,4 @@
 ! Description:
 ! ------------
-!> Advection of u - Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE advec_u_ws_acc
-
-       USE arrays_3d,                                                          &
-           ONLY:  ddzw, drho_air, tend, u, v, w, rho_air, rho_air_zw
-
-       USE constants,                                                          &
-           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
-
-       USE control_parameters,                                                 &
-           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
-
-       USE grid_variables,                                                     &
-           ONLY:  ddx, ddy
-
-       USE indices,                                                            &
-           ONLY:  i_left, i_right, j_north, j_south, nxl, nxr, nyn, nys, nzb,  &
-                  nzb_max, nzt, wall_flags_0
-           
-       USE kinds
-       
-!        USE statistics,                                                       &
-!            ONLY:  hom, sums_us2_ws_l, sums_wsus_ws_l, weight_substep
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i      !<
-       INTEGER(iwp) ::  ibit9  !<
-       INTEGER(iwp) ::  ibit10 !<
-       INTEGER(iwp) ::  ibit11 !<
-       INTEGER(iwp) ::  ibit12 !<
-       INTEGER(iwp) ::  ibit13 !<
-       INTEGER(iwp) ::  ibit14 !<
-       INTEGER(iwp) ::  ibit15 !<
-       INTEGER(iwp) ::  ibit16 !<
-       INTEGER(iwp) ::  ibit17 !<
-       INTEGER(iwp) ::  j      !<
-       INTEGER(iwp) ::  k      !<
-       INTEGER(iwp) ::  k_mmm  !<
-       INTEGER(iwp) ::  k_mm   !<
-       INTEGER(iwp) ::  k_pp   !<
-       INTEGER(iwp) ::  k_ppp  !<
-       INTEGER(iwp) ::  tn = 0 !<
-
-       REAL(wp)    ::  diss_d   !<
-       REAL(wp)    ::  diss_l   !<
-       REAL(wp)    ::  diss_n   !<
-       REAL(wp)    ::  diss_r   !<
-       REAL(wp)    ::  diss_s   !<
-       REAL(wp)    ::  diss_t   !<
-       REAL(wp)    ::  div      !<
-       REAL(wp)    ::  flux_d   !<
-       REAL(wp)    ::  flux_l   !<
-       REAL(wp)    ::  flux_n   !<
-       REAL(wp)    ::  flux_r   !<
-       REAL(wp)    ::  flux_s   !<
-       REAL(wp)    ::  flux_t   !<
-       REAL(wp)    ::  gu       !<
-       REAL(wp)    ::  gv       !<
-       REAL(wp)    ::  u_comp   !<
-       REAL(wp)    ::  u_comp_l !<
-       REAL(wp)    ::  v_comp   !<
-       REAL(wp)    ::  v_comp_s !<
-       REAL(wp)    ::  w_comp   !<
-
-
-       gu = 2.0_wp * u_gtrans
-       gv = 2.0_wp * v_gtrans
-
-!
-!--    Computation of fluxes and tendency terms
-       !$acc  kernels present( ddzw, tend, u, v, w, wall_flags_0 )
-       DO i = i_left, i_right
-          DO  j = j_south, j_north
-             DO  k = nzb+1, nzt
-
-                ibit11 = IBITS(wall_flags_0(k,j,i-1),11,1)
-                ibit10 = IBITS(wall_flags_0(k,j,i-1),10,1)
-                ibit9  = IBITS(wall_flags_0(k,j,i-1),9,1)
-
-                u_comp_l           = u(k,j,i) + u(k,j,i-1) - gu
-                flux_l             = u_comp_l * (                          &
-                                    ( 37.0_wp * ibit11 * adv_mom_5             &
-                                 +     7.0_wp * ibit10 * adv_mom_3             &
-                                 +              ibit9  * adv_mom_1             &
-                                    ) *                                     &
-                                  ( u(k,j,i)   + u(k,j,i-1) )               &
-                             -      (  8.0_wp * ibit11 * adv_mom_5             &
-                                 +              ibit10 * adv_mom_3             &
-                                    ) *                                     &
-                                  ( u(k,j,i+1) + u(k,j,i-2) )               &
-                             +      (           ibit11 * adv_mom_5             &
-                                    ) *                                     &
-                                  ( u(k,j,i+2) + u(k,j,i-3) )               &
-                                                )
-
-                diss_l             = - ABS( u_comp_l ) * (                &
-                                   ( 10.0_wp * ibit11 * adv_mom_5             &
-                                +     3.0_wp * ibit10 * adv_mom_3             &
-                                +              ibit9  * adv_mom_1             &
-                                   ) *                                     &
-                                 ( u(k,j,i)   - u(k,j,i-1) )               &
-                            -      (  5.0_wp * ibit11 * adv_mom_5             &
-                                +              ibit10 * adv_mom_3             &
-                                   ) *                                     &
-                                 ( u(k,j,i+1) - u(k,j,i-2) )               &
-                            +      (           ibit11 * adv_mom_5             &
-                                   ) *                                     &
-                                 ( u(k,j,i+2) - u(k,j,i-3) )               &
-                                                         )
-
-                ibit11 = IBITS(wall_flags_0(k,j,i),11,1)
-                ibit10 = IBITS(wall_flags_0(k,j,i),10,1)
-                ibit9  = IBITS(wall_flags_0(k,j,i),9,1)
-
-                u_comp    = u(k,j,i+1) + u(k,j,i)
-                flux_r    = ( u_comp   - gu ) * (                           &
-                          ( 37.0_wp * ibit11 * adv_mom_5                        &
-                       +     7.0_wp * ibit10 * adv_mom_3                        &
-                       +              ibit9  * adv_mom_1                        &
-                          ) *                                                &
-                                 ( u(k,j,i+1) + u(k,j,i)   )                 &
-                   -      (  8.0_wp * ibit11 * adv_mom_5                        &
-                       +              ibit10 * adv_mom_3                        &
-                          ) *                                                &
-                                 ( u(k,j,i+2) + u(k,j,i-1) )                 &
-                   +      (           ibit11 * adv_mom_5                        &
-                          ) *                                                &
-                                 ( u(k,j,i+3) + u(k,j,i-2) )                 &
-                                                 )
-
-                diss_r    = - ABS( u_comp    - gu ) * (                      &
-                          ( 10.0_wp * ibit11 * adv_mom_5                        &
-                       +     3.0_wp * ibit10 * adv_mom_3                        &
-                       +              ibit9  * adv_mom_1                        &
-                          ) *                                                &
-                                 ( u(k,j,i+1) - u(k,j,i)  )                  &
-                   -      (  5.0_wp * ibit11 * adv_mom_5                        &
-                       +              ibit10 * adv_mom_3                        &
-                          ) *                                                &
-                                 ( u(k,j,i+2) - u(k,j,i-1) )                 &
-                   +      (           ibit11 * adv_mom_5                        &
-                          ) *                                                &
-                                 ( u(k,j,i+3) - u(k,j,i-2) )                 &
-                                                     )
-
-                ibit14 = IBITS(wall_flags_0(k,j-1,i),14,1)
-                ibit13 = IBITS(wall_flags_0(k,j-1,i),13,1)
-                ibit12 = IBITS(wall_flags_0(k,j-1,i),12,1)
-
-                v_comp_s                 = v(k,j,i) + v(k,j,i-1) - gv
-                flux_s                   = v_comp_s * (                       &
-                                   ( 37.0_wp * ibit14 * adv_mom_5                &
-                                +     7.0_wp * ibit13 * adv_mom_3                &
-                                +              ibit12 * adv_mom_1                &
-                                   ) *                                         &
-                                     ( u(k,j,i)   + u(k,j-1,i) )              &
-                            -      (  8.0_wp * ibit14 * adv_mom_5                &
-                            +                  ibit13 * adv_mom_3                    &
-                                   ) *                                        &
-                                     ( u(k,j+1,i) + u(k,j-2,i) )              &
-                        +      (               ibit14 * adv_mom_5                    &
-                               ) *                                            &
-                                     ( u(k,j+2,i) + u(k,j-3,i) )              &
-                                               )
-
-                diss_s                  = - ABS ( v_comp_s ) * (              &
-                                   ( 10.0_wp * ibit14 * adv_mom_5                &
-                                +     3.0_wp * ibit13 * adv_mom_3                &
-                                +              ibit12 * adv_mom_1                &
-                                   ) *                                        &
-                                     ( u(k,j,i)   - u(k,j-1,i) )              &
-                            -      (  5.0_wp * ibit14 * adv_mom_5                &
-                                +              ibit13 * adv_mom_3                &
-                                   ) *                                        &
-                                     ( u(k,j+1,i) - u(k,j-2,i) )              &
-                            +      (           ibit14 * adv_mom_5                &
-                                   ) *                                        &
-                                     ( u(k,j+2,i) - u(k,j-3,i) )              &
-                                                         )
-
-
-                ibit14 = IBITS(wall_flags_0(k,j,i),14,1)
-                ibit13 = IBITS(wall_flags_0(k,j,i),13,1)
-                ibit12 = IBITS(wall_flags_0(k,j,i),12,1)
-
-                v_comp    = v(k,j+1,i) + v(k,j+1,i-1) - gv
-                flux_n    = v_comp * (                                       &
-                          ( 37.0_wp * ibit14 * adv_mom_5                        &
-                       +     7.0_wp * ibit13 * adv_mom_3                        &
-                       +              ibit12 * adv_mom_1                        &
-                          ) *                                                &
-                                 ( u(k,j+1,i) + u(k,j,i)   )                 &
-                   -      (  8.0_wp * ibit14 * adv_mom_5                        &
-                       +              ibit13 * adv_mom_3                        &
-                          ) *                                                &
-                                 ( u(k,j+2,i) + u(k,j-1,i) )                 &
-                   +      (           ibit14 * adv_mom_5                        &
-                          ) *                                                &
-                                 ( u(k,j+3,i) + u(k,j-2,i) )                 &
-                                                 )
-
-                diss_n    = - ABS ( v_comp ) * (                             &
-                          ( 10.0_wp * ibit14 * adv_mom_5                        &
-                       +     3.0_wp * ibit13 * adv_mom_3                        &
-                       +              ibit12 * adv_mom_1                        &
-                          ) *                                                &
-                                 ( u(k,j+1,i) - u(k,j,i)  )                  &
-                   -      (  5.0_wp * ibit14 * adv_mom_5                        &
-                       +              ibit13 * adv_mom_3                        &
-                          ) *                                                &
-                                 ( u(k,j+2,i) - u(k,j-1,i) )                 &
-                   +      (           ibit14 * adv_mom_5                        &
-                          ) *                                                &
-                                 ( u(k,j+3,i) - u(k,j-2,i) )                 &
-                                                      )
-
-                ibit17 = IBITS(wall_flags_0(k-1,j,i),17,1)
-                ibit16 = IBITS(wall_flags_0(k-1,j,i),16,1)
-                ibit15 = IBITS(wall_flags_0(k-1,j,i),15,1)
-
-                k_pp  = k + 2 * ibit17
-                k_mm  = k - 2 * ( ibit16 + ibit17 )
-                k_mmm = k - 3 * ibit17
-
-                w_comp    = w(k-1,j,i) + w(k-1,j,i-1)
-                flux_d    = w_comp  * (                                      &
-                          ( 37.0_wp * ibit17 * adv_mom_5                        &
-                       +     7.0_wp * ibit16 * adv_mom_3                        &
-                       +              ibit15 * adv_mom_1                        &
-                          ) *                                                &
-                             ( u(k,j,i)    + u(k-1,j,i)   )                  &
-                   -      (  8.0_wp * ibit17 * adv_mom_5                        &
-                       +              ibit16 * adv_mom_3                        &
-                          ) *                                                &
-                             ( u(k+1,j,i) + u(k_mm,j,i)   )                  &
-                   +      (           ibit17 * adv_mom_5                        &
-                          ) *                                                 &
-                             ( u(k_pp,j,i) + u(k_mmm,j,i) )                  &
-                                      )
-
-                diss_d    = - ABS( w_comp ) * (                              &
-                          ( 10.0_wp * ibit17 * adv_mom_5                        &
-                       +     3.0_wp * ibit16 * adv_mom_3                        &
-                       +              ibit15 * adv_mom_1                        &
-                          ) *                                                &
-                             ( u(k,j,i)     - u(k-1,j,i)  )                  &
-                   -      (  5.0_wp * ibit17 * adv_mom_5                        &
-                       +              ibit16 * adv_mom_3                        &
-                          ) *                                                &
-                             ( u(k+1,j,i)  - u(k_mm,j,i)  )                  &
-                   +      (           ibit17 * adv_mom_5                        &
-                           ) *                                               &
-                             ( u(k_pp,j,i) - u(k_mmm,j,i) )                  &
-                                              )
-!
-!--             k index has to be modified near bottom and top, else array
-!--             subscripts will be exceeded.
-                ibit17 = IBITS(wall_flags_0(k,j,i),17,1)
-                ibit16 = IBITS(wall_flags_0(k,j,i),16,1)
-                ibit15 = IBITS(wall_flags_0(k,j,i),15,1)
-
-                k_ppp = k + 3 * ibit17
-                k_pp  = k + 2 * ( 1 - ibit15  )
-                k_mm  = k - 2 * ibit17
-
-                w_comp    = w(k,j,i) + w(k,j,i-1)
-                flux_t    = w_comp * rho_air_zw(k) * (                       &
-                          ( 37.0_wp * ibit17 * adv_mom_5                        &
-                       +     7.0_wp * ibit16 * adv_mom_3                        &
-                       +              ibit15 * adv_mom_1                        &
-                          ) *                                                &
-                             ( u(k+1,j,i)  + u(k,j,i)     )                  &
-                   -      (  8.0_wp * ibit17 * adv_mom_5                        &
-                       +              ibit16 * adv_mom_3                        &
-                          ) *                                                &
-                             ( u(k_pp,j,i) + u(k-1,j,i)   )                  &
-                   +      (           ibit17 * adv_mom_5                        &
-                          ) *                                                &
-                             ( u(k_ppp,j,i) + u(k_mm,j,i) )                  &
-                                      )
-
-                diss_t    = - ABS( w_comp ) * rho_air_zw(k) * (              &
-                          ( 10.0_wp * ibit17 * adv_mom_5                        &
-                       +     3.0_wp * ibit16 * adv_mom_3                        &
-                       +              ibit15 * adv_mom_1                        &
-                          ) *                                                &
-                             ( u(k+1,j,i)   - u(k,j,i)    )                  &
-                   -      (  5.0_wp * ibit17 * adv_mom_5                        &
-                       +              ibit16 * adv_mom_3                        &
-                          ) *                                                &
-                             ( u(k_pp,j,i)  - u(k-1,j,i)  )                  &
-                   +      (           ibit17 * adv_mom_5                        &
-                           ) *                                               &
-                             ( u(k_ppp,j,i) - u(k_mm,j,i) )                  &
-                                              )
-!
-!--             Calculate the divergence of the velocity field. A respective
-!--             correction is needed to overcome numerical instabilities caused
-!--             by a not sufficient reduction of divergences near topography.
-                div = ( ( u_comp    * ( ibit9 + ibit10 + ibit11 )             &
-                - ( u(k,j,i)   + u(k,j,i-1)   )                               &
-                                    * ( IBITS(wall_flags_0(k,j,i-1),9,1)      &
-                                      + IBITS(wall_flags_0(k,j,i-1),10,1)     &
-                                      + IBITS(wall_flags_0(k,j,i-1),11,1)     &
-                                      )                                       &
-                  ) * rho_air(k) * ddx                                        &
-               +  ( ( v_comp + gv ) * ( ibit12 + ibit13 + ibit14 )            &
-                  - ( v(k,j,i)   + v(k,j,i-1 )  )                             &
-                                    * ( IBITS(wall_flags_0(k,j-1,i),12,1)     &
-                                      + IBITS(wall_flags_0(k,j-1,i),13,1)     &
-                                      + IBITS(wall_flags_0(k,j-1,i),14,1)     &
-                                      )                                       &
-                  ) * rho_air(k) * ddy                                        &
-               +  ( w_comp * rho_air_zw(k) * ( ibit15 + ibit16 + ibit17 )     &
-                - ( w(k-1,j,i) + w(k-1,j,i-1) ) * rho_air_zw(k-1)             &
-                                    * ( IBITS(wall_flags_0(k-1,j,i),15,1)     &
-                                      + IBITS(wall_flags_0(k-1,j,i),16,1)     &
-                                      + IBITS(wall_flags_0(k-1,j,i),17,1)     &
-                                      )                                       &
-                  ) * ddzw(k)   &
-                ) * 0.5_wp
-
-
-                tend(k,j,i) = - (                                              &
-                               ( flux_r + diss_r - flux_l - diss_l ) * ddx     &
-                             + ( flux_n + diss_n - flux_s - diss_s ) * ddy     &
-                             + ( ( flux_t + diss_t ) -                         &
-                                 ( flux_d + diss_d )                           &
-                                                     ) * drho_air(k) * ddzw(k) &
-                                ) + div * u(k,j,i)
-
-!++
-!--             Statistical Evaluation of u'u'. The factor has to be applied
-!--             for right evaluation when gallilei_trans = .T. .
-!                sums_us2_ws_l(k,tn) = sums_us2_ws_l(k,tn)                     &
-!                              + ( flux_r    *                                 &
-!                                ( u_comp    - 2.0_wp * hom(k,1,1,0) )            &
-!                              / ( u_comp    - gu + 1.0E-20_wp   )             &
-!                              +   diss_r    *                                 &
-!                                  ABS( u_comp    - 2.0_wp * hom(k,1,1,0) )       &
-!                              / ( ABS( u_comp    - gu ) + 1.0E-20_wp ) )      &
-!                              *   weight_substep(intermediate_timestep_count)
-!
-!--             Statistical Evaluation of w'u'.
-!                sums_wsus_ws_l(k,tn) = sums_wsus_ws_l(k,tn)                   &
-!                              + ( flux_t    + diss_t    )                     &
-!                              *   weight_substep(intermediate_timestep_count)
-             ENDDO
-          ENDDO
-       ENDDO
-       !$acc end kernels
-
-!++
-!       sums_us2_ws_l(nzb,tn) = sums_us2_ws_l(nzb+1,tn)
-
-    END SUBROUTINE advec_u_ws_acc
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
 !> Advection of v - Call for all grid points
 !------------------------------------------------------------------------------!
@@ -5906,370 +5020,4 @@
     
     
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Advection of v - Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE advec_v_ws_acc
-
-       USE arrays_3d,                                                          &
-           ONLY:  ddzw, drho_air, tend, u, v, w, rho_air, rho_air_zw
-
-       USE constants,                                                          &
-           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
-
-       USE control_parameters,                                                 &
-           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
-
-       USE grid_variables,                                                     &
-           ONLY:  ddx, ddy
-
-       USE indices,                                                            &
-           ONLY:  i_left, i_right, j_north, j_south, nxl, nxr, nyn, nys, nzb,  &
-                  nzb_max, nzt, wall_flags_0
-           
-       USE kinds
-       
-!        USE statistics,                                                       &
-!            ONLY:  hom, sums_vs2_ws_l, sums_wsvs_ws_l, weight_substep
-
-       IMPLICIT NONE
-
-
-       INTEGER(iwp) ::  i      !<
-       INTEGER(iwp) ::  ibit18 !<
-       INTEGER(iwp) ::  ibit19 !<
-       INTEGER(iwp) ::  ibit20 !<
-       INTEGER(iwp) ::  ibit21 !<
-       INTEGER(iwp) ::  ibit22 !<
-       INTEGER(iwp) ::  ibit23 !<
-       INTEGER(iwp) ::  ibit24 !<
-       INTEGER(iwp) ::  ibit25 !<
-       INTEGER(iwp) ::  ibit26 !<
-       INTEGER(iwp) ::  j      !<
-       INTEGER(iwp) ::  k      !<
-       INTEGER(iwp) ::  k_mm   !<
-       INTEGER(iwp) ::  k_mmm  !<
-       INTEGER(iwp) ::  k_pp   !<
-       INTEGER(iwp) ::  k_ppp  !<
-       INTEGER(iwp) ::  tn = 0 !<
-
-       REAL(wp)    ::  diss_d   !<
-       REAL(wp)    ::  diss_l   !<
-       REAL(wp)    ::  diss_n   !<
-       REAL(wp)    ::  diss_r   !<
-       REAL(wp)    ::  diss_s   !<
-       REAL(wp)    ::  diss_t   !<
-       REAL(wp)    ::  div      !<
-       REAL(wp)    ::  flux_d   !<
-       REAL(wp)    ::  flux_l   !<
-       REAL(wp)    ::  flux_n   !<
-       REAL(wp)    ::  flux_r   !<
-       REAL(wp)    ::  flux_s   !<
-       REAL(wp)    ::  flux_t   !<
-       REAL(wp)    ::  gu       !<
-       REAL(wp)    ::  gv       !<
-       REAL(wp)    ::  u_comp   !<
-       REAL(wp)    ::  u_comp_l !<
-       REAL(wp)    ::  v_comp   !<
-       REAL(wp)    ::  v_comp_s !<
-       REAL(wp)    ::  w_comp   !<
-
-       gu = 2.0_wp * u_gtrans
-       gv = 2.0_wp * v_gtrans
-
-!
-!--    Computation of fluxes and tendency terms
-       !$acc kernels present( ddzw, tend, u, v, w, wall_flags_0 )
-       DO  i = i_left, i_right
-          DO  j = j_south, j_north
-             DO  k = nzb+1, nzt
-
-                ibit20 = IBITS(wall_flags_0(k,j,i-1),20,1)
-                ibit19 = IBITS(wall_flags_0(k,j,i-1),19,1)
-                ibit18 = IBITS(wall_flags_0(k,j,i-1),18,1)
-
-                u_comp_l                 = u(k,j-1,i) + u(k,j,i) - gu
-                flux_l                   = u_comp_l * (                          &
-                                      ( 37.0_wp * ibit20 * adv_mom_5              &
-                                   +     7.0_wp * ibit19 * adv_mom_3              &
-                                   +              ibit18 * adv_mom_1              &
-                                      ) *                                      &
-                                     ( v(k,j,i)   + v(k,j,i-1) )               &
-                               -      (  8.0_wp * ibit20 * adv_mom_5              &
-                                   +              ibit19 * adv_mom_3              &
-                                      ) *                                      &
-                                     ( v(k,j,i+1) + v(k,j,i-2) )               &
-                               +      (           ibit20 * adv_mom_5              &
-                                      ) *                                      &
-                                     ( v(k,j,i+2) + v(k,j,i-3) )               &
-                                                 )
-
-                diss_l                   = - ABS( u_comp_l ) * (                 &
-                                      ( 10.0_wp * ibit20 * adv_mom_5              &
-                                   +     3.0_wp * ibit19 * adv_mom_3              &
-                                   +              ibit18 * adv_mom_1              &
-                                      ) *                                      &
-                                     ( v(k,j,i)   - v(k,j,i-1) )               &
-                               -      (  5.0_wp * ibit20 * adv_mom_5              &
-                                   +              ibit19 * adv_mom_3              &
-                                      ) *                                      &
-                                     ( v(k,j,i+1) - v(k,j,i-2) )               &
-                               +      (           ibit20 * adv_mom_5              &
-                                      ) *                                      &
-                                     ( v(k,j,i+2) - v(k,j,i-3) )               &
-                                                           )
-
-                ibit20 = IBITS(wall_flags_0(k,j,i),20,1)
-                ibit19 = IBITS(wall_flags_0(k,j,i),19,1)
-                ibit18 = IBITS(wall_flags_0(k,j,i),18,1)
-
-                u_comp    = u(k,j-1,i+1) + u(k,j,i+1) - gu
-                flux_r    = u_comp * (                                       &
-                          ( 37.0_wp * ibit20 * adv_mom_5                        &
-                       +     7.0_wp * ibit19 * adv_mom_3                        &
-                       +              ibit18 * adv_mom_1                        &
-                          ) *                                                &
-                                 ( v(k,j,i+1) + v(k,j,i)   )                 &
-                   -      (  8.0_wp * ibit20 * adv_mom_5                        &
-                       +              ibit19 * adv_mom_3                        &
-                          ) *                                                &
-                                 ( v(k,j,i+2) + v(k,j,i-1) )                 &
-                   +      (           ibit20 * adv_mom_5                        &
-                          ) *                                                &
-                                 ( v(k,j,i+3) + v(k,j,i-2) )                 &
-                                     )
-
-                diss_r    = - ABS( u_comp ) * (                              &
-                          ( 10.0_wp * ibit20 * adv_mom_5                        &
-                       +     3.0_wp * ibit19 * adv_mom_3                        &
-                       +              ibit18 * adv_mom_1                        &
-                          ) *                                                &
-                                 ( v(k,j,i+1) - v(k,j,i)  )                  &
-                   -      (  5.0_wp * ibit20 * adv_mom_5                        &
-                       +              ibit19 * adv_mom_3                        &
-                          ) *                                                &
-                                 ( v(k,j,i+2) - v(k,j,i-1) )                 &
-                   +      (           ibit20 * adv_mom_5                        &
-                          ) *                                                &
-                                 ( v(k,j,i+3) - v(k,j,i-2) )                 &
-                                              )
-
-                ibit23 = IBITS(wall_flags_0(k,j-1,i),23,1)
-                ibit22 = IBITS(wall_flags_0(k,j-1,i),22,1)
-                ibit21 = IBITS(wall_flags_0(k,j-1,i),21,1)
-
-
-                v_comp_s              = v(k,j,i) + v(k,j-1,i) - gv
-                flux_s                = v_comp_s    * (                       &
-                                   ( 37.0_wp * ibit23 * adv_mom_5                &
-                                +     7.0_wp * ibit22 * adv_mom_3                &
-                                +              ibit21 * adv_mom_1                &
-                                   ) *                                        &
-                                     ( v(k,j,i)   + v(k,j-1,i) )              &
-                            -      (  8.0_wp * ibit23 * adv_mom_5                &
-                                +              ibit22 * adv_mom_3                &
-                                   ) *                                        &
-                                     ( v(k,j+1,i) + v(k,j-2,i) )              &
-                            +      (           ibit23 * adv_mom_5                &
-                                   ) *                                        &
-                                     ( v(k,j+2,i) + v(k,j-3,i) )              &
-                                                 )
-
-                diss_s                = - ABS( v_comp_s ) * (                 &
-                                   ( 10.0_wp * ibit23 * adv_mom_5                &
-                                +     3.0_wp * ibit22 * adv_mom_3                &
-                                +              ibit21 * adv_mom_1                &
-                                   ) *                                        &
-                                     ( v(k,j,i)   - v(k,j-1,i) )              &
-                            -      (  5.0_wp * ibit23 * adv_mom_5                &
-                                +              ibit22 * adv_mom_3                &
-                                   ) *                                        &
-                                     ( v(k,j+1,i) - v(k,j-2,i) )              &
-                            +      (           ibit23 * adv_mom_5                &
-                                   ) *                                        &
-                                     ( v(k,j+2,i) - v(k,j-3,i) )              &
-                                                          )
-
-                ibit23 = IBITS(wall_flags_0(k,j,i),23,1)
-                ibit22 = IBITS(wall_flags_0(k,j,i),22,1)
-                ibit21 = IBITS(wall_flags_0(k,j,i),21,1)
-
-                v_comp = v(k,j+1,i) + v(k,j,i)
-                flux_n = ( v_comp - gv ) * (                                 &
-                          ( 37.0_wp * ibit23 * adv_mom_5                        &
-                       +     7.0_wp * ibit22 * adv_mom_3                        &
-                       +              ibit21 * adv_mom_1                        &
-                          ) *                                                &
-                                 ( v(k,j+1,i) + v(k,j,i)   )                 &
-                   -      (  8.0_wp * ibit23 * adv_mom_5                        &
-                       +              ibit22 * adv_mom_3                        &
-                          ) *                                                &
-                                 ( v(k,j+2,i) + v(k,j-1,i) )                 &
-                   +      (           ibit23 * adv_mom_5                        &
-                          ) *                                                &
-                                 ( v(k,j+3,i) + v(k,j-2,i) )                 &
-                                     )
-
-                diss_n = - ABS( v_comp - gv ) * (                         &
-                          ( 10.0_wp * ibit23 * adv_mom_5                        &
-                       +     3.0_wp * ibit22 * adv_mom_3                        &
-                       +              ibit21 * adv_mom_1                        &
-                          ) *                                                &
-                                 ( v(k,j+1,i) - v(k,j,i)  )                  &
-                   -      (  5.0_wp * ibit23 * adv_mom_5                        &
-                       +              ibit22 * adv_mom_3                        &
-                          ) *                                                &
-                                 ( v(k,j+2,i) - v(k,j-1,i) )                 &
-                   +      (           ibit23 * adv_mom_5                        &
-                          ) *                                                &
-                                 ( v(k,j+3,i) - v(k,j-2,i) )                 &
-                                                     )
-
-                ibit26 = IBITS(wall_flags_0(k-1,j,i),26,1)
-                ibit25 = IBITS(wall_flags_0(k-1,j,i),25,1)
-                ibit24 = IBITS(wall_flags_0(k-1,j,i),24,1)
-
-                k_pp  = k + 2 * ibit26
-                k_mm  = k - 2 * ( ibit25 + ibit26 )
-                k_mmm = k - 3 * ibit26
-
-                w_comp    = w(k-1,j-1,i) + w(k-1,j,i)
-                flux_d    = w_comp  * (                                      &
-                          ( 37.0_wp * ibit26 * adv_mom_5                        &
-                       +     7.0_wp * ibit25 * adv_mom_3                        &
-                       +              ibit24 * adv_mom_1                        &
-                          ) *                                                &
-                             ( v(k,j,i)     + v(k-1,j,i)  )                  &
-                   -      (  8.0_wp * ibit26 * adv_mom_5                        &
-                       +              ibit25 * adv_mom_3                        &
-                          ) *                                                &
-                             ( v(k+1,j,i)  + v(k_mm,j,i)  )                  &
-                   +      (           ibit26 * adv_mom_5                        &
-                          ) *                                                &
-                             ( v(k_pp,j,i) + v(k_mmm,j,i) )                  &
-                                      )
-
-                diss_d    = - ABS( w_comp ) * (                              &
-                          ( 10.0_wp * ibit26 * adv_mom_5                        &
-                       +     3.0_wp * ibit25 * adv_mom_3                        &
-                       +              ibit24 * adv_mom_1                        &
-                          ) *                                                &
-                             ( v(k,j,i)     - v(k-1,j,i)  )                  &
-                   -      (  5.0_wp * ibit26 * adv_mom_5                        &
-                       +              ibit25 * adv_mom_3                        &
-                          ) *                                                &
-                             ( v(k+1,j,i)  - v(k_mm,j,i)  )                  &
-                   +      (           ibit26 * adv_mom_5                        &
-                          ) *                                                &
-                             ( v(k_pp,j,i) - v(k_mmm,j,i) )                  &
-                                               )
-!
-!--             k index has to be modified near bottom and top, else array
-!--             subscripts will be exceeded.
-                ibit26 = IBITS(wall_flags_0(k,j,i),26,1)
-                ibit25 = IBITS(wall_flags_0(k,j,i),25,1)
-                ibit24 = IBITS(wall_flags_0(k,j,i),24,1)
-
-                k_ppp = k + 3 * ibit26
-                k_pp  = k + 2 * ( 1 - ibit24  )
-                k_mm  = k - 2 * ibit26
-
-                w_comp    = w(k,j-1,i) + w(k,j,i)
-                flux_t    = w_comp * rho_air_zw(k) * (                       &
-                          ( 37.0_wp * ibit26 * adv_mom_5                        &
-                       +     7.0_wp * ibit25 * adv_mom_3                        &
-                       +              ibit24 * adv_mom_1                        &
-                          ) *                                                &
-                             ( v(k+1,j,i)   + v(k,j,i)    )                  &
-                   -      (  8.0_wp * ibit26 * adv_mom_5                        &
-                       +              ibit25 * adv_mom_3                        &
-                          ) *                                                &
-                             ( v(k_pp,j,i)  + v(k-1,j,i)  )                  &
-                   +      (           ibit26 * adv_mom_5                        &
-                          ) *                                                &
-                             ( v(k_ppp,j,i) + v(k_mm,j,i) )                  &
-                                      )
-
-                diss_t    = - ABS( w_comp ) * rho_air_zw(k) * (              &
-                          ( 10.0_wp * ibit26 * adv_mom_5                        &
-                       +     3.0_wp * ibit25 * adv_mom_3                        &
-                       +              ibit24 * adv_mom_1                        &
-                          ) *                                                &
-                             ( v(k+1,j,i)   - v(k,j,i)    )                  &
-                   -      (  5.0_wp * ibit26 * adv_mom_5                        &
-                       +              ibit25 * adv_mom_3                        &
-                          ) *                                                &
-                             ( v(k_pp,j,i)  - v(k-1,j,i)  )                  &
-                   +      (           ibit26 * adv_mom_5                        &
-                          ) *                                                &
-                             ( v(k_ppp,j,i) - v(k_mm,j,i) )                  &
-                                               )
-!
-!--             Calculate the divergence of the velocity field. A respective
-!--             correction is needed to overcome numerical instabilities caused
-!--             by a not sufficient reduction of divergences near topography.
-                div = ( ( ( u_comp     + gu )                                 &
-                                       * ( ibit18 + ibit19 + ibit20 )         &
-                - ( u(k,j-1,i)   + u(k,j,i) )                                 &
-                                       * ( IBITS(wall_flags_0(k,j,i-1),18,1)  &
-                                         + IBITS(wall_flags_0(k,j,i-1),19,1)  &
-                                         + IBITS(wall_flags_0(k,j,i-1),20,1)  &
-                                         )                                    &
-                  ) * rho_air(k) * ddx                                        &
-               +  ( v_comp                                                    &
-                                       * ( ibit21 + ibit22 + ibit23 )         &
-                - ( v(k,j,i)     + v(k,j-1,i) )                               &
-                                       * ( IBITS(wall_flags_0(k,j-1,i),21,1)  &
-                                         + IBITS(wall_flags_0(k,j-1,i),22,1)  &
-                                         + IBITS(wall_flags_0(k,j-1,i),23,1)  &
-                                         )                                    &
-                  ) * rho_air(k) * ddy                                        &
-               +  ( w_comp * rho_air_zw(k)                                    &
-                                       * ( ibit24 + ibit25 + ibit26 )         &
-                - ( w(k-1,j-1,i) + w(k-1,j,i) ) * rho_air_zw(k-1)             &
-                                       * ( IBITS(wall_flags_0(k-1,j,i),24,1)  &
-                                         + IBITS(wall_flags_0(k-1,j,i),25,1)  &
-                                         + IBITS(wall_flags_0(k-1,j,i),26,1)  &
-                                         )                                    &
-                   ) * ddzw(k)   &
-                ) * 0.5_wp
-
-
-                tend(k,j,i) = - (                                              &
-                               ( flux_r + diss_r - flux_l - diss_l ) * ddx     &
-                             + ( flux_n + diss_n - flux_s - diss_s ) * ddy     &
-                             + ( ( flux_t + diss_t ) -                         &
-                                 ( flux_d + diss_d )                           &
-                               ) * drho_air(k) * ddzw(k)                       &
-                                ) + div * v(k,j,i)
-
-
-!++
-!--             Statistical Evaluation of v'v'. The factor has to be applied
-!--             for right evaluation when gallilei_trans = .T. .
-!                sums_vs2_ws_l(k,tn) = sums_vs2_ws_l(k,tn)                  &
-!                      + ( flux_n                                           &
-!                      * ( v_comp - 2.0_wp * hom(k,1,2,0) )                    &
-!                      / ( v_comp - gv + 1.0E-20_wp )                       &
-!                      +   diss_n                                           &
-!                      *   ABS( v_comp - 2.0_wp * hom(k,1,2,0) )               &
-!                      / ( ABS( v_comp - gv ) +1.0E-20_wp ) )               &
-!                      *   weight_substep(intermediate_timestep_count)
-!
-!--              Statistical Evaluation of w'v'.
-!                 sums_wsvs_ws_l(k,tn) = sums_wsvs_ws_l(k,tn)                &
-!                              + ( flux_t + diss_t )                         &
-!                              *   weight_substep(intermediate_timestep_count)
-
-             ENDDO
-          ENDDO
-       ENDDO
-       !$acc end kernels
-
-!++
-!       sums_vs2_ws_l(nzb,tn) = sums_vs2_ws_l(nzb+1,tn)
-
-    END SUBROUTINE advec_v_ws_acc
     
     
@@ -6756,352 +5504,3 @@
 
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Advection of w - Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE advec_w_ws_acc
-
-       USE arrays_3d,                                                          &
-           ONLY:  ddzu, drho_air_zw, tend, u, v, w, rho_air, rho_air_zw
-
-       USE constants,                                                          &
-           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
-
-       USE control_parameters,                                                 &
-           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
-
-       USE grid_variables,                                                     &
-           ONLY:  ddx, ddy
-
-       USE indices,                                                            &
-           ONLY:  i_left, i_right, j_north, j_south, nxl, nxr, nyn, nys, nzb,  &
-                  nzb_max, nzt, wall_flags_0, wall_flags_00
-           
-       USE kinds
-       
-!        USE statistics,                                                       &
-!            ONLY:  hom, sums_ws2_ws_l, weight_substep
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i      !<
-       INTEGER(iwp) ::  ibit27 !<
-       INTEGER(iwp) ::  ibit28 !<
-       INTEGER(iwp) ::  ibit29 !<
-       INTEGER(iwp) ::  ibit30 !<
-       INTEGER(iwp) ::  ibit31 !<
-       INTEGER(iwp) ::  ibit32 !<
-       INTEGER(iwp) ::  ibit33 !<
-       INTEGER(iwp) ::  ibit34 !<
-       INTEGER(iwp) ::  ibit35 !<
-       INTEGER(iwp) ::  j      !<
-       INTEGER(iwp) ::  k      !<
-       INTEGER(iwp) ::  k_mmm  !<
-       INTEGER(iwp) ::  k_mm   !<
-       INTEGER(iwp) ::  k_pp   !<
-       INTEGER(iwp) ::  k_ppp  !<
-       INTEGER(iwp) ::  tn = 0 !<
-
-       REAL(wp)    ::  diss_d   !<
-       REAL(wp)    ::  diss_l   !<
-       REAL(wp)    ::  diss_n   !<
-       REAL(wp)    ::  diss_r   !<
-       REAL(wp)    ::  diss_s   !<
-       REAL(wp)    ::  diss_t   !<
-       REAL(wp)    ::  div      !<
-       REAL(wp)    ::  flux_d   !<
-       REAL(wp)    ::  flux_l   !<
-       REAL(wp)    ::  flux_n   !<
-       REAL(wp)    ::  flux_r   !<
-       REAL(wp)    ::  flux_s   !<
-       REAL(wp)    ::  flux_t   !<
-       REAL(wp)    ::  gu       !<
-       REAL(wp)    ::  gv       !<
-       REAL(wp)    ::  u_comp   !<
-       REAL(wp)    ::  u_comp_l !<
-       REAL(wp)    ::  v_comp   !<
-       REAL(wp)    ::  v_comp_s !<
-       REAL(wp)    ::  w_comp   !<
-
-       gu = 2.0_wp * u_gtrans
-       gv = 2.0_wp * v_gtrans
-
-
-!
-!--    Computation of fluxes and tendency terms
-       !$acc kernels present( ddzu, tend, u, v, w, wall_flags_0, wall_flags_00 )
-       DO i = i_left, i_right
-          DO  j = j_south, j_north
-             DO  k = nzb+1, nzt
-
-                ibit27 = IBITS(wall_flags_0(k,j,i-1),27,1)
-                ibit28 = IBITS(wall_flags_0(k,j,i-1),28,1)
-                ibit29 = IBITS(wall_flags_0(k,j,i-1),29,1)
-
-                u_comp_l                 = u(k+1,j,i) + u(k,j,i) - gu
-                flux_l                   = u_comp_l * (                        &
-                                      ( 37.0_wp * ibit29 * adv_mom_5              &
-                                   +     7.0_wp * ibit28 * adv_mom_3              &
-                                   +              ibit27 * adv_mom_1              &
-                                      ) *                                      &
-                                     ( w(k,j,i)   + w(k,j,i-1) )               &
-                               -      (  8.0_wp * ibit29 * adv_mom_5              &
-                                   +              ibit28 * adv_mom_3              &
-                                      ) *                                      &
-                                     ( w(k,j,i+1) + w(k,j,i-2) )               &
-                               +      (           ibit29 * adv_mom_5              &
-                                      ) *                                      &
-                                     ( w(k,j,i+2) + w(k,j,i-3) )               &
-                                                 )
-
-                diss_l                    = - ABS( u_comp_l ) * (              &
-                                        ( 10.0_wp * ibit29 * adv_mom_5            &
-                                     +     3.0_wp * ibit28 * adv_mom_3            &
-                                     +              ibit27 * adv_mom_1            &
-                                        ) *                                    &
-                                     ( w(k,j,i)   - w(k,j,i-1) )               &
-                                 -      (  5.0_wp * ibit29 * adv_mom_5            &
-                                     +              ibit28 * adv_mom_3            &
-                                        ) *                                    &
-                                     ( w(k,j,i+1) - w(k,j,i-2) )               &
-                                 +      (           ibit29 * adv_mom_5            &
-                                        ) *                                    &
-                                     ( w(k,j,i+2) - w(k,j,i-3) )               &
-                                                            )
-
-                ibit27 = IBITS(wall_flags_0(k,j,i),27,1)
-                ibit28 = IBITS(wall_flags_0(k,j,i),28,1)
-                ibit29 = IBITS(wall_flags_0(k,j,i),29,1)
-
-                u_comp    = u(k+1,j,i+1) + u(k,j,i+1) - gu
-                flux_r    = u_comp * (                                       &
-                          ( 37.0_wp * ibit29 * adv_mom_5                        &
-                       +     7.0_wp * ibit28 * adv_mom_3                        &
-                       +              ibit27 * adv_mom_1                        &
-                          ) *                                                &
-                                 ( w(k,j,i+1) + w(k,j,i)   )                 &
-                   -      (  8.0_wp * ibit29 * adv_mom_5                        &
-                       +              ibit28 * adv_mom_3                        &
-                          ) *                                                &
-                                 ( w(k,j,i+2) + w(k,j,i-1) )                 &
-                   +      (           ibit29 * adv_mom_5                        &
-                          ) *                                                &
-                                 ( w(k,j,i+3) + w(k,j,i-2) )                 &
-                                     )
-
-                diss_r    = - ABS( u_comp ) * (                              &
-                          ( 10.0_wp * ibit29 * adv_mom_5                        &
-                       +     3.0_wp * ibit28 * adv_mom_3                        &
-                       +              ibit27 * adv_mom_1                        &
-                          ) *                                                &
-                                 ( w(k,j,i+1) - w(k,j,i)  )                  &
-                   -      (  5.0_wp * ibit29 * adv_mom_5                        &
-                       +              ibit28 * adv_mom_3                        &
-                          ) *                                                &
-                                 ( w(k,j,i+2) - w(k,j,i-1) )                 &
-                   +      (           ibit29 * adv_mom_5                        &
-                          ) *                                                &
-                                 ( w(k,j,i+3) - w(k,j,i-2) )                 &
-                                              )
-                ibit32 = IBITS(wall_flags_00(k,j-1,i),0,1)
-                ibit31 = IBITS(wall_flags_0(k,j-1,i),31,1)
-                ibit30 = IBITS(wall_flags_0(k,j-1,i),30,1)
-
-                v_comp_s               = v(k+1,j,i) + v(k,j,i) - gv
-                flux_s                 = v_comp_s * (                         &
-                                    ( 37.0_wp * ibit32 * adv_mom_5               &
-                                 +     7.0_wp * ibit31 * adv_mom_3               &
-                                 +              ibit30 * adv_mom_1               &
-                                    ) *                                       &
-                                     ( w(k,j,i)   + w(k,j-1,i) )              &
-                             -      (  8.0_wp * ibit32 * adv_mom_5               &
-                                 +              ibit31 * adv_mom_3               &
-                                    ) *                                       &
-                                     ( w(k,j+1,i) + w(k,j-2,i) )              &
-                             +      (           ibit32 * adv_mom_5               &
-                                    ) *                                       &
-                                     ( w(k,j+2,i) + w(k,j-3,i) )              &
-                                               )
-
-                diss_s                 = - ABS( v_comp_s ) * (                &
-                                    ( 10.0_wp * ibit32 * adv_mom_5               &
-                                 +     3.0_wp * ibit31 * adv_mom_3               &
-                                 +              ibit30 * adv_mom_1               &
-                                    ) *                                       &
-                                     ( w(k,j,i)   - w(k,j-1,i) )              &
-                             -      (  5.0_wp * ibit32 * adv_mom_5               &
-                                 +              ibit31 * adv_mom_3               &
-                                    ) *                                       &
-                                     ( w(k,j+1,i) - w(k,j-2,i) )              &
-                             +      (           ibit32 * adv_mom_5               &
-                                    ) *                                       &
-                                     ( w(k,j+2,i) - w(k,j-3,i) )              &
-                                                        )
-
-                ibit32 = IBITS(wall_flags_00(k,j,i),0,1)
-                ibit31 = IBITS(wall_flags_0(k,j,i),31,1)
-                ibit30 = IBITS(wall_flags_0(k,j,i),30,1)
-
-                v_comp    = v(k+1,j+1,i) + v(k,j+1,i) - gv
-                flux_n    = v_comp * (                                       &
-                          ( 37.0_wp * ibit32 * adv_mom_5                        &
-                       +     7.0_wp * ibit31 * adv_mom_3                        &
-                       +              ibit30 * adv_mom_1                        &
-                          ) *                                                 &
-                                 ( w(k,j+1,i) + w(k,j,i)   )                 &
-                   -      (  8.0_wp * ibit32 * adv_mom_5                        &
-                       +              ibit31 * adv_mom_3                        &
-                          ) *                                                &
-                                 ( w(k,j+2,i) + w(k,j-1,i) )                 &
-                   +      (           ibit32 * adv_mom_5                        &
-                          ) *                                                &
-                                 ( w(k,j+3,i) + w(k,j-2,i) )                 &
-                                     )
-
-                diss_n    = - ABS( v_comp ) * (                              &
-                          ( 10.0_wp * ibit32 * adv_mom_5                        &
-                       +     3.0_wp * ibit31 * adv_mom_3                        &
-                       +              ibit30 * adv_mom_1                        &
-                          ) *                                                &
-                                 ( w(k,j+1,i) - w(k,j,i)  )                  &
-                   -      (  5.0_wp * ibit32 * adv_mom_5                        &
-                       +              ibit31 * adv_mom_3                        &
-                          ) *                                                &
-                                 ( w(k,j+2,i) - w(k,j-1,i) )                 &
-                   +      (           ibit32 * adv_mom_5                        &
-                          ) *                                                &
-                                 ( w(k,j+3,i) - w(k,j-2,i) )                 &
-                                              )
-
-                ibit35 = IBITS(wall_flags_00(k-1,j,i),3,1)
-                ibit34 = IBITS(wall_flags_00(k-1,j,i),2,1)
-                ibit33 = IBITS(wall_flags_00(k-1,j,i),1,1)
-
-                k_pp  = k + 2 * ibit35
-                k_mm  = k - 2 * ( ibit34 + ibit35 )
-                k_mmm = k - 3 * ibit35
-
-                w_comp    = w(k,j,i) + w(k-1,j,i)
-                flux_d    = w_comp  * (                                      &
-                          ( 37.0_wp * ibit35 * adv_mom_5                        &
-                       +     7.0_wp * ibit34 * adv_mom_3                        &
-                       +              ibit33 * adv_mom_1                        &
-                          ) *                                                &
-                             ( w(k,j,i)    + w(k-1,j,i)   )                  &
-                   -      (  8.0_wp * ibit35 * adv_mom_5                        &
-                       +              ibit34 * adv_mom_3                        &
-                          ) *                                                &
-                             ( w(k+1,j,i)  + w(k_mm,j,i)  )                  &
-                   +      (           ibit35 * adv_mom_5                        &
-                          ) *                                                &
-                             ( w(k_pp,j,i) + w(k_mmm,j,i) )                  &
-                                       )
-
-                diss_d    = - ABS( w_comp ) * (                              &
-                          ( 10.0_wp * ibit35 * adv_mom_5                        &
-                       +     3.0_wp * ibit34 * adv_mom_3                        &
-                       +              ibit33 * adv_mom_1                        &
-                          ) *                                                &
-                             ( w(k,j,i)    - w(k-1,j,i)   )                  &
-                   -      (  5.0_wp * ibit35 * adv_mom_5                        &
-                       +              ibit34 * adv_mom_3                        &
-                          ) *                                                &
-                             ( w(k+1,j,i)  - w(k_mm,j,i)  )                  &
-                   +      (           ibit35 * adv_mom_5                        &
-                          ) *                                                &
-                             ( w(k_pp,j,i) - w(k_mmm,j,i) )                  &
-                                               )
-
-!
-!--             k index has to be modified near bottom and top, else array
-!--             subscripts will be exceeded.
-                ibit35 = IBITS(wall_flags_00(k,j,i),3,1)
-                ibit34 = IBITS(wall_flags_00(k,j,i),2,1)
-                ibit33 = IBITS(wall_flags_00(k,j,i),1,1)
-
-                k_ppp = k + 3 * ibit35
-                k_pp  = k + 2 * ( 1 - ibit33  )
-                k_mm  = k - 2 * ibit35
-
-                w_comp    = w(k+1,j,i) + w(k,j,i)
-                flux_t    = w_comp * rho_air(k+1) * (                        &
-                          ( 37.0_wp * ibit35 * adv_mom_5                        &
-                       +     7.0_wp * ibit34 * adv_mom_3                        &
-                       +              ibit33 * adv_mom_1                        &
-                          ) *                                                &
-                             ( w(k+1,j,i)  + w(k,j,i)     )                  &
-                   -      (  8.0_wp * ibit35 * adv_mom_5                        &
-                       +              ibit34 * adv_mom_3                        &
-                          ) *                                                &
-                             ( w(k_pp,j,i)  + w(k-1,j,i)  )                  &
-                   +      (           ibit35 * adv_mom_5                        &
-                          ) *                                                &
-                             ( w(k_ppp,j,i) + w(k_mm,j,i) )                  &
-                                       )
-
-                diss_t    = - ABS( w_comp ) * rho_air(k+1) * (               &
-                          ( 10.0_wp * ibit35 * adv_mom_5                        &
-                       +     3.0_wp * ibit34 * adv_mom_3                        &
-                       +              ibit33 * adv_mom_1                        &
-                          ) *                                                &
-                             ( w(k+1,j,i)   - w(k,j,i)    )                  &
-                   -      (  5.0_wp * ibit35 * adv_mom_5                        &
-                       +              ibit34 * adv_mom_3                        &
-                          ) *                                                &
-                             ( w(k_pp,j,i)  - w(k-1,j,i)  )                  &
-                   +      (           ibit35 * adv_mom_5                        &
-                          ) *                                                &
-                             ( w(k_ppp,j,i) - w(k_mm,j,i) )                  &
-                                               )
-!
-!--             Calculate the divergence of the velocity field. A respective
-!--             correction is needed to overcome numerical instabilities caused
-!--             by a not sufficient reduction of divergences near topography.
-                div = ( ( ( u_comp + gu ) * ( ibit27 + ibit28 + ibit29 )      &
-                  - ( u(k+1,j,i) + u(k,j,i)   )                               & 
-                                    * ( IBITS(wall_flags_0(k,j,i-1),27,1)     &
-                                      + IBITS(wall_flags_0(k,j,i-1),28,1)     &
-                                      + IBITS(wall_flags_0(k,j,i-1),29,1)     &
-                                      )                                       &
-                  ) * rho_air_zw(k) * ddx                                     &
-              +   ( ( v_comp + gv ) * ( ibit30 + ibit31 + ibit32 )            &
-                  - ( v(k+1,j,i) + v(k,j,i)   )                               &
-                                    * ( IBITS(wall_flags_0(k,j-1,i),30,1)     &
-                                      + IBITS(wall_flags_0(k,j-1,i),31,1)     &
-                                      + IBITS(wall_flags_00(k,j-1,i),0,1)     &
-                                      )                                       &
-                  ) * rho_air_zw(k) * ddy                                     &
-              +   ( w_comp * rho_air(k+1) * ( ibit33 + ibit34 + ibit35 )      &
-                - ( w(k,j,i)   + w(k-1,j,i)   ) * rho_air(k)                  &
-                                    * ( IBITS(wall_flags_00(k-1,j,i),1,1)     &
-                                      + IBITS(wall_flags_00(k-1,j,i),2,1)     &
-                                      + IBITS(wall_flags_00(k-1,j,i),3,1)     &
-                                      )                                       & 
-                  ) * ddzu(k+1)   &
-                ) * 0.5_wp
-
-
-                tend(k,j,i) = - (                                                &
-                               ( flux_r + diss_r - flux_l - diss_l ) * ddx       &
-                             + ( flux_n + diss_n - flux_s - diss_s ) * ddy       &
-                             + ( ( flux_t + diss_t ) -                           &
-                                 ( flux_d + diss_d ) * rho_air(k)                &
-                               ) * drho_air_zw(k) * ddzu(k+1)                    &
-                                 ) + div * w(k,j,i)
-
-
-!++
-!--             Statistical Evaluation of w'w'.
-!                sums_ws2_ws_l(k,tn)  = sums_ws2_ws_l(k,tn)                    &
-!                               + ( flux_t + diss_t )                    &
-!                               *   weight_substep(intermediate_timestep_count)
-
-             ENDDO
-          ENDDO
-       ENDDO
-       !$acc end kernels
-
-    END SUBROUTINE advec_w_ws_acc
-
  END MODULE advec_ws
Index: /palm/trunk/SOURCE/boundary_conds.f90
===================================================================
--- /palm/trunk/SOURCE/boundary_conds.f90	(revision 2117)
+++ /palm/trunk/SOURCE/boundary_conds.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC directives removed
 ! 
 ! Former revisions:
@@ -188,11 +188,8 @@
 !-- Bottom boundary 
     IF ( ibc_uv_b == 1 )  THEN
-       !$acc kernels present( u_p, v_p )
        u_p(nzb,:,:) = u_p(nzb+1,:,:)
        v_p(nzb,:,:) = v_p(nzb+1,:,:)
-       !$acc end kernels
-    ENDIF
-
-    !$acc kernels present( nzb_w_inner, w_p )
+    ENDIF
+
     DO  i = nxlg, nxrg
        DO  j = nysg, nyng
@@ -200,24 +197,17 @@
        ENDDO
     ENDDO
-    !$acc end kernels
 
 !
 !-- Top boundary. A nested domain ( ibc_uv_t = 3 ) does not require settings.
     IF ( ibc_uv_t == 0 )  THEN
-       !$acc kernels present( u_init, u_p, v_init, v_p )
         u_p(nzt+1,:,:) = u_init(nzt+1)
         v_p(nzt+1,:,:) = v_init(nzt+1)
-       !$acc end kernels
     ELSEIF ( ibc_uv_t == 1 )  THEN
-       !$acc kernels present( u_p, v_p )
         u_p(nzt+1,:,:) = u_p(nzt,:,:)
         v_p(nzt+1,:,:) = v_p(nzt,:,:)
-       !$acc end kernels
     ENDIF
 
     IF ( .NOT. nest_domain )  THEN
-       !$acc kernels present( w_p )
        w_p(nzt:nzt+1,:,:) = 0.0_wp  ! nzt is not a prognostic level (but cf. pres)
-       !$acc end kernels
     ENDIF
 
@@ -227,23 +217,15 @@
 !-- the sea surface temperature of the coupled ocean model.
     IF ( ibc_pt_b == 0 )  THEN
-       !$acc kernels present( nzb_s_inner, pt, pt_p )
-       !$acc loop independent
        DO  i = nxlg, nxrg
-          !$acc loop independent
           DO  j = nysg, nyng
              pt_p(nzb_s_inner(j,i),j,i) = pt(nzb_s_inner(j,i),j,i)
           ENDDO
        ENDDO
-       !$acc end kernels
     ELSEIF ( ibc_pt_b == 1 )  THEN
-       !$acc kernels present( nzb_s_inner, pt_p )
-       !$acc loop independent
        DO  i = nxlg, nxrg
-          !$acc loop independent
           DO  j = nysg, nyng
              pt_p(nzb_s_inner(j,i),j,i) = pt_p(nzb_s_inner(j,i)+1,j,i)
           ENDDO
        ENDDO
-      !$acc end kernels
     ENDIF
 
@@ -251,5 +233,4 @@
 !-- Temperature at top boundary
     IF ( ibc_pt_t == 0 )  THEN
-       !$acc kernels present( pt, pt_p )
         pt_p(nzt+1,:,:) = pt(nzt+1,:,:)
 !
@@ -259,13 +240,8 @@
            pt_p(nzt+1,:,:) = pt_init(nzt+1)
         ENDIF
-       !$acc end kernels
     ELSEIF ( ibc_pt_t == 1 )  THEN
-       !$acc kernels present( pt_p )
         pt_p(nzt+1,:,:) = pt_p(nzt,:,:)
-       !$acc end kernels
     ELSEIF ( ibc_pt_t == 2 )  THEN
-       !$acc kernels present( dzu, pt_p )
         pt_p(nzt+1,:,:) = pt_p(nzt,:,:) + bc_pt_t_val * dzu(nzt+1)
-       !$acc end kernels
     ENDIF
 
@@ -274,8 +250,5 @@
 !-- Generally Neumann conditions with de/dz=0 are assumed
     IF ( .NOT. constant_diffusion )  THEN
-       !$acc kernels present( e_p, nzb_s_inner )
-       !$acc loop independent
        DO  i = nxlg, nxrg
-          !$acc loop independent
           DO  j = nysg, nyng
              e_p(nzb_s_inner(j,i),j,i) = e_p(nzb_s_inner(j,i)+1,j,i)
@@ -285,5 +258,4 @@
           e_p(nzt+1,:,:) = e_p(nzt,:,:)
        ENDIF
-       !$acc end kernels
     ENDIF
 
Index: /palm/trunk/SOURCE/buoyancy.f90
===================================================================
--- /palm/trunk/SOURCE/buoyancy.f90	(revision 2117)
+++ /palm/trunk/SOURCE/buoyancy.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! OpenACC version of subroutine removed
 ! 
 ! Former revisions:
@@ -102,5 +102,5 @@
 
     PRIVATE
-    PUBLIC buoyancy, buoyancy_acc
+    PUBLIC buoyancy
 
     INTERFACE buoyancy
@@ -108,8 +108,4 @@
        MODULE PROCEDURE buoyancy_ij
     END INTERFACE buoyancy
-
-    INTERFACE buoyancy_acc
-       MODULE PROCEDURE buoyancy_acc
-    END INTERFACE buoyancy_acc
 
  CONTAINS
@@ -212,106 +208,4 @@
 
     END SUBROUTINE buoyancy
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE buoyancy_acc( var, wind_component )
-
-       USE arrays_3d,                                                          &
-           ONLY:  pt, pt_slope_ref, ref_state, tend
-
-       USE control_parameters,                                                 &
-           ONLY:  atmos_ocean_sign, cos_alpha_surface, g, message_string,      &
-                  pt_surface, sin_alpha_surface, sloping_surface
-
-       USE indices,                                                            &
-           ONLY:  i_left, i_right, j_north, j_south, nxl, nxlg, nxlu, nxr,     &
-                  nxrg, nyn, nyng, nys, nysg, nzb, nzb_s_inner, nzt
-
-       USE kinds
-
-       USE pegrid
-
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i              !<
-       INTEGER(iwp) ::  j              !<
-       INTEGER(iwp) ::  k              !<
-       INTEGER(iwp) ::  wind_component !<
-       
-#if defined( __nopointer )
-       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var !<
-#else
-       REAL(wp), DIMENSION(:,:,:), POINTER ::  var
-#endif
-
-
-       IF ( .NOT. sloping_surface )  THEN
-!
-!--       Normal case: horizontal surface
-          !$acc kernels present( nzb_s_inner, ref_state, tend, var )
-          !$acc loop
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-                !$acc loop independent vector
-                DO  k = nzb_s_inner(j,i)+1, nzt-1
-                   tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5_wp * &
-                          (                                                    &
-                             ( var(k,j,i)   - ref_state(k) )   / ref_state(k) + &
-                             ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1) &
-                          )
-                ENDDO
-             ENDDO
-          ENDDO
-          !$acc end kernels
-
-       ELSE
-!
-!--       Buoyancy term for a surface with a slope in x-direction. The equations
-!--       for both the u and w velocity-component contain proportionate terms.
-!--       Temperature field at time t=0 serves as environmental temperature.
-!--       Reference temperature (pt_surface) is the one at the lower left corner
-!--       of the total domain.
-          IF ( wind_component == 1 )  THEN
-
-             DO  i = nxlu, nxr
-                DO  j = nys, nyn
-                   DO  k = nzb_s_inner(j,i)+1, nzt-1
-                      tend(k,j,i) = tend(k,j,i) + g * sin_alpha_surface *      &
-                           0.5_wp * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
-                                    - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
-                                    ) / pt_surface
-                   ENDDO
-                ENDDO
-             ENDDO
-
-          ELSEIF ( wind_component == 3 )  THEN
-
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   DO  k = nzb_s_inner(j,i)+1, nzt-1
-                      tend(k,j,i) = tend(k,j,i) + g * cos_alpha_surface *      &
-                           0.5_wp * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
-                                    - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
-                                    ) / pt_surface
-                   ENDDO
-                ENDDO
-            ENDDO
-
-          ELSE
-
-             WRITE( message_string, * ) 'no term for component "',             &
-                                       wind_component,'"'
-             CALL message( 'buoyancy', 'PA0159', 1, 2, 0, 6, 0 )
-
-          ENDIF
-
-       ENDIF
-
-    END SUBROUTINE buoyancy_acc
 
 
Index: /palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- /palm/trunk/SOURCE/check_parameters.f90	(revision 2117)
+++ /palm/trunk/SOURCE/check_parameters.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC related parts of code removed
 ! 
 ! Former revisions:
@@ -518,7 +518,4 @@
     IF ( transpose_compute_overlap )  THEN
        IF ( numprocs == 1 )  STOP '+++ transpose-compute-overlap not implemented for single PE runs'
-#if defined( __openacc )
-       STOP '+++ transpose-compute-overlap not implemented for GPU usage'
-#endif
     ENDIF
 
@@ -774,5 +771,5 @@
     SELECT CASE ( TRIM( loop_optimization ) )
 
-       CASE ( 'acc', 'cache', 'vector' )
+       CASE ( 'cache', 'vector' )
           CONTINUE
 
Index: /palm/trunk/SOURCE/coriolis.f90
===================================================================
--- /palm/trunk/SOURCE/coriolis.f90	(revision 2117)
+++ /palm/trunk/SOURCE/coriolis.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC version of subroutine removed
 ! 
 ! Former revisions:
@@ -35,5 +35,4 @@
 ! 1850 2016-04-08 13:29:27Z maronga
 ! Module renamed
-! 
 ! 
 ! 1682 2015-10-07 23:56:08Z knoop
@@ -76,5 +75,5 @@
 
     PRIVATE
-    PUBLIC coriolis, coriolis_acc
+    PUBLIC coriolis
 
     INTERFACE coriolis
@@ -82,8 +81,4 @@
        MODULE PROCEDURE coriolis_ij
     END INTERFACE coriolis
-
-    INTERFACE coriolis_acc
-       MODULE PROCEDURE coriolis_acc
-    END INTERFACE coriolis_acc
 
  CONTAINS
@@ -177,100 +172,4 @@
 ! Description:
 ! ------------
-!> Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE coriolis_acc( component )
-
-       USE arrays_3d,                                                          &
-           ONLY:  tend, u, ug, v, vg, w 
-           
-       USE control_parameters,                                                 &
-           ONLY:  f, fs, message_string
-           
-       USE indices,                                                            &
-           ONLY:  i_left, i_right, j_north, j_south, nzb_u_inner,              &
-                  nzb_v_inner, nzb_w_inner, nzt
-                   
-       USE kinds
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  component  !< 
-       INTEGER(iwp) ::  i          !<
-       INTEGER(iwp) ::  j          !< 
-       INTEGER(iwp) ::  k          !<
-
-
-!
-!--    Compute Coriolis terms for the three velocity components
-       SELECT CASE ( component )
-
-!
-!--       u-component
-          CASE ( 1 )
-             !$acc  kernels present( nzb_u_inner, tend, v, vg, w )
-             DO  i = i_left, i_right
-                DO  j = j_south, j_north
-                   DO  k = 1, nzt
-                      IF  ( k > nzb_u_inner(j,i) )  THEN
-                         tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25_wp *       &
-                                      ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + &
-                                        v(k,j+1,i) ) - vg(k) )                 &
-                                                   - fs *    ( 0.25_wp *       &
-                                      ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) &
-                                        + w(k,j,i)   )                         &
-                                                             )
-                      ENDIF
-                   ENDDO
-                ENDDO
-             ENDDO
-             !$acc end kernels
-
-!
-!--       v-component
-          CASE ( 2 )
-             !$acc  kernels present( nzb_v_inner, tend, u, ug )
-             DO  i = i_left, i_right
-                DO  j = j_south, j_north
-                   DO  k = 1, nzt
-                      IF  ( k > nzb_v_inner(j,i) )  THEN
-                         tend(k,j,i) = tend(k,j,i) - f *     ( 0.25_wp *       &
-                                      ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + &
-                                        u(k,j,i+1) ) - ug(k) )
-                      ENDIF
-                   ENDDO
-                ENDDO
-             ENDDO
-             !$acc end kernels
-
-!
-!--       w-component
-          CASE ( 3 )
-             !$acc  kernels present( nzb_w_inner, tend, u )
-             DO  i = i_left, i_right
-                DO  j = j_south, j_north
-                   DO  k = 1, nzt
-                      IF  ( k > nzb_w_inner(j,i) )  THEN
-                         tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp *            &
-                                      ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) +   &
-                                        u(k+1,j,i+1) )
-                      ENDIF
-                   ENDDO
-                ENDDO
-             ENDDO
-             !$acc end kernels
-
-          CASE DEFAULT
-
-             WRITE( message_string, * ) ' wrong component: ', component
-             CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 )
-
-       END SELECT
-
-    END SUBROUTINE coriolis_acc
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
 !> Call for grid point i,j
 !------------------------------------------------------------------------------!
Index: /palm/trunk/SOURCE/cpulog_mod.f90
===================================================================
--- /palm/trunk/SOURCE/cpulog_mod.f90	(revision 2117)
+++ /palm/trunk/SOURCE/cpulog_mod.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC relevant code removed
 ! 
 ! Former revisions:
@@ -401,5 +401,4 @@
                              average_cputime
 
-          IF ( num_acc_per_node /= 0 )  WRITE ( 18, 108 )  num_acc_per_node
           WRITE ( 18, 110 )
 #else
@@ -409,5 +408,4 @@
                              average_cputime
 
-          IF ( num_acc_per_node /= 0 )  WRITE ( 18, 109 )  num_acc_per_node
           WRITE ( 18, 110 )
 #endif
@@ -565,6 +563,4 @@
    106 FORMAT (/'Exchange of ghostpoints via MPI_ISEND/MPI_IRECV')
    107 FORMAT (//)
-   108 FORMAT ('Accelerator boards per node: ',14X,I2)
-   109 FORMAT ('Accelerator boards: ',23X,I2)
    110 FORMAT ('-------------------------------------------------------------',     &
                &'---------'//&
Index: lm/trunk/SOURCE/cuda_fft_interfaces_mod.f90
===================================================================
--- /palm/trunk/SOURCE/cuda_fft_interfaces_mod.f90	(revision 2117)
+++ 	(revision )
@@ -1,194 +1,0 @@
-!> @file cuda_fft_interfaces_mod.f90
-!------------------------------------------------------------------------------!
-! This file is part of PALM.
-!
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2017 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
-!
-! Current revisions:
-! -----------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id$
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1850 2016-04-08 13:29:27Z maronga
-! Module renamed
-! 
-! 
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1374 2014-04-25 12:55:07Z raasch
-! bugfix: missing module kinds added
-!
-! 1320 2014-03-20 08:40:49Z raasch
-! Kind-parameters added to all INTEGER and REAL declaration statements,
-! kinds are defined in new module kinds,
-! old module precision_kind is removed,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements
-!
-! 1224 2013-09-16 07:27:23Z raasch
-! dummy interface added to avoid compiler warnings
-!
-! 1166 2013-05-24 13:55:44Z raasch
-! C_DOUBLE/COMPLEX reset to dpk,
-! DEVICE attribut added to idata/odata arguments
-!
-! 1153 2013-05-10 14:33:08Z raasch
-! code adjustment of data types for CUDA fft required by PGI 12.3 / CUDA 5.0
-!
-! 1111 2013-03-08 23:54:10Z raasch
-! idata and odata changed from 1d- to 3d-arrays
-!
-! 1106 2013-03-04 05:31:38Z raasch
-! Initial revision
-!
-! Description:
-! ------------
-!> FORTRAN interfaces for the CUDA fft
-!> Routines for the fft along x and y (forward/backward) using the CUDA fft
-!--------------------------------------------------------------------------------!
- MODULE cuda_fft_interfaces
- 
-
-#if defined ( __cuda_fft )
-
-    USE kinds
-
-    INTEGER(iwp) ::  CUFFT_FORWARD = -1   !<
-    INTEGER(iwp) ::  CUFFT_INVERSE =  1   !<
-    INTEGER(iwp) ::  CUFFT_R2C = Z'2a'    !< Real to Complex (interleaved)
-    INTEGER(iwp) ::  CUFFT_C2R = Z'2c'    !< Complex (interleaved) to Real
-    INTEGER(iwp) ::  CUFFT_C2C = Z'29'    !< Complex to Complex, interleaved
-    INTEGER(iwp) ::  CUFFT_D2Z = Z'6a'    !< Double to Double-Complex
-    INTEGER(iwp) ::  CUFFT_Z2D = Z'6c'    !< Double-Complex to Double
-    INTEGER(iwp) ::  CUFFT_Z2Z = Z'69'    !< Double-Complex to Double-Complex
-
-    PUBLIC
-
-
-!
-!-- cufftPlan1d( cufftHandle *plan, int nx, cufftType type, int batch )
-    INTERFACE CUFFTPLAN1D
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> @todo Missing subroutine description.
-!------------------------------------------------------------------------------!
-       SUBROUTINE CUFFTPLAN1D( plan, nx, type, batch ) bind( C, name='cufftPlan1d' )
-
-          USE ISO_C_BINDING
-
-          INTEGER(C_INT)        ::  plan   !< 
-          INTEGER(C_INT), value ::  batch  !< 
-          INTEGER(C_INT), value ::  nx     !< 
-          INTEGER(C_INT), value ::  type   !< 
-       END SUBROUTINE CUFFTPLAN1D
-
-    END INTERFACE CUFFTPLAN1D
-
-!
-!-- cufftDestroy( cufftHandle plan )  !!! remove later if not really needed !!!
-    INTERFACE CUFFTDESTROY
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> @todo Missing subroutine description.
-!------------------------------------------------------------------------------!
-       SUBROUTINE CUFFTDESTROY( plan ) bind( C, name='cufftDestroy' )
-
-          USE ISO_C_BINDING
-
-          INTEGER(C_INT), VALUE ::  plan
-
-       END SUBROUTINE CUFFTDESTROY
-
-    END INTERFACE CUFFTDESTROY
-
-
-    INTERFACE CUFFTEXECZ2D
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> @todo Missing subroutine description.
-!------------------------------------------------------------------------------!
-       SUBROUTINE CUFFTEXECZ2D( plan, idata, odata ) bind( C, name='cufftExecZ2D' )
-
-          USE ISO_C_BINDING
-          USE kinds
-
-          INTEGER(C_INT), VALUE ::  plan          !<
-          COMPLEX(dp), DEVICE   ::  idata(:,:,:)  !<
-          REAL(dp), DEVICE      ::  odata(:,:,:)  !<
-
-       END SUBROUTINE CUFFTEXECZ2D
-
-    END INTERFACE CUFFTEXECZ2D
-
-
-    INTERFACE CUFFTEXECD2Z
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> @todo Missing subroutine description.
-!------------------------------------------------------------------------------!
-       SUBROUTINE CUFFTEXECD2Z( plan, idata, odata ) bind( C, name='cufftExecD2Z' )
-
-          USE ISO_C_BINDING
-          
-          USE kinds
-
-          INTEGER(C_INT), VALUE ::  plan          !<
-          REAL(dp), DEVICE      ::  idata(:,:,:)  !<
-          COMPLEX(dp), DEVICE   ::  odata(:,:,:)  !<
-
-       END SUBROUTINE CUFFTEXECD2Z
-
-    END INTERFACE CUFFTEXECD2Z
-
-#else
-
-    INTERFACE CUFFTdummy
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Dummy interface to avoid compiler warnings in case of no bublic objects
-!> declared.
-!------------------------------------------------------------------------------!
-       SUBROUTINE CUFFTdummy( dummy )
-       
-          USE kinds
-
-          REAL(wp) ::  dummy  !<
-
-       END SUBROUTINE CUFFTdummy
-
-    END INTERFACE CUFFTdummy
-
-#endif
-
- END MODULE cuda_fft_interfaces
Index: /palm/trunk/SOURCE/diffusion_e.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_e.f90	(revision 2117)
+++ /palm/trunk/SOURCE/diffusion_e.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC version of subroutine removed
 ! 
 ! Former revisions:
@@ -34,5 +34,4 @@
 ! 1873 2016-04-18 14:50:06Z maronga
 ! Module renamed (removed _mod)
-! 
 ! 
 ! 1850 2016-04-08 13:29:27Z maronga
@@ -108,5 +107,5 @@
 
     PRIVATE
-    PUBLIC diffusion_e, diffusion_e_acc
+    PUBLIC diffusion_e
     
 
@@ -116,8 +115,4 @@
     END INTERFACE diffusion_e
  
-    INTERFACE diffusion_e_acc
-       MODULE PROCEDURE diffusion_e_acc
-    END INTERFACE diffusion_e_acc
-
  CONTAINS
 
@@ -337,212 +332,4 @@
 
     END SUBROUTINE diffusion_e
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE diffusion_e_acc( var, var_reference )
-
-       USE arrays_3d,                                                          &
-           ONLY:  dd2zu, ddzu, ddzw, diss, e, km, l_grid, tend, zu, zw,        &
-                  drho_air, rho_air_zw
-          
-       USE control_parameters,                                                 &
-           ONLY:  atmos_ocean_sign, g, use_single_reference_value,             &
-                  wall_adjustment, wall_adjustment_factor
-
-       USE grid_variables,                                                     &
-           ONLY:  ddx2, ddy2
-           
-       USE indices,                                                            &
-           ONLY:  i_left, i_right, j_north, j_south, nxlg, nxrg, nyng, nysg,   &
-                  nzb, nzb_s_inner, nzt
-           
-       USE kinds
-
-       USE microphysics_mod,                                                   &
-           ONLY:  collision_turbulence
-
-       USE particle_attributes,                                                &
-           ONLY:  use_sgs_for_particles, wang_kernel
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i              !< 
-       INTEGER(iwp) ::  j              !< 
-       INTEGER(iwp) ::  k              !< 
-       REAL(wp)     ::  dissipation    !< 
-       REAL(wp)     ::  dvar_dz        !< 
-       REAL(wp)     ::  l              !< 
-       REAL(wp)     ::  ll             !< 
-       REAL(wp)     ::  l_stable       !< 
-       REAL(wp)     ::  var_reference  !< 
-
-#if defined( __nopointer )
-       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var  !< 
-#else
-       REAL(wp), DIMENSION(:,:,:), POINTER ::  var  !< 
-#endif
-
-
-!
-!--    This if clause must be outside the k-loop because otherwise
-!--    runtime errors occur with -C hopt on NEC
-       IF ( use_single_reference_value )  THEN
-
-          !$acc kernels present( ddzu, ddzw, dd2zu, diss, e, km, l_grid ) &
-          !$acc         present( nzb_s_inner, tend, var, zu, zw )
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-                DO  k = 1, nzt
-
-                   IF ( k > nzb_s_inner(j,i) )  THEN
-!
-!--                   Calculate the mixing length (for dissipation)
-                      dvar_dz = atmos_ocean_sign * &
-                                ( var(k+1,j,i) - var(k-1,j,i) ) * dd2zu(k)
-                      IF ( dvar_dz > 0.0_wp ) THEN
-                         l_stable = 0.76_wp * SQRT( e(k,j,i) ) / &
-                                       SQRT( g / var_reference * dvar_dz ) + 1E-5_wp
-                      ELSE
-                         l_stable = l_grid(k)
-                      ENDIF
-!
-!--                   Adjustment of the mixing length
-                      IF ( wall_adjustment )  THEN
-                         l  = MIN( wall_adjustment_factor *          &
-                                   ( zu(k) - zw(nzb_s_inner(j,i)) ), &
-                                   l_grid(k), l_stable )
-                         ll = MIN( wall_adjustment_factor *          &
-                                   ( zu(k) - zw(nzb_s_inner(j,i)) ), &
-                                   l_grid(k) )
-                      ELSE
-                         l  = MIN( l_grid(k), l_stable )
-                         ll = l_grid(k)
-                      ENDIF
-!
-!--                   Calculate the tendency terms
-                      dissipation = ( 0.19_wp + 0.74_wp * l / ll ) * &
-                                          e(k,j,i) * SQRT( e(k,j,i) ) / l
-
-                      tend(k,j,i) = tend(k,j,i)                                  &
-                                        + (                                    &
-                          ( km(k,j,i)+km(k,j,i+1) ) * ( e(k,j,i+1)-e(k,j,i) )  &
-                        - ( km(k,j,i)+km(k,j,i-1) ) * ( e(k,j,i)-e(k,j,i-1) )  &
-                                          ) * ddx2                             &
-                                        + (                                    &
-                          ( km(k,j,i)+km(k,j+1,i) ) * ( e(k,j+1,i)-e(k,j,i) )  &
-                        - ( km(k,j,i)+km(k,j-1,i) ) * ( e(k,j,i)-e(k,j-1,i) )  &
-                                          ) * ddy2                             &
-                                        + (                                    &
-               ( km(k,j,i)+km(k+1,j,i) ) * ( e(k+1,j,i)-e(k,j,i) ) * ddzu(k+1) &
-                                                             * rho_air_zw(k)   &
-             - ( km(k,j,i)+km(k-1,j,i) ) * ( e(k,j,i)-e(k-1,j,i) ) * ddzu(k)   &
-                                                             * rho_air_zw(k-1) &
-                                          ) * ddzw(k) * drho_air(k)            &
-                                  - dissipation
-
-!
-!--                   Store dissipation if needed for calculating the sgs particle
-!--                   velocities
-                      IF ( use_sgs_for_particles  .OR.  wang_kernel  .OR.      &
-                           collision_turbulence )  THEN
-                         diss(k,j,i) = dissipation
-                      ENDIF
-
-                   ENDIF
-
-                ENDDO
-             ENDDO
-          ENDDO
-          !$acc end kernels
-
-       ELSE
-
-          !$acc kernels present( ddzu, ddzw, dd2zu, diss, e, km, l_grid ) &
-          !$acc         present( nzb_s_inner, tend, var, zu, zw )
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-                DO  k = 1, nzt
-
-                   IF ( k > nzb_s_inner(j,i) )  THEN
-!
-!--                   Calculate the mixing length (for dissipation)
-                      dvar_dz = atmos_ocean_sign * &
-                                ( var(k+1,j,i) - var(k-1,j,i) ) * dd2zu(k)
-                      IF ( dvar_dz > 0.0_wp ) THEN
-                         l_stable = 0.76_wp * SQRT( e(k,j,i) ) / &
-                                              SQRT( g / var(k,j,i) * dvar_dz ) + 1E-5_wp
-                      ELSE
-                         l_stable = l_grid(k)
-                      ENDIF
-!
-!--                   Adjustment of the mixing length
-                      IF ( wall_adjustment )  THEN
-                         l  = MIN( wall_adjustment_factor *          &
-                                   ( zu(k) - zw(nzb_s_inner(j,i)) ), &
-                                     l_grid(k), l_stable )
-                         ll = MIN( wall_adjustment_factor *          &
-                                   ( zu(k) - zw(nzb_s_inner(j,i)) ), &
-                                   l_grid(k) )
-                      ELSE
-                         l  = MIN( l_grid(k), l_stable )
-                         ll = l_grid(k)
-                      ENDIF
-!
-!--                   Calculate the tendency terms
-                      dissipation = ( 0.19_wp + 0.74_wp * l / ll ) * &
-                                          e(k,j,i) * SQRT( e(k,j,i) ) / l
-
-                      tend(k,j,i) = tend(k,j,i)                                &
-                                        + (                                    &
-                          ( km(k,j,i)+km(k,j,i+1) ) * ( e(k,j,i+1)-e(k,j,i) )  &
-                        - ( km(k,j,i)+km(k,j,i-1) ) * ( e(k,j,i)-e(k,j,i-1) )  &
-                                          ) * ddx2                             &
-                                        + (                                    &
-                          ( km(k,j,i)+km(k,j+1,i) ) * ( e(k,j+1,i)-e(k,j,i) )  &
-                        - ( km(k,j,i)+km(k,j-1,i) ) * ( e(k,j,i)-e(k,j-1,i) )  &
-                                          ) * ddy2                             &
-                                        + (                                    &
-               ( km(k,j,i)+km(k+1,j,i) ) * ( e(k+1,j,i)-e(k,j,i) ) * ddzu(k+1) &
-                                                             * rho_air_zw(k)   &
-             - ( km(k,j,i)+km(k-1,j,i) ) * ( e(k,j,i)-e(k-1,j,i) ) * ddzu(k)   &
-                                                             * rho_air_zw(k-1) &
-                                          ) * ddzw(k) * drho_air(k)            &
-                                  - dissipation
-
-!
-!--                   Store dissipation if needed for calculating the sgs
-!--                   particle  velocities
-                      IF ( use_sgs_for_particles  .OR.  wang_kernel  .OR.      &
-                           collision_turbulence )  THEN
-                         diss(k,j,i) = dissipation
-                      ENDIF
-
-                   ENDIF
-
-                ENDDO
-             ENDDO
-          ENDDO
-          !$acc end kernels
-
-       ENDIF
-
-!
-!--    Boundary condition for dissipation
-       IF ( use_sgs_for_particles  .OR.  wang_kernel  .OR.                     &
-            collision_turbulence )  THEN
-          !$acc kernels present( diss, nzb_s_inner )
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-                diss(nzb_s_inner(j,i),j,i) = diss(nzb_s_inner(j,i)+1,j,i)
-             ENDDO
-          ENDDO
-          !$acc end kernels
-       ENDIF
-
-    END SUBROUTINE diffusion_e_acc
 
 
Index: /palm/trunk/SOURCE/diffusion_s.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_s.f90	(revision 2117)
+++ /palm/trunk/SOURCE/diffusion_s.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! OpenACC version of subroutine removed
 ! 
 ! Former revisions:
@@ -34,9 +34,7 @@
 ! 1873 2016-04-18 14:50:06Z maronga
 ! Module renamed (removed _mod)
-! 
-! 
+!
 ! 1850 2016-04-08 13:29:27Z maronga
 ! Module renamed
-! 
 ! 
 ! 1691 2015-10-26 16:17:44Z maronga
@@ -94,5 +92,5 @@
 
     PRIVATE
-    PUBLIC diffusion_s, diffusion_s_acc
+    PUBLIC diffusion_s
 
     INTERFACE diffusion_s
@@ -100,8 +98,4 @@
        MODULE PROCEDURE diffusion_s_ij
     END INTERFACE diffusion_s
-
-    INTERFACE diffusion_s_acc
-       MODULE PROCEDURE diffusion_s_acc
-    END INTERFACE diffusion_s_acc
 
  CONTAINS
@@ -242,138 +236,4 @@
 ! Description:
 ! ------------
-!> Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE diffusion_s_acc( s, s_flux_b, s_flux_t, wall_s_flux )
-
-       USE arrays_3d,                                                          &
-           ONLY:  ddzu, ddzw, kh, tend, drho_air, rho_air_zw
-           
-       USE control_parameters,                                                 & 
-           ONLY: use_surface_fluxes, use_top_fluxes
-       
-       USE grid_variables,                                                     &
-           ONLY:  ddx2, ddy2, fwxm, fwxp, fwym, fwyp, wall_w_x, wall_w_y
-       
-       USE indices, &
-           ONLY: i_left, i_right, j_north, j_south, nxlg, nxrg, nyng, nysg,    &
-                 nzb, nzb_diff_s_inner, nzb_s_inner, nzb_s_outer, nzt, nzt_diff
-           
-       USE kinds
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i                 !< 
-       INTEGER(iwp) ::  j                 !< 
-       INTEGER(iwp) ::  k                 !< 
-       REAL(wp)     ::  wall_s_flux(0:4)  !< 
-       REAL(wp), DIMENSION(nysg:nyng,nxlg:nxrg) ::  s_flux_b !< 
-       REAL(wp), DIMENSION(nysg:nyng,nxlg:nxrg) ::  s_flux_t !< 
-#if defined( __nopointer )
-       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  s  !<
-#else
-       REAL(wp), DIMENSION(:,:,:), POINTER ::  s  !<
-#endif
-
-       !$acc kernels present( ddzu, ddzw, fwxm, fwxp, fwym, fwyp, kh )        &
-       !$acc         present( nzb_diff_s_inner, nzb_s_inner, nzb_s_outer, s ) &
-       !$acc         present( s_flux_b, s_flux_t, tend, wall_s_flux )         &
-       !$acc         present( wall_w_x, wall_w_y )
-       DO  i = i_left, i_right
-          DO  j = j_south, j_north
-!
-!--          Compute horizontal diffusion
-             DO  k = 1, nzt
-                IF ( k > nzb_s_outer(j,i) )  THEN
-
-                   tend(k,j,i) = tend(k,j,i)                                   &
-                                          + 0.5_wp * (                         &
-                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) )  &
-                      - ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) )  &
-                                                     ) * ddx2                  &
-                                          + 0.5_wp * (                         &
-                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) )  &
-                      - ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) )  &
-                                                     ) * ddy2
-                ENDIF
-             ENDDO
-
-!
-!--          Apply prescribed horizontal wall heatflux where necessary
-             DO  k = 1, nzt
-                IF ( k > nzb_s_inner(j,i)  .AND.  k <= nzb_s_outer(j,i)  .AND. &
-                     ( wall_w_x(j,i) /= 0.0_wp  .OR.  wall_w_y(j,i) /= 0.0_wp ) )    &
-                THEN
-                   tend(k,j,i) = tend(k,j,i)                                   &
-                                                + ( fwxp(j,i) * 0.5_wp *       &
-                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) )  &
-                        + ( 1.0_wp - fwxp(j,i) ) * wall_s_flux(1)              &
-                                                   -fwxm(j,i) * 0.5_wp *       &
-                        ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) )  &
-                        + ( 1.0_wp - fwxm(j,i) ) * wall_s_flux(2)              &
-                                                  ) * ddx2                     &
-                                                + ( fwyp(j,i) * 0.5_wp *       &
-                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) )  &
-                        + ( 1.0_wp - fwyp(j,i) ) * wall_s_flux(3)              &
-                                                   -fwym(j,i) * 0.5_wp *       &
-                        ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) )  &
-                        + ( 1.0_wp - fwym(j,i) ) * wall_s_flux(4)              &
-                                                  ) * ddy2
-                ENDIF
-             ENDDO
-
-!
-!--          Compute vertical diffusion. In case that surface fluxes have been
-!--          prescribed or computed at bottom and/or top, index k starts/ends at
-!--          nzb+2 or nzt-1, respectively.
-             DO  k = 1, nzt_diff
-                IF ( k >= nzb_diff_s_inner(j,i) )  THEN
-                   tend(k,j,i) = tend(k,j,i)                                   &
-                                       + 0.5_wp * (                            &
-            ( kh(k,j,i) + kh(k+1,j,i) ) * ( s(k+1,j,i)-s(k,j,i) ) * ddzu(k+1)  &
-                                                            * rho_air_zw(k)    &
-          - ( kh(k,j,i) + kh(k-1,j,i) ) * ( s(k,j,i)-s(k-1,j,i) ) * ddzu(k)    &
-                                                            * rho_air_zw(k-1)  &
-                                                  ) * ddzw(k) * drho_air(k)
-                ENDIF
-             ENDDO
-
-!
-!--          Vertical diffusion at the first computational gridpoint along
-!--          z-direction
-             DO  k = 1, nzt
-                IF ( use_surface_fluxes  .AND.  k == nzb_s_inner(j,i)+1 )  THEN
-                   tend(k,j,i) = tend(k,j,i)                                   &
-                                          + ( 0.5_wp * ( kh(k,j,i)+kh(k+1,j,i) )&
-                                                     * ( s(k+1,j,i)-s(k,j,i) ) &
-                                                     * ddzu(k+1)               &
-                                                     * rho_air_zw(k)           &
-                                              + s_flux_b(j,i)                  &
-                                            ) * ddzw(k) * drho_air(k)
-                ENDIF
-
-!
-!--             Vertical diffusion at the last computational gridpoint along
-!--             z-direction
-                IF ( use_top_fluxes  .AND.  k == nzt )  THEN
-                   tend(k,j,i) = tend(k,j,i)                                   &
-                                          + ( - s_flux_t(j,i)                  &
-                                              - 0.5_wp * ( kh(k-1,j,i)+kh(k,j,i) )&
-                                                       * ( s(k,j,i)-s(k-1,j,i) )  &
-                                                       * ddzu(k)                  &
-                                                       * rho_air_zw(k-1)          &
-                                            ) * ddzw(k) * drho_air(k)
-                ENDIF
-             ENDDO
-
-          ENDDO
-       ENDDO
-       !$acc end kernels
-
-    END SUBROUTINE diffusion_s_acc
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
 !> Call for grid point i,j
 !------------------------------------------------------------------------------!
Index: /palm/trunk/SOURCE/diffusion_u.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_u.f90	(revision 2117)
+++ /palm/trunk/SOURCE/diffusion_u.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC version of subroutine removed
 ! 
 ! Former revisions:
@@ -35,8 +35,6 @@
 ! Module renamed (removed _mod)
 ! 
-! 
 ! 1850 2016-04-08 13:29:27Z maronga
 ! Module renamed
-! 
 !
 ! 1740 2016-01-13 08:19:40Z raasch
@@ -97,5 +95,5 @@
 
     PRIVATE
-    PUBLIC diffusion_u, diffusion_u_acc
+    PUBLIC diffusion_u
 
     INTERFACE diffusion_u
@@ -103,8 +101,4 @@
        MODULE PROCEDURE diffusion_u_ij
     END INTERFACE diffusion_u
-
-    INTERFACE diffusion_u_acc
-       MODULE PROCEDURE diffusion_u_acc
-    END INTERFACE diffusion_u_acc
 
  CONTAINS
@@ -280,195 +274,4 @@
 ! Description:
 ! ------------
-!> Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE diffusion_u_acc
-
-       USE arrays_3d,                                                          &
-           ONLY:  ddzu, ddzw, km, tend, u, usws, uswst, v, w,                  &
-                  drho_air, rho_air_zw
-       
-       USE control_parameters,                                                 &
-           ONLY:  constant_top_momentumflux, topography, use_surface_fluxes,   &
-                  use_top_fluxes
-       
-       USE grid_variables,                                                     &
-           ONLY:  ddx, ddx2, ddy, fym, fyp, wall_u
-       
-       USE indices,                                                            &
-           ONLY:  i_left, i_right, j_north, j_south, nxl, nxr, nyn, nys, nzb,  &
-                  nzb_diff_u, nzb_u_inner, nzb_u_outer, nzt, nzt_diff
-       
-       USE kinds
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i     !< 
-       INTEGER(iwp) ::  j     !< 
-       INTEGER(iwp) ::  k     !< 
-       REAL(wp)     ::  kmym  !<
-       REAL(wp)     ::  kmyp  !<
-       REAL(wp)     ::  kmzm  !<
-       REAL(wp)     ::  kmzp  !<
-
-       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  usvs  !< 
-       !$acc declare create ( usvs )
-
-!
-!--    First calculate horizontal momentum flux u'v' at vertical walls,
-!--    if neccessary
-       IF ( topography /= 'flat' )  THEN
-          CALL wall_fluxes_acc( usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp,          &
-                                nzb_u_inner, nzb_u_outer, wall_u )
-       ENDIF
-
-       !$acc kernels present ( u, v, w, km, tend, usws, uswst )                &
-       !$acc         present ( ddzu, ddzw, fym, fyp, wall_u )                  &
-       !$acc         present ( nzb_u_inner, nzb_u_outer, nzb_diff_u )
-       DO  i = i_left, i_right
-          DO  j = j_south, j_north
-!
-!--          Compute horizontal diffusion
-             DO  k = 1, nzt
-                IF ( k > nzb_u_outer(j,i) )  THEN
-!
-!--                Interpolate eddy diffusivities on staggered gridpoints
-                   kmyp = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k,j+1,i)+km(k,j,i-1)+km(k,j+1,i-1) )
-                   kmym = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k,j-1,i)+km(k,j,i-1)+km(k,j-1,i-1) )
-
-                   tend(k,j,i) = tend(k,j,i)                                   &
-                         & + 2.0_wp * (                                        &
-                         &           km(k,j,i)   * ( u(k,j,i+1) - u(k,j,i)   ) &
-                         &         - km(k,j,i-1) * ( u(k,j,i)   - u(k,j,i-1) ) &
-                         &            ) * ddx2                                 &
-                         & + ( kmyp * ( u(k,j+1,i) - u(k,j,i)     ) * ddy      &
-                         &   + kmyp * ( v(k,j+1,i) - v(k,j+1,i-1) ) * ddx      &
-                         &   - kmym * ( u(k,j,i) - u(k,j-1,i) ) * ddy          &
-                         &   - kmym * ( v(k,j,i) - v(k,j,i-1) ) * ddx          &
-                         &   ) * ddy
-                ENDIF
-             ENDDO
-
-!
-!--          Wall functions at the north and south walls, respectively
-             DO  k = 1, nzt
-                IF( k > nzb_u_inner(j,i)  .AND.  k <= nzb_u_outer(j,i)  .AND.  &
-                    wall_u(j,i) /= 0.0_wp )  THEN
-
-                   kmyp = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k,j+1,i)+km(k,j,i-1)+km(k,j+1,i-1) )
-                   kmym = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k,j-1,i)+km(k,j,i-1)+km(k,j-1,i-1) )
-
-                   tend(k,j,i) = tend(k,j,i)                                   &
-                                 + 2.0_wp * (                                  &
-                                       km(k,j,i)   * ( u(k,j,i+1) - u(k,j,i) ) &
-                                     - km(k,j,i-1) * ( u(k,j,i) - u(k,j,i-1) ) &
-                                            ) * ddx2                           &
-                                 + (   fyp(j,i) * (                            &
-                                  kmyp * ( u(k,j+1,i) - u(k,j,i)     ) * ddy   &
-                                + kmyp * ( v(k,j+1,i) - v(k,j+1,i-1) ) * ddx   &
-                                                  )                            &
-                                     - fym(j,i) * (                            &
-                                  kmym * ( u(k,j,i) - u(k,j-1,i) ) * ddy       &
-                                + kmym * ( v(k,j,i) - v(k,j,i-1) ) * ddx       &
-                                                  )                            &
-                                     + wall_u(j,i) * usvs(k,j,i)               &
-                                   ) * ddy
-                ENDIF
-             ENDDO
-
-!
-!--          Compute vertical diffusion. In case of simulating a Prandtl layer,
-!--          index k starts at nzb_u_inner+2.
-             DO  k = 1, nzt_diff
-                IF ( k >= nzb_diff_u(j,i) )  THEN
-!
-!--                Interpolate eddy diffusivities on staggered gridpoints
-                   kmzp = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) )
-                   kmzm = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) )
-
-                   tend(k,j,i) = tend(k,j,i)                                   &
-                         & + ( kmzp * ( ( u(k+1,j,i) - u(k,j,i)   ) * ddzu(k+1)&
-                         &            + ( w(k,j,i)   - w(k,j,i-1) ) * ddx      &
-                         &            ) * rho_air_zw(k)                        &
-                         &   - kmzm * ( ( u(k,j,i)   - u(k-1,j,i)   ) * ddzu(k)&
-                         &            + ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx    &
-                         &            ) * rho_air_zw(k-1)                      &
-                         &   ) * ddzw(k) * drho_air(k)
-                ENDIF
-             ENDDO
-
-          ENDDO
-       ENDDO
-
-!
-!--    Vertical diffusion at the first grid point above the surface,
-!--    if the momentum flux at the bottom is given by the Prandtl law or
-!--    if it is prescribed by the user.
-!--    Difference quotient of the momentum flux is not formed over half
-!--    of the grid spacing (2.0*ddzw(k)) any more, since the comparison
-!--    with other (LES) models showed that the values of the momentum
-!--    flux becomes too large in this case.
-!--    The term containing w(k-1,..) (see above equation) is removed here
-!--    because the vertical velocity is assumed to be zero at the surface.
-       IF ( use_surface_fluxes )  THEN
-
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-          
-                k = nzb_u_inner(j,i)+1
-!
-!--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzp = 0.25_wp *                                               &
-                      ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) )
-
-                tend(k,j,i) = tend(k,j,i)                                      &
-                      & + ( kmzp * ( ( u(k+1,j,i) - u(k,j,i)   ) * ddzu(k+1)   &
-                      &            + ( w(k,j,i)   - w(k,j,i-1) ) * ddx         &
-                      &            ) * rho_air_zw(k)                           &
-                      &   - ( -usws(j,i) )                                     &
-                      &   ) * ddzw(k) * drho_air(k)
-             ENDDO
-          ENDDO
-
-       ENDIF
-
-!
-!--    Vertical diffusion at the first gridpoint below the top boundary,
-!--    if the momentum flux at the top is prescribed by the user
-       IF ( use_top_fluxes  .AND.  constant_top_momentumflux )  THEN
-
-          k = nzt
-
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-
-!
-!--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzm = 0.25_wp *                                               &
-                       ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) )
-
-                tend(k,j,i) = tend(k,j,i)                                      &
-                      & + ( ( -uswst(j,i) )                                    &
-                      &   - kmzm * ( ( u(k,j,i)   - u(k-1,j,i)   ) * ddzu(k)   &
-                      &            + ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx       &
-                      &            ) * rho_air_zw(k-1)                         &
-                      &   ) * ddzw(k) * drho_air(k)
-             ENDDO
-          ENDDO
-
-       ENDIF
-       !$acc end kernels
-
-    END SUBROUTINE diffusion_u_acc
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
 !> Call for grid point i,j
 !------------------------------------------------------------------------------!
Index: /palm/trunk/SOURCE/diffusion_v.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_v.f90	(revision 2117)
+++ /palm/trunk/SOURCE/diffusion_v.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC version of subroutine removed
 ! 
 ! Former revisions:
@@ -35,8 +35,6 @@
 ! Module renamed (removed _mod)
 ! 
-! 
 ! 1850 2016-04-08 13:29:27Z maronga
 ! Module renamed
-! 
 !
 ! 1740 2016-01-13 08:19:40Z raasch
@@ -92,5 +90,5 @@
 
     PRIVATE
-    PUBLIC diffusion_v, diffusion_v_acc
+    PUBLIC diffusion_v
 
     INTERFACE diffusion_v
@@ -98,8 +96,4 @@
        MODULE PROCEDURE diffusion_v_ij
     END INTERFACE diffusion_v
-
-    INTERFACE diffusion_v_acc
-       MODULE PROCEDURE diffusion_v_acc
-    END INTERFACE diffusion_v_acc
 
  CONTAINS
@@ -275,195 +269,4 @@
 ! Description:
 ! ------------
-!> Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE diffusion_v_acc
-
-       USE arrays_3d,                                                          &
-           ONLY:  ddzu, ddzw, km, tend, u, v, vsws, vswst, w,                  &
-                  drho_air, rho_air_zw
-       
-       USE control_parameters,                                                 &
-           ONLY:  constant_top_momentumflux, topography, use_surface_fluxes,   &
-                  use_top_fluxes
-       
-       USE grid_variables,                                                     &
-           ONLY:  ddx, ddy, ddy2, fxm, fxp, wall_v
-       
-       USE indices,                                                            &
-           ONLY:  i_left, i_right, j_north, j_south, nxl, nxr, nyn, nys, nzb,  &
-                  nzb_diff_v, nzb_v_inner, nzb_v_outer, nzt, nzt_diff
-       
-       USE kinds
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i     !< 
-       INTEGER(iwp) ::  j     !< 
-       INTEGER(iwp) ::  k     !< 
-       REAL(wp)     ::  kmxm  !< 
-       REAL(wp)     ::  kmxp  !< 
-       REAL(wp)     ::  kmzm  !< 
-       REAL(wp)     ::  kmzp  !< 
-
-       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  vsus  !< 
-       !$acc declare create ( vsus )
-
-!
-!--    First calculate horizontal momentum flux v'u' at vertical walls,
-!--    if neccessary
-       IF ( topography /= 'flat' )  THEN
-          CALL wall_fluxes_acc( vsus, 0.0_wp, 1.0_wp, 0.0_wp, 0.0_wp,          &
-                                nzb_v_inner, nzb_v_outer, wall_v )
-       ENDIF
-
-       !$acc kernels present ( u, v, w, km, tend, vsws, vswst )                &
-       !$acc         present ( ddzu, ddzw, fxm, fxp, wall_v )                  &
-       !$acc         present ( nzb_v_inner, nzb_v_outer, nzb_diff_v )
-       DO  i = i_left, i_right
-          DO  j = j_south, j_north
-!
-!--          Compute horizontal diffusion
-             DO  k = 1, nzt
-                IF ( k > nzb_v_outer(j,i) )  THEN
-!
-!--                Interpolate eddy diffusivities on staggered gridpoints
-                   kmxp = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k,j,i+1)+km(k,j-1,i)+km(k,j-1,i+1) )
-                   kmxm = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k,j,i-1)+km(k,j-1,i)+km(k,j-1,i-1) )
-
-                   tend(k,j,i) = tend(k,j,i)                                   &
-                         & + ( kmxp * ( v(k,j,i+1) - v(k,j,i)     ) * ddx      &
-                         &   + kmxp * ( u(k,j,i+1) - u(k,j-1,i+1) ) * ddy      &
-                         &   - kmxm * ( v(k,j,i) - v(k,j,i-1) ) * ddx          &
-                         &   - kmxm * ( u(k,j,i) - u(k,j-1,i) ) * ddy          &
-                         &   ) * ddx                                           &
-                         & + 2.0_wp * (                                        &
-                         &           km(k,j,i)   * ( v(k,j+1,i) - v(k,j,i) )   &
-                         &         - km(k,j-1,i) * ( v(k,j,i) - v(k,j-1,i) )   &
-                         &            ) * ddy2
-                ENDIF
-             ENDDO
-
-!
-!--          Wall functions at the left and right walls, respectively
-             DO  k = 1, nzt
-                IF( k > nzb_v_inner(j,i)  .AND.  k <= nzb_v_outer(j,i)  .AND.  &
-                    wall_v(j,i) /= 0.0_wp )  THEN
-
-                   kmxp = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k,j,i+1)+km(k,j-1,i)+km(k,j-1,i+1) )
-                   kmxm = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k,j,i-1)+km(k,j-1,i)+km(k,j-1,i-1) )
-                   
-                   tend(k,j,i) = tend(k,j,i)                                   &
-                                 + 2.0_wp * (                                  &
-                                       km(k,j,i)   * ( v(k,j+1,i) - v(k,j,i) ) &
-                                     - km(k,j-1,i) * ( v(k,j,i) - v(k,j-1,i) ) &
-                                            ) * ddy2                           &
-                                 + (   fxp(j,i) * (                            &
-                                  kmxp * ( v(k,j,i+1) - v(k,j,i)     ) * ddx   &
-                                + kmxp * ( u(k,j,i+1) - u(k,j-1,i+1) ) * ddy   &
-                                                  )                            &
-                                     - fxm(j,i) * (                            &
-                                  kmxm * ( v(k,j,i) - v(k,j,i-1) ) * ddx       &
-                                + kmxm * ( u(k,j,i) - u(k,j-1,i) ) * ddy       &
-                                                  )                            &
-                                     + wall_v(j,i) * vsus(k,j,i)               &
-                                   ) * ddx
-                ENDIF
-             ENDDO
-
-!
-!--          Compute vertical diffusion. In case of simulating a Prandtl
-!--          layer, index k starts at nzb_v_inner+2.
-             DO  k = 1, nzt_diff
-                IF ( k >= nzb_diff_v(j,i) )  THEN
-!
-!--                Interpolate eddy diffusivities on staggered gridpoints
-                   kmzp = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
-                   kmzm = 0.25_wp *                                            &
-                          ( 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)                                   &
-                         & + ( kmzp * ( ( v(k+1,j,i) - v(k,j,i)   ) * ddzu(k+1)&
-                         &            + ( w(k,j,i)   - w(k,j-1,i) ) * ddy      &
-                         &            ) * rho_air_zw(k)                        &
-                         &   - kmzm * ( ( v(k,j,i)   - v(k-1,j,i)   ) * ddzu(k)&
-                         &            + ( w(k-1,j,i) - w(k-1,j-1,i) ) * ddy    &
-                         &            ) * rho_air_zw(k-1)                      &
-                         &   ) * ddzw(k) * drho_air(k)
-                ENDIF
-             ENDDO
-
-          ENDDO
-       ENDDO
-
-!
-!--    Vertical diffusion at the first grid point above the surface,
-!--    if the momentum flux at the bottom is given by the Prandtl law
-!--    or if it is prescribed by the user.
-!--    Difference quotient of the momentum flux is not formed over
-!--    half of the grid spacing (2.0*ddzw(k)) any more, since the
-!--    comparison with other (LES) models showed that the values of
-!--    the momentum flux becomes too large in this case.
-!--    The term containing w(k-1,..) (see above equation) is removed here
-!--    because the vertical velocity is assumed to be zero at the surface.
-       IF ( use_surface_fluxes )  THEN
-
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-          
-                k = nzb_v_inner(j,i)+1
-!
-!--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzp = 0.25_wp *                                               &
-                       ( 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)                                      &
-                      & + ( kmzp * ( ( v(k+1,j,i) - v(k,j,i)   ) * ddzu(k+1)   &
-                      &            + ( w(k,j,i)   - w(k,j-1,i) ) * ddy         &
-                      &            ) * rho_air_zw(k)                           &
-                      &   - ( -vsws(j,i) )                                     &
-                      &   ) * ddzw(k) * drho_air(k)
-             ENDDO
-          ENDDO
-
-       ENDIF
-
-!
-!--    Vertical diffusion at the first gridpoint below the top boundary,
-!--    if the momentum flux at the top is prescribed by the user
-       IF ( use_top_fluxes  .AND.  constant_top_momentumflux )  THEN
-
-          k = nzt
-
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-
-!
-!--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzm = 0.25_wp *                                               &
-                       ( 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)                                      &
-                      & + ( ( -vswst(j,i) )                                    &
-                      &   - kmzm * ( ( v(k,j,i)   - v(k-1,j,i)   ) * ddzu(k)   &
-                      &            + ( w(k-1,j,i) - w(k-1,j-1,i) ) * ddy       &
-                      &            ) * rho_air_zw(k-1)                         &
-                      &   ) * ddzw(k) * drho_air(k)
-             ENDDO
-          ENDDO
-
-       ENDIF
-       !$acc end kernels
-
-    END SUBROUTINE diffusion_v_acc
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
 !> Call for grid point i,j
 !------------------------------------------------------------------------------!
Index: /palm/trunk/SOURCE/diffusion_w.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_w.f90	(revision 2117)
+++ /palm/trunk/SOURCE/diffusion_w.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC version of subroutine removed
 ! 
 ! Former revisions:
@@ -35,8 +35,6 @@
 ! Module renamed (removed _mod)
 ! 
-! 
 ! 1850 2016-04-08 13:29:27Z maronga
 ! Module renamed
-! 
 ! 
 ! 1682 2015-10-07 23:56:08Z knoop
@@ -97,8 +95,8 @@
 
     USE wall_fluxes_mod,                                                       &
-        ONLY :  wall_fluxes, wall_fluxes_acc
+        ONLY :  wall_fluxes
 
     PRIVATE
-    PUBLIC diffusion_w, diffusion_w_acc
+    PUBLIC diffusion_w
 
     INTERFACE diffusion_w
@@ -106,8 +104,4 @@
        MODULE PROCEDURE diffusion_w_ij
     END INTERFACE diffusion_w
-
-    INTERFACE diffusion_w_acc
-       MODULE PROCEDURE diffusion_w_acc
-    END INTERFACE diffusion_w_acc
 
  CONTAINS
@@ -248,143 +242,4 @@
 ! Description:
 ! ------------
-!> Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE diffusion_w_acc
-
-       USE arrays_3d,                                                          &
-           ONLY :  ddzu, ddzw, km, tend, u, v, w, drho_air_zw, rho_air
-           
-       USE control_parameters,                                                 &
-           ONLY :  topography
-           
-       USE grid_variables,                                                     &
-           ONLY : ddx, ddy, fwxm, fwxp, fwym, fwyp, wall_w_x, wall_w_y
-           
-       USE indices,                                                            &
-           ONLY :  i_left, i_right, j_north, j_south, nxl, nxr, nyn, nys, nzb, &
-                   nzb_w_inner, nzb_w_outer, nzt
-                   
-       USE kinds
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i     !<
-       INTEGER(iwp) ::  j     !<
-       INTEGER(iwp) ::  k     !<
-       
-       REAL(wp) ::  kmxm  !<
-       REAL(wp) ::  kmxp  !<
-       REAL(wp) ::  kmym  !<
-       REAL(wp) ::  kmyp  !< 
-
-       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wsus  !<
-       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wsvs  !<
-       !$acc declare create ( wsus, wsvs )
-
-!
-!--    First calculate horizontal momentum flux w'u' and/or w'v' at vertical
-!--    walls, if neccessary
-       IF ( topography /= 'flat' )  THEN
-          CALL wall_fluxes_acc( wsus, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp,          &
-                                nzb_w_inner, nzb_w_outer, wall_w_x )
-          CALL wall_fluxes_acc( wsvs, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp,          &
-                                nzb_w_inner, nzb_w_outer, wall_w_y )
-       ENDIF
-
-       !$acc kernels present ( u, v, w, km, tend )                             &
-       !$acc         present ( ddzu, ddzw, fwxm, fwxp, fwym, fwyp, wall_w_x, wall_w_y )           &
-       !$acc         present ( nzb_w_inner, nzb_w_outer )
-       DO  i = i_left, i_right
-          DO  j = j_south, j_north
-             DO  k = 1, nzt
-                IF ( k > nzb_w_outer(j,i) )  THEN
-!
-!--                Interpolate eddy diffusivities on staggered gridpoints
-                   kmxp = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k,j,i+1)+km(k+1,j,i)+km(k+1,j,i+1) )
-                   kmxm = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k,j,i-1)+km(k+1,j,i)+km(k+1,j,i-1) )
-                   kmyp = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k+1,j,i)+km(k,j+1,i)+km(k+1,j+1,i) )
-                   kmym = 0.25_wp *                                            &
-                          ( 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 * ( 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 * ( 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_wp * (                                          &
-                         &   km(k+1,j,i) * ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) &
-                         &               * rho_air(k+1)                          &
-                         & - km(k,j,i)   * ( w(k,j,i)   - w(k-1,j,i) ) * ddzw(k) &
-                         &               * rho_air(k)                            &
-                         &            ) * ddzu(k+1) * drho_air_zw(k)
-                ENDIF
-             ENDDO
-
-!
-!--          Wall functions at all vertical walls, where necessary
-             DO  k = 1,nzt
-
-                IF ( k > nzb_w_inner(j,i)  .AND.  k <= nzb_w_outer(j,i)  .AND. &
-                     wall_w_x(j,i) /= 0.0_wp  .AND.  wall_w_y(j,i) /= 0.0_wp )  THEN
-!
-!--                Interpolate eddy diffusivities on staggered gridpoints
-                   kmxp = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k,j,i+1)+km(k+1,j,i)+km(k+1,j,i+1) )
-                   kmxm = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k,j,i-1)+km(k+1,j,i)+km(k+1,j,i-1) )
-                   kmyp = 0.25_wp *                                            &
-                          ( km(k,j,i)+km(k+1,j,i)+km(k,j+1,i)+km(k+1,j+1,i) )
-                   kmym = 0.25_wp *                                            &
-                          ( 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 * ( 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 * ( 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 * ( 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 * ( 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)             &
-                                   ) * ddy                                     &
-                                 + 2.0_wp * (                                  &
-                           km(k+1,j,i) * ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) &
-                                       * rho_air(k+1)                          &
-                         - km(k,j,i)   * ( w(k,j,i)   - w(k-1,j,i) ) * ddzw(k) &
-                                       * rho_air(k)                            &
-                                            ) * ddzu(k+1) * drho_air_zw(k)
-                ENDIF
-             ENDDO
-
-          ENDDO
-       ENDDO
-       !$acc end kernels
-
-    END SUBROUTINE diffusion_w_acc
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
 !> Call for grid point i,j
 !------------------------------------------------------------------------------!
Index: /palm/trunk/SOURCE/diffusivities.f90
===================================================================
--- /palm/trunk/SOURCE/diffusivities.f90	(revision 2117)
+++ /palm/trunk/SOURCE/diffusivities.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC directives removed
 ! 
 ! Former revisions:
@@ -130,16 +130,9 @@
 
 !
-!-- Data declerations for accelerators
-    !$acc data present( dd2zu, e, km, kh, l_grid, l_wall, nzb_s_inner, var )
-    !$acc kernels
-
-!
 !-- Introduce an optional minimum tke
     IF ( e_min > 0.0_wp )  THEN
        !$OMP DO
-       !$acc loop
        DO  i = nxlg, nxrg
           DO  j = nysg, nyng
-             !$acc loop vector( 32 )
              DO  k = 1, nzt
                 IF ( k > nzb_s_inner(j,i) )  THEN
@@ -152,8 +145,6 @@
 
     !$OMP DO
-    !$acc loop
     DO  i = nxlg, nxrg
        DO  j = nysg, nyng
-          !$acc loop vector( 32 )
           DO  k = 1, nzt
 
@@ -191,12 +182,10 @@
                 kh(k,j,i) = ( 1.0_wp + 2.0_wp * l / ll ) * km(k,j,i)
 
-#if ! defined( __openacc )
-!
-!++             Statistics still have to be realized for accelerators
+!
 !--             Summation for averaged profile (cf. flow_statistics)
                 DO  sr = 0, statistic_regions
                    sums_l_l(k,sr,tn) = sums_l_l(k,sr,tn) + l * rmask(j,i,sr)
                 ENDDO
-#endif
+
              ENDIF
 
@@ -205,11 +194,7 @@
     ENDDO
 
-#if ! defined( __openacc )
-!
-!++ Statistics still have to be realized for accelerators
     sums_l_l(nzt+1,:,tn) = sums_l_l(nzt,:,tn)   ! quasi boundary-condition for
-                                                  ! data output
-#endif
-    !$OMP END PARALLEL
+                                                ! data output
+!$OMP END PARALLEL
 
 !
@@ -219,5 +204,4 @@
 !-- values of the diffusivities are not needed
     !$OMP PARALLEL DO
-    !$acc loop
     DO  i = nxlg, nxrg
        DO  j = nysg, nyng
@@ -249,6 +233,3 @@
     ENDIF
 
-    !$acc end kernels
-    !$acc end data
-
  END SUBROUTINE diffusivities
Index: /palm/trunk/SOURCE/exchange_horiz.f90
===================================================================
--- /palm/trunk/SOURCE/exchange_horiz.f90	(revision 2117)
+++ /palm/trunk/SOURCE/exchange_horiz.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC directives and related code removed
 ! 
 ! Former revisions:
@@ -86,5 +86,5 @@
     USE control_parameters,                                                    &
         ONLY:  bc_lr, bc_lr_cyc, bc_ns, bc_ns_cyc, grid_level,                 &
-               mg_switch_to_pe0, on_device, synchronous_exchange
+               mg_switch_to_pe0, synchronous_exchange
                 
     USE cpulog,                                                                &
@@ -254,40 +254,11 @@
 !-- with array syntax, explicit loops are used.
     IF ( bc_lr == 'cyclic' )  THEN
-       IF ( on_device )  THEN
-          !$acc kernels present( ar )
-          !$acc loop independent
-          DO  i = 0, nbgp_local-1
-             DO  j = nys-nbgp_local, nyn+nbgp_local
-                DO  k = nzb, nzt+1
-                   ar(k,j,nxl-nbgp_local+i) = ar(k,j,nxr-nbgp_local+1+i)
-                   ar(k,j,nxr+1+i)          = ar(k,j,nxl+i)
-                ENDDO
-             ENDDO
-          ENDDO
-          !$acc end kernels
-       ELSE
-          ar(:,:,nxl-nbgp_local:nxl-1) = ar(:,:,nxr-nbgp_local+1:nxr)
-          ar(:,:,nxr+1:nxr+nbgp_local) = ar(:,:,nxl:nxl+nbgp_local-1)
-       ENDIF
+       ar(:,:,nxl-nbgp_local:nxl-1) = ar(:,:,nxr-nbgp_local+1:nxr)
+       ar(:,:,nxr+1:nxr+nbgp_local) = ar(:,:,nxl:nxl+nbgp_local-1)
     ENDIF
 
     IF ( bc_ns == 'cyclic' )  THEN
-       IF ( on_device )  THEN
-          !$acc kernels present( ar )
-          DO  i = nxl-nbgp_local, nxr+nbgp_local
-             !$acc loop independent
-             DO  j = 0, nbgp_local-1
-                !$acc loop independent
-                DO  k = nzb, nzt+1
-                   ar(k,nys-nbgp_local+j,i) = ar(k,nyn-nbgp_local+1+j,i)
-                   ar(k,nyn+1+j,i)          = ar(k,nys+j,i)
-                ENDDO
-             ENDDO
-          ENDDO
-          !$acc end kernels
-       ELSE
-          ar(:,nys-nbgp_local:nys-1,:) = ar(:,nyn-nbgp_local+1:nyn,:)
-          ar(:,nyn+1:nyn+nbgp_local,:) = ar(:,nys:nys+nbgp_local-1,:)
-       ENDIF
+       ar(:,nys-nbgp_local:nys-1,:) = ar(:,nyn-nbgp_local+1:nyn,:)
+       ar(:,nyn+1:nyn+nbgp_local,:) = ar(:,nys:nys+nbgp_local-1,:)
     ENDIF
 
Index: /palm/trunk/SOURCE/fft_xy_mod.f90
===================================================================
--- /palm/trunk/SOURCE/fft_xy_mod.f90	(revision 2117)
+++ /palm/trunk/SOURCE/fft_xy_mod.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC directives and CUDA-fft related code removed
 ! 
 ! Former revisions:
@@ -31,5 +31,4 @@
 ! 1850 2016-04-08 13:29:27Z maronga
 ! Module renamed
-! 
 ! 
 ! 1815 2016-04-06 13:49:59Z raasch
@@ -139,7 +138,5 @@
         ONLY:  nx, ny, nz
         
-#if defined( __cuda_fft )
-    USE ISO_C_BINDING
-#elif defined( __fftw )
+#if defined( __fftw )
     USE, INTRINSIC ::  ISO_C_BINDING
 #endif
@@ -192,12 +189,4 @@
     REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  trig_yf  !<
     
-#elif defined( __cuda_fft )
-    INTEGER(C_INT), SAVE ::  plan_xf  !<
-    INTEGER(C_INT), SAVE ::  plan_xi  !<
-    INTEGER(C_INT), SAVE ::  plan_yf  !<
-    INTEGER(C_INT), SAVE ::  plan_yi  !<
-    
-    INTEGER(iwp), SAVE   ::  total_points_x_transpo  !<
-    INTEGER(iwp), SAVE   ::  total_points_y_transpo  !<
 #endif
 
@@ -261,6 +250,4 @@
     SUBROUTINE fft_init
 
-       USE cuda_fft_interfaces
-
        IMPLICIT NONE
 
@@ -338,11 +325,4 @@
           CALL ZDFFTM( 0, ny+1, nz1, sqr_dny, work_y, ny+4, work_y, ny+4,      &
                        trig_yb, worky, 0 )
-#elif defined( __cuda_fft )
-          total_points_x_transpo = (nx+1) * (nyn_x-nys_x+1) * (nzt_x-nzb_x+1)
-          total_points_y_transpo = (ny+1) * (nxr_y-nxl_y+1) * (nzt_y-nzb_y+1)
-          CALL CUFFTPLAN1D( plan_xf, nx+1, CUFFT_D2Z, (nyn_x-nys_x+1) * (nzt_x-nzb_x+1) )
-          CALL CUFFTPLAN1D( plan_xi, nx+1, CUFFT_Z2D, (nyn_x-nys_x+1) * (nzt_x-nzb_x+1) )
-          CALL CUFFTPLAN1D( plan_yf, ny+1, CUFFT_D2Z, (nxr_y-nxl_y+1) * (nzt_y-nzb_y+1) )
-          CALL CUFFTPLAN1D( plan_yi, ny+1, CUFFT_Z2D, (nxr_y-nxl_y+1) * (nzt_y-nzb_y+1) )
 #else
           message_string = 'no system-specific fft-call available'
@@ -403,9 +383,4 @@
 
 
-       USE cuda_fft_interfaces
-#if defined( __cuda_fft )
-       USE ISO_C_BINDING
-#endif
-
        IMPLICIT NONE
 
@@ -429,9 +404,4 @@
 #elif defined( __nec )
        REAL(wp), DIMENSION(6*(nx+1)) ::  work2  !<
-#elif defined( __cuda_fft )
-       COMPLEX(dp), DIMENSION(0:(nx+1)/2,nys_x:nyn_x,nzb_x:nzt_x) ::           &
-          ar_tmp  !<
-       ! following does not work for PGI 14.1 -> to be removed later
-       ! !$acc declare create( ar_tmp )
 #endif
 
@@ -737,55 +707,4 @@
 
           ENDIF
-
-#elif defined( __cuda_fft )
-
-          !$acc data create( ar_tmp )
-          IF ( forward_fft )  THEN
-
-             !$acc data present( ar )
-             CALL CUFFTEXECD2Z( plan_xf, ar, ar_tmp )
-
-             !$acc kernels
-             DO  k = nzb_x, nzt_x
-                DO  j = nys_x, nyn_x
-
-                   DO  i = 0, (nx+1)/2
-                      ar(i,j,k)      = REAL( ar_tmp(i,j,k), KIND=wp )  * dnx
-                   ENDDO
-
-                   DO  i = 1, (nx+1)/2 - 1
-                      ar(nx+1-i,j,k) = AIMAG( ar_tmp(i,j,k) ) * dnx
-                   ENDDO
-
-                ENDDO
-             ENDDO
-             !$acc end kernels
-             !$acc end data
-
-          ELSE
-
-             !$acc data present( ar )
-             !$acc kernels
-             DO  k = nzb_x, nzt_x
-                DO  j = nys_x, nyn_x
-
-                   ar_tmp(0,j,k) = CMPLX( ar(0,j,k), 0.0_wp, KIND=wp )
-
-                   DO  i = 1, (nx+1)/2 - 1
-                      ar_tmp(i,j,k) = CMPLX( ar(i,j,k), ar(nx+1-i,j,k),        &
-                                             KIND=wp )
-                   ENDDO
-                   ar_tmp((nx+1)/2,j,k) = CMPLX( ar((nx+1)/2,j,k), 0.0_wp,     &
-                                                 KIND=wp )
-
-                ENDDO
-             ENDDO
-             !$acc end kernels
-
-             CALL CUFFTEXECZ2D( plan_xi, ar_tmp, ar )
-             !$acc end data
-
-          ENDIF
-          !$acc end data
 
 #else
@@ -1052,9 +971,4 @@
 
 
-       USE cuda_fft_interfaces
-#if defined( __cuda_fft )
-       USE ISO_C_BINDING
-#endif
-
        IMPLICIT NONE
 
@@ -1082,9 +996,4 @@
 #elif defined( __nec )
        REAL(wp), DIMENSION(6*(ny+1)) ::  work2  !<
-#elif defined( __cuda_fft )
-       COMPLEX(dp), DIMENSION(0:(ny+1)/2,nxl_y:nxr_y,nzb_y:nzt_y) ::           &
-          ar_tmp  !<
-       ! following does not work for PGI 14.1 -> to be removed later
-       ! !$acc declare create( ar_tmp )
 #endif
 
@@ -1364,55 +1273,4 @@
 
           ENDIF
-#elif defined( __cuda_fft )
-
-          !$acc data create( ar_tmp )
-          IF ( forward_fft )  THEN
-
-             !$acc data present( ar )
-             CALL CUFFTEXECD2Z( plan_yf, ar, ar_tmp )
-
-             !$acc kernels
-             DO  k = nzb_y, nzt_y
-                DO  i = nxl_y, nxr_y
-
-                   DO  j = 0, (ny+1)/2
-                      ar(j,i,k)      = REAL( ar_tmp(j,i,k), KIND=wp )  * dny
-                   ENDDO
-
-                   DO  j = 1, (ny+1)/2 - 1
-                      ar(ny+1-j,i,k) = AIMAG( ar_tmp(j,i,k) ) * dny
-                   ENDDO
-
-                ENDDO
-             ENDDO
-             !$acc end kernels
-             !$acc end data
-
-          ELSE
-
-             !$acc data present( ar )
-             !$acc kernels
-             DO  k = nzb_y, nzt_y
-                DO  i = nxl_y, nxr_y
-
-                   ar_tmp(0,i,k) = CMPLX( ar(0,i,k), 0.0_wp, KIND=wp )
-
-                   DO  j = 1, (ny+1)/2 - 1
-                      ar_tmp(j,i,k) = CMPLX( ar(j,i,k), ar(ny+1-j,i,k),        &
-                                             KIND=wp )
-                   ENDDO
-                   ar_tmp((ny+1)/2,i,k) = CMPLX( ar((ny+1)/2,i,k), 0.0_wp,     &
-                                                 KIND=wp )
-
-                ENDDO
-             ENDDO
-             !$acc end kernels
-
-             CALL CUFFTEXECZ2D( plan_yi, ar_tmp, ar )
-             !$acc end data
-
-          ENDIF
-          !$acc end data
-
 #else
           message_string = 'no system-specific fft-call available'
Index: /palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- /palm/trunk/SOURCE/flow_statistics.f90	(revision 2117)
+++ /palm/trunk/SOURCE/flow_statistics.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC version of subroutine removed
 ! 
 ! Former revisions:
@@ -216,5 +216,4 @@
 !>       are zero at the walls and inside buildings.
 !------------------------------------------------------------------------------!
-#if ! defined( __openacc )
  SUBROUTINE flow_statistics
  
@@ -309,5 +308,4 @@
     CALL cpu_log( log_point(10), 'flow_statistics', 'start' )
 
-    !$acc update host( km, kh, e, ol, pt, qs, qsws, shf, ts, u, usws, v, vsws, w )
 
 !
@@ -1756,2031 +1754,2 @@
 
  END SUBROUTINE flow_statistics
-
-
-#else
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> flow statistics - accelerator version
-!------------------------------------------------------------------------------!
- SUBROUTINE flow_statistics
-
-    USE arrays_3d,                                                             &
-        ONLY:  ddzu, ddzw, e, heatflux_output_conversion, hyp, km, kh,         &
-               momentumflux_output_conversion, nr, p, prho, pt, q, qc, ql, qr, &
-               qs, qsws, qswst, rho_air, rho_air_zw, rho_ocean, s, sa, saswsb, &
-               saswst, shf, ss, ssws, sswst, td_lsa_lpt, td_lsa_q, td_sub_lpt, &
-               td_sub_q, time_vert, ts, tswst, u, ug, us, usws, uswst, vsws,   &
-               v, vg, vpt, vswst, w, w_subs, waterflux_output_conversion, zw
-                 
-        
-    USE cloud_parameters,                                                      &
-        ONLY:  l_d_cp, prr, pt_d_t
-        
-    USE control_parameters,                                                    &
-        ONLY :  average_count_pr, cloud_droplets, cloud_physics, do_sum,       &
-                dt_3d, g, humidity, kappa, large_scale_forcing,                &
-                large_scale_subsidence, max_pr_user, message_string,           &
-                microphysics_seifert, neutral, ocean, passive_scalar,          &
-                simulated_time, use_subsidence_tendencies, use_surface_fluxes, &
-                use_top_fluxes, ws_scheme_mom, ws_scheme_sca
-        
-    USE cpulog,                                                                &
-        ONLY:  cpu_log, log_point
-        
-    USE grid_variables,                                                        &
-        ONLY:  ddx, ddy
-        
-    USE indices,                                                               &
-        ONLY:  ngp_2dh, ngp_2dh_s_inner, ngp_3d, ngp_3d_inner, ngp_sums,       &
-               ngp_sums_ls, nxl, nxr, nyn, nys, nzb, nzb_diff_s_inner,         &
-               nzb_s_inner, nzt, nzt_diff, rflags_invers
-        
-    USE kinds
-    
-    USE land_surface_model_mod,                                                &
-        ONLY:   ghf_eb, land_surface, m_soil, nzb_soil, nzt_soil,              &
-                qsws_eb, qsws_liq_eb, qsws_soil_eb, qsws_veg_eb, r_a, r_s,     &
-                shf_eb, t_soil
-
-    USE netcdf_interface,                                                      &
-        ONLY:  dots_rad, dots_soil
-
-    USE pegrid
-    
-    USE radiation_model_mod,                                                   &
-        ONLY:  radiation, radiation_scheme, rad_net,                 &
-               rad_lw_in, rad_lw_out, rad_sw_in, rad_sw_out
-
-#if defined ( __rrtmg )
-    USE radiation_model_mod,                                                   &
-        ONLY:  rrtm_aldif, rrtm_aldir, rrtm_asdif, rrtm_asdir, rad_lw_cs_hr,   &
-               rad_lw_hr,  rad_sw_cs_hr, rad_sw_hr
-#endif
-
-    USE statistics
-
-    IMPLICIT NONE
-
-    INTEGER(iwp) ::  i                   !<
-    INTEGER(iwp) ::  j                   !<
-    INTEGER(iwp) ::  k                   !<
-    INTEGER(iwp) ::  k_surface_level     !<
-    INTEGER(iwp) ::  nt                  !<
-    INTEGER(iwp) ::  omp_get_thread_num  !<
-    INTEGER(iwp) ::  sr                  !<
-    INTEGER(iwp) ::  tn                  !<
-    
-    LOGICAL ::  first  !<
-    
-    REAL(wp) ::  dptdz_threshold  !<
-    REAL(wp) ::  fac              !<
-    REAL(wp) ::  height           !<
-    REAL(wp) ::  pts              !<
-    REAL(wp) ::  sums_l_eper      !<
-    REAL(wp) ::  sums_l_etot      !<
-    REAL(wp) ::  s1               !<
-    REAL(wp) ::  s2               !<
-    REAL(wp) ::  s3               !<
-    REAL(wp) ::  s4               !<
-    REAL(wp) ::  s5               !<
-    REAL(wp) ::  s6               !<
-    REAL(wp) ::  s7               !<
-    REAL(wp) ::  ust              !<
-    REAL(wp) ::  ust2             !<
-    REAL(wp) ::  u2               !<
-    REAL(wp) ::  vst              !<
-    REAL(wp) ::  vst2             !<
-    REAL(wp) ::  v2               !<
-    REAL(wp) ::  w2               !<
-    REAL(wp) ::  z_i(2)           !<
-
-    REAL(wp) ::  dptdz(nzb+1:nzt+1)    !<
-    REAL(wp) ::  sums_ll(nzb:nzt+1,2)  !<
-
-    CALL cpu_log( log_point(10), 'flow_statistics', 'start' )
-
-!
-!-- To be on the safe side, check whether flow_statistics has already been
-!-- called once after the current time step
-    IF ( flow_statistics_called )  THEN
-
-       message_string = 'flow_statistics is called two times within one ' // &
-                        'timestep'
-       CALL message( 'flow_statistics', 'PA0190', 1, 2, 0, 6, 0 )
-
-    ENDIF
-
-    !$acc data create( sums, sums_l )
-    !$acc update device( hom )
-
-!
-!-- Compute statistics for each (sub-)region
-    DO  sr = 0, statistic_regions
-
-!
-!--    Initialize (local) summation array
-       sums_l = 0.0_wp
-
-!
-!--    Store sums that have been computed in other subroutines in summation
-!--    array
-       sums_l(:,11,:) = sums_l_l(:,sr,:)      ! mixing length from diffusivities
-!--    WARNING: next line still has to be adjusted for OpenMP
-       sums_l(:,21,0) = sums_wsts_bc_l(:,sr) *                                 &
-                        heatflux_output_conversion  ! heat flux from advec_s_bc
-       sums_l(nzb+9,pr_palm,0)  = sums_divold_l(sr)  ! old divergence from pres
-       sums_l(nzb+10,pr_palm,0) = sums_divnew_l(sr)  ! new divergence from pres
-
-!
-!--    When calcuating horizontally-averaged total (resolved- plus subgrid-
-!--    scale) vertical fluxes and velocity variances by using commonly-
-!--    applied Reynolds-based methods ( e.g. <w'pt'> = (w-<w>)*(pt-<pt>) )
-!--    in combination with the 5th order advection scheme, pronounced 
-!--    artificial kinks could be observed in the vertical profiles near the 
-!--    surface. Please note: these kinks were not related to the model truth, 
-!--    i.e. these kinks are just related to an evaluation problem.   
-!--    In order avoid these kinks, vertical fluxes and horizontal as well 
-!--    vertical velocity variances are calculated directly within the advection
-!--    routines, according to the numerical discretization, to evaluate the 
-!--    statistical quantities as they will appear within the prognostic 
-!--    equations. 
-!--    Copy the turbulent quantities, evaluated in the advection routines to
-!--    the local array sums_l() for further computations.
-       IF ( ws_scheme_mom .AND. sr == 0 )  THEN
-
-!
-!--       According to the Neumann bc for the horizontal velocity components,
-!--       the corresponding fluxes has to satisfiy the same bc.
-          IF ( ocean )  THEN
-             sums_us2_ws_l(nzt+1,:) = sums_us2_ws_l(nzt,:)
-             sums_vs2_ws_l(nzt+1,:) = sums_vs2_ws_l(nzt,:)
-          ENDIF
-
-          DO  i = 0, threads_per_task-1
-!
-!--          Swap the turbulent quantities evaluated in advec_ws.
-             sums_l(:,13,i) = sums_wsus_ws_l(:,i)                              &
-                              * momentumflux_output_conversion ! w*u*
-             sums_l(:,15,i) = sums_wsvs_ws_l(:,i)                              &
-                              * momentumflux_output_conversion ! w*v*
-             sums_l(:,30,i) = sums_us2_ws_l(:,i)        ! u*2
-             sums_l(:,31,i) = sums_vs2_ws_l(:,i)        ! v*2
-             sums_l(:,32,i) = sums_ws2_ws_l(:,i)        ! w*2
-             sums_l(:,34,i) = sums_l(:,34,i) + 0.5_wp *                        &
-                              ( sums_us2_ws_l(:,i) + sums_vs2_ws_l(:,i) +      &
-                                sums_ws2_ws_l(:,i) )    ! e*
-             DO  k = nzb, nzt
-                sums_l(nzb+5,pr_palm,i) = sums_l(nzb+5,pr_palm,i) + 0.5_wp * ( &
-                                                      sums_us2_ws_l(k,i) +     &
-                                                      sums_vs2_ws_l(k,i) +     &
-                                                      sums_ws2_ws_l(k,i)     )
-             ENDDO
-          ENDDO
-
-       ENDIF
-
-       IF ( ws_scheme_sca .AND. sr == 0 )  THEN
-
-          DO  i = 0, threads_per_task-1
-             sums_l(:,17,i) = sums_wspts_ws_l(:,i)                             &
-                              * heatflux_output_conversion        ! w*pt* from advec_s_ws
-             IF ( ocean ) sums_l(:,66,i) = sums_wssas_ws_l(:,i) ! w*sa*
-             IF ( humidity       )  sums_l(:,49,i)  = sums_wsqs_ws_l(:,i)      &
-                                            * waterflux_output_conversion !w*q*
-             IF ( passive_scalar )  sums_l(:,116,i) = sums_wsss_ws_l(:,i) !w*s*
-          ENDDO
-
-       ENDIF
-!
-!--    Horizontally averaged profiles of horizontal velocities and temperature.
-!--    They must have been computed before, because they are already required
-!--    for other horizontal averages.
-       tn = 0
-
-       !$OMP PARALLEL PRIVATE( i, j, k, tn )
-!$     tn = omp_get_thread_num()
-
-       !$acc update device( sums_l )
-
-       !$OMP DO
-       !$acc parallel loop gang present( pt, rflags_invers, rmask, sums_l, u, v ) create( s1, s2, s3 )
-       DO  k = nzb, nzt+1
-          s1 = 0
-          s2 = 0
-          s3 = 0
-          !$acc loop vector collapse( 2 ) reduction( +: s1, s2, s3 )
-          DO  i = nxl, nxr
-             DO  j =  nys, nyn
-!
-!--             k+1 is used in rflags since rflags is set 0 at surface points
-                s1 = s1 + u(k,j,i)  * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                s2 = s2 + v(k,j,i)  * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                s3 = s3 + pt(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-             ENDDO
-          ENDDO
-          sums_l(k,1,tn) = s1
-          sums_l(k,2,tn) = s2
-          sums_l(k,4,tn) = s3
-       ENDDO
-       !$acc end parallel loop
-
-!
-!--    Horizontally averaged profile of salinity
-       IF ( ocean )  THEN
-          !$OMP DO
-          !$acc parallel loop gang present( rflags_invers, rmask, sums_l, sa ) create( s1 )
-          DO  k = nzb, nzt+1
-             s1 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1 )
-             DO  i = nxl, nxr
-                DO  j =  nys, nyn
-                   s1 = s1 + sa(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                ENDDO
-             ENDDO
-             sums_l(k,23,tn) = s1
-          ENDDO
-          !$acc end parallel loop
-       ENDIF
-
-!
-!--    Horizontally averaged profiles of virtual potential temperature,
-!--    total water content, specific humidity and liquid water potential
-!--    temperature
-       IF ( humidity )  THEN
-
-          !$OMP DO
-          !$acc parallel loop gang present( q, rflags_invers, rmask, sums_l, vpt ) create( s1, s2 )
-          DO  k = nzb, nzt+1
-             s1 = 0
-             s2 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1, s2 )
-             DO  i = nxl, nxr
-                DO  j =  nys, nyn
-                   s1 = s1 + q(k,j,i)   * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                   s2 = s2 + vpt(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                ENDDO
-             ENDDO
-             sums_l(k,41,tn) = s1
-             sums_l(k,44,tn) = s2
-          ENDDO
-          !$acc end parallel loop
-
-          IF ( cloud_physics )  THEN
-             !$OMP DO
-             !$acc parallel loop gang present( pt, q, ql, rflags_invers, rmask, sums_l ) create( s1, s2 )
-             DO  k = nzb, nzt+1
-                s1 = 0
-                s2 = 0
-                !$acc loop vector collapse( 2 ) reduction( +: s1, s2 )
-                DO  i = nxl, nxr
-                   DO  j =  nys, nyn
-                      s1 = s1 + ( q(k,j,i) - ql(k,j,i) ) * &
-                                rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                      s2 = s2 + ( pt(k,j,i) + l_d_cp*pt_d_t(k) * ql(k,j,i) ) * &
-                                rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                   ENDDO
-                ENDDO
-                sums_l(k,42,tn) = s1
-                sums_l(k,43,tn) = s2
-             ENDDO
-             !$acc end parallel loop
-          ENDIF
-       ENDIF
-
-!
-!--    Horizontally averaged profiles of passive scalar
-       IF ( passive_scalar )  THEN
-          !$OMP DO
-          !$acc parallel loop gang present( s, rflags_invers, rmask, sums_l ) create( s1 )
-          DO  k = nzb, nzt+1
-             s1 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1 )
-             DO  i = nxl, nxr
-                DO  j =  nys, nyn
-                   s1 = s1 + s(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                ENDDO
-             ENDDO
-             sums_l(k,117,tn) = s1
-          ENDDO
-          !$acc end parallel loop
-       ENDIF
-       !$OMP END PARALLEL
-
-!
-!--    Summation of thread sums
-       IF ( threads_per_task > 1 )  THEN
-          DO  i = 1, threads_per_task-1
-             !$acc parallel present( sums_l )
-             sums_l(:,1,0) = sums_l(:,1,0) + sums_l(:,1,i)
-             sums_l(:,2,0) = sums_l(:,2,0) + sums_l(:,2,i)
-             sums_l(:,4,0) = sums_l(:,4,0) + sums_l(:,4,i)
-             !$acc end parallel
-             IF ( ocean )  THEN
-                !$acc parallel present( sums_l )
-                sums_l(:,23,0) = sums_l(:,23,0) + sums_l(:,23,i)
-                !$acc end parallel
-             ENDIF
-             IF ( humidity )  THEN
-                !$acc parallel present( sums_l )
-                sums_l(:,41,0) = sums_l(:,41,0) + sums_l(:,41,i)
-                sums_l(:,44,0) = sums_l(:,44,0) + sums_l(:,44,i)
-                !$acc end parallel
-                IF ( cloud_physics )  THEN
-                   !$acc parallel present( sums_l )
-                   sums_l(:,42,0) = sums_l(:,42,0) + sums_l(:,42,i)
-                   sums_l(:,43,0) = sums_l(:,43,0) + sums_l(:,43,i)
-                   !$acc end parallel
-                ENDIF
-             ENDIF
-             IF ( passive_scalar )  THEN
-                !$acc parallel present( sums_l )
-                sums_l(:,117,0) = sums_l(:,117,0) + sums_l(:,117,i)
-                !$acc end parallel
-             ENDIF
-          ENDDO
-       ENDIF
-
-#if defined( __parallel )
-!
-!--    Compute total sum from local sums
-       !$acc update host( sums_l )
-       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( sums_l(nzb,1,0), sums(nzb,1), nzt+2-nzb, MPI_REAL,  &
-                           MPI_SUM, comm2d, ierr )
-       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( sums_l(nzb,2,0), sums(nzb,2), nzt+2-nzb, MPI_REAL,  &
-                           MPI_SUM, comm2d, ierr )
-       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( sums_l(nzb,4,0), sums(nzb,4), nzt+2-nzb, MPI_REAL,  &
-                           MPI_SUM, comm2d, ierr )
-       IF ( ocean )  THEN
-          IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,23,0), sums(nzb,23), nzt+2-nzb,       &
-                              MPI_REAL, MPI_SUM, comm2d, ierr )
-       ENDIF
-       IF ( humidity ) THEN
-          IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,44,0), sums(nzb,44), nzt+2-nzb,       &
-                              MPI_REAL, MPI_SUM, comm2d, ierr )
-          IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,41,0), sums(nzb,41), nzt+2-nzb,       &
-                              MPI_REAL, MPI_SUM, comm2d, ierr )
-          IF ( cloud_physics ) THEN
-             IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-             CALL MPI_ALLREDUCE( sums_l(nzb,42,0), sums(nzb,42), nzt+2-nzb,    &
-                                 MPI_REAL, MPI_SUM, comm2d, ierr )
-             IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-             CALL MPI_ALLREDUCE( sums_l(nzb,43,0), sums(nzb,43), nzt+2-nzb,    &
-                                 MPI_REAL, MPI_SUM, comm2d, ierr )
-          ENDIF
-       ENDIF
-
-       IF ( passive_scalar )  THEN
-          IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,117,0), sums(nzb,117), nzt+2-nzb,     &
-                              MPI_REAL, MPI_SUM, comm2d, ierr )
-       ENDIF
-       !$acc update device( sums )
-#else
-       !$acc parallel present( sums, sums_l )
-       sums(:,1) = sums_l(:,1,0)
-       sums(:,2) = sums_l(:,2,0)
-       sums(:,4) = sums_l(:,4,0)
-       !$acc end parallel
-       IF ( ocean )  THEN
-          !$acc parallel present( sums, sums_l )
-          sums(:,23) = sums_l(:,23,0)
-          !$acc end parallel
-       ENDIF
-       IF ( humidity )  THEN
-          !$acc parallel present( sums, sums_l )
-          sums(:,44) = sums_l(:,44,0)
-          sums(:,41) = sums_l(:,41,0)
-          !$acc end parallel
-          IF ( cloud_physics )  THEN
-             !$acc parallel present( sums, sums_l )
-             sums(:,42) = sums_l(:,42,0)
-             sums(:,43) = sums_l(:,43,0)
-             !$acc end parallel
-          ENDIF
-       ENDIF
-       IF ( passive_scalar )  THEN
-          !$acc parallel present( sums, sums_l )
-          sums(:,117) = sums_l(:,117,0)
-          !$acc end parallel
-       ENDIF
-#endif
-
-!
-!--    Final values are obtained by division by the total number of grid points
-!--    used for summation. After that store profiles.
-       !$acc parallel present( hom, ngp_2dh, ngp_2dh_s_inner, sums )
-       sums(:,1) = sums(:,1) / ngp_2dh(sr)
-       sums(:,2) = sums(:,2) / ngp_2dh(sr)
-       sums(:,4) = sums(:,4) / ngp_2dh_s_inner(:,sr)
-       hom(:,1,1,sr) = sums(:,1)             ! u
-       hom(:,1,2,sr) = sums(:,2)             ! v
-       hom(:,1,4,sr) = sums(:,4)             ! pt
-       !$acc end parallel
-
-!
-!--    Salinity
-       IF ( ocean )  THEN
-          !$acc parallel present( hom, ngp_2dh_s_inner, sums )
-          sums(:,23) = sums(:,23) / ngp_2dh_s_inner(:,sr)
-          hom(:,1,23,sr) = sums(:,23)             ! sa
-          !$acc end parallel
-       ENDIF
-
-!
-!--    Humidity and cloud parameters
-       IF ( humidity ) THEN
-          !$acc parallel present( hom, ngp_2dh_s_inner, sums )
-          sums(:,44) = sums(:,44) / ngp_2dh_s_inner(:,sr)
-          sums(:,41) = sums(:,41) / ngp_2dh_s_inner(:,sr)
-          hom(:,1,44,sr) = sums(:,44)                ! vpt
-          hom(:,1,41,sr) = sums(:,41)                ! qv (q)
-          !$acc end parallel
-          IF ( cloud_physics ) THEN
-             !$acc parallel present( hom, ngp_2dh_s_inner, sums )
-             sums(:,42) = sums(:,42) / ngp_2dh_s_inner(:,sr)
-             sums(:,43) = sums(:,43) / ngp_2dh_s_inner(:,sr)
-             hom(:,1,42,sr) = sums(:,42)             ! qv
-             hom(:,1,43,sr) = sums(:,43)             ! pt
-             !$acc end parallel
-          ENDIF
-       ENDIF
-
-!
-!--    Passive scalar
-       IF ( passive_scalar )  THEN
-          !$acc parallel present( hom, ngp_2dh_s_inner, sums )
-          sums(:,117)     = sums(:,117) / ngp_2dh_s_inner(:,sr)
-          hom(:,1,117,sr) = sums(:,117)                ! s
-          !$acc end parallel
-       ENDIF
-
-!
-!--    Horizontally averaged profiles of the remaining prognostic variables,
-!--    variances, the total and the perturbation energy (single values in last
-!--    column of sums_l) and some diagnostic quantities.
-!--    NOTE: for simplicity, nzb_s_inner is used below, although strictly
-!--    ----  speaking the following k-loop would have to be split up and
-!--          rearranged according to the staggered grid.
-!--          However, this implies no error since staggered velocity components
-!--          are zero at the walls and inside buildings.
-       tn = 0
-       !$OMP PARALLEL PRIVATE( i, j, k, pts, sums_ll, sums_l_eper,             &
-       !$OMP                   sums_l_etot, tn, ust, ust2, u2, vst, vst2, v2,  &
-       !$OMP                   w2 )
-!$     tn = omp_get_thread_num()
-
-       !$OMP DO
-       !$acc parallel loop gang present( e, hom, kh, km, p, pt, w, rflags_invers, rmask, sums_l ) create( s1, s2, s3, s4, s5, s6, s7 )
-       DO  k = nzb, nzt+1
-          s1 = 0
-          s2 = 0
-          s3 = 0
-          s4 = 0
-          s5 = 0
-          s6 = 0
-          s7 = 0
-          !$acc loop vector collapse( 2 ) reduction( +: s1, s2, s3, s4, s5, s6, s7 )
-          DO  i = nxl, nxr
-             DO  j =  nys, nyn
-!
-!--             Prognostic and diagnostic variables
-                s1 = s1 + w(k,j,i)  * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                s2 = s2 + e(k,j,i)  * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                s3 = s3 + km(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                s4 = s4 + kh(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                s5 = s5 + p(k,j,i)  * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                s6 = s6 + ( pt(k,j,i)-hom(k,1,4,sr) )**2 * rmask(j,i,sr) * &
-                          rflags_invers(j,i,k+1)
-!
-!--             Higher moments
-!--             (Computation of the skewness of w further below)
-                s7 = s7 + w(k,j,i)**3 * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-             ENDDO
-          ENDDO
-          sums_l(k,3,tn)  = s1
-          sums_l(k,8,tn)  = s2
-          sums_l(k,9,tn)  = s3
-          sums_l(k,10,tn) = s4
-          sums_l(k,40,tn) = s5
-          sums_l(k,33,tn) = s6
-          sums_l(k,38,tn) = s7
-       ENDDO
-       !$acc end parallel loop
-
-       IF ( humidity )  THEN
-          !$OMP DO
-          !$acc parallel loop gang present( hom, q, rflags_invers, rmask, sums_l ) create( s1 )
-          DO  k = nzb, nzt+1
-             s1 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1 )
-             DO  i = nxl, nxr
-                DO  j =  nys, nyn
-                   s1 = s1 + ( q(k,j,i)-hom(k,1,41,sr) )**2 * rmask(j,i,sr) * &
-                             rflags_invers(j,i,k+1)
-                ENDDO
-             ENDDO
-             sums_l(k,70,tn) = s1
-          ENDDO
-          !$acc end parallel loop
-       ENDIF
-
-!
-!--    Total and perturbation energy for the total domain (being
-!--    collected in the last column of sums_l).
-       s1 = 0
-       !$OMP DO
-       !$acc parallel loop collapse(3) present( rflags_invers, rmask, u, v, w ) reduction(+:s1)
-       DO  i = nxl, nxr
-          DO  j =  nys, nyn
-             DO  k = nzb, nzt+1
-                s1 = s1 + 0.5_wp *                                             & 
-                          ( u(k,j,i)**2 + v(k,j,i)**2 + w(k,j,i)**2 ) *        &
-                          rmask(j,i,sr) * rflags_invers(j,i,k+1)
-             ENDDO
-          ENDDO
-       ENDDO
-       !$acc end parallel loop
-       !$acc parallel present( sums_l )
-       sums_l(nzb+4,pr_palm,tn) = s1
-       !$acc end parallel
-
-       !$OMP DO
-       !$acc parallel present( rmask, sums_l, us, usws, vsws, ts ) create( s1, s2, s3, s4 )
-       s1 = 0
-       s2 = 0
-       s3 = 0
-       s4 = 0
-       !$acc loop vector collapse( 2 ) reduction( +: s1, s2, s3, s4 )
-       DO  i = nxl, nxr
-          DO  j =  nys, nyn
-!
-!--          2D-arrays (being collected in the last column of sums_l)
-             s1 = s1 + us(j,i)   * rmask(j,i,sr)
-             s2 = s2 + usws(j,i) * rmask(j,i,sr)
-             s3 = s3 + vsws(j,i) * rmask(j,i,sr)
-             s4 = s4 + ts(j,i)   * rmask(j,i,sr)
-          ENDDO
-       ENDDO
-       sums_l(nzb,pr_palm,tn)   = s1
-       sums_l(nzb+1,pr_palm,tn) = s2
-       sums_l(nzb+2,pr_palm,tn) = s3
-       sums_l(nzb+3,pr_palm,tn) = s4
-       !$acc end parallel
-
-       IF ( humidity )  THEN
-          !$acc parallel present( qs, rmask, sums_l ) create( s1 )
-          s1 = 0
-          !$acc loop vector collapse( 2 ) reduction( +: s1 )
-          DO  i = nxl, nxr
-             DO  j =  nys, nyn
-                s1 = s1 + qs(j,i) * rmask(j,i,sr)
-             ENDDO
-          ENDDO
-          sums_l(nzb+12,pr_palm,tn) = s1
-          !$acc end parallel
-       ENDIF
-
-       IF ( passive_scalar )  THEN
-          !$acc parallel present( ss, rmask, sums_l ) create( s1 )
-          s1 = 0
-          !$acc loop vector collapse( 2 ) reduction( +: s1 )
-          DO  i = nxl, nxr
-             DO  j =  nys, nyn
-                s1 = s1 + ss(j,i) * rmask(j,i,sr)
-             ENDDO
-          ENDDO
-          sums_l(nzb+13,pr_palm,tn) = s1
-          !$acc end parallel
-       ENDIF
-
-!
-!--    Computation of statistics when ws-scheme is not used. Else these
-!--    quantities are evaluated in the advection routines.
-       IF ( .NOT. ws_scheme_mom .OR. sr /= 0 .OR. simulated_time == 0.0_wp )   &
-       THEN
-
-          !$OMP DO
-          !$acc parallel loop gang present( u, v, w, rflags_invers, rmask, sums_l ) create( s1, s2, s3, s4, ust2, vst2, w2 )
-          DO  k = nzb, nzt+1
-             s1 = 0
-             s2 = 0
-             s3 = 0
-             s4 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1, s2, s3, s4 )
-             DO  i = nxl, nxr
-                DO  j =  nys, nyn
-                   ust2 = ( u(k,j,i) - hom(k,1,1,sr) )**2
-                   vst2 = ( v(k,j,i) - hom(k,1,2,sr) )**2
-                   w2   = w(k,j,i)**2
-
-                   s1 = s1 + ust2 * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                   s2 = s2 + vst2 * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                   s3 = s3 + w2   * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-!
-!--                Perturbation energy
-                   s4 = s4 + 0.5_wp * ( ust2 + vst2 + w2 ) * rmask(j,i,sr) *   &
-                             rflags_invers(j,i,k+1)
-                ENDDO
-             ENDDO
-             sums_l(k,30,tn) = s1
-             sums_l(k,31,tn) = s2
-             sums_l(k,32,tn) = s3
-             sums_l(k,34,tn) = s4
-          ENDDO
-          !$acc end parallel loop
-!
-!--       Total perturbation TKE
-          !$OMP DO
-          !$acc parallel present( sums_l ) create( s1 )
-          s1 = 0
-          !$acc loop reduction( +: s1 )
-          DO  k = nzb, nzt+1
-             s1 = s1 + sums_l(k,34,tn)
-          ENDDO
-          sums_l(nzb+5,pr_palm,tn) = s1
-          !$acc end parallel
-
-       ENDIF
-
-!
-!--    Horizontally averaged profiles of the vertical fluxes
-
-!
-!--    Subgridscale fluxes.
-!--    WARNING: If a Prandtl-layer is used (k=nzb for flat terrain), the fluxes
-!--    -------  should be calculated there in a different way. This is done
-!--             in the next loop further below, where results from this loop are
-!--             overwritten. However, THIS WORKS IN CASE OF FLAT TERRAIN ONLY!
-!--             The non-flat case still has to be handled.
-!--    NOTE: for simplicity, nzb_s_inner is used below, although
-!--    ----  strictly speaking the following k-loop would have to be
-!--          split up according to the staggered grid.
-!--          However, this implies no error since staggered velocity
-!--          components are zero at the walls and inside buildings.
-       !$OMP DO
-       !$acc parallel loop gang present( ddzu, kh, km, pt, u, v, w, rflags_invers, rmask, sums_l ) create( s1, s2, s3 )
-       DO  k = nzb, nzt_diff
-          s1 = 0
-          s2 = 0
-          s3 = 0
-          !$acc loop vector collapse( 2 ) reduction( +: s1, s2, s3 )
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-
-!
-!--             Momentum flux w"u"
-                s1 = s1 - 0.25_wp * (                                          &
-                               km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) &
-                                                           ) * (               &
-                                   ( u(k+1,j,i) - u(k,j,i)   ) * ddzu(k+1)     &
-                                 + ( w(k,j,i)   - w(k,j,i-1) ) * ddx           &
-                                                               )               &
-                               * rmask(j,i,sr) * rflags_invers(j,i,k+1)        &
-                               * rho_air_zw(k)                                 &
-                               * momentumflux_output_conversion(k)
-!
-!--             Momentum flux w"v"
-                s2 = s2 - 0.25_wp * (                                          &
-                               km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) &
-                                                           ) * (               &
-                                   ( v(k+1,j,i) - v(k,j,i)   ) * ddzu(k+1)     &
-                                 + ( w(k,j,i)   - w(k,j-1,i) ) * ddy           &
-                                                               )               &
-                               * rmask(j,i,sr) * rflags_invers(j,i,k+1)        &
-                               * rho_air_zw(k)                                 &
-                               * momentumflux_output_conversion(k)
-!
-!--             Heat flux w"pt"
-                s3 = s3 - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )                 &
-                                 * ( pt(k+1,j,i) - pt(k,j,i) )                 &
-                                 * rho_air_zw(k)                               &
-                                 * heatflux_output_conversion(k)               &
-                                 * ddzu(k+1) * rmask(j,i,sr)                   &
-                                 * rflags_invers(j,i,k+1)
-             ENDDO
-          ENDDO
-          sums_l(k,12,tn) = s1
-          sums_l(k,14,tn) = s2
-          sums_l(k,16,tn) = s3
-       ENDDO
-       !$acc end parallel loop
-
-!
-!--    Salinity flux w"sa"
-       IF ( ocean )  THEN
-          !$acc parallel loop gang present( ddzu, kh, sa, rflags_invers, rmask, sums_l ) create( s1 )
-          DO  k = nzb, nzt_diff
-             s1 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1 )
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   s1 = s1 - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )              &
-                                    * ( sa(k+1,j,i) - sa(k,j,i) )              &
-                                    * ddzu(k+1) * rmask(j,i,sr)                & 
-                                    * rflags_invers(j,i,k+1)
-                ENDDO
-             ENDDO
-             sums_l(k,65,tn) = s1
-          ENDDO
-          !$acc end parallel loop
-       ENDIF
-
-!
-!--    Buoyancy flux, water flux (humidity flux) w"q"
-       IF ( humidity ) THEN
-
-          !$acc parallel loop gang present( ddzu, kh, q, vpt, rflags_invers, rmask, sums_l ) create( s1, s2 )
-          DO  k = nzb, nzt_diff
-             s1 = 0
-             s2 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1, s2 )
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   s1 = s1 - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )              &
-                                    * ( vpt(k+1,j,i) - vpt(k,j,i) )            &
-                                    * rho_air_zw(k)                            &
-                                    * heatflux_output_conversion(k)            &
-                                    * ddzu(k+1) * rmask(j,i,sr)                &
-                                    * rflags_invers(j,i,k+1)
-                   s2 = s2 - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )              &
-                                    * ( q(k+1,j,i) - q(k,j,i) )                &
-                                    * rho_air_zw(k)                            &
-                                    * waterflux_output_conversion(k)           &
-                                    * ddzu(k+1) * rmask(j,i,sr)                &
-                                    * rflags_invers(j,i,k+1)
-                ENDDO
-             ENDDO
-             sums_l(k,45,tn) = s1
-             sums_l(k,48,tn) = s2
-          ENDDO
-          !$acc end parallel loop
-
-          IF ( cloud_physics ) THEN
-
-             !$acc parallel loop gang present( ddzu, kh, q, ql, rflags_invers, rmask, sums_l ) create( s1 )
-             DO  k = nzb, nzt_diff
-                s1 = 0
-                !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                DO  i = nxl, nxr
-                   DO  j = nys, nyn
-                      s1 = s1 - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )           &
-                                       *  ( ( q(k+1,j,i) - ql(k+1,j,i) )       &
-                                          - ( q(k,j,i) - ql(k,j,i) ) )         &
-                                       * rho_air_zw(k)                         &
-                                       * waterflux_output_conversion(k)        &
-                                       * ddzu(k+1) * rmask(j,i,sr)             & 
-                                       * rflags_invers(j,i,k+1)
-                   ENDDO
-                ENDDO
-                sums_l(k,51,tn) = s1
-             ENDDO
-             !$acc end parallel loop
-
-          ENDIF
-
-       ENDIF
-!
-!--    Passive scalar flux
-       IF ( passive_scalar )  THEN
-
-          !$acc parallel loop gang present( ddzu, kh, s, rflags_invers, rmask, sums_l ) create( s1 )
-          DO  k = nzb, nzt_diff
-             s1 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1 )
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   s1 = s1 - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )              &
-                                    * ( s(k+1,j,i) - s(k,j,i) )                &
-                                    * ddzu(k+1) * rmask(j,i,sr)                &
-                                    * rflags_invers(j,i,k+1)
-                ENDDO
-             ENDDO
-             sums_l(k,119,tn) = s1
-          ENDDO
-          !$acc end parallel loop
-
-       ENDIF
-
-       IF ( use_surface_fluxes )  THEN
-
-          !$OMP DO
-          !$acc parallel present( rmask, shf, sums_l, usws, vsws ) create( s1, s2, s3, s4, s5 )
-          s1 = 0
-          s2 = 0
-          s3 = 0
-          s4 = 0
-          s5 = 0
-          !$acc loop vector collapse( 2 ) reduction( +: s1, s2, s3, s4, s5 )
-          DO  i = nxl, nxr
-             DO  j =  nys, nyn
-!
-!--             Subgridscale fluxes in the Prandtl layer
-                s1 = s1 + usws(j,i) * momentumflux_output_conversion(nzb)      &
-                                    * rmask(j,i,sr) ! w"u"
-                s2 = s2 + vsws(j,i) * momentumflux_output_conversion(nzb)      &
-                                    * rmask(j,i,sr) ! w"v"
-                s3 = s3 + shf(j,i)  * heatflux_output_conversion(nzb)          &
-                                    * rmask(j,i,sr) ! w"pt"
-                s4 = s4 + 0.0_wp * rmask(j,i,sr)        ! u"pt"
-                s5 = s5 + 0.0_wp * rmask(j,i,sr)        ! v"pt"
-             ENDDO
-          ENDDO
-          sums_l(nzb,12,tn) = s1
-          sums_l(nzb,14,tn) = s2
-          sums_l(nzb,16,tn) = s3
-          sums_l(nzb,58,tn) = s4
-          sums_l(nzb,61,tn) = s5
-          !$acc end parallel
-
-          IF ( ocean )  THEN
-
-             !$OMP DO
-             !$acc parallel present( rmask, saswsb, sums_l ) create( s1 )
-             s1 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1 )
-             DO  i = nxl, nxr
-                DO  j =  nys, nyn
-                   s1 = s1 + saswsb(j,i) * rmask(j,i,sr)  ! w"sa"
-                ENDDO
-             ENDDO
-             sums_l(nzb,65,tn) = s1
-             !$acc end parallel
-
-          ENDIF
-
-          IF ( humidity )  THEN
-
-             !$OMP DO
-             !$acc parallel present( pt, q, qsws, rmask, shf, sums_l ) create( s1, s2 )
-             s1 = 0
-             s2 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1, s2 )
-             DO  i = nxl, nxr
-                DO  j =  nys, nyn
-                   s1 = s1 + qsws(j,i) * waterflux_output_conversion(nzb)      &
-                                       * rmask(j,i,sr) ! w"q" (w"qv")
-                   s2 = s2 + ( ( 1.0_wp + 0.61_wp * q(nzb,j,i) ) * shf(j,i)    &
-                               + 0.61_wp * pt(nzb,j,i) * qsws(j,i) )           &
-                             * heatflux_output_conversion(nzb)
-                ENDDO
-             ENDDO
-             sums_l(nzb,48,tn) = s1
-             sums_l(nzb,45,tn) = s2
-             !$acc end parallel
-
-             IF ( cloud_droplets )  THEN
-
-                !$OMP DO
-                !$acc parallel present( pt, q, ql, qsws, rmask, shf, sums_l ) create( s1 )
-                s1 = 0
-                !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                DO  i = nxl, nxr
-                   DO  j =  nys, nyn
-                      s1 = s1 + ( ( 1.0_wp +                                   &
-                                    0.61_wp * q(nzb,j,i) - ql(nzb,j,i) ) *     &
-                                 shf(j,i) + 0.61_wp * pt(nzb,j,i) * qsws(j,i) )&
-                                * heatflux_output_conversion(nzb)
-                   ENDDO
-                ENDDO
-                sums_l(nzb,45,tn) = s1
-                !$acc end parallel
-
-             ENDIF
-
-             IF ( cloud_physics )  THEN
-
-                !$OMP DO
-                !$acc parallel present( qsws, rmask, sums_l ) create( s1 )
-                s1 = 0
-                !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                DO  i = nxl, nxr
-                   DO  j =  nys, nyn
-!
-!--                   Formula does not work if ql(nzb) /= 0.0
-                      s1 = s1 + qsws(j,i) * waterflux_output_conversion(nzb)   &
-                                          * rmask(j,i,sr)   ! w"q" (w"qv")
-                   ENDDO
-                ENDDO
-                sums_l(nzb,51,tn) = s1
-                !$acc end parallel
-
-             ENDIF
-
-          ENDIF
-
-          IF ( passive_scalar )  THEN
-
-             !$OMP DO
-             !$acc parallel present( ssws, rmask, sums_l ) create( s1 )
-             s1 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1 )
-             DO  i = nxl, nxr
-                DO  j =  nys, nyn
-                   s1 = s1 + ssws(j,i) * rmask(j,i,sr)  ! w"s"
-                ENDDO
-             ENDDO
-             sums_l(nzb,119,tn) = s1
-             !$acc end parallel
-
-          ENDIF
-
-       ENDIF
-
-!
-!--    Subgridscale fluxes at the top surface
-       IF ( use_top_fluxes )  THEN
-
-          !$OMP DO
-          !$acc parallel present( rmask, sums_l, tswst, uswst, vswst ) create( s1, s2, s3, s4, s5 )
-          s1 = 0
-          s2 = 0
-          s3 = 0
-          s4 = 0
-          s5 = 0
-          !$acc loop vector collapse( 2 ) reduction( +: s1, s2, s3, s4, s5 )
-          DO  i = nxl, nxr
-             DO  j =  nys, nyn
-                s1 = s1 + uswst(j,i) * momentumflux_output_conversion(nzt:nzt+1) &
-                                     * rmask(j,i,sr)    ! w"u"
-                s2 = s2 + vswst(j,i) * momentumflux_output_conversion(nzt:nzt+1) &
-                                     * rmask(j,i,sr)    ! w"v"
-                s3 = s3 + tswst(j,i) * heatflux_output_conversion(nzt:nzt+1)   &
-                                     * rmask(j,i,sr)    ! w"pt"
-                s4 = s4 + 0.0_wp * rmask(j,i,sr)        ! u"pt"
-                s5 = s5 + 0.0_wp * rmask(j,i,sr)        ! v"pt"
-             ENDDO
-          ENDDO
-          sums_l(nzt:nzt+1,12,tn) = s1
-          sums_l(nzt:nzt+1,14,tn) = s2
-          sums_l(nzt:nzt+1,16,tn) = s3
-          sums_l(nzt:nzt+1,58,tn) = s4
-          sums_l(nzt:nzt+1,61,tn) = s5
-          !$acc end parallel
-
-          IF ( ocean )  THEN
-
-             !$OMP DO
-             !$acc parallel present( rmask, saswst, sums_l ) create( s1 )
-             s1 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1 )
-             DO  i = nxl, nxr
-                DO  j =  nys, nyn
-                   s1 = s1 + saswst(j,i) * rmask(j,i,sr)  ! w"sa"
-                ENDDO
-             ENDDO
-             sums_l(nzt,65,tn) = s1
-             !$acc end parallel
-
-          ENDIF
-
-          IF ( humidity )  THEN
-
-             !$OMP DO
-             !$acc parallel present( pt, q, qswst, rmask, tswst, sums_l ) create( s1, s2 )
-             s1 = 0
-             s2 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1, s2 )
-             DO  i = nxl, nxr
-                DO  j =  nys, nyn
-                   s1 = s1 + qswst(j,i) * waterflux_output_conversion(nzt)     &
-                                        * rmask(j,i,sr) ! w"q" (w"qv")
-                   s2 = s2 + ( ( 1.0_wp + 0.61_wp * q(nzt,j,i) ) * tswst(j,i) +&
-                                 0.61_wp * pt(nzt,j,i) * qswst(j,i) )          &
-                             * heatflux_output_conversion(nzt)
-                ENDDO
-             ENDDO
-             sums_l(nzt,48,tn) = s1
-             sums_l(nzt,45,tn) = s2
-             !$acc end parallel
-
-             IF ( cloud_droplets )  THEN
-
-                !$OMP DO
-                !$acc parallel present( pt, q, ql, qswst, rmask, tswst, sums_l ) create( s1 )
-                s1 = 0
-                !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                DO  i = nxl, nxr
-                   DO  j =  nys, nyn
-                      s1 = s1 + ( ( 1.0_wp +                                   &
-                                    0.61_wp * q(nzt,j,i) - ql(nzt,j,i) ) *     &
-                                  tswst(j,i) +                                 &
-                                  0.61_wp * pt(nzt,j,i) * qswst(j,i) )         &
-                                * heatflux_output_conversion(nzt)
-                   ENDDO
-                ENDDO
-                sums_l(nzt,45,tn) = s1
-                !$acc end parallel
-
-             ENDIF
-
-             IF ( cloud_physics )  THEN
-
-                !$OMP DO
-                !$acc parallel present( qswst, rmask, sums_l ) create( s1 )
-                s1 = 0
-                !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                DO  i = nxl, nxr
-                   DO  j =  nys, nyn
-!
-!--                   Formula does not work if ql(nzb) /= 0.0
-                      s1 = s1 + qswst(j,i) * waterflux_output_conversion(nzt)  &
-                                           * rmask(j,i,sr)  ! w"q" (w"qv")
-                   ENDDO
-                ENDDO
-                sums_l(nzt,51,tn) = s1
-                !$acc end parallel
-
-             ENDIF
-
-          ENDIF
-
-          IF ( passive_scalar )  THEN
-
-             !$OMP DO
-             !$acc parallel present( sswst, rmask, sums_l ) create( s1 )
-             s1 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1 )
-             DO  i = nxl, nxr
-                DO  j =  nys, nyn
-                   s1 = s1 + sswst(j,i) * rmask(j,i,sr) ! w"s"
-                ENDDO
-             ENDDO
-             sums_l(nzt,119,tn) = s1
-             !$acc end parallel
-
-          ENDIF
-
-       ENDIF
-
-!
-!--    Resolved fluxes (can be computed for all horizontal points)
-!--    NOTE: for simplicity, nzb_s_inner is used below, although strictly
-!--    ----  speaking the following k-loop would have to be split up and
-!--          rearranged according to the staggered grid.
-       !$acc parallel loop gang present( hom, pt, rflags_invers, rmask, sums_l, u, v, w ) create( s1, s2, s3 )
-       DO  k = nzb, nzt_diff
-          s1 = 0
-          s2 = 0
-          s3 = 0
-          !$acc loop vector collapse( 2 ) reduction( +: s1, s2, s3 )
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                ust = 0.5_wp * ( u(k,j,i)   - hom(k,1,1,sr) + &
-                                 u(k+1,j,i) - hom(k+1,1,1,sr) )
-                vst = 0.5_wp * ( v(k,j,i)   - hom(k,1,2,sr) + &
-                                 v(k+1,j,i) - hom(k+1,1,2,sr) )
-                pts = 0.5_wp * ( pt(k,j,i)   - hom(k,1,4,sr) + &
-                                 pt(k+1,j,i) - hom(k+1,1,4,sr) )
-!
-!--             Higher moments
-                s1 = s1 + pts * w(k,j,i)**2 * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                s2 = s2 + pts**2 * w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-!
-!--             Energy flux w*e* (has to be adjusted?)
-                s3 = s3 + w(k,j,i) * 0.5_wp * ( ust**2 + vst**2 + w(k,j,i)**2 )&
-                                   * rmask(j,i,sr) * rflags_invers(j,i,k+1)    &
-                                   * momentumflux_output_conversion(k)
-             ENDDO
-          ENDDO
-          sums_l(k,35,tn) = s1
-          sums_l(k,36,tn) = s2
-          sums_l(k,37,tn) = s3
-       ENDDO
-       !$acc end parallel loop
-
-!
-!--    Salinity flux and density (density does not belong to here,
-!--    but so far there is no other suitable place to calculate)
-       IF ( ocean )  THEN
-
-          IF( .NOT. ws_scheme_sca .OR. sr /= 0 )  THEN
-
-             !$acc parallel loop gang present( hom, rflags_invers, rmask, sa, sums_l, w ) create( s1 )
-             DO  k = nzb, nzt_diff
-                s1 = 0
-                !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                DO  i = nxl, nxr
-                   DO  j = nys, nyn
-                      s1 = s1 + 0.5_wp * ( sa(k,j,i)   - hom(k,1,23,sr) +      &
-                                           sa(k+1,j,i) - hom(k+1,1,23,sr) )    &
-                                       * w(k,j,i) * rmask(j,i,sr)              & 
-                                       * rflags_invers(j,i,k+1)
-                   ENDDO
-                ENDDO
-                sums_l(k,66,tn) = s1
-             ENDDO
-             !$acc end parallel loop
-
-          ENDIF
-
-          !$acc parallel loop gang present( rflags_invers, rho_ocean, prho, rmask, sums_l ) create( s1, s2 )
-          DO  k = nzb, nzt_diff
-             s1 = 0
-             s2 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1, s2 )
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   s1 = s1 + rho_ocean(k,j,i)  * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                   s2 = s2 + prho(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                ENDDO
-             ENDDO
-             sums_l(k,64,tn) = s1
-             sums_l(k,71,tn) = s2
-          ENDDO
-          !$acc end parallel loop
-
-       ENDIF
-
-!
-!--    Buoyancy flux, water flux, humidity flux, liquid water
-!--    content, rain drop concentration and rain water content
-       IF ( humidity )  THEN
-
-          IF ( cloud_physics  .OR.  cloud_droplets )  THEN
-
-             !$acc parallel loop gang present( hom, rflags_invers, rmask, sums_l, vpt, w ) create( s1 )
-             DO  k = nzb, nzt_diff
-                s1 = 0
-                !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                DO  i = nxl, nxr
-                   DO  j = nys, nyn
-                      s1 = s1 + 0.5_wp * ( vpt(k,j,i)   - hom(k,1,44,sr) +     &
-                                           vpt(k+1,j,i) - hom(k+1,1,44,sr) ) * &
-                                         heatflux_output_conversion(k) *       &
-                                         w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                   ENDDO
-                ENDDO
-                sums_l(k,46,tn) = s1
-             ENDDO
-             !$acc end parallel loop
-
-             IF ( .NOT. cloud_droplets )  THEN
-
-                !$acc parallel loop gang present( hom, q, ql, rflags_invers, rmask, sums_l, w ) create( s1 )
-                DO  k = nzb, nzt_diff
-                   s1 = 0
-                   !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                   DO  i = nxl, nxr
-                      DO  j = nys, nyn
-                         s1 = s1 + 0.5_wp * ( ( q(k,j,i)   - ql(k,j,i)   ) - hom(k,1,42,sr) +   &
-                                              ( q(k+1,j,i) - ql(k+1,j,i) ) - hom(k+1,1,42,sr) ) &
-                                          * waterflux_output_conversion(k)                      &
-                                          * w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                      ENDDO
-                   ENDDO
-                   sums_l(k,52,tn) = s1
-                ENDDO
-                !$acc end parallel loop
-
-                IF ( microphysics_seifert )  THEN
-
-                   !$acc parallel loop gang present( qc, ql, rflags_invers, rmask, sums_l ) create( s1, s2 )
-                   DO  k = nzb, nzt_diff
-                      s1 = 0
-                      !$acc loop vector collapse( 2 ) reduction( +: s1, s2 )
-                      DO  i = nxl, nxr
-                         DO  j = nys, nyn
-                            s1 = s1 + ql(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                            s2 = s2 + qc(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                         ENDDO
-                      ENDDO
-                      sums_l(k,54,tn) = s1
-                      sums_l(k,75,tn) = s2
-                   ENDDO
-                   !$acc end parallel loop
-
-                   !$acc parallel loop gang present( nr, qr, prr, rflags_invers, rmask, sums_l ) create( s1, s2, s3 )
-                   DO  k = nzb, nzt_diff
-                      s1 = 0
-                      s2 = 0
-                      s3 = 0
-                      !$acc loop vector collapse( 2 ) reduction( +: s1, s2, s3 )
-                      DO  i = nxl, nxr
-                         DO  j = nys, nyn
-                            s1 = s1 + nr(k,j,i)  * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                            s2 = s2 + qr(k,j,i)  * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                            s3 = s3 + prr(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                         ENDDO
-                      ENDDO
-                      sums_l(k,73,tn) = s1
-                      sums_l(k,74,tn) = s2
-                      sums_l(k,76,tn) = s3
-                   ENDDO
-                   !$acc end parallel loop
-
-                ELSE
-
-                   !$acc parallel loop gang present( ql, rflags_invers, rmask, sums_l ) create( s1 )
-                   DO  k = nzb, nzt_diff
-                      s1 = 0
-                      !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                      DO  i = nxl, nxr
-                         DO  j = nys, nyn
-                            s1 = s1 + ql(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                         ENDDO
-                      ENDDO
-                      sums_l(k,54,tn) = s1
-                   ENDDO
-                   !$acc end parallel loop
-
-                ENDIF
-
-             ELSE
-
-                !$acc parallel loop gang present( ql, rflags_invers, rmask, sums_l ) create( s1 )
-                DO  k = nzb, nzt_diff
-                   s1 = 0
-                   !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                   DO  i = nxl, nxr
-                      DO  j = nys, nyn
-                         s1 = s1 + ql(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                      ENDDO
-                   ENDDO
-                   sums_l(k,54,tn) = s1
-                ENDDO
-                !$acc end parallel loop
-
-             ENDIF
-
-          ELSE
-
-             IF( .NOT. ws_scheme_sca  .OR.  sr /= 0 )  THEN
-
-                !$acc parallel loop gang present( hom, rflags_invers, rmask, sums_l, vpt, w ) create( s1 )
-                DO  k = nzb, nzt_diff
-                   s1 = 0
-                   !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                   DO  i = nxl, nxr
-                      DO  j = nys, nyn
-                         s1 = s1 + 0.5_wp * ( vpt(k,j,i)   - hom(k,1,44,sr) +   &
-                                              vpt(k+1,j,i) - hom(k+1,1,44,sr) ) &
-                                          * heatflux_output_conversion(k)       &
-                                          * w(k,j,i) * rmask(j,i,sr) * rflags_invers(j,i,k+1)
-                      ENDDO
-                   ENDDO
-                   sums_l(k,46,tn) = s1
-                ENDDO
-                !$acc end parallel loop
-
-             ELSEIF ( ws_scheme_sca  .AND.  sr == 0 )  THEN
-
-                !$acc parallel loop present( hom, sums_l )
-                DO  k = nzb, nzt_diff
-                   sums_l(k,46,tn) = ( ( 1.0_wp + 0.61_wp * hom(k,1,41,sr) ) * &
-                                       sums_l(k,17,tn) + 0.61_wp *             &
-                                       hom(k,1,4,sr) * sums_l(k,49,tn)         &
-                                     ) * heatflux_output_conversion(k)
-                ENDDO
-                !$acc end parallel loop
-
-             ENDIF
-
-          ENDIF
-
-       ENDIF
-!
-!--    Passive scalar flux
-       IF ( passive_scalar  .AND.  ( .NOT. ws_scheme_sca  .OR.  sr /= 0 ) )  THEN
-
-          !$acc parallel loop gang present( hom, s, rflags_invers, rmask, sums_l, w ) create( s1 )
-          DO  k = nzb, nzt_diff
-             s1 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1 )
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   s1 = s1 + 0.5_wp * ( s(k,j,i)   - hom(k,1,117,sr) +          &
-                                        s(k+1,j,i) - hom(k+1,1,117,sr) )        &
-                                    * w(k,j,i) * rmask(j,i,sr)                 &
-                                    * rflags_invers(j,i,k+1)
-                ENDDO
-             ENDDO
-             sums_l(k,49,tn) = s1
-          ENDDO
-          !$acc end parallel loop
-
-       ENDIF
-
-!
-!--    For speed optimization fluxes which have been computed in part directly
-!--    inside the WS advection routines are treated seperatly
-!--    Momentum fluxes first:
-       IF ( .NOT. ws_scheme_mom  .OR.  sr /= 0  )  THEN
-
-          !$OMP DO
-          !$acc parallel loop gang present( hom, rflags_invers, rmask, sums_l, u, v, w ) create( s1, s2 )
-          DO  k = nzb, nzt_diff
-             s1 = 0
-             s2 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1, s2 )
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-                   ust = 0.5_wp * ( u(k,j,i)   - hom(k,1,1,sr) +               &
-                                    u(k+1,j,i) - hom(k+1,1,1,sr) )
-                   vst = 0.5_wp * ( v(k,j,i)   - hom(k,1,2,sr) +               &
-                                    v(k+1,j,i) - hom(k+1,1,2,sr) )
-!
-!--                Momentum flux w*u*
-                   s1 = s1 + 0.5_wp * ( w(k,j,i-1) + w(k,j,i) )                &
-                                    * ust * rmask(j,i,sr)                      &
-                                    * momentumflux_output_conversion(k)        &
-                                    * rflags_invers(j,i,k+1)
-!
-!--                Momentum flux w*v*
-                   s2 = s2 + 0.5_wp * ( w(k,j-1,i) + w(k,j,i) )                &
-                                    * vst * rmask(j,i,sr)                      & 
-                                    * momentumflux_output_conversion(k)        &
-                                    * rflags_invers(j,i,k+1)
-                ENDDO
-             ENDDO
-             sums_l(k,13,tn) = s1
-             sums_l(k,15,tn) = s2
-          ENDDO
-          !$acc end parallel loop
-
-       ENDIF
-
-       IF ( .NOT. ws_scheme_sca  .OR.  sr /= 0 )  THEN
-
-          !$OMP DO
-          !$acc parallel loop gang present( hom, pt, rflags_invers, rmask, sums_l, w ) create( s1 )
-          DO  k = nzb, nzt_diff
-             s1 = 0
-             !$acc loop vector collapse( 2 ) reduction( +: s1 )
-             DO  i = nxl, nxr
-                DO  j = nys, nyn
-!
-!--                Vertical heat flux
-                   s1 = s1 + 0.5_wp * ( pt(k,j,i)   - hom(k,1,4,sr) +          &
-                                        pt(k+1,j,i) - hom(k+1,1,4,sr) )        &
-                                    * heatflux_output_conversion(k)            &
-                                    * w(k,j,i) * rmask(j,i,sr)                 & 
-                                    * rflags_invers(j,i,k+1)
-                ENDDO
-             ENDDO
-             sums_l(k,17,tn) = s1
-          ENDDO
-          !$acc end parallel loop
-
-          IF ( humidity )  THEN
-
-             !$acc parallel loop gang present( hom, q, rflags_invers, rmask, sums_l, w ) create( s1 )
-             DO  k = nzb, nzt_diff
-                s1 = 0
-                !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                DO  i = nxl, nxr
-                   DO  j = nys, nyn
-                      s1 = s1 + 0.5_wp * ( q(k,j,i)   - hom(k,1,41,sr) +       &
-                                           q(k+1,j,i) - hom(k+1,1,41,sr) )     &
-                                       * waterflux_output_conversion(k)        &
-                                       * w(k,j,i) * rmask(j,i,sr)              &
-                                       * rflags_invers(j,i,k+1)
-                   ENDDO
-                ENDDO
-                sums_l(k,49,tn) = s1
-             ENDDO
-             !$acc end parallel loop
-
-          ENDIF
-
-          IF ( passive_scalar )  THEN
-
-             !$acc parallel loop gang present( hom, s, rflags_invers, rmask, sums_l, w ) create( s1 )
-             DO  k = nzb, nzt_diff
-                s1 = 0
-                !$acc loop vector collapse( 2 ) reduction( +: s1 )
-                DO  i = nxl, nxr
-                   DO  j = nys, nyn
-                      s1 = s1 + 0.5_wp * ( s(k,j,i)   - hom(k,1,117,sr) +      &
-                                           s(k+1,j,i) - hom(k+1,1,117,sr) )    &
-                                       * w(k,j,i) * rmask(j,i,sr)              &
-                                       * rflags_invers(j,i,k+1)
-                   ENDDO
-                ENDDO
-                sums_l(k,116,tn) = s1
-             ENDDO
-             !$acc end parallel loop
-
-          ENDIF
-
-       ENDIF
-
-
-!
-!--    Density at top follows Neumann condition
-       IF ( ocean )  THEN
-          !$acc parallel present( sums_l )
-          sums_l(nzt+1,64,tn) = sums_l(nzt,64,tn)
-          sums_l(nzt+1,71,tn) = sums_l(nzt,71,tn)
-          !$acc end parallel
-       ENDIF
-
-!
-!--    Divergence of vertical flux of resolved scale energy and pressure
-!--    fluctuations as well as flux of pressure fluctuation itself (68).
-!--    First calculate the products, then the divergence.
-!--    Calculation is time consuming. Do it only, if profiles shall be plotted.
-       IF ( hom(nzb+1,2,55,0) /= 0.0_wp  .OR.  hom(nzb+1,2,68,0) /= 0.0_wp )  THEN
-
-          STOP '+++ openACC porting for vertical flux div of resolved scale TKE in flow_statistics is still missing'
-          sums_ll = 0.0_wp  ! local array
-
-          !$OMP DO
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_s_inner(j,i)+1, nzt
-
-                   sums_ll(k,1) = sums_ll(k,1) + 0.5_wp * w(k,j,i) * (         &
-                  ( 0.25_wp * ( u(k,j,i)+u(k+1,j,i)+u(k,j,i+1)+u(k+1,j,i+1) )  &
-                            - 0.5_wp * ( hom(k,1,1,sr) + hom(k+1,1,1,sr) ) )**2&
-                + ( 0.25_wp * ( v(k,j,i)+v(k+1,j,i)+v(k,j+1,i)+v(k+1,j+1,i) )  &
-                            - 0.5_wp * ( hom(k,1,2,sr) + hom(k+1,1,2,sr) ) )**2&
-                + w(k,j,i)**2                                        )
-
-                   sums_ll(k,2) = sums_ll(k,2) + 0.5_wp * w(k,j,i)             &
-                                               * ( p(k,j,i) + p(k+1,j,i) )
-
-                ENDDO
-             ENDDO
-          ENDDO
-          sums_ll(0,1)     = 0.0_wp    ! because w is zero at the bottom
-          sums_ll(nzt+1,1) = 0.0_wp
-          sums_ll(0,2)     = 0.0_wp
-          sums_ll(nzt+1,2) = 0.0_wp
-
-          DO  k = nzb+1, nzt
-             sums_l(k,55,tn) = ( sums_ll(k,1) - sums_ll(k-1,1) ) * ddzw(k)
-             sums_l(k,56,tn) = ( sums_ll(k,2) - sums_ll(k-1,2) ) * ddzw(k)
-             sums_l(k,68,tn) = sums_ll(k,2)
-          ENDDO
-          sums_l(nzb,55,tn) = sums_l(nzb+1,55,tn)
-          sums_l(nzb,56,tn) = sums_l(nzb+1,56,tn)
-          sums_l(nzb,68,tn) = 0.0_wp    ! because w* = 0 at nzb
-
-       ENDIF
-
-!
-!--    Divergence of vertical flux of SGS TKE and the flux itself (69)
-       IF ( hom(nzb+1,2,57,0) /= 0.0_wp  .OR.  hom(nzb+1,2,69,0) /= 0.0_wp )  THEN
-
-          STOP '+++ openACC porting for vertical flux div of SGS TKE in flow_statistics is still missing'
-          !$OMP DO
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_s_inner(j,i)+1, nzt
-
-                   sums_l(k,57,tn) = sums_l(k,57,tn) - 0.5_wp * (              &
-                   (km(k,j,i)+km(k+1,j,i)) * (e(k+1,j,i)-e(k,j,i)) * ddzu(k+1) &
-                 - (km(k-1,j,i)+km(k,j,i)) * (e(k,j,i)-e(k-1,j,i)) * ddzu(k)   &
-                                                                ) * ddzw(k)
-
-                   sums_l(k,69,tn) = sums_l(k,69,tn) - 0.5_wp * (              &
-                   (km(k,j,i)+km(k+1,j,i)) * (e(k+1,j,i)-e(k,j,i)) * ddzu(k+1) &
-                                                                )
-
-                ENDDO
-             ENDDO
-          ENDDO
-          sums_l(nzb,57,tn) = sums_l(nzb+1,57,tn)
-          sums_l(nzb,69,tn) = sums_l(nzb+1,69,tn)
-
-       ENDIF
-
-!
-!--    Horizontal heat fluxes (subgrid, resolved, total).
-!--    Do it only, if profiles shall be plotted.
-       IF ( hom(nzb+1,2,58,0) /= 0.0_wp ) THEN
-
-          STOP '+++ openACC porting for horizontal flux calculation in flow_statistics is still missing'
-          !$OMP DO
-          DO  i = nxl, nxr
-             DO  j = nys, nyn
-                DO  k = nzb_s_inner(j,i)+1, nzt
-!
-!--                Subgrid horizontal heat fluxes u"pt", v"pt"
-                   sums_l(k,58,tn) = sums_l(k,58,tn) - 0.5_wp *                &
-                                                   ( kh(k,j,i) + kh(k,j,i-1) ) &
-                                                 * ( pt(k,j,i-1) - pt(k,j,i) ) &
-                                               * rho_air_zw(k)                 &
-                                               * heatflux_output_conversion(k) &
-                                                 * ddx * rmask(j,i,sr)
-                   sums_l(k,61,tn) = sums_l(k,61,tn) - 0.5_wp *                &
-                                                   ( kh(k,j,i) + kh(k,j-1,i) ) &
-                                                 * ( pt(k,j-1,i) - pt(k,j,i) ) &
-                                               * rho_air_zw(k)                 &
-                                               * heatflux_output_conversion(k) &
-                                                 * ddy * rmask(j,i,sr)
-!
-!--                Resolved horizontal heat fluxes u*pt*, v*pt*
-                   sums_l(k,59,tn) = sums_l(k,59,tn) +                         &
-                                     ( u(k,j,i) - hom(k,1,1,sr) ) * 0.5_wp *   &
-                                     ( pt(k,j,i-1) - hom(k,1,4,sr) +           &
-                                       pt(k,j,i)   - hom(k,1,4,sr) )           &
-                                     * heatflux_output_conversion(k)
-                   pts = 0.5_wp * ( pt(k,j-1,i) - hom(k,1,4,sr) +              &
-                                    pt(k,j,i)   - hom(k,1,4,sr) )
-                   sums_l(k,62,tn) = sums_l(k,62,tn) +                         &
-                                     ( v(k,j,i) - hom(k,1,2,sr) ) * 0.5_wp *   &
-                                     ( pt(k,j-1,i) - hom(k,1,4,sr) +           &
-                                       pt(k,j,i)   - hom(k,1,4,sr) )           &
-                                     * heatflux_output_conversion(k)
-                ENDDO
-             ENDDO
-          ENDDO
-!
-!--       Fluxes at the surface must be zero (e.g. due to the Prandtl-layer)
-          sums_l(nzb,58,tn) = 0.0_wp
-          sums_l(nzb,59,tn) = 0.0_wp
-          sums_l(nzb,60,tn) = 0.0_wp
-          sums_l(nzb,61,tn) = 0.0_wp
-          sums_l(nzb,62,tn) = 0.0_wp
-          sums_l(nzb,63,tn) = 0.0_wp
-
-       ENDIF
-
-!
-!--    Collect current large scale advection and subsidence tendencies for
-!--    data output
-       IF ( large_scale_forcing  .AND.  ( simulated_time > 0.0_wp ) )  THEN
-!
-!--       Interpolation in time of LSF_DATA 
-          nt = 1
-          DO WHILE ( simulated_time - dt_3d > time_vert(nt) )
-             nt = nt + 1
-          ENDDO
-          IF ( simulated_time - dt_3d /= time_vert(nt) )  THEN
-            nt = nt - 1
-          ENDIF
-
-          fac = ( simulated_time - dt_3d - time_vert(nt) )                     &
-                / ( time_vert(nt+1)-time_vert(nt) )
-
-
-          DO  k = nzb, nzt
-             sums_ls_l(k,0) = td_lsa_lpt(k,nt)                                 &
-                              + fac * ( td_lsa_lpt(k,nt+1) - td_lsa_lpt(k,nt) )
-             sums_ls_l(k,1) = td_lsa_q(k,nt)                                   &
-                              + fac * ( td_lsa_q(k,nt+1) - td_lsa_q(k,nt) )
-          ENDDO
-
-          sums_ls_l(nzt+1,0) = sums_ls_l(nzt,0)
-          sums_ls_l(nzt+1,1) = sums_ls_l(nzt,1)
-
-          IF ( large_scale_subsidence .AND. use_subsidence_tendencies )  THEN
-
-             DO  k = nzb, nzt
-                sums_ls_l(k,2) = td_sub_lpt(k,nt) + fac *                      &
-                                 ( td_sub_lpt(k,nt+1) - td_sub_lpt(k,nt) )
-                sums_ls_l(k,3) = td_sub_q(k,nt) + fac *                        &
-                                 ( td_sub_q(k,nt+1) - td_sub_q(k,nt) )
-             ENDDO
-
-             sums_ls_l(nzt+1,2) = sums_ls_l(nzt,2)
-             sums_ls_l(nzt+1,3) = sums_ls_l(nzt,3)
-
-          ENDIF
-
-       ENDIF
-
-
-       IF ( land_surface )  THEN
-          !$OMP DO
-          DO  i = nxl, nxr
-             DO  j =  nys, nyn
-                DO  k = nzb_soil, nzt_soil
-                   sums_l(k,89,tn)  = sums_l(k,89,tn)  + t_soil(k,j,i)         &
-                                      * rmask(j,i,sr)
-                   sums_l(k,91,tn)  = sums_l(k,91,tn)  + m_soil(k,j,i)         &
-                                      * rmask(j,i,sr)
-                ENDDO
-             ENDDO
-          ENDDO
-       ENDIF
-
-
-       IF ( radiation .AND. radiation_scheme == 'rrtmg' )  THEN
-          !$OMP DO
-          DO  i = nxl, nxr
-             DO  j =  nys, nyn
-                DO  k = nzb_s_inner(j,i)+1, nzt+1
-                   sums_l(k,102,tn)  = sums_l(k,102,tn)  + rad_lw_in(k,j,i)    &
-                                       * rmask(j,i,sr)
-                   sums_l(k,103,tn)  = sums_l(k,103,tn)  + rad_lw_out(k,j,i)   &
-                                       * rmask(j,i,sr)
-                   sums_l(k,104,tn)  = sums_l(k,104,tn)  + rad_sw_in(k,j,i)    &
-                                       * rmask(j,i,sr)
-                   sums_l(k,105,tn)  = sums_l(k,105,tn)  + rad_sw_out(k,j,i)   &
-                                       * rmask(j,i,sr)
-#if defined ( __rrtmg )
-                   sums_l(k,106,tn)  = sums_l(k,106,tn)  + rad_lw_cs_hr(k,j,i) &
-                                       * rmask(j,i,sr)
-                   sums_l(k,107,tn)  = sums_l(k,107,tn)  + rad_lw_hr(k,j,i)    &
-                                       * rmask(j,i,sr)
-                   sums_l(k,108,tn)  = sums_l(k,108,tn)  + rad_sw_cs_hr(k,j,i) &
-                                       * rmask(j,i,sr)
-                   sums_l(k,109,tn)  = sums_l(k,109,tn)  + rad_sw_hr(k,j,i)    &
-                                       * rmask(j,i,sr)
-#endif
-                ENDDO
-             ENDDO
-          ENDDO
-       ENDIF
-
-!
-!--    Calculate the user-defined profiles
-       CALL user_statistics( 'profiles', sr, tn )
-       !$OMP END PARALLEL
-
-!
-!--    Summation of thread sums
-       IF ( threads_per_task > 1 )  THEN
-          STOP '+++ openACC porting for threads_per_task > 1 in flow_statistics is still missing'
-          DO  i = 1, threads_per_task-1
-             sums_l(:,3,0)          = sums_l(:,3,0) + sums_l(:,3,i)
-             sums_l(:,4:40,0)       = sums_l(:,4:40,0) + sums_l(:,4:40,i)
-             sums_l(:,45:pr_palm,0) = sums_l(:,45:pr_palm,0) + &
-                                      sums_l(:,45:pr_palm,i)
-             IF ( max_pr_user > 0 )  THEN
-                sums_l(:,pr_palm+1:pr_palm+max_pr_user,0) = &
-                                   sums_l(:,pr_palm+1:pr_palm+max_pr_user,0) + &
-                                   sums_l(:,pr_palm+1:pr_palm+max_pr_user,i)
-             ENDIF
-          ENDDO
-       ENDIF
-
-       !$acc update host( hom, sums, sums_l )
-
-#if defined( __parallel )
-
-!
-!--    Compute total sum from local sums
-       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( sums_l(nzb,1,0), sums(nzb,1), ngp_sums, MPI_REAL, &
-                           MPI_SUM, comm2d, ierr )
-       IF ( large_scale_forcing )  THEN
-          CALL MPI_ALLREDUCE( sums_ls_l(nzb,2), sums(nzb,83), ngp_sums_ls,     &
-                              MPI_REAL, MPI_SUM, comm2d, ierr )
-       ENDIF
-#else
-       sums = sums_l(:,:,0)
-       IF ( large_scale_forcing )  THEN
-          sums(:,81:88) = sums_ls_l
-       ENDIF
-#endif
-
-!
-!--    Final values are obtained by division by the total number of grid points
-!--    used for summation. After that store profiles.
-!--    Check, if statistical regions do contain at least one grid point at the
-!--    respective k-level, otherwise division by zero will lead to undefined
-!--    values, which may cause e.g. problems with NetCDF output
-!--    Profiles:
-       DO  k = nzb, nzt+1
-          sums(k,3)             = sums(k,3)             / ngp_2dh(sr)
-          sums(k,12:22)         = sums(k,12:22)         / ngp_2dh(sr)
-          sums(k,30:32)         = sums(k,30:32)         / ngp_2dh(sr)
-          sums(k,35:39)         = sums(k,35:39)         / ngp_2dh(sr)
-          sums(k,45:53)         = sums(k,45:53)         / ngp_2dh(sr)
-          sums(k,55:63)         = sums(k,55:63)         / ngp_2dh(sr)
-          sums(k,81:88)         = sums(k,81:88)         / ngp_2dh(sr)
-          sums(k,89:114)        = sums(k,89:114)        / ngp_2dh(sr)
-          IF ( ngp_2dh_s_inner(k,sr) /= 0 )  THEN
-             sums(k,8:11)          = sums(k,8:11)          / ngp_2dh_s_inner(k,sr)
-             sums(k,23:29)         = sums(k,23:29)         / ngp_2dh_s_inner(k,sr)
-             sums(k,33:34)         = sums(k,33:34)         / ngp_2dh_s_inner(k,sr)
-             sums(k,40)            = sums(k,40)            / ngp_2dh_s_inner(k,sr)
-             sums(k,54)            = sums(k,54)            / ngp_2dh_s_inner(k,sr)
-             sums(k,64)            = sums(k,64)            / ngp_2dh_s_inner(k,sr)
-             sums(k,70:80)         = sums(k,70:80)         / ngp_2dh_s_inner(k,sr)
-             sums(k,115:pr_palm-2) = sums(k,115:pr_palm-2) / ngp_2dh_s_inner(k,sr)
-          ENDIF
-       ENDDO
-
-!--    u* and so on
-!--    As sums(nzb:nzb+3,pr_palm) are full 2D arrays (us, usws, vsws, ts) whose
-!--    size is always ( nx + 1 ) * ( ny + 1 ), defined at the first grid layer
-!--    above the topography, they are being divided by ngp_2dh(sr)
-       sums(nzb:nzb+3,pr_palm)    = sums(nzb:nzb+3,pr_palm)    / &
-                                    ngp_2dh(sr)
-       sums(nzb+12,pr_palm)       = sums(nzb+12,pr_palm)       / &    ! qs
-                                    ngp_2dh(sr)
-!--    eges, e*
-       sums(nzb+4:nzb+5,pr_palm)  = sums(nzb+4:nzb+5,pr_palm)  / &
-                                    ngp_3d(sr)
-!--    Old and new divergence
-       sums(nzb+9:nzb+10,pr_palm) = sums(nzb+9:nzb+10,pr_palm) / &
-                                    ngp_3d_inner(sr)
-
-!--    User-defined profiles
-       IF ( max_pr_user > 0 )  THEN
-          DO  k = nzb, nzt+1
-             IF ( ngp_2dh_s_inner(k,sr) /= 0 )  THEN
-                sums(k,pr_palm+1:pr_palm+max_pr_user) = &
-                                       sums(k,pr_palm+1:pr_palm+max_pr_user) / &
-                                       ngp_2dh_s_inner(k,sr)
-             ENDIF
-          ENDDO
-       ENDIF
-
-!
-!--    Collect horizontal average in hom.
-!--    Compute deduced averages (e.g. total heat flux)
-       hom(:,1,3,sr)  = sums(:,3)      ! w
-       hom(:,1,8,sr)  = sums(:,8)      ! e     profiles 5-7 are initial profiles
-       hom(:,1,9,sr)  = sums(:,9)      ! km
-       hom(:,1,10,sr) = sums(:,10)     ! kh
-       hom(:,1,11,sr) = sums(:,11)     ! l
-       hom(:,1,12,sr) = sums(:,12)     ! w"u"
-       hom(:,1,13,sr) = sums(:,13)     ! w*u*
-       hom(:,1,14,sr) = sums(:,14)     ! w"v"
-       hom(:,1,15,sr) = sums(:,15)     ! w*v*
-       hom(:,1,16,sr) = sums(:,16)     ! w"pt"
-       hom(:,1,17,sr) = sums(:,17)     ! w*pt*
-       hom(:,1,18,sr) = sums(:,16) + sums(:,17)    ! wpt
-       hom(:,1,19,sr) = sums(:,12) + sums(:,13)    ! wu
-       hom(:,1,20,sr) = sums(:,14) + sums(:,15)    ! wv
-       hom(:,1,21,sr) = sums(:,21)     ! w*pt*BC
-       hom(:,1,22,sr) = sums(:,16) + sums(:,21)    ! wptBC
-                                       ! profile 24 is initial profile (sa)
-                                       ! profiles 25-29 left empty for initial
-                                       ! profiles
-       hom(:,1,30,sr) = sums(:,30)     ! u*2
-       hom(:,1,31,sr) = sums(:,31)     ! v*2
-       hom(:,1,32,sr) = sums(:,32)     ! w*2
-       hom(:,1,33,sr) = sums(:,33)     ! pt*2
-       hom(:,1,34,sr) = sums(:,34)     ! e*
-       hom(:,1,35,sr) = sums(:,35)     ! w*2pt*
-       hom(:,1,36,sr) = sums(:,36)     ! w*pt*2
-       hom(:,1,37,sr) = sums(:,37)     ! w*e*
-       hom(:,1,38,sr) = sums(:,38)     ! w*3
-       hom(:,1,39,sr) = sums(:,38) / ( abs( sums(:,32) ) + 1E-20_wp )**1.5_wp   ! Sw
-       hom(:,1,40,sr) = sums(:,40)     ! p
-       hom(:,1,45,sr) = sums(:,45)     ! w"vpt"
-       hom(:,1,46,sr) = sums(:,46)     ! w*vpt*
-       hom(:,1,47,sr) = sums(:,45) + sums(:,46)    ! wvpt
-       hom(:,1,48,sr) = sums(:,48)     ! w"q" (w"qv")
-       hom(:,1,49,sr) = sums(:,49)     ! w*q* (w*qv*)
-       hom(:,1,50,sr) = sums(:,48) + sums(:,49)    ! wq (wqv)
-       hom(:,1,51,sr) = sums(:,51)     ! w"qv"
-       hom(:,1,52,sr) = sums(:,52)     ! w*qv*
-       hom(:,1,53,sr) = sums(:,52) + sums(:,51)    ! wq (wqv)
-       hom(:,1,54,sr) = sums(:,54)     ! ql
-       hom(:,1,55,sr) = sums(:,55)     ! w*u*u*/dz
-       hom(:,1,56,sr) = sums(:,56)     ! w*p*/dz
-       hom(:,1,57,sr) = sums(:,57)     ! ( w"e + w"p"/rho_ocean )/dz
-       hom(:,1,58,sr) = sums(:,58)     ! u"pt"
-       hom(:,1,59,sr) = sums(:,59)     ! u*pt*
-       hom(:,1,60,sr) = sums(:,58) + sums(:,59)    ! upt_t
-       hom(:,1,61,sr) = sums(:,61)     ! v"pt"
-       hom(:,1,62,sr) = sums(:,62)     ! v*pt*
-       hom(:,1,63,sr) = sums(:,61) + sums(:,62)    ! vpt_t
-       hom(:,1,64,sr) = sums(:,64)     ! rho_ocean
-       hom(:,1,65,sr) = sums(:,65)     ! w"sa"
-       hom(:,1,66,sr) = sums(:,66)     ! w*sa*
-       hom(:,1,67,sr) = sums(:,65) + sums(:,66)    ! wsa
-       hom(:,1,68,sr) = sums(:,68)     ! w*p*
-       hom(:,1,69,sr) = sums(:,69)     ! w"e + w"p"/rho_ocean
-       hom(:,1,70,sr) = sums(:,70)     ! q*2
-       hom(:,1,71,sr) = sums(:,71)     ! prho
-       hom(:,1,72,sr) = hyp * 1E-4_wp     ! hyp in dbar
-       hom(:,1,73,sr) = sums(:,73)     ! nr
-       hom(:,1,74,sr) = sums(:,74)     ! qr
-       hom(:,1,75,sr) = sums(:,75)     ! qc
-       hom(:,1,76,sr) = sums(:,76)     ! prr (precipitation rate)
-                                       ! 77 is initial density profile
-       hom(:,1,78,sr) = ug             ! ug
-       hom(:,1,79,sr) = vg             ! vg
-       hom(:,1,80,sr) = w_subs         ! w_subs
-
-       IF ( large_scale_forcing )  THEN
-          hom(:,1,81,sr) = sums_ls_l(:,0)          ! td_lsa_lpt
-          hom(:,1,82,sr) = sums_ls_l(:,1)          ! td_lsa_q
-          IF ( use_subsidence_tendencies )  THEN
-             hom(:,1,83,sr) = sums_ls_l(:,2)       ! td_sub_lpt
-             hom(:,1,84,sr) = sums_ls_l(:,3)       ! td_sub_q
-          ELSE
-             hom(:,1,83,sr) = sums(:,83)           ! td_sub_lpt
-             hom(:,1,84,sr) = sums(:,84)           ! td_sub_q
-          ENDIF
-          hom(:,1,85,sr) = sums(:,85)              ! td_nud_lpt
-          hom(:,1,86,sr) = sums(:,86)              ! td_nud_q
-          hom(:,1,87,sr) = sums(:,87)              ! td_nud_u
-          hom(:,1,88,sr) = sums(:,88)              ! td_nud_v
-       END IF
-
-       hom(:,1,121,sr) = rho_air       ! rho_air in Kg/m^3
-       hom(:,1,122,sr) = rho_air_zw    ! rho_air_zw in Kg/m^3
-
-       hom(:,1,pr_palm,sr) =   sums(:,pr_palm)
-                                       ! u*, w'u', w'v', t* (in last profile)
-
-       IF ( max_pr_user > 0 )  THEN    ! user-defined profiles
-          hom(:,1,pr_palm+1:pr_palm+max_pr_user,sr) = &
-                               sums(:,pr_palm+1:pr_palm+max_pr_user)
-       ENDIF
-
-!
-!--    Determine the boundary layer height using two different schemes.
-!--    First scheme: Starting from the Earth's (Ocean's) surface, look for the
-!--    first relative minimum (maximum) of the total heat flux.
-!--    The corresponding height is assumed as the boundary layer height, if it
-!--    is less than 1.5 times the height where the heat flux becomes negative
-!--    (positive) for the first time.
-       z_i(1) = 0.0_wp
-       first = .TRUE.
-
-       IF ( ocean )  THEN
-          DO  k = nzt, nzb+1, -1
-             IF (  first  .AND.  hom(k,1,18,sr) < -1.0E-8_wp )  THEN
-                first = .FALSE.
-                height = zw(k)
-             ENDIF
-             IF ( hom(k,1,18,sr) < -1.0E-8_wp  .AND.                           &
-                  hom(k-1,1,18,sr) > hom(k,1,18,sr) )  THEN
-                IF ( zw(k) < 1.5_wp * height )  THEN
-                   z_i(1) = zw(k)
-                ELSE
-                   z_i(1) = height
-                ENDIF
-                EXIT
-             ENDIF
-          ENDDO
-       ELSE
-          DO  k = nzb, nzt-1
-             IF ( first  .AND.  hom(k,1,18,sr) < -1.0E-8_wp )  THEN
-                first = .FALSE.
-                height = zw(k)
-             ENDIF
-             IF ( hom(k,1,18,sr) < -1.0E-8_wp  .AND.                           &
-                  hom(k+1,1,18,sr) > hom(k,1,18,sr) )  THEN
-                IF ( zw(k) < 1.5_wp * height )  THEN
-                   z_i(1) = zw(k)
-                ELSE
-                   z_i(1) = height
-                ENDIF
-                EXIT
-             ENDIF
-          ENDDO
-       ENDIF
-
-!
-!--    Second scheme: Gradient scheme from Sullivan et al. (1998), modified
-!--    by Uhlenbrock(2006). The boundary layer height is the height with the
-!--    maximal local temperature gradient: starting from the second (the last
-!--    but one) vertical gridpoint, the local gradient must be at least
-!--    0.2K/100m and greater than the next four gradients.
-!--    WARNING: The threshold value of 0.2K/100m must be adjusted for the
-!--             ocean case!
-       z_i(2) = 0.0_wp
-       DO  k = nzb+1, nzt+1
-          dptdz(k) = ( hom(k,1,4,sr) - hom(k-1,1,4,sr) ) * ddzu(k)
-       ENDDO
-       dptdz_threshold = 0.2_wp / 100.0_wp
-
-       IF ( ocean )  THEN
-          DO  k = nzt+1, nzb+5, -1
-             IF ( dptdz(k) > dptdz_threshold  .AND.                           &
-                  dptdz(k) > dptdz(k-1)  .AND.  dptdz(k) > dptdz(k-2)  .AND.  &
-                  dptdz(k) > dptdz(k-3)  .AND.  dptdz(k) > dptdz(k-4) )  THEN
-                z_i(2) = zw(k-1)
-                EXIT
-             ENDIF
-          ENDDO
-       ELSE
-          DO  k = nzb+1, nzt-3
-             IF ( dptdz(k) > dptdz_threshold  .AND.                           &
-                  dptdz(k) > dptdz(k+1)  .AND.  dptdz(k) > dptdz(k+2)  .AND.  &
-                  dptdz(k) > dptdz(k+3)  .AND.  dptdz(k) > dptdz(k+4) )  THEN
-                z_i(2) = zw(k-1)
-                EXIT
-             ENDIF
-          ENDDO
-       ENDIF
-
-       hom(nzb+6,1,pr_palm,sr) = z_i(1)
-       hom(nzb+7,1,pr_palm,sr) = z_i(2)
-
-!
-!--    Determine vertical index which is nearest to the mean surface level
-!--    height of the respective statistic region
-       DO  k = nzb, nzt
-          IF ( zw(k) >= mean_surface_level_height(sr) )  THEN
-             k_surface_level = k
-             EXIT
-          ENDIF
-       ENDDO
-
-!
-!--    Computation of both the characteristic vertical velocity and
-!--    the characteristic convective boundary layer temperature.
-!--    The inversion height entering into the equation is defined with respect
-!--    to the mean surface level height of the respective statistic region.
-!--    The horizontal average at surface level index + 1 is input for the
-!--    average temperature.
-       IF ( hom(nzb,1,18,sr) > 1.0E-8_wp  .AND.  z_i(1) /= 0.0_wp )  THEN
-          hom(nzb+8,1,pr_palm,sr) = &
-             ( g / hom(k_surface_level+1,1,4,sr) *                             &
-             ( hom(k_surface_level,1,18,sr) / heatflux_output_conversion(nzb) )&
-             * ABS( z_i(1) - mean_surface_level_height(sr) ) )**0.333333333_wp
-       ELSE
-          hom(nzb+8,1,pr_palm,sr)  = 0.0_wp
-       ENDIF
-
-!
-!--    Collect the time series quantities
-       ts_value(1,sr) = hom(nzb+4,1,pr_palm,sr)     ! E
-       ts_value(2,sr) = hom(nzb+5,1,pr_palm,sr)     ! E*
-       ts_value(3,sr) = dt_3d
-       ts_value(4,sr) = hom(nzb,1,pr_palm,sr)       ! u*
-       ts_value(5,sr) = hom(nzb+3,1,pr_palm,sr)     ! th*
-       ts_value(6,sr) = u_max
-       ts_value(7,sr) = v_max
-       ts_value(8,sr) = w_max
-       ts_value(9,sr) = hom(nzb+10,1,pr_palm,sr)    ! new divergence
-       ts_value(10,sr) = hom(nzb+9,1,pr_palm,sr)    ! old Divergence
-       ts_value(11,sr) = hom(nzb+6,1,pr_palm,sr)    ! z_i(1)
-       ts_value(12,sr) = hom(nzb+7,1,pr_palm,sr)    ! z_i(2)
-       ts_value(13,sr) = hom(nzb+8,1,pr_palm,sr)    ! w*
-       ts_value(14,sr) = hom(nzb,1,16,sr)           ! w'pt'   at k=0
-       ts_value(15,sr) = hom(nzb+1,1,16,sr)         ! w'pt'   at k=1
-       ts_value(16,sr) = hom(nzb+1,1,18,sr)         ! wpt     at k=1
-       ts_value(17,sr) = hom(nzb,1,4,sr)            ! pt(0)
-       ts_value(18,sr) = hom(nzb+1,1,4,sr)          ! pt(zp)
-       ts_value(19,sr) = hom(nzb+1,1,pr_palm,sr)    ! u'w'    at k=0
-       ts_value(20,sr) = hom(nzb+2,1,pr_palm,sr)    ! v'w'    at k=0
-       ts_value(21,sr) = hom(nzb,1,48,sr)           ! w"q"    at k=0
-
-       IF ( .NOT. neutral )  THEN
-          ts_value(22,sr) = hom(nzb,1,114,sr)          ! L
-       ELSE
-          ts_value(22,sr) = 1.0E10_wp
-       ENDIF
-
-       ts_value(23,sr) = hom(nzb+12,1,pr_palm,sr)   ! q*
-
-!
-!--    Collect land surface model timeseries
-       IF ( land_surface )  THEN
-          ts_value(dots_soil  ,sr) = hom(nzb,1,93,sr)           ! ghf_eb
-          ts_value(dots_soil+1,sr) = hom(nzb,1,94,sr)           ! shf_eb
-          ts_value(dots_soil+2,sr) = hom(nzb,1,95,sr)           ! qsws_eb
-          ts_value(dots_soil+3,sr) = hom(nzb,1,96,sr)           ! qsws_liq_eb
-          ts_value(dots_soil+4,sr) = hom(nzb,1,97,sr)           ! qsws_soil_eb
-          ts_value(dots_soil+5,sr) = hom(nzb,1,98,sr)           ! qsws_veg_eb
-          ts_value(dots_soil+6,sr) = hom(nzb,1,99,sr)           ! r_a
-          ts_value(dots_soil+7,sr) = hom(nzb,1,100,sr)          ! r_s
-       ENDIF
-!
-!--    Collect radiation model timeseries
-       IF ( radiation )  THEN
-          ts_value(dots_rad,sr)   = hom(nzb,1,101,sr)          ! rad_net
-          ts_value(dots_rad+1,sr) = hom(nzb,1,102,sr)          ! rad_lw_in
-          ts_value(dots_rad+2,sr) = hom(nzb,1,103,sr)          ! rad_lw_out
-          ts_value(dots_rad+3,sr) = hom(nzb,1,104,sr)          ! rad_sw_in
-          ts_value(dots_rad+4,sr) = hom(nzb,1,105,sr)          ! rad_sw_out
-
-          IF ( radiation_scheme == 'rrtmg' )  THEN
-             ts_value(dots_rad+5,sr) = hom(nzb,1,106,sr)          ! rrtm_aldif
-             ts_value(dots_rad+6,sr) = hom(nzb,1,107,sr)          ! rrtm_aldir
-             ts_value(dots_rad+7,sr) = hom(nzb,1,108,sr)          ! rrtm_asdif
-             ts_value(dots_rad+8,sr) = hom(nzb,1,109,sr)          ! rrtm_asdir
-          ENDIF
-
-       ENDIF
-
-!
-!--    Calculate additional statistics provided by the user interface
-       CALL user_statistics( 'time_series', sr, 0 )
-
-    ENDDO    ! loop of the subregions
-
-    !$acc end data
-
-!
-!-- If required, sum up horizontal averages for subsequent time averaging
-!-- Do not sum, if flow statistics is called before the first initial time step.
-    IF ( do_sum  .AND.  simulated_time /= 0.0_wp )  THEN
-       IF ( average_count_pr == 0 )  hom_sum = 0.0_wp
-       hom_sum = hom_sum + hom(:,1,:,:)
-       average_count_pr = average_count_pr + 1
-       do_sum = .FALSE.
-    ENDIF
-
-!
-!-- Set flag for other UPs (e.g. output routines, but also buoyancy).
-!-- This flag is reset after each time step in time_integration.
-    flow_statistics_called = .TRUE.
-
-    CALL cpu_log( log_point(10), 'flow_statistics', 'stop' )
-
-
- END SUBROUTINE flow_statistics
-#endif
Index: /palm/trunk/SOURCE/header.f90
===================================================================
--- /palm/trunk/SOURCE/header.f90	(revision 2117)
+++ /palm/trunk/SOURCE/header.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC relatec code removed
 ! 
 ! Former revisions:
@@ -513,5 +513,4 @@
                           threads_per_task, pdims(1), pdims(2), TRIM( char1 )
     ENDIF
-    IF ( num_acc_per_node /= 0 )  WRITE ( io, 117 )  num_acc_per_node    
     IF ( ( host(1:3) == 'ibm'  .OR.  host(1:3) == 'nec'  .OR.    &
            host(1:2) == 'lc'   .OR.  host(1:3) == 'dec' )  .AND. &
@@ -528,6 +527,4 @@
        WRITE ( io, 108 )  maximum_parallel_io_streams
     ENDIF
-#else
-    IF ( num_acc_per_node /= 0 )  WRITE ( io, 120 )  num_acc_per_node
 #endif
 
@@ -1915,5 +1912,4 @@
             35X,'independent precursor runs'/             &
             35X,42('-'))
-117 FORMAT (' Accelerator boards / node:  ',I2)
 #endif
 110 FORMAT (/' Numerical Schemes:'/ &
@@ -1932,5 +1928,4 @@
             '     translation velocity = ',A/ &
             '     distance advected ',A,':  ',F8.3,' km(x)  ',F8.3,' km(y)')
-120 FORMAT (' Accelerator boards: ',8X,I2)
 122 FORMAT (' --> Time differencing scheme: ',A)
 123 FORMAT (' --> Rayleigh-Damping active, starts ',A,' z = ',F8.2,' m'/ &
Index: /palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- /palm/trunk/SOURCE/init_3d_model.f90	(revision 2117)
+++ /palm/trunk/SOURCE/init_3d_model.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! OpenACC directives removed
 ! 
 ! Former revisions:
@@ -800,6 +800,6 @@
 !-- 3D-array for storing the dissipation, needed for calculating the sgs
 !-- particle velocities
-    IF ( use_sgs_for_particles  .OR.  wang_kernel  .OR.  collision_turbulence  &
-         .OR.  num_acc_per_node > 0 )  THEN
+    IF ( use_sgs_for_particles  .OR.  wang_kernel  .OR.  collision_turbulence )&
+    THEN
        ALLOCATE( diss(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
     ENDIF
@@ -1920,10 +1920,5 @@
        CALL location_message( 'calling pressure solver', .FALSE. )
        n_sor = nsor_ini
-       !$acc data copyin( d, ddzu, ddzw, nzb_s_inner, nzb_u_inner )            &
-       !$acc      copyin( nzb_v_inner, nzb_w_inner, p, rflags_s_inner, tend )  &
-       !$acc      copyin( weight_pres, weight_substep )                        &
-       !$acc      copy( tri, tric, u, v, w )
        CALL pres
-       !$acc end data
        n_sor = nsor
        CALL location_message( 'finished', .TRUE. )
Index: /palm/trunk/SOURCE/modules.f90
===================================================================
--- /palm/trunk/SOURCE/modules.f90	(revision 2117)
+++ /palm/trunk/SOURCE/modules.f90	(revision 2118)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! ------------------
-! 
+! -acc_rank, background_communication, i_left, i_right, j_south, j_north,
+!  num_acc_per_node, on_device
 ! 
 ! Former revisions:
@@ -1142,5 +1143,4 @@
     LOGICAL ::  nudging = .FALSE.                            !< 
     LOGICAL ::  ocean = .FALSE.                              !< 
-    LOGICAL ::  on_device = .FALSE.                          !< 
     LOGICAL ::  outflow_l = .FALSE.                          !< 
     LOGICAL ::  outflow_n = .FALSE.                          !< 
@@ -1557,8 +1557,4 @@
     USE kinds
 
-    INTEGER(iwp) ::  i_left       !< 
-    INTEGER(iwp) ::  i_right      !< 
-    INTEGER(iwp) ::  j_north      !< 
-    INTEGER(iwp) ::  j_south      !< 
     INTEGER(iwp) ::  nbgp = 3     !< 
     INTEGER(iwp) ::  ngp_sums     !< 
@@ -1801,5 +1797,4 @@
     CHARACTER(LEN=7) ::  myid_char = ''
     
-    INTEGER(iwp) ::  acc_rank                    !< 
     INTEGER(iwp) ::  comm1dx                     !< 
     INTEGER(iwp) ::  comm1dy                     !< 
@@ -1824,5 +1819,4 @@
     INTEGER(iwp) ::  numprocs = 1                !< 
     INTEGER(iwp) ::  numprocs_previous_run = -1  !< 
-    INTEGER(iwp) ::  num_acc_per_node = 0        !< 
     INTEGER(iwp) ::  pleft                       !< 
     INTEGER(iwp) ::  pnorth                      !< 
@@ -1848,5 +1842,4 @@
     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  hor_index_bounds_previous_run  !< 
 
-    LOGICAL ::  background_communication =.FALSE.  !< 
     LOGICAL ::  collective_wait = .FALSE.          !< 
     LOGICAL ::  sendrecv_in_background = .FALSE.   !< 
Index: /palm/trunk/SOURCE/palm.f90
===================================================================
--- /palm/trunk/SOURCE/palm.f90	(revision 2117)
+++ /palm/trunk/SOURCE/palm.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC directives and related code removed
 ! 
 ! Former revisions:
@@ -213,8 +213,4 @@
         ONLY:  usm_write_restart_data        
 
-#if defined( __openacc )
-    USE OPENACC
-#endif
-
     IMPLICIT NONE
 
@@ -226,7 +222,4 @@
     INTEGER(iwp)      ::  i               !<
     INTEGER(iwp)      ::  myid_openmpi    !< OpenMPI local rank for CUDA aware MPI
-#if defined( __openacc )
-    REAL(wp), DIMENSION(100) ::  acc_dum     !<
-#endif
 
     version = 'PALM 4.0'
@@ -265,34 +258,4 @@
     ENDIF
 #endif
-
-#if defined( __openacc )
-!
-!-- Get the local MPI rank in case of CUDA aware OpenMPI. Important, if there
-!-- is more than one accelerator board on the node
-    CALL GET_ENVIRONMENT_VARIABLE('OMPI_COMM_WORLD_LOCAL_RANK',                &
-         VALUE=env_string, STATUS=env_stat )
-    READ( env_string, '(I1)' )  myid_openmpi
-    PRINT*, '### local_rank = ', myid_openmpi, '  status=',env_stat
-!
-!-- Get the number of accelerator boards per node and assign the MPI processes
-!-- to these boards
-    PRINT*, '*** ACC_DEVICE_NVIDIA = ', ACC_DEVICE_NVIDIA
-    num_acc_per_node  = ACC_GET_NUM_DEVICES( ACC_DEVICE_NVIDIA )
-    IF ( numprocs == 1  .AND.  num_acc_per_node > 0 )  num_acc_per_node = 1
-    PRINT*, '*** myid = ', myid_openmpi, ' num_acc_per_node = ', num_acc_per_node
-    acc_rank = MOD( myid_openmpi, num_acc_per_node )
-    CALL ACC_SET_DEVICE_NUM ( acc_rank, ACC_DEVICE_NVIDIA )
-!
-!-- Test output (to be removed later)
-    WRITE (*,'(A,I6,A,I3,A,I3,A,I3)') '*** Connect MPI-Task ', myid_openmpi,   &
-                                      ' to CPU ', acc_rank, ' Devices: ',      &
-                                      num_acc_per_node, ' connected to:',      &
-                                      ACC_GET_DEVICE_NUM( ACC_DEVICE_NVIDIA )
-#endif
-
-!
-!-- Ensure that OpenACC first attaches the GPU devices by copying a dummy data
-!-- region
-    !$acc data copyin( acc_dum )
 
 !
@@ -422,16 +385,4 @@
     ENDIF
 
-!
-!-- Declare and initialize variables in the accelerator memory with their
-!-- host values
-    !$acc  data copyin( d, diss, e, e_p, kh, km, p, pt, pt_p, q, ql, tend, te_m, tpt_m, tu_m, tv_m, tw_m, u, u_p, v, vpt, v_p, w, w_p )          &
-    !$acc       copyin( tri, tric, dzu, ddzu, ddzw, dd2zu, l_grid, l_wall, ptdf_x, ptdf_y, pt_init, rdf, rdf_sc, ref_state, ug, u_init, vg, v_init, zu, zw )   &
-    !$acc       copyin( hom, ol, pt1, qs, qsws, qswst, qv1, rif_wall, shf, ts, tswst, us, usws, uswst, uv_total, vsws, vswst, z0, z0h )      &
-    !$acc       copyin( fxm, fxp, fym, fyp, fwxm, fwxp, fwym, fwyp, nzb_diff_s_inner, nzb_diff_s_outer, nzb_diff_u )       &
-    !$acc       copyin( nzb_diff_v, nzb_s_inner, nzb_s_outer, nzb_u_inner )    &
-    !$acc       copyin( nzb_u_outer, nzb_v_inner, nzb_v_outer, nzb_w_inner )   &
-    !$acc       copyin( nzb_w_outer, rflags_invers, rflags_s_inner, rmask, wall_heatflux, wall_e_x, wall_e_y, wall_u, wall_v, wall_w_x, wall_w_y, wall_flags_0, wall_flags_00 )  &
-    !$acc       copyin( ngp_2dh, ngp_2dh_s_inner )  &
-    !$acc       copyin( weight_pres, weight_substep )
 !
 !-- Integration of the model equations using timestep-scheme
@@ -513,9 +464,4 @@
 
 !
-!-- Close the OpenACC dummy data region
-    !$acc end data
-    !$acc end data
-
-!
 !-- Take final CPU-time for CPU-time analysis
     CALL cpu_log( log_point(1), 'total', 'stop' )
Index: /palm/trunk/SOURCE/parin.f90
===================================================================
--- /palm/trunk/SOURCE/parin.f90	(revision 2117)
+++ /palm/trunk/SOURCE/parin.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! -background_communication from inipar
 ! 
 ! Former revisions:
@@ -319,6 +319,5 @@
 
 
-    NAMELIST /inipar/  alpha_surface, approximation,                           &
-                       background_communication, bc_e_b, bc_lr,                &
+    NAMELIST /inipar/  alpha_surface, approximation, 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/poisfft_mod.f90
===================================================================
--- /palm/trunk/SOURCE/poisfft_mod.f90	(revision 2117)
+++ /palm/trunk/SOURCE/poisfft_mod.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC directives and related code removed
 ! 
 ! Former revisions:
@@ -242,5 +242,4 @@
        REAL(wp), DIMENSION(1:nz,nys:nyn,nxl:nxr) ::  ar      !<
        REAL(wp), DIMENSION(nys:nyn,nxl:nxr,1:nz) ::  ar_inv  !<
-       !$acc declare create( ar_inv )
 
        REAL(wp), DIMENSION(:,:,:),   ALLOCATABLE ::  ar1      !<
@@ -257,6 +256,5 @@
 !
 !--    Two-dimensional Fourier Transformation in x- and y-direction.
-       IF ( pdims(2) == 1  .AND.  pdims(1) > 1  .AND.  num_acc_per_node == 0 ) &
-       THEN
+       IF ( pdims(2) == 1  .AND.  pdims(1) > 1 )  THEN
 
 !
@@ -273,6 +271,5 @@
           CALL tr_xy_ffty( ar, ar )
 
-       ELSEIF ( pdims(1) == 1 .AND. pdims(2) > 1 .AND. num_acc_per_node == 0 ) &
-       THEN
+       ELSEIF ( pdims(1) == 1 .AND. pdims(2) > 1 )  THEN
 
 !
@@ -300,11 +297,5 @@
 
           CALL cpu_log( log_point_s(4), 'fft_x', 'start' )
-          IF ( fft_method /= 'system-specific' )  THEN
-             !$acc update host( ar )
-          ENDIF
           CALL fft_x( ar, 'forward' )
-          IF ( fft_method /= 'system-specific' )  THEN
-             !$acc update device( ar )
-          ENDIF
           CALL cpu_log( log_point_s(4), 'fft_x', 'pause' )
 
@@ -317,13 +308,7 @@
 
           CALL cpu_log( log_point_s(7), 'fft_y', 'start' )
-          IF ( fft_method /= 'system-specific' )  THEN
-             !$acc update host( ar )
-          ENDIF
           CALL fft_y( ar, 'forward', ar_tr = ar,                &
                       nxl_y_bound = nxl_y, nxr_y_bound = nxr_y, &
                       nxl_y_l = nxl_y, nxr_y_l = nxr_y )
-          IF ( fft_method /= 'system-specific' )  THEN
-             !$acc update device( ar )
-          ENDIF
           CALL cpu_log( log_point_s(7), 'fft_y', 'pause' )
 
@@ -350,13 +335,7 @@
 
           CALL cpu_log( log_point_s(7), 'fft_y', 'continue' )
-          IF ( fft_method /= 'system-specific' )  THEN
-             !$acc update host( ar )
-          ENDIF
           CALL fft_y( ar, 'backward', ar_tr = ar,               &
                       nxl_y_bound = nxl_y, nxr_y_bound = nxr_y, &
                       nxl_y_l = nxl_y, nxr_y_l = nxr_y )
-          IF ( fft_method /= 'system-specific' )  THEN
-             !$acc update device( ar )
-          ENDIF
           CALL cpu_log( log_point_s(7), 'fft_y', 'stop' )
 
@@ -369,11 +348,5 @@
 
           CALL cpu_log( log_point_s(4), 'fft_x', 'continue' )
-          IF ( fft_method /= 'system-specific' )  THEN
-             !$acc update host( ar )
-          ENDIF
           CALL fft_x( ar, 'backward' )
-          IF ( fft_method /= 'system-specific' )  THEN
-             !$acc update device( ar )
-          ENDIF
           CALL cpu_log( log_point_s(4), 'fft_x', 'stop' )
 
Index: /palm/trunk/SOURCE/pres.f90
===================================================================
--- /palm/trunk/SOURCE/pres.f90	(revision 2117)
+++ /palm/trunk/SOURCE/pres.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! OpenACC directives and related code removed
 ! 
 ! Former revisions:
@@ -141,5 +141,5 @@
                gathered_size, ibc_p_b, ibc_p_t, intermediate_timestep_count,   &
                intermediate_timestep_count_max, mg_switch_to_pe0_level,        &
-               nest_domain, on_device, outflow_l, outflow_n, outflow_r,        &
+               nest_domain, outflow_l, outflow_n, outflow_r,                   &
                outflow_s, psolver, subdomain_size, topography, volume_flow,    &
                volume_flow_area, volume_flow_initial
@@ -386,5 +386,4 @@
     ELSE
        !$OMP PARALLEL DO SCHEDULE( STATIC )
-       !$acc kernels present( d )
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -394,5 +393,4 @@
           ENDDO
        ENDDO
-       !$acc end kernels
     ENDIF
 
@@ -430,6 +428,4 @@
     !$OMP PARALLEL PRIVATE (i,j,k)
     !$OMP DO SCHEDULE( STATIC )
-    !$acc kernels present( d, ddzw, rflags_s_inner, u, v, w )
-    !$acc loop collapse( 3 )
     DO  i = nxl, nxr
        DO  j = nys, nyn
@@ -443,5 +439,4 @@
        ENDDO
     ENDDO
-    !$acc end kernels
     !$OMP END PARALLEL
 
@@ -453,5 +448,4 @@
        !$OMP PARALLEL PRIVATE (i,j,k) FIRSTPRIVATE(threadsum) REDUCTION(+:localsum)
        !$OMP DO SCHEDULE( STATIC )
-       !$acc parallel loop collapse(3) present( d ) reduction(+:threadsum)
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -461,5 +455,4 @@
           ENDDO
        ENDDO
-       !$acc end parallel loop
        localsum = localsum + threadsum * dt_3d * weight_pres_l
        !$OMP END PARALLEL
@@ -489,5 +482,4 @@
 !--    z-direction
        !$OMP PARALLEL DO
-       !$acc kernels present( d, tend )
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -497,5 +489,4 @@
           ENDDO
        ENDDO
-       !$acc end kernels
 
 !
@@ -507,5 +498,4 @@
 !--       Neumann (dp/dz = 0)
           !$OMP PARALLEL DO
-          !$acc kernels present( nzb_s_inner, tend )
           DO  i = nxlg, nxrg
              DO  j = nysg, nyng
@@ -513,5 +503,4 @@
              ENDDO
           ENDDO
-          !$acc end kernels
 
        ELSE
@@ -519,5 +508,4 @@
 !--       Dirichlet
           !$OMP PARALLEL DO
-          !$acc kernels present( tend )
           DO  i = nxlg, nxrg
              DO  j = nysg, nyng
@@ -525,5 +513,4 @@
              ENDDO
           ENDDO
-          !$acc end kernels
 
        ENDIF
@@ -535,5 +522,4 @@
 !--       Neumann
           !$OMP PARALLEL DO
-          !$acc kernels present( tend )
           DO  i = nxlg, nxrg
              DO  j = nysg, nyng
@@ -541,5 +527,4 @@
              ENDDO
           ENDDO
-          !$acc end kernels
 
        ELSE
@@ -547,5 +532,4 @@
 !--       Dirichlet
           !$OMP PARALLEL DO
-          !$acc kernels present( tend )
           DO  i = nxlg, nxrg
              DO  j = nysg, nyng
@@ -553,5 +537,4 @@
              ENDDO
           ENDDO
-          !$acc end kernels
 
        ENDIF
@@ -559,15 +542,5 @@
 !
 !--    Exchange boundaries for p
-       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( tend )
-       ENDIF
        CALL exchange_horiz( tend, 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( tend )
-       ENDIF
       
     ELSEIF ( psolver == 'sor' )  THEN
@@ -628,10 +601,6 @@
        !$OMP PARALLEL PRIVATE (i,j,k)
        !$OMP DO
-       !$acc kernels present( p, tend, weight_substep_l )
-       !$acc loop independent
        DO  i = nxl-1, nxr+1
-          !$acc loop independent
           DO  j = nys-1, nyn+1
-             !$acc loop independent
              DO  k = nzb, nzt+1
                 p(k,j,i) = tend(k,j,i) * &
@@ -640,5 +609,4 @@
           ENDDO
        ENDDO
-       !$acc end kernels
        !$OMP END PARALLEL
 
@@ -646,10 +614,6 @@
        !$OMP PARALLEL PRIVATE (i,j,k)
        !$OMP DO
-       !$acc kernels present( p, tend, weight_substep_l )
-       !$acc loop independent
        DO  i = nxl-1, nxr+1
-          !$acc loop independent
           DO  j = nys-1, nyn+1
-             !$acc loop independent
              DO  k = nzb, nzt+1
                 p(k,j,i) = p(k,j,i) + tend(k,j,i) * &
@@ -658,5 +622,4 @@
           ENDDO
        ENDDO
-       !$acc end kernels
        !$OMP END PARALLEL
 
@@ -677,10 +640,7 @@
     !$OMP PARALLEL PRIVATE (i,j,k)
     !$OMP DO
-    !$acc kernels present( ddzu, nzb_u_inner, nzb_v_inner, nzb_w_inner, tend, u, v, w )
-    !$acc loop independent
     DO  i = nxl, nxr   
-       !$acc loop independent
        DO  j = nys, nyn
-          !$acc loop independent
+
           DO  k = 1, nzt
              IF ( k > nzb_w_inner(j,i) )  THEN
@@ -690,5 +650,5 @@
              ENDIF
           ENDDO
-          !$acc loop independent
+
           DO  k = 1, nzt
              IF ( k > nzb_u_inner(j,i) )  THEN
@@ -698,5 +658,5 @@
              ENDIF
           ENDDO
-          !$acc loop independent
+
           DO  k = 1, nzt
              IF ( k > nzb_v_inner(j,i) )  THEN
@@ -709,5 +669,4 @@
        ENDDO
     ENDDO
-    !$acc end kernels
     !$OMP END PARALLEL
 
@@ -780,17 +739,7 @@
 !
 !-- Exchange of boundaries for the velocities
-    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( u, v, w )
-    ENDIF
     CALL exchange_horiz( u, nbgp )
     CALL exchange_horiz( v, nbgp )
     CALL exchange_horiz( w, 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( u, v, w )
-    ENDIF
 
 !
@@ -829,6 +778,4 @@
 #else
        !$OMP DO SCHEDULE( STATIC )
-       !$acc kernels present( d, ddzw, rflags_s_inner, u, v, w )
-       !$acc loop collapse( 3 )
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -842,9 +789,7 @@
           ENDDO
        ENDDO
-       !$acc end kernels
 !
 !--    Compute possible PE-sum of divergences for flow_statistics
        !$OMP DO SCHEDULE( STATIC )
-       !$acc parallel loop collapse(3) present( d ) reduction(+:threadsum)
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -854,5 +799,4 @@
           ENDDO
        ENDDO
-       !$acc end parallel loop
 #endif
 
Index: /palm/trunk/SOURCE/production_e.f90
===================================================================
--- /palm/trunk/SOURCE/production_e.f90	(revision 2117)
+++ /palm/trunk/SOURCE/production_e.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC version of subroutine removed
 ! 
 ! Former revisions:
@@ -103,10 +103,10 @@
 
     USE wall_fluxes_mod,                                                       &
-        ONLY:  wall_fluxes_e, wall_fluxes_e_acc
+        ONLY:  wall_fluxes_e
 
     USE kinds
 
     PRIVATE
-    PUBLIC production_e, production_e_acc, production_e_init
+    PUBLIC production_e, production_e_init
 
     LOGICAL, SAVE ::  first_call = .TRUE.  !<
@@ -120,8 +120,4 @@
     END INTERFACE production_e
     
-    INTERFACE production_e_acc
-       MODULE PROCEDURE production_e_acc
-    END INTERFACE production_e_acc
-
     INTERFACE production_e_init
        MODULE PROCEDURE production_e_init
@@ -740,672 +736,4 @@
 ! Description:
 ! ------------
-!> Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE production_e_acc
-
-       USE arrays_3d,                                                          &
-           ONLY:  ddzw, dd2zu, kh, km, pt, q, ql, qsws, qswst, rho_ocean, shf,       &
-                  tend, tswst, u, v, vpt, w
-
-       USE cloud_parameters,                                                   &
-           ONLY:  l_d_cp, l_d_r, pt_d_t, t_d_pt
-
-       USE control_parameters,                                                 &
-           ONLY:  cloud_droplets, cloud_physics, constant_flux_layer, g,       &
-                  humidity, kappa, neutral, ocean, pt_reference,               &
-                  rho_reference, topography, use_single_reference_value,       &
-                  use_surface_fluxes, use_top_fluxes
-
-       USE grid_variables,                                                     &
-           ONLY:  ddx, dx, ddy, dy, wall_e_x, wall_e_y
-
-       USE indices,                                                            &
-           ONLY:  i_left, i_right, j_north, j_south, nxl, nxr, nys, nyn, nzb,  &
-                  nzb_diff_s_inner, nzb_diff_s_outer, nzb_s_inner, nzt,        &
-                  nzt_diff
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i           !<
-       INTEGER(iwp) ::  j           !<
-       INTEGER(iwp) ::  k           !<
-
-       REAL(wp)     ::  def         !<
-       REAL(wp)     ::  dudx        !<
-       REAL(wp)     ::  dudy        !<
-       REAL(wp)     ::  dudz        !<
-       REAL(wp)     ::  dvdx        !<
-       REAL(wp)     ::  dvdy        !<
-       REAL(wp)     ::  dvdz        !<
-       REAL(wp)     ::  dwdx        !<
-       REAL(wp)     ::  dwdy        !<
-       REAL(wp)     ::  dwdz        !<
-       REAL(wp)     ::  k1          !<
-       REAL(wp)     ::  k2          !<
-       REAL(wp)     ::  km_neutral  !<
-       REAL(wp)     ::  theta       !<
-       REAL(wp)     ::  temp        !<
-
-       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  usvs  !<
-       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  vsus  !<
-       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wsus  !<
-       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wsvs  !<
-       !$acc declare create ( usvs, vsus, wsus, wsvs )
-
-!
-!--    First calculate horizontal momentum flux u'v', w'v', v'u', w'u' at
-!--    vertical walls, if neccessary
-!--    CAUTION: results are slightly different from the ij-version!!
-!--    ij-version should be called further below within the ij-loops!!
-       IF ( topography /= 'flat' )  THEN
-          CALL wall_fluxes_e_acc( usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, wall_e_y )
-          CALL wall_fluxes_e_acc( wsvs, 0.0_wp, 0.0_wp, 1.0_wp, 0.0_wp, wall_e_y )
-          CALL wall_fluxes_e_acc( vsus, 0.0_wp, 1.0_wp, 0.0_wp, 0.0_wp, wall_e_x )
-          CALL wall_fluxes_e_acc( wsus, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp, wall_e_x )
-       ENDIF
-
-
-!
-!--    Calculate TKE production by shear
-       !$acc kernels present( ddzw, dd2zu, kh, km, nzb_diff_s_inner, nzb_diff_s_outer ) &
-       !$acc         present( nzb_s_inner, pt, q, ql, qsws, qswst, rho_ocean )                &
-       !$acc         present( shf, tend, tswst, u, v, vpt, w, wall_e_x, wall_e_y )      &
-       !$acc         copyin( u_0, v_0 )
-       DO  i = i_left, i_right
-          DO  j = j_south, j_north
-             DO  k = 1, nzt
-
-                IF ( k >= nzb_diff_s_outer(j,i) )  THEN
-
-                   dudx  =           ( u(k,j,i+1) - u(k,j,i)     ) * ddx
-                   dudy  = 0.25_wp * ( u(k,j+1,i) + u(k,j+1,i+1) - &
-                                       u(k,j-1,i) - u(k,j-1,i+1) ) * ddy
-                   dudz  = 0.5_wp  * ( u(k+1,j,i) + u(k+1,j,i+1) - &
-                                       u(k-1,j,i) - u(k-1,j,i+1) ) * dd2zu(k)
-
-                   dvdx  = 0.25_wp * ( v(k,j,i+1) + v(k,j+1,i+1) - &
-                                       v(k,j,i-1) - v(k,j+1,i-1) ) * ddx
-                   dvdy  =           ( v(k,j+1,i) - v(k,j,i)     ) * ddy
-                   dvdz  = 0.5_wp  * ( v(k+1,j,i) + v(k+1,j+1,i) - &
-                                       v(k-1,j,i) - v(k-1,j+1,i) ) * dd2zu(k)
-
-                   dwdx  = 0.25_wp * ( w(k,j,i+1) + w(k-1,j,i+1) - &
-                                       w(k,j,i-1) - w(k-1,j,i-1) ) * ddx
-                   dwdy  = 0.25_wp * ( w(k,j+1,i) + w(k-1,j+1,i) - &
-                                       w(k,j-1,i) - w(k-1,j-1,i) ) * ddy
-                   dwdz  =           ( w(k,j,i)   - w(k-1,j,i)   ) * ddzw(k)
-
-                   def = 2.0_wp * ( dudx**2 + dvdy**2 + dwdz**2 ) +           &
-                         dudy**2 + dvdx**2 + dwdx**2 + dwdy**2 + dudz**2 + &
-                         dvdz**2 + 2.0_wp * ( dvdx*dudy + dwdx*dudz + dwdy*dvdz )
-
-                   IF ( def < 0.0_wp )  def = 0.0_wp
-
-                   tend(k,j,i) = tend(k,j,i) + km(k,j,i) * def
-
-                ENDIF
-
-             ENDDO
-          ENDDO
-       ENDDO
-
-       IF ( constant_flux_layer )  THEN
-
-!
-!--       Position beneath wall
-!--       (2) - Will allways be executed.
-!--       'bottom and wall: use u_0,v_0 and wall functions'
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-                DO  k = 1, nzt
-
-                   IF ( ( wall_e_x(j,i) /= 0.0_wp ).OR.( wall_e_y(j,i) /= 0.0_wp ) ) &
-                   THEN
-
-                      IF ( k == nzb_diff_s_inner(j,i) - 1 )  THEN
-                         dudx = ( u(k,j,i+1) - u(k,j,i) ) * ddx
-                         dudz = 0.5_wp * ( u(k+1,j,i) + u(k+1,j,i+1) - &
-                                           u_0(j,i)   - u_0(j,i+1)   ) * dd2zu(k)
-                         dvdy = ( v(k,j+1,i) - v(k,j,i) ) * ddy
-                         dvdz = 0.5_wp * ( v(k+1,j,i) + v(k+1,j+1,i) - &
-                                           v_0(j,i)   - v_0(j+1,i)   ) * dd2zu(k)
-                         dwdz = ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k)
-
-                         IF ( wall_e_y(j,i) /= 0.0_wp )  THEN
-!
-!--                         Inconsistency removed: as the thermal stratification is
-!--                         not taken into account for the evaluation of the wall
-!--                         fluxes at vertical walls, the eddy viscosity km must not
-!--                         be used for the evaluation of the velocity gradients dudy
-!--                         and dwdy
-!--                         Note: The validity of the new method has not yet been
-!--                               shown, as so far no suitable data for a validation
-!--                               has been available
-!                            CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-!                                                usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp )
-!                            CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-!                                                wsvs, 0.0_wp, 0.0_wp, 1.0_wp, 0.0_wp )
-                            km_neutral = kappa *                                    &
-                                        ( usvs(k,j,i)**2 + wsvs(k,j,i)**2 )**0.25_wp * &
-                                         0.5_wp * dy
-                            IF ( km_neutral > 0.0_wp )  THEN
-                               dudy = - wall_e_y(j,i) * usvs(k,j,i) / km_neutral
-                               dwdy = - wall_e_y(j,i) * wsvs(k,j,i) / km_neutral
-                            ELSE
-                               dudy = 0.0_wp
-                               dwdy = 0.0_wp
-                            ENDIF
-                         ELSE
-                            dudy = 0.25_wp * ( u(k,j+1,i) + u(k,j+1,i+1) - &
-                                               u(k,j-1,i) - u(k,j-1,i+1) ) * ddy
-                            dwdy = 0.25_wp * ( w(k,j+1,i) + w(k-1,j+1,i) - &
-                                               w(k,j-1,i) - w(k-1,j-1,i) ) * ddy
-                         ENDIF
-
-                         IF ( wall_e_x(j,i) /= 0.0_wp )  THEN
-!
-!--                         Inconsistency removed: as the thermal stratification is
-!--                         not taken into account for the evaluation of the wall
-!--                         fluxes at vertical walls, the eddy viscosity km must not
-!--                         be used for the evaluation of the velocity gradients dvdx
-!--                         and dwdx
-!--                         Note: The validity of the new method has not yet been
-!--                               shown, as so far no suitable data for a validation
-!--                               has been available
-!                            CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-!                                                vsus, 0.0_wp, 1.0_wp, 0.0_wp, 0.0_wp )
-!                            CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-!                                                wsus, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp )
-                            km_neutral = kappa *                                     &
-                                         ( vsus(k,j,i)**2 + wsus(k,j,i)**2 )**0.25_wp * &
-                                         0.5_wp * dx
-                            IF ( km_neutral > 0.0_wp )  THEN
-                               dvdx = - wall_e_x(j,i) * vsus(k,j,i) / km_neutral
-                               dwdx = - wall_e_x(j,i) * wsus(k,j,i) / km_neutral
-                            ELSE
-                               dvdx = 0.0_wp
-                               dwdx = 0.0_wp
-                            ENDIF
-                         ELSE
-                            dvdx = 0.25_wp * ( v(k,j,i+1) + v(k,j+1,i+1) - &
-                                               v(k,j,i-1) - v(k,j+1,i-1) ) * ddx
-                            dwdx = 0.25_wp * ( w(k,j,i+1) + w(k-1,j,i+1) - &
-                                               w(k,j,i-1) - w(k-1,j,i-1) ) * ddx
-                         ENDIF
-
-                         def = 2.0_wp * ( dudx**2 + dvdy**2 + dwdz**2 ) +           &
-                               dudy**2 + dvdx**2 + dwdx**2 + dwdy**2 + dudz**2 + &
-                               dvdz**2 + 2.0_wp * ( dvdx*dudy + dwdx*dudz + dwdy*dvdz )
-
-                         IF ( def < 0.0_wp )  def = 0.0_wp
-
-                         tend(k,j,i) = tend(k,j,i) + km(k,j,i) * def
-
-                      ENDIF
-!
-!--                   (3) - will be executed only, if there is at least one level
-!--                   between (2) and (4), i.e. the topography must have a
-!--                   minimum height of 2 dz. Wall fluxes for this case have
-!--                   already been calculated for (2).
-!--                   'wall only: use wall functions'
-
-                      IF ( k >= nzb_diff_s_inner(j,i)  .AND.  &
-                           k <= nzb_diff_s_outer(j,i)-2 )  THEN
-
-                         dudx = ( u(k,j,i+1) - u(k,j,i) ) * ddx
-                         dudz = 0.5_wp * ( u(k+1,j,i) + u(k+1,j,i+1) - &
-                                           u(k-1,j,i) - u(k-1,j,i+1) ) * dd2zu(k)
-                         dvdy =          ( v(k,j+1,i) - v(k,j,i)     ) * ddy
-                         dvdz = 0.5_wp * ( v(k+1,j,i) + v(k+1,j+1,i) - &
-                                           v(k-1,j,i) - v(k-1,j+1,i) ) * dd2zu(k)
-                         dwdz = ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k)
-
-                         IF ( wall_e_y(j,i) /= 0.0_wp )  THEN
-!
-!--                         Inconsistency removed: as the thermal stratification
-!--                         is not taken into account for the evaluation of the
-!--                         wall fluxes at vertical walls, the eddy viscosity km
-!--                         must not be used for the evaluation of the velocity
-!--                         gradients dudy and dwdy
-!--                         Note: The validity of the new method has not yet
-!--                               been shown, as so far no suitable data for a
-!--                               validation has been available
-                            km_neutral = kappa * ( usvs(k,j,i)**2 + &
-                                                   wsvs(k,j,i)**2 )**0.25_wp * 0.5_wp * dy
-                            IF ( km_neutral > 0.0_wp )  THEN
-                               dudy = - wall_e_y(j,i) * usvs(k,j,i) / km_neutral
-                               dwdy = - wall_e_y(j,i) * wsvs(k,j,i) / km_neutral
-                            ELSE
-                               dudy = 0.0_wp
-                               dwdy = 0.0_wp
-                            ENDIF
-                         ELSE
-                            dudy = 0.25_wp * ( u(k,j+1,i) + u(k,j+1,i+1) - &
-                                               u(k,j-1,i) - u(k,j-1,i+1) ) * ddy
-                            dwdy = 0.25_wp * ( w(k,j+1,i) + w(k-1,j+1,i) - &
-                                               w(k,j-1,i) - w(k-1,j-1,i) ) * ddy
-                         ENDIF
-
-                         IF ( wall_e_x(j,i) /= 0.0_wp )  THEN
-!
-!--                         Inconsistency removed: as the thermal stratification
-!--                         is not taken into account for the evaluation of the
-!--                         wall fluxes at vertical walls, the eddy viscosity km
-!--                         must not be used for the evaluation of the velocity
-!--                         gradients dvdx and dwdx
-!--                         Note: The validity of the new method has not yet
-!--                               been shown, as so far no suitable data for a
-!--                               validation has been available
-                            km_neutral = kappa * ( vsus(k,j,i)**2 + &
-                                                   wsus(k,j,i)**2 )**0.25_wp * 0.5_wp * dx
-                            IF ( km_neutral > 0.0_wp )  THEN
-                               dvdx = - wall_e_x(j,i) * vsus(k,j,i) / km_neutral
-                               dwdx = - wall_e_x(j,i) * wsus(k,j,i) / km_neutral
-                            ELSE
-                               dvdx = 0.0_wp
-                               dwdx = 0.0_wp
-                            ENDIF
-                         ELSE
-                            dvdx = 0.25_wp * ( v(k,j,i+1) + v(k,j+1,i+1) - &
-                                               v(k,j,i-1) - v(k,j+1,i-1) ) * ddx
-                            dwdx = 0.25_wp * ( w(k,j,i+1) + w(k-1,j,i+1) - &
-                                               w(k,j,i-1) - w(k-1,j,i-1) ) * ddx
-                         ENDIF
-
-                         def = 2.0_wp * ( dudx**2 + dvdy**2 + dwdz**2 ) +           &
-                              dudy**2 + dvdx**2 + dwdx**2 + dwdy**2 + dudz**2 +  &
-                              dvdz**2 + 2.0_wp * ( dvdx*dudy + dwdx*dudz + dwdy*dvdz )
-
-                         IF ( def < 0.0_wp )  def = 0.0_wp
-
-                         tend(k,j,i) = tend(k,j,i) + km(k,j,i) * def
-
-                      ENDIF
-
-!
-!--                   (4) - will allways be executed.
-!--                   'special case: free atmosphere' (as for case (0))
-                      IF ( k == nzb_diff_s_outer(j,i)-1 )  THEN
-
-                         dudx  =           ( u(k,j,i+1) - u(k,j,i)     ) * ddx
-                         dudy  = 0.25_wp * ( u(k,j+1,i) + u(k,j+1,i+1) - &
-                                             u(k,j-1,i) - u(k,j-1,i+1) ) * ddy
-                         dudz  = 0.5_wp  * ( u(k+1,j,i) + u(k+1,j,i+1) - &
-                                             u(k-1,j,i) - u(k-1,j,i+1) ) * dd2zu(k)
-
-                         dvdx  = 0.25_wp * ( v(k,j,i+1) + v(k,j+1,i+1) - &
-                                             v(k,j,i-1) - v(k,j+1,i-1) ) * ddx
-                         dvdy  =           ( v(k,j+1,i) - v(k,j,i)     ) * ddy
-                         dvdz  = 0.5_wp  * ( v(k+1,j,i) + v(k+1,j+1,i) - &
-                                             v(k-1,j,i) - v(k-1,j+1,i) ) * dd2zu(k)
-
-                         dwdx  = 0.25_wp * ( w(k,j,i+1) + w(k-1,j,i+1) - &
-                                             w(k,j,i-1) - w(k-1,j,i-1) ) * ddx
-                         dwdy  = 0.25_wp * ( w(k,j+1,i) + w(k-1,j+1,i) - &
-                                             w(k,j-1,i) - w(k-1,j-1,i) ) * ddy
-                         dwdz  =           ( w(k,j,i)   - w(k-1,j,i)   ) * ddzw(k)
-
-                         def = 2.0_wp * ( dudx**2 + dvdy**2 + dwdz**2 ) +           &
-                               dudy**2 + dvdx**2 + dwdx**2 + dwdy**2 + dudz**2 + &
-                               dvdz**2 + 2.0_wp * ( dvdx*dudy + dwdx*dudz + dwdy*dvdz )
-
-                         IF ( def < 0.0_wp )  def = 0.0_wp
-
-                         tend(k,j,i) = tend(k,j,i) + km(k,j,i) * def
-
-                      ENDIF
-
-                   ENDIF
-
-                ENDDO
-             ENDDO
-          ENDDO
-
-!
-!--       Position without adjacent wall
-!--       (1) - will allways be executed.
-!--       'bottom only: use u_0,v_0'
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-                DO  k = 1, nzt
-
-                   IF ( ( wall_e_x(j,i) == 0.0_wp ) .AND. ( wall_e_y(j,i) == 0.0_wp ) ) &
-                   THEN
-
-                      IF ( k == nzb_diff_s_inner(j,i)-1 )  THEN
-
-                         dudx  =           ( u(k,j,i+1) - u(k,j,i)     ) * ddx
-                         dudy  = 0.25_wp * ( u(k,j+1,i) + u(k,j+1,i+1) - &
-                                             u(k,j-1,i) - u(k,j-1,i+1) ) * ddy
-                         dudz  = 0.5_wp  * ( u(k+1,j,i) + u(k+1,j,i+1) - &
-                                             u_0(j,i)   - u_0(j,i+1)   ) * dd2zu(k)
-
-                         dvdx  = 0.25_wp * ( v(k,j,i+1) + v(k,j+1,i+1) - &
-                                             v(k,j,i-1) - v(k,j+1,i-1) ) * ddx
-                         dvdy  =           ( v(k,j+1,i) - v(k,j,i)     ) * ddy
-                         dvdz  = 0.5_wp  * ( v(k+1,j,i) + v(k+1,j+1,i) - &
-                                             v_0(j,i)   - v_0(j+1,i)   ) * dd2zu(k)
-
-                         dwdx  = 0.25_wp * ( w(k,j,i+1) + w(k-1,j,i+1) - &
-                                             w(k,j,i-1) - w(k-1,j,i-1) ) * ddx
-                         dwdy  = 0.25_wp * ( w(k,j+1,i) + w(k-1,j+1,i) - &
-                                             w(k,j-1,i) - w(k-1,j-1,i) ) * ddy
-                         dwdz  =           ( w(k,j,i)   - w(k-1,j,i)   ) * ddzw(k)
-
-                         def = 2.0_wp * ( dudx**2 + dvdy**2 + dwdz**2 ) +           &
-                               dudy**2 + dvdx**2 + dwdx**2 + dwdy**2 + dudz**2 + &
-                               dvdz**2 + 2.0_wp * ( dvdx*dudy + dwdx*dudz + dwdy*dvdz )
-
-                         IF ( def < 0.0_wp )  def = 0.0_wp
-
-                         tend(k,j,i) = tend(k,j,i) + km(k,j,i) * def
-
-                      ENDIF
-
-                   ENDIF
-
-                ENDDO
-             ENDDO
-          ENDDO
-
-       ELSEIF ( use_surface_fluxes )  THEN
-
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-                 DO  k = 1, nzt
-
-                   IF ( k == nzb_diff_s_outer(j,i)-1 )  THEN
-
-                      dudx  =           ( u(k,j,i+1) - u(k,j,i)     ) * ddx
-                      dudy  = 0.25_wp * ( u(k,j+1,i) + u(k,j+1,i+1) - &
-                                          u(k,j-1,i) - u(k,j-1,i+1) ) * ddy
-                      dudz  = 0.5_wp  * ( u(k+1,j,i) + u(k+1,j,i+1) - &
-                                          u(k-1,j,i) - u(k-1,j,i+1) ) * dd2zu(k)
-
-                      dvdx  = 0.25_wp * ( v(k,j,i+1) + v(k,j+1,i+1) - &
-                                          v(k,j,i-1) - v(k,j+1,i-1) ) * ddx
-                      dvdy  =           ( v(k,j+1,i) - v(k,j,i)     ) * ddy
-                      dvdz  = 0.5_wp  * ( v(k+1,j,i) + v(k+1,j+1,i) - &
-                                          v(k-1,j,i) - v(k-1,j+1,i) ) * dd2zu(k)
-
-                      dwdx  = 0.25_wp * ( w(k,j,i+1) + w(k-1,j,i+1) - &
-                                          w(k,j,i-1) - w(k-1,j,i-1) ) * ddx
-                      dwdy  = 0.25_wp * ( w(k,j+1,i) + w(k-1,j+1,i) - &
-                                          w(k,j-1,i) - w(k-1,j-1,i) ) * ddy
-                      dwdz  =           ( w(k,j,i)   - w(k-1,j,i)   ) * ddzw(k)
-
-                      def = 2.0_wp * ( dudx**2 + dvdy**2 + dwdz**2 ) +           &
-                            dudy**2 + dvdx**2 + dwdx**2 + dwdy**2 + dudz**2 + &
-                            dvdz**2 + 2.0_wp * ( dvdx*dudy + dwdx*dudz + dwdy*dvdz )
-
-                      IF ( def < 0.0_wp )  def = 0.0_wp
-
-                      tend(k,j,i) = tend(k,j,i) + km(k,j,i) * def
-
-                   ENDIF
-
-                ENDDO
-             ENDDO
-          ENDDO
-
-       ENDIF
-
-!
-!--    If required, calculate TKE production by buoyancy
-       IF ( .NOT. neutral )  THEN
-
-          IF ( .NOT. humidity )  THEN
-
-             IF ( use_single_reference_value )  THEN
-
-                IF ( ocean )  THEN
-!
-!--                So far in the ocean no special treatment of density flux
-!--                in the bottom and top surface layer
-                   DO  i = i_left, i_right
-                      DO  j = j_south, j_north
-                         DO  k = 1, nzt
-                            IF ( k > nzb_s_inner(j,i) )  THEN
-                               tend(k,j,i) = tend(k,j,i) +                     &
-                                             kh(k,j,i) * g / rho_reference *   &
-                                             ( rho_ocean(k+1,j,i) - rho_ocean(k-1,j,i) ) * &
-                                             dd2zu(k)
-                            ENDIF
-                         ENDDO
-                      ENDDO
-                   ENDDO
-
-                ELSE
-
-                   DO  i = i_left, i_right
-                      DO  j = j_south, j_north
-                         DO  k = 1, nzt_diff
-                            IF ( k >= nzb_diff_s_inner(j,i) )  THEN
-                               tend(k,j,i) = tend(k,j,i) -                   &
-                                             kh(k,j,i) * g / pt_reference *  &
-                                             ( pt(k+1,j,i) - pt(k-1,j,i) ) * &
-                                             dd2zu(k)
-                            ENDIF
-
-                            IF ( k == nzb_diff_s_inner(j,i)-1  .AND.  &
-                                 use_surface_fluxes )  THEN
-                               tend(k,j,i) = tend(k,j,i) + g / pt_reference * &
-                                                           shf(j,i)
-                            ENDIF
-
-                            IF ( k == nzt  .AND.  use_top_fluxes )  THEN
-                               tend(k,j,i) = tend(k,j,i) + g / pt_reference * &
-                                                           tswst(j,i)
-                            ENDIF
-                         ENDDO
-                      ENDDO
-                   ENDDO
-
-                ENDIF
-
-             ELSE
-
-                IF ( ocean )  THEN
-!
-!--                So far in the ocean no special treatment of density flux
-!--                in the bottom and top surface layer
-                   DO  i = i_left, i_right
-                      DO  j = j_south, j_north
-                         DO  k = 1, nzt
-                            IF ( k > nzb_s_inner(j,i) )  THEN
-                               tend(k,j,i) = tend(k,j,i) +                     &
-                                             kh(k,j,i) * g / rho_ocean(k,j,i) *      &
-                                             ( rho_ocean(k+1,j,i) - rho_ocean(k-1,j,i) ) * &
-                                             dd2zu(k)
-                            ENDIF
-                         ENDDO
-                      ENDDO
-                   ENDDO
-
-                ELSE
-
-                   DO  i = i_left, i_right
-                      DO  j = j_south, j_north
-                         DO  k = 1, nzt_diff
-                            IF( k >= nzb_diff_s_inner(j,i) )  THEN
-                               tend(k,j,i) = tend(k,j,i) -                   &
-                                             kh(k,j,i) * g / pt(k,j,i) *     &
-                                             ( pt(k+1,j,i) - pt(k-1,j,i) ) * &
-                                             dd2zu(k)
-                            ENDIF
-
-                            IF (  k == nzb_diff_s_inner(j,i)-1  .AND.  &
-                                  use_surface_fluxes )  THEN
-                               tend(k,j,i) = tend(k,j,i) + g / pt(k,j,i) * &
-                                                           shf(j,i)
-                            ENDIF
-
-                            IF ( k == nzt  .AND.  use_top_fluxes )  THEN
-                               tend(k,j,i) = tend(k,j,i) + g / pt(k,j,i) * &
-                                                           tswst(j,i)
-                            ENDIF
-                         ENDDO
-                      ENDDO
-                   ENDDO
-
-                ENDIF
-
-             ENDIF
-
-          ELSE
-!
-!++          This part gives the PGI compiler problems in the previous loop
-!++          even without any acc statements????
-!             STOP '+++ production_e problems with acc-directives'
-!             !acc loop
-!             DO  i = nxl, nxr
-!                DO  j = nys, nyn
-!                   !acc loop vector
-!                   DO  k = 1, nzt_diff
-!
-!                      IF ( k >= nzb_diff_s_inner(j,i) )  THEN
-!
-!                         IF ( .NOT. cloud_physics .AND. .NOT. cloud_droplets ) THEN
-!                            k1 = 1.0_wp + 0.61_wp * q(k,j,i)
-!                            k2 = 0.61_wp * pt(k,j,i)
-!                            tend(k,j,i) = tend(k,j,i) - kh(k,j,i) *               &
-!                                            g / vpt(k,j,i) *                      &
-!                                            ( k1 * ( pt(k+1,j,i)-pt(k-1,j,i) ) +  &
-!                                              k2 * ( q(k+1,j,i) - q(k-1,j,i) )    &
-!                                            ) * dd2zu(k)
-!                         ELSE IF ( cloud_physics )  THEN
-!                            IF ( ql(k,j,i) == 0.0_wp )  THEN
-!                               k1 = 1.0_wp + 0.61_wp * q(k,j,i)
-!                               k2 = 0.61_wp * pt(k,j,i)
-!                            ELSE
-!                               theta = pt(k,j,i) + pt_d_t(k) * l_d_cp * ql(k,j,i)
-!                               temp  = theta * t_d_pt(k)
-!                               k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp *                 &
-!                                             ( q(k,j,i) - ql(k,j,i) ) *          &
-!                                    ( 1.0_wp + 0.622_wp * l_d_r / temp ) ) /        &
-!                                    ( 1.0_wp + 0.622_wp * l_d_r * l_d_cp *          &
-!                                    ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
-!                               k2 = theta * ( l_d_cp / temp * k1 - 1.0_wp )
-!                            ENDIF
-!                            tend(k,j,i) = tend(k,j,i) - kh(k,j,i) *               &
-!                                            g / vpt(k,j,i) *                      &
-!                                            ( k1 * ( pt(k+1,j,i)-pt(k-1,j,i) ) +  &
-!                                              k2 * ( q(k+1,j,i) - q(k-1,j,i) )    &
-!                                            ) * dd2zu(k)
-!                         ELSE IF ( cloud_droplets )  THEN
-!                            k1 = 1.0_wp + 0.61_wp * q(k,j,i) - ql(k,j,i)
-!                            k2 = 0.61_wp * pt(k,j,i)
-!                            tend(k,j,i) = tend(k,j,i) -                          &
-!                                          kh(k,j,i) * g / vpt(k,j,i) *           &
-!                                          ( k1 * ( pt(k+1,j,i)- pt(k-1,j,i) ) +  &
-!                                            k2 * ( q(k+1,j,i) -  q(k-1,j,i) ) -  &
-!                                            pt(k,j,i) * ( ql(k+1,j,i) -          &
-!                                            ql(k-1,j,i) ) ) * dd2zu(k)
-!                         ENDIF
-!
-!                      ENDIF
-!
-!                   ENDDO
-!                ENDDO
-!             ENDDO
-!
-
-!!++          Next two loops are probably very inefficiently parallellized
-!!++          and will require better optimization
-!             IF ( use_surface_fluxes )  THEN
-!
-!                !acc loop
-!                DO  i = nxl, nxr
-!                   DO  j = nys, nyn
-!                      !acc loop vector
-!                      DO  k = 1, nzt_diff
-!
-!                         IF ( k == nzb_diff_s_inner(j,i)-1 )  THEN
-!
-!                            IF ( .NOT. cloud_physics .AND. .NOT. cloud_droplets ) THEN
-!                               k1 = 1.0_wp + 0.61_wp * q(k,j,i)
-!                               k2 = 0.61_wp * pt(k,j,i)
-!                            ELSE IF ( cloud_physics )  THEN
-!                               IF ( ql(k,j,i) == 0.0_wp )  THEN
-!                                  k1 = 1.0_wp + 0.61_wp * q(k,j,i)
-!                                  k2 = 0.61_wp * pt(k,j,i)
-!                               ELSE
-!                                  theta = pt(k,j,i) + pt_d_t(k) * l_d_cp * ql(k,j,i)
-!                                  temp  = theta * t_d_pt(k)
-!                                  k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp *        &
-!                                                ( q(k,j,i) - ql(k,j,i) ) *    &
-!                                       ( 1.0_wp + 0.622_wp * l_d_r / temp ) ) /&
-!                                       ( 1.0_wp + 0.622_wp * l_d_r * l_d_cp * &
-!                                       ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
-!                                  k2 = theta * ( l_d_cp / temp * k1 - 1.0_wp )
-!                               ENDIF
-!                            ELSE IF ( cloud_droplets )  THEN
-!                               k1 = 1.0_wp + 0.61_wp * q(k,j,i) - ql(k,j,i)
-!                               k2 = 0.61_wp * pt(k,j,i)
-!                            ENDIF
-!
-!                            tend(k,j,i) = tend(k,j,i) + g / vpt(k,j,i) * &
-!                                                  ( k1* shf(j,i) + k2 * qsws(j,i) )
-!                         ENDIF
-!
-!                      ENDDO
-!                   ENDDO
-!                ENDDO
-!
-!             ENDIF
-!
-!             IF ( use_top_fluxes )  THEN
-!
-!                !acc loop
-!                DO  i = nxl, nxr
-!                   DO  j = nys, nyn
-!                      !acc loop vector
-!                      DO  k = 1, nzt
-!                         IF ( k == nzt )  THEN
-!
-!                            IF ( .NOT. cloud_physics .AND. .NOT. cloud_droplets ) THEN
-!                               k1 = 1.0_wp + 0.61_wp * q(k,j,i)
-!                               k2 = 0.61_wp * pt(k,j,i)
-!                            ELSE IF ( cloud_physics )  THEN
-!                               IF ( ql(k,j,i) == 0.0_wp )  THEN
-!                                  k1 = 1.0_wp + 0.61_wp * q(k,j,i)
-!                                  k2 = 0.61_wp * pt(k,j,i)
-!                               ELSE
-!                                  theta = pt(k,j,i) + pt_d_t(k) * l_d_cp * ql(k,j,i)
-!                                  temp  = theta * t_d_pt(k)
-!                                  k1 = ( 1.0_wp - q(k,j,i) + 1.61_wp *        &
-!                                                ( q(k,j,i) - ql(k,j,i) ) *    &
-!                                       ( 1.0_wp + 0.622_wp * l_d_r / temp ) ) /&
-!                                       ( 1.0_wp + 0.622_wp * l_d_r * l_d_cp * &
-!                                       ( q(k,j,i) - ql(k,j,i) ) / ( temp * temp ) )
-!                                  k2 = theta * ( l_d_cp / temp * k1 - 1.0_wp )
-!                               ENDIF
-!                            ELSE IF ( cloud_droplets )  THEN
-!                               k1 = 1.0_wp + 0.61_wp * q(k,j,i) - ql(k,j,i)
-!                               k2 = 0.61_wp * pt(k,j,i)
-!                            ENDIF
-!
-!                            tend(k,j,i) = tend(k,j,i) + g / vpt(k,j,i) * &
-!                                                  ( k1* tswst(j,i) + k2 * qswst(j,i) )
-!
-!                         ENDIF
-!
-!                      ENDDO
-!                   ENDDO
-!                ENDDO
-!
-!             ENDIF
-
-          ENDIF
-
-       ENDIF
-       !$acc end kernels
-
-    END SUBROUTINE production_e_acc
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
 !> Call for grid point i,j
 !------------------------------------------------------------------------------!
Index: /palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- /palm/trunk/SOURCE/prognostic_equations.f90	(revision 2117)
+++ /palm/trunk/SOURCE/prognostic_equations.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! OpenACC version of subroutine removed
 ! 
 ! Former revisions:
@@ -246,10 +246,9 @@
 
     USE indices,                                                               &
-        ONLY:  i_left, i_right, j_north, j_south, nxl, nxlu, nxr, nyn, nys,    &
-               nysv, nzb_s_inner, nzb_u_inner, nzb_v_inner, nzb_w_inner, nzt
+        ONLY:  nxl, nxlu, nxr, nyn, nys, nysv, nzb_s_inner, nzb_u_inner,       &
+               nzb_v_inner, nzb_w_inner, nzt
 
     USE advec_ws,                                                              &
-        ONLY:  advec_s_ws, advec_s_ws_acc, advec_u_ws, advec_u_ws_acc,         &
-               advec_v_ws, advec_v_ws_acc, advec_w_ws, advec_w_ws_acc
+        ONLY:  advec_s_ws, advec_u_ws, advec_v_ws, advec_w_ws
 
     USE advec_s_bc_mod,                                                        &
@@ -281,5 +280,5 @@
 
     USE buoyancy_mod,                                                          &
-        ONLY:  buoyancy, buoyancy_acc
+        ONLY:  buoyancy
 
     USE calc_radiation_mod,                                                    &
@@ -287,20 +286,20 @@
   
     USE coriolis_mod,                                                          &
-        ONLY:  coriolis, coriolis_acc
+        ONLY:  coriolis
 
     USE diffusion_e_mod,                                                       &
-        ONLY:  diffusion_e, diffusion_e_acc
+        ONLY:  diffusion_e
 
     USE diffusion_s_mod,                                                       &
-        ONLY:  diffusion_s, diffusion_s_acc
+        ONLY:  diffusion_s
 
     USE diffusion_u_mod,                                                       &
-        ONLY:  diffusion_u, diffusion_u_acc
+        ONLY:  diffusion_u
 
     USE diffusion_v_mod,                                                       &
-        ONLY:  diffusion_v, diffusion_v_acc
+        ONLY:  diffusion_v
 
     USE diffusion_w_mod,                                                       &
-        ONLY:  diffusion_w, diffusion_w_acc
+        ONLY:  diffusion_w
 
     USE kinds
@@ -319,5 +318,5 @@
 
     USE production_e_mod,                                                      &
-        ONLY:  production_e, production_e_acc
+        ONLY:  production_e
 
     USE radiation_model_mod,                                                   &
@@ -342,6 +341,5 @@
 
     PRIVATE
-    PUBLIC prognostic_equations_cache, prognostic_equations_vector, &
-           prognostic_equations_acc
+    PUBLIC prognostic_equations_cache, prognostic_equations_vector
 
     INTERFACE prognostic_equations_cache
@@ -352,8 +350,4 @@
        MODULE PROCEDURE prognostic_equations_vector
     END INTERFACE prognostic_equations_vector
-
-    INTERFACE prognostic_equations_acc
-       MODULE PROCEDURE prognostic_equations_acc
-    END INTERFACE prognostic_equations_acc
 
 
@@ -2001,831 +1995,3 @@
 
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Version for accelerator boards
-!------------------------------------------------------------------------------!
- 
- SUBROUTINE prognostic_equations_acc
-
-
-    IMPLICIT NONE
-
-    INTEGER(iwp) ::  i           !<
-    INTEGER(iwp) ::  j           !<
-    INTEGER(iwp) ::  k           !<
-    INTEGER(iwp) ::  runge_step  !<
-
-    REAL(wp)     ::  sbt         !<
-
-!
-!-- Set switch for intermediate Runge-Kutta step
-    runge_step = 0
-    IF ( timestep_scheme(1:5) == 'runge' )  THEN
-       IF ( intermediate_timestep_count == 1 )  THEN
-          runge_step = 1
-       ELSEIF ( intermediate_timestep_count < &
-                intermediate_timestep_count_max )  THEN
-          runge_step = 2
-       ENDIF
-    ENDIF
-
-!
-!-- If required, calculate cloud microphysical impacts (two-moment scheme)
-    IF ( cloud_physics  .AND.  .NOT. microphysics_sat_adjust  .AND.            &
-         ( intermediate_timestep_count == 1  .OR.                              &
-           call_microphysics_at_all_substeps )                                 &
-       )  THEN
-       CALL cpu_log( log_point(51), 'microphysics', 'start' )
-       CALL microphysics_control
-       CALL cpu_log( log_point(51), 'microphysics', 'stop' )
-    ENDIF
-
-!
-!-- u-velocity component
-!++ Statistics still not completely ported to accelerators
-    !$acc update device( hom, ref_state )
-    CALL cpu_log( log_point(5), 'u-equation', 'start' )
-
-    IF ( timestep_scheme(1:5) == 'runge' )  THEN
-       IF ( ws_scheme_mom )  THEN
-          CALL advec_u_ws_acc
-       ELSE
-          tend = 0.0_wp   ! to be removed later??
-          CALL advec_u_pw
-       ENDIF
-    ELSE
-       CALL advec_u_up
-    ENDIF
-    CALL diffusion_u_acc
-    CALL coriolis_acc( 1 )
-    IF ( sloping_surface  .AND.  .NOT. neutral )  THEN
-       CALL buoyancy( pt, 1 )
-    ENDIF
-
-!
-!-- Drag by plant canopy
-    IF ( plant_canopy )  CALL pcm_tendency( 1 )
-
-!
-!-- External pressure gradient
-    IF ( dp_external )  THEN
-       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)
-             ENDDO
-          ENDDO
-       ENDDO
-    ENDIF
-
-!
-!-- Nudging
-    IF ( nudging )  CALL nudge( simulated_time, 'u' )
-
-!
-!-- Forces by wind turbines
-    IF ( wind_turbine )  CALL wtm_tendencies( 1 )
-
-    CALL user_actions( 'u-tendency' )
-
-!
-!-- Prognostic equation for u-velocity component
-    !$acc kernels present( nzb_u_inner, rdf, tend, tu_m, u, u_init, u_p )
-    !$acc loop independent
-    DO  i = i_left, i_right
-       !$acc loop independent
-       DO  j = j_south, j_north
-          !$acc loop independent
-          DO  k = 1, nzt
-             IF ( k > nzb_u_inner(j,i) )  THEN
-                u_p(k,j,i) = u(k,j,i) + dt_3d * ( tsc(2) * tend(k,j,i) +       &
-                                                  tsc(3) * tu_m(k,j,i) )       &
-                                      - tsc(5) * rdf(k) * ( u(k,j,i) - u_init(k) )
-!
-!--             Tendencies for the next Runge-Kutta step
-                IF ( runge_step == 1 )  THEN
-                   tu_m(k,j,i) = tend(k,j,i)
-                ELSEIF ( runge_step == 2 )  THEN
-                   tu_m(k,j,i) = -9.5625_wp * tend(k,j,i) + 5.3125_wp * tu_m(k,j,i)
-                ENDIF
-             ENDIF
-          ENDDO
-       ENDDO
-    ENDDO
-    !$acc end kernels
-
-    CALL cpu_log( log_point(5), 'u-equation', 'stop' )
-
-!
-!-- v-velocity component
-    CALL cpu_log( log_point(6), 'v-equation', 'start' )
-
-    IF ( timestep_scheme(1:5) == 'runge' )  THEN
-       IF ( ws_scheme_mom )  THEN
-          CALL advec_v_ws_acc
-       ELSE
-          tend = 0.0_wp    ! to be removed later??
-          CALL advec_v_pw
-       END IF
-    ELSE
-       CALL advec_v_up
-    ENDIF
-    CALL diffusion_v_acc
-    CALL coriolis_acc( 2 )
-
-!
-!-- Drag by plant canopy
-    IF ( plant_canopy )  CALL pcm_tendency( 2 )
-
-!
-!-- External pressure gradient
-    IF ( dp_external )  THEN
-       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)
-             ENDDO
-          ENDDO
-       ENDDO
-    ENDIF
-
-!
-!-- Nudging
-    IF ( nudging )  CALL nudge( simulated_time, 'v' )
-
-!
-!-- Forces by wind turbines
-    IF ( wind_turbine )  CALL wtm_tendencies( 2 )
-
-    CALL user_actions( 'v-tendency' )
-
-!
-!-- Prognostic equation for v-velocity component
-    !$acc kernels present( nzb_v_inner, rdf, tend, tv_m, v, v_init, v_p )
-    !$acc loop independent
-    DO  i = i_left, i_right
-       !$acc loop independent
-       DO  j = j_south, j_north
-          !$acc loop independent
-          DO  k = 1, nzt
-             IF ( k > nzb_v_inner(j,i) )  THEN
-                v_p(k,j,i) = v(k,j,i) + dt_3d * ( tsc(2) * tend(k,j,i) +       &
-                                                  tsc(3) * tv_m(k,j,i) )       &
-                                      - tsc(5) * rdf(k) * ( v(k,j,i) - v_init(k) )
-!
-!--             Tendencies for the next Runge-Kutta step
-                IF ( runge_step == 1 )  THEN
-                   tv_m(k,j,i) = tend(k,j,i)
-                ELSEIF ( runge_step == 2 )  THEN
-                   tv_m(k,j,i) = -9.5625_wp * tend(k,j,i) + 5.3125_wp * tv_m(k,j,i)
-                ENDIF
-             ENDIF
-          ENDDO
-       ENDDO
-    ENDDO
-    !$acc end kernels
-
-    CALL cpu_log( log_point(6), 'v-equation', 'stop' )
-
-!
-!-- w-velocity component
-    CALL cpu_log( log_point(7), 'w-equation', 'start' )
-
-    IF ( timestep_scheme(1:5) == 'runge' )  THEN
-       IF ( ws_scheme_mom )  THEN
-          CALL advec_w_ws_acc
-       ELSE
-          tend = 0.0_wp    ! to be removed later??
-          CALL advec_w_pw
-       ENDIF
-    ELSE
-       CALL advec_w_up
-    ENDIF
-    CALL diffusion_w_acc
-    CALL coriolis_acc( 3 )
-
-    IF ( .NOT. neutral )  THEN
-       IF ( ocean )  THEN
-          CALL buoyancy( rho_ocean, 3 )
-       ELSE
-          IF ( .NOT. humidity )  THEN
-             CALL buoyancy_acc( pt, 3 )
-          ELSE
-             CALL buoyancy( vpt, 3 )
-          ENDIF
-       ENDIF
-    ENDIF
-
-!
-!-- Drag by plant canopy
-    IF ( plant_canopy )  CALL pcm_tendency( 3 )
-
-!
-!-- Forces by wind turbines
-    IF ( wind_turbine )  CALL wtm_tendencies( 3 )
-
-    CALL user_actions( 'w-tendency' )
-
-!
-!-- Prognostic equation for w-velocity component
-    !$acc kernels present( nzb_w_inner, rdf, tend, tw_m, w, w_p )
-    !$acc loop independent
-    DO  i = i_left, i_right
-       !$acc loop independent
-       DO  j = j_south, j_north
-          !$acc loop independent
-          DO  k = 1, nzt-1
-             IF ( k > nzb_w_inner(j,i) )  THEN
-                w_p(k,j,i) = w(k,j,i) + dt_3d * ( tsc(2) * tend(k,j,i) +       &
-                                                  tsc(3) * tw_m(k,j,i) )       &
-                                      - tsc(5) * rdf(k) * w(k,j,i)
-   !
-   !--          Tendencies for the next Runge-Kutta step
-                IF ( runge_step == 1 )  THEN
-                   tw_m(k,j,i) = tend(k,j,i)
-                ELSEIF ( runge_step == 2 )  THEN
-                   tw_m(k,j,i) = -9.5625_wp * tend(k,j,i) + 5.3125_wp * tw_m(k,j,i)
-                ENDIF
-             ENDIF
-          ENDDO
-       ENDDO
-    ENDDO
-    !$acc end kernels
-
-    CALL cpu_log( log_point(7), 'w-equation', 'stop' )
-
-
-!
-!-- If required, compute prognostic equation for potential temperature
-    IF ( .NOT. neutral )  THEN
-
-       CALL cpu_log( log_point(13), 'pt-equation', 'start' )
-
-!
-!--    pt-tendency terms with communication
-       sbt = tsc(2)
-       IF ( scalar_advec == 'bc-scheme' )  THEN
-
-          IF ( timestep_scheme(1:5) /= 'runge' )  THEN
-!
-!--          Bott-Chlond scheme always uses Euler time step. Thus:
-             sbt = 1.0_wp
-          ENDIF
-          tend = 0.0_wp
-          CALL advec_s_bc( pt, 'pt' )
-
-       ENDIF
-
-!
-!--    pt-tendency terms with no communication
-       IF ( scalar_advec /= 'bc-scheme' )  THEN
-          tend = 0.0_wp
-          IF ( timestep_scheme(1:5) == 'runge' )  THEN
-             IF ( ws_scheme_sca )  THEN
-                CALL advec_s_ws_acc( pt, 'pt' )
-             ELSE
-                tend = 0.0_wp    ! to be removed later??
-                CALL advec_s_pw( pt )
-             ENDIF
-          ELSE
-             CALL advec_s_up( pt )
-          ENDIF
-       ENDIF
-
-       CALL diffusion_s_acc( pt, shf, tswst, wall_heatflux )
-
-!
-!--    Tendency pt from wall heat flux from urban surface
-       IF ( urban_surface )  THEN
-          CALL usm_wall_heat_flux
-       ENDIF
-
-!
-!--    If required compute heating/cooling due to long wave radiation processes
-       IF ( cloud_top_radiation )  THEN
-          CALL calc_radiation
-       ENDIF
-
-!
-!--    Consideration of heat sources within the plant canopy
-       IF ( plant_canopy .AND. ( cthf /= 0.0_wp ) ) THEN
-          CALL pcm_tendency( 4 )
-       ENDIF
-
-!
-!--    Large scale advection
-       IF ( large_scale_forcing )  THEN
-          CALL ls_advec( simulated_time, 'pt' )
-       ENDIF
-
-!
-!--    Nudging
-       IF ( nudging )  CALL nudge( simulated_time, 'pt' ) 
-
-!
-!--    If required compute influence of large-scale subsidence/ascent
-       IF ( large_scale_subsidence  .AND.                                      &
-            .NOT. use_subsidence_tendencies )  THEN
-          CALL subsidence( tend, pt, pt_init, 2 )
-       ENDIF
-
-       IF ( radiation .AND.                                                    &
-            simulated_time > skip_time_do_radiation )  THEN
-            CALL radiation_tendency ( tend )
-       ENDIF
-
-       CALL user_actions( 'pt-tendency' )
-
-!
-!--    Prognostic equation for potential temperature
-       !$acc kernels present( nzb_s_inner, rdf_sc, ptdf_x, ptdf_y, pt_init ) &
-       !$acc         present( tend, tpt_m, pt, pt_p )
-       !$acc loop independent
-       DO  i = i_left, i_right
-          !$acc loop independent
-          DO  j = j_south, j_north
-             !$acc loop independent
-             DO  k = 1, nzt
-                IF ( k > nzb_s_inner(j,i) )  THEN
-                   pt_p(k,j,i) = pt(k,j,i) + dt_3d * ( sbt * tend(k,j,i) +        &
-                                                       tsc(3) * tpt_m(k,j,i) )    &
-                                           - tsc(5) * ( pt(k,j,i) - pt_init(k) ) *&
-                                             ( rdf_sc(k) + ptdf_x(i) + ptdf_y(j) )
-!
-!--                Tendencies for the next Runge-Kutta step
-                   IF ( runge_step == 1 )  THEN
-                      tpt_m(k,j,i) = tend(k,j,i)
-                   ELSEIF ( runge_step == 2 )  THEN
-                      tpt_m(k,j,i) = -9.5625_wp * tend(k,j,i) + 5.3125_wp * tpt_m(k,j,i)
-                   ENDIF
-                ENDIF
-             ENDDO
-          ENDDO
-       ENDDO
-       !$acc end kernels
-
-       CALL cpu_log( log_point(13), 'pt-equation', 'stop' )
-
-    ENDIF
-
-!
-!-- If required, compute prognostic equation for salinity
-    IF ( ocean )  THEN
-
-       CALL cpu_log( log_point(37), 'sa-equation', 'start' )
-
-!
-!--    sa-tendency terms with communication
-       sbt = tsc(2)
-       IF ( scalar_advec == 'bc-scheme' )  THEN
-
-          IF ( timestep_scheme(1:5) /= 'runge' )  THEN
-!
-!--          Bott-Chlond scheme always uses Euler time step. Thus:
-             sbt = 1.0_wp
-          ENDIF
-          tend = 0.0_wp
-          CALL advec_s_bc( sa, 'sa' )
-
-       ENDIF
-
-!
-!--    sa-tendency terms with no communication
-       IF ( scalar_advec /= 'bc-scheme' )  THEN
-          tend = 0.0_wp
-          IF ( timestep_scheme(1:5) == 'runge' )  THEN
-             IF ( ws_scheme_sca )  THEN
-                 CALL advec_s_ws( sa, 'sa' )
-             ELSE
-                 CALL advec_s_pw( sa )
-             ENDIF
-          ELSE
-             CALL advec_s_up( sa )
-          ENDIF
-       ENDIF
-
-       CALL diffusion_s( sa, saswsb, saswst, wall_salinityflux )
-
-       CALL user_actions( 'sa-tendency' )
-
-!
-!--    Prognostic equation for salinity
-       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) +        &
-                                                    tsc(3) * tsa_m(k,j,i) )    &
-                                        - tsc(5) * rdf_sc(k) *                 &
-                                          ( sa(k,j,i) - sa_init(k) )
-                IF ( sa_p(k,j,i) < 0.0_wp )  sa_p(k,j,i) = 0.1_wp * sa(k,j,i)
-!
-!--             Tendencies for the next Runge-Kutta step
-                IF ( runge_step == 1 )  THEN
-                   tsa_m(k,j,i) = tend(k,j,i)
-                ELSEIF ( runge_step == 2 )  THEN
-                   tsa_m(k,j,i) = -9.5625_wp * tend(k,j,i) + 5.3125_wp * tsa_m(k,j,i)
-                ENDIF
-             ENDDO
-          ENDDO
-       ENDDO
-
-       CALL cpu_log( log_point(37), 'sa-equation', 'stop' )
-
-!
-!--    Calculate density by the equation of state for seawater
-       CALL cpu_log( log_point(38), 'eqns-seawater', 'start' )
-       CALL eqn_state_seawater
-       CALL cpu_log( log_point(38), 'eqns-seawater', 'stop' )
-
-    ENDIF
-
-!
-!-- If required, compute prognostic equation for total water content
-    IF ( humidity )  THEN
-
-       CALL cpu_log( log_point(29), 'q-equation', 'start' )
-
-!
-!--    Scalar/q-tendency terms with communication
-       sbt = tsc(2)
-       IF ( scalar_advec == 'bc-scheme' )  THEN
-
-          IF ( timestep_scheme(1:5) /= 'runge' )  THEN
-!
-!--          Bott-Chlond scheme always uses Euler time step. Thus:
-             sbt = 1.0_wp
-          ENDIF
-          tend = 0.0_wp
-          CALL advec_s_bc( q, 'q' )
-
-       ENDIF
-
-!
-!--    Scalar/q-tendency terms with no communication
-       IF ( scalar_advec /= 'bc-scheme' )  THEN
-          tend = 0.0_wp
-          IF ( timestep_scheme(1:5) == 'runge' )  THEN
-             IF ( ws_scheme_sca )  THEN
-                CALL advec_s_ws( q, 'q' )
-             ELSE
-                CALL advec_s_pw( q )
-             ENDIF
-          ELSE
-             CALL advec_s_up( q )
-          ENDIF
-       ENDIF
-
-       CALL diffusion_s( q, qsws, qswst, wall_qflux )
-
-!
-!--    Sink or source of scalar concentration due to canopy elements
-       IF ( plant_canopy ) CALL pcm_tendency( 5 )
-
-!
-!--    Large scale advection
-       IF ( large_scale_forcing )  THEN
-          CALL ls_advec( simulated_time, 'q' )
-       ENDIF
-
-!
-!--    Nudging
-       IF ( nudging )  CALL nudge( simulated_time, 'q' ) 
-
-!
-!--    If required compute influence of large-scale subsidence/ascent
-       IF ( large_scale_subsidence  .AND.                                      &
-            .NOT. use_subsidence_tendencies )  THEN
-         CALL subsidence( tend, q, q_init, 3 )
-       ENDIF
-
-       CALL user_actions( 'q-tendency' )
-
-!
-!--    Prognostic equation for total water content / scalar
-       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) +          &
-                                                  tsc(3) * tq_m(k,j,i) )       &
-                                      - tsc(5) * rdf_sc(k) *                   &
-                                        ( q(k,j,i) - q_init(k) )
-                IF ( q_p(k,j,i) < 0.0_wp )  q_p(k,j,i) = 0.1_wp * q(k,j,i)
-!
-!--             Tendencies for the next Runge-Kutta step
-                IF ( runge_step == 1 )  THEN
-                   tq_m(k,j,i) = tend(k,j,i)
-                ELSEIF ( runge_step == 2 )  THEN
-                   tq_m(k,j,i) = -9.5625_wp * tend(k,j,i) + 5.3125_wp * tq_m(k,j,i)
-                ENDIF
-             ENDDO
-          ENDDO
-       ENDDO
-
-       CALL cpu_log( log_point(29), 'q-equation', 'stop' )
-
-!
-!--    If required, calculate prognostic equations for rain water content 
-!--    and rain drop concentration
-       IF ( cloud_physics  .AND.  microphysics_seifert )  THEN
-
-          CALL cpu_log( log_point(52), 'qr-equation', 'start' )
-!
-!--       qr-tendency terms with communication
-          sbt = tsc(2)
-          IF ( scalar_advec == 'bc-scheme' )  THEN
-
-             IF ( timestep_scheme(1:5) /= 'runge' )  THEN
-!
-!--             Bott-Chlond scheme always uses Euler time step. Thus:
-                sbt = 1.0_wp
-             ENDIF
-             tend = 0.0_wp
-             CALL advec_s_bc( qr, 'qr' )
-
-          ENDIF
-
-!
-!--       qr-tendency terms with no communication
-          IF ( scalar_advec /= 'bc-scheme' )  THEN
-             tend = 0.0_wp
-             IF ( timestep_scheme(1:5) == 'runge' )  THEN
-                IF ( ws_scheme_sca )  THEN
-                   CALL advec_s_ws( qr, 'qr' )
-                ELSE
-                   CALL advec_s_pw( qr )
-                ENDIF
-             ELSE
-                CALL advec_s_up( qr )
-             ENDIF
-          ENDIF
-
-          CALL diffusion_s( qr, qrsws, qrswst, wall_qrflux )
-
-!
-!--       Prognostic equation for rain water content
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-                DO  k = nzb_s_inner(j,i)+1, nzt
-                   qr_p(k,j,i) = qr(k,j,i) + dt_3d * ( sbt * tend(k,j,i) +     &
-                                                       tsc(3) * tqr_m(k,j,i) ) &
-                                           - tsc(5) * rdf_sc(k) * qr(k,j,i)
-                   IF ( qr_p(k,j,i) < 0.0_wp )  qr_p(k,j,i) = 0.0_wp
-!
-!--                Tendencies for the next Runge-Kutta step
-                   IF ( runge_step == 1 )  THEN
-                      tqr_m(k,j,i) = tend(k,j,i)
-                   ELSEIF ( runge_step == 2 )  THEN
-                      tqr_m(k,j,i) = -9.5625_wp * tend(k,j,i) + 5.3125_wp *    &
-                                                                tqr_m(k,j,i)
-                   ENDIF
-                ENDDO
-             ENDDO
-          ENDDO
-
-          CALL cpu_log( log_point(52), 'qr-equation', 'stop' )
-          CALL cpu_log( log_point(53), 'nr-equation', 'start' )
-
-!
-!--       nr-tendency terms with communication
-          sbt = tsc(2)
-          IF ( scalar_advec == 'bc-scheme' )  THEN
-
-             IF ( timestep_scheme(1:5) /= 'runge' )  THEN
-!
-!--             Bott-Chlond scheme always uses Euler time step. Thus:
-                sbt = 1.0_wp
-             ENDIF
-             tend = 0.0_wp
-             CALL advec_s_bc( nr, 'nr' )
-
-          ENDIF
-
-!
-!--       nr-tendency terms with no communication
-          IF ( scalar_advec /= 'bc-scheme' )  THEN
-             tend = 0.0_wp
-             IF ( timestep_scheme(1:5) == 'runge' )  THEN
-                IF ( ws_scheme_sca )  THEN
-                   CALL advec_s_ws( nr, 'nr' )
-                ELSE
-                   CALL advec_s_pw( nr )
-                ENDIF
-             ELSE
-                CALL advec_s_up( nr )
-             ENDIF
-          ENDIF
-
-          CALL diffusion_s( nr, nrsws, nrswst, wall_nrflux )
-
-!
-!--       Prognostic equation for rain drop concentration
-          DO  i = i_left, i_right
-             DO  j = j_south, j_north
-                DO  k = nzb_s_inner(j,i)+1, nzt
-                   nr_p(k,j,i) = nr(k,j,i) + dt_3d * ( sbt * tend(k,j,i) +     &
-                                                       tsc(3) * tnr_m(k,j,i) ) &
-                                           - tsc(5) * rdf_sc(k) * nr(k,j,i)
-                   IF ( nr_p(k,j,i) < 0.0_wp )  nr_p(k,j,i) = 0.0_wp
-!
-!--                Tendencies for the next Runge-Kutta step
-                   IF ( runge_step == 1 )  THEN
-                      tnr_m(k,j,i) = tend(k,j,i)
-                   ELSEIF ( runge_step == 2 )  THEN
-                      tnr_m(k,j,i) = -9.5625_wp * tend(k,j,i) + 5.3125_wp *    &
-                                                                tnr_m(k,j,i)
-                   ENDIF
-                ENDDO
-             ENDDO
-          ENDDO
-
-          CALL cpu_log( log_point(53), 'nr-equation', 'stop' )
-
-       ENDIF
-
-    ENDIF
-
-!
-!-- If required, compute prognostic equation for scalar
-    IF ( passive_scalar )  THEN
-
-       CALL cpu_log( log_point(66), 's-equation', 'start' )
-
-!
-!--    Scalar/q-tendency terms with communication
-       sbt = tsc(2)
-       IF ( scalar_advec == 'bc-scheme' )  THEN
-
-          IF ( timestep_scheme(1:5) /= 'runge' )  THEN
-!
-!--          Bott-Chlond scheme always uses Euler time step. Thus:
-             sbt = 1.0_wp
-          ENDIF
-          tend = 0.0_wp
-          CALL advec_s_bc( s, 's' )
-
-       ENDIF
-
-!
-!--    Scalar/q-tendency terms with no communication
-       IF ( scalar_advec /= 'bc-scheme' )  THEN
-          tend = 0.0_wp
-          IF ( timestep_scheme(1:5) == 'runge' )  THEN
-             IF ( ws_scheme_sca )  THEN
-                CALL advec_s_ws( s, 's' )
-             ELSE
-                CALL advec_s_pw( s )
-             ENDIF
-          ELSE
-             CALL advec_s_up( s )
-          ENDIF
-       ENDIF
-
-       CALL diffusion_s( s, ssws, sswst, wall_sflux )
-
-!
-!--    Sink or source of scalar concentration due to canopy elements
-       IF ( plant_canopy ) CALL pcm_tendency( 7 )
-
-!
-!--    Large scale advection. Not implemented so far.
-!        IF ( large_scale_forcing )  THEN
-!           CALL ls_advec( simulated_time, 's' )
-!        ENDIF
-
-!
-!--    Nudging. Not implemented so far.
-!        IF ( nudging )  CALL nudge( simulated_time, 's' ) 
-
-!
-!--    If required compute influence of large-scale subsidence/ascent.
-!--    Not implemented so far.
-       IF ( large_scale_subsidence  .AND.                                      &
-            .NOT. use_subsidence_tendencies  .AND.                             &
-            .NOT. large_scale_forcing )  THEN
-         CALL subsidence( tend, s, s_init, 3 )
-       ENDIF
-
-       CALL user_actions( 's-tendency' )
-
-!
-!--    Prognostic equation for total water content / scalar
-       DO  i = i_left, i_right
-          DO  j = j_south, j_north
-             DO  k = nzb_s_inner(j,i)+1, nzt
-                s_p(k,j,i) = s(k,j,i) + dt_3d * ( sbt * tend(k,j,i) +          &
-                                                  tsc(3) * ts_m(k,j,i) )       &
-                                      - tsc(5) * rdf_sc(k) *                   &
-                                        ( s(k,j,i) - s_init(k) )
-                IF ( s_p(k,j,i) < 0.0_wp )  s_p(k,j,i) = 0.1_wp * s(k,j,i)
-!
-!--             Tendencies for the next Runge-Kutta step
-                IF ( runge_step == 1 )  THEN
-                   ts_m(k,j,i) = tend(k,j,i)
-                ELSEIF ( runge_step == 2 )  THEN
-                   ts_m(k,j,i) = -9.5625_wp * tend(k,j,i) + 5.3125_wp * ts_m(k,j,i)
-                ENDIF
-             ENDDO
-          ENDDO
-       ENDDO
-
-       CALL cpu_log( log_point(66), 's-equation', 'stop' )
-
-    ENDIF
-!
-!-- If required, compute prognostic equation for turbulent kinetic
-!-- energy (TKE)
-    IF ( .NOT. constant_diffusion )  THEN
-
-       CALL cpu_log( log_point(16), 'tke-equation', 'start' )
-
-       sbt = tsc(2)
-       IF ( .NOT. use_upstream_for_tke )  THEN
-          IF ( scalar_advec == 'bc-scheme' )  THEN
-
-             IF ( timestep_scheme(1:5) /= 'runge' )  THEN
-!
-!--             Bott-Chlond scheme always uses Euler time step. Thus:
-                sbt = 1.0_wp
-             ENDIF
-             tend = 0.0_wp
-             CALL advec_s_bc( e, 'e' )
-
-          ENDIF
-       ENDIF
-
-!
-!--    TKE-tendency terms with no communication
-       IF ( scalar_advec /= 'bc-scheme'  .OR.  use_upstream_for_tke )  THEN
-          IF ( use_upstream_for_tke )  THEN
-             tend = 0.0_wp
-             CALL advec_s_up( e )
-          ELSE
-             IF ( timestep_scheme(1:5) == 'runge' )  THEN
-                IF ( ws_scheme_sca )  THEN
-                   CALL advec_s_ws_acc( e, 'e' )
-                ELSE
-                   tend = 0.0_wp    ! to be removed later??
-                   CALL advec_s_pw( e )
-                ENDIF
-             ELSE
-                tend = 0.0_wp    ! to be removed later??
-                CALL advec_s_up( e )
-             ENDIF
-          ENDIF
-       ENDIF
-
-       IF ( .NOT. humidity )  THEN
-          IF ( ocean )  THEN
-             CALL diffusion_e( prho, prho_reference )
-          ELSE
-             CALL diffusion_e_acc( pt, pt_reference )
-          ENDIF
-       ELSE
-          CALL diffusion_e( vpt, pt_reference )
-       ENDIF
-
-       CALL production_e_acc
-
-!
-!--    Additional sink term for flows through plant canopies
-       IF ( plant_canopy )  CALL pcm_tendency( 6 )
-       CALL user_actions( 'e-tendency' )
-
-!
-!--    Prognostic equation for TKE.
-!--    Eliminate negative TKE values, which can occur due to numerical
-!--    reasons in the course of the integration. In such cases the old TKE
-!--    value is reduced by 90%.
-       !$acc kernels present( e, e_p, nzb_s_inner, tend, te_m )
-       !$acc loop independent
-       DO  i = i_left, i_right
-          !$acc loop independent
-          DO  j = j_south, j_north
-             !$acc loop independent
-             DO  k = 1, nzt
-                IF ( k > nzb_s_inner(j,i) )  THEN
-                   e_p(k,j,i) = e(k,j,i) + dt_3d * ( sbt * tend(k,j,i) +          &
-                                                     tsc(3) * te_m(k,j,i) )
-                   IF ( e_p(k,j,i) < 0.0_wp )  e_p(k,j,i) = 0.1_wp * e(k,j,i)
-!
-!--                Tendencies for the next Runge-Kutta step
-                   IF ( runge_step == 1 )  THEN
-                      te_m(k,j,i) = tend(k,j,i)
-                   ELSEIF ( runge_step == 2 )  THEN
-                      te_m(k,j,i) = -9.5625_wp * tend(k,j,i) + 5.3125_wp * te_m(k,j,i)
-                   ENDIF
-                ENDIF
-             ENDDO
-          ENDDO
-       ENDDO
-       !$acc end kernels
-
-       CALL cpu_log( log_point(16), 'tke-equation', 'stop' )
-
-    ENDIF
-
- END SUBROUTINE prognostic_equations_acc
-
-
  END MODULE prognostic_equations_mod
Index: /palm/trunk/SOURCE/surface_layer_fluxes_mod.f90
===================================================================
--- /palm/trunk/SOURCE/surface_layer_fluxes_mod.f90	(revision 2117)
+++ /palm/trunk/SOURCE/surface_layer_fluxes_mod.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! OpenACC directives and related code removed
 ! 
 ! Former revisions:
@@ -163,5 +163,5 @@
 !>
 !> @todo (re)move large_scale_forcing actions
-!> @todo check/optimize OpenMP and OpenACC directives
+!> @todo check/optimize OpenMP directives
 !------------------------------------------------------------------------------!
  MODULE surface_layer_fluxes_mod
@@ -472,5 +472,4 @@
 
        !$OMP PARALLEL DO PRIVATE( k )
-       !$acc kernels loop present( nzb_s_inner, u, uv_total, v ) private( j, k )
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -492,7 +491,5 @@
 !
 !--    Values of uv_total need to be exchanged at the ghost boundaries
-       !$acc update host( uv_total )
        CALL exchange_horiz_2d( uv_total )
-       !$acc update device( uv_total )
 
     END SUBROUTINE calc_uv_total
@@ -522,8 +519,5 @@
        IF ( TRIM( most_method ) /= 'circular' )  THEN
       
-          !$acc data present( nzb_s_inner, pt, q, qsws, rib, shf, uv_total, vpt, zu, zw )
-
           !$OMP PARALLEL DO PRIVATE( k, z_mo )
-          !$acc kernels loop private( j, k, z_mo )
           DO  i = nxl, nxr
              DO  j = nys, nyn
@@ -564,5 +558,4 @@
              ENDDO
           ENDDO 
-          !$acc end data
 
        ENDIF
@@ -574,7 +567,4 @@
 
           !$OMP PARALLEL DO PRIVATE( k, z_mo )
-          !# WARNING: does not work on GPU so far because of DO-loop with
-          !#          undetermined iterations
-          !!!!!!$acc kernels loop
           DO  i = nxl, nxr
              DO  j = nys, nyn
@@ -695,6 +685,4 @@
 
           !$OMP PARALLEL DO PRIVATE( k, l, z_mo ) FIRSTPRIVATE( l_bnd ) LASTPRIVATE( l_bnd )
-          !# WARNING: does not work on GPU so far because of DO  WHILE construct
-          !!!!!!$acc kernels loop
           DO  i = nxl, nxr
              DO  j = nys, nyn
@@ -736,5 +724,4 @@
 
           !$OMP PARALLEL DO PRIVATE( k, z_mo )
-          !$acc kernels loop present( nzb_s_inner, ol, pt, pt1, q, ql, qs, qv1, ts, us, vpt, zu, zw ) private( j, k, z_mo )
           DO  i = nxl, nxr
              DO  j = nys, nyn
@@ -775,7 +762,5 @@
 !--    Values of ol at ghost point locations are needed for the evaluation
 !--    of usws and vsws.
-       !$acc update host( ol )
        CALL exchange_horiz_2d( ol )
-       !$acc update device( ol )
 
     END SUBROUTINE calc_ol
@@ -788,5 +773,4 @@
 
        !$OMP PARALLEL DO PRIVATE( k, z_mo )
-       !$acc kernels loop present( nzb_s_inner, ol, us, uv_total, zu, zw, z0 ) private( j, k, z_mo )
        DO  i = nxlg, nxrg
           DO  j = nysg, nyng
@@ -811,5 +795,4 @@
        IMPLICIT NONE
 
-       !$acc kernels loop present( nzb_s_inner, pt, pt1, pt_d_t, q, ql, qv1 ) private( j, k )
        DO  i = nxlg, nxrg
           DO  j = nysg, nyng
@@ -828,9 +811,4 @@
        IMPLICIT NONE
 
-!
-!--    Data information for accelerators
-       !$acc data present( e, nrsws, nzb_u_inner, nzb_v_inner, nzb_s_inner, pt )  &
-       !$acc      present( q, qs, qsws, qrsws, shf, ts, u, us, usws, v )     &
-       !$acc      present( vpt, vsws, zu, zw, z0, z0h )
 ! 
 !--    Compute theta*
@@ -840,5 +818,4 @@
 !--       For a given heat flux in the surface layer:
           !$OMP PARALLEL DO
-          !$acc kernels loop private( j, k )
           DO  i = nxlg, nxrg
              DO  j = nysg, nyng
@@ -858,5 +835,4 @@
           IF ( large_scale_forcing  .AND.  lsf_surf )  THEN
              !$OMP PARALLEL DO
-             !$acc kernels loop private( j, k )
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
@@ -868,5 +844,4 @@
 
           !$OMP PARALLEL DO PRIVATE( k, z_mo )
-          !$acc kernels loop present( nzb_s_inner, ol, pt, pt1, ts, zu, zw, z0h ) private( j, k, z_mo )
           DO  i = nxlg, nxrg
              DO  j = nysg, nyng
@@ -898,5 +873,4 @@
 !--          For a given water flux in the surface layer
              !$OMP PARALLEL DO
-             !$acc kernels loop private( j )
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
@@ -912,5 +886,4 @@
              IF ( large_scale_forcing  .AND.  lsf_surf )  THEN
                 !$OMP PARALLEL DO
-                !$acc kernels loop private( j, k )
                 DO  i = nxlg, nxrg
                    DO  j = nysg, nyng
@@ -922,7 +895,5 @@
 
              !$OMP PARALLEL DO PRIVATE( e_s, k, z_mo )
-             !$acc kernels loop independent present( nzb_s_inner, ol, pt, q, qs, qv1, zu, zw, z0q ) private( e_s, j, k, z_mo )
              DO  i = nxlg, nxrg
-                !$acc loop independent
                 DO  j = nysg, nyng
 
@@ -965,5 +936,4 @@
 !--          For a given water flux in the surface layer
              !$OMP PARALLEL DO
-             !$acc kernels loop private( j )
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
@@ -981,7 +951,5 @@
 
           !$OMP PARALLEL DO PRIVATE( k, z_mo )
-          !$acc kernels loop independent present( nr, nrs, nzb_s_inner, ol, qr, qrs, zu, zw, z0q ) private( j, k, z_mo )
           DO  i = nxlg, nxrg
-             !$acc loop independent
              DO  j = nysg, nyng
 
@@ -1002,5 +970,4 @@
 
        ENDIF
-       !$acc end data
 
     END SUBROUTINE calc_scaling_parameters
@@ -1020,5 +987,4 @@
 !--    First compute the corresponding component of u* and square it.
        !$OMP PARALLEL DO PRIVATE( k, ol_mid, z_mo )
-       !$acc kernels loop present( nzb_u_inner, ol, u, us, usws, zu, zw, z0 ) private( j, k, z_mo )
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -1048,5 +1014,4 @@
 !--    First compute the corresponding component of u* and square it.
        !$OMP PARALLEL DO PRIVATE( k, ol_mid, z_mo )
-       !$acc kernels loop present( nzb_v_inner, ol, v, us, vsws, zu, zw, z0 ) private( j, k, ol_mid, z_mo )
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -1075,8 +1040,6 @@
 !
 !--    Exchange the boundaries for the momentum fluxes (is this still required?)
-       !$acc update host( usws, vsws )
        CALL exchange_horiz_2d( usws )
        CALL exchange_horiz_2d( vsws )
-       !$acc update device( usws, vsws )
 
 !
@@ -1086,7 +1049,5 @@
             .NOT.  urban_surface )  THEN
           !$OMP PARALLEL DO
-          !$acc kernels loop independent present( shf, ts, us )
           DO  i = nxlg, nxrg
-             !$acc loop independent
              DO  j = nysg, nyng
                 k   = nzb_s_inner(j,i)
@@ -1103,7 +1064,5 @@
             .OR.  .NOT.  land_surface ) )  THEN
           !$OMP PARALLEL DO
-          !$acc kernels loop independent present( qs, qsws, us )
           DO  i = nxlg, nxrg
-             !$acc loop independent
              DO  j = nysg, nyng
                 k   = nzb_s_inner(j,i)
@@ -1120,7 +1079,5 @@
             .OR.  .NOT.  land_surface ) )  THEN
           !$OMP PARALLEL DO
-          !$acc kernels loop independent present( qs, qsws, us )
           DO  i = nxlg, nxrg
-             !$acc loop independent
              DO  j = nysg, nyng
                 ssws(j,i) = -ss(j,i) * us(j,i)
@@ -1134,7 +1091,5 @@
        IF ( cloud_physics  .AND.  microphysics_seifert )  THEN
           !$OMP PARALLEL DO
-          !$acc kernels loop independent present( nrs, nrsws, qrs, qrsws, us )
           DO  i = nxlg, nxrg
-             !$acc loop independent
              DO  j = nysg, nyng
                 qrsws(j,i) = -qrs(j,i) * us(j,i)
@@ -1148,7 +1103,5 @@
        IF ( ibc_e_b == 2 )  THEN
           !$OMP PARALLEL DO
-          !$acc kernels loop independent present( e, nzb_s_inner, us )
           DO  i = nxlg, nxrg
-             !$acc loop independent
              DO  j = nysg, nyng
                 k = nzb_s_inner(j,i)
Index: /palm/trunk/SOURCE/swap_timelevel.f90
===================================================================
--- /palm/trunk/SOURCE/swap_timelevel.f90	(revision 2117)
+++ /palm/trunk/SOURCE/swap_timelevel.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC directives removed
 ! 
 ! Former revisions:
@@ -142,10 +142,6 @@
     CALL cpu_log( log_point(28), 'swap_timelevel (nop)', 'start' )
 
-    !$acc kernels present( pt, pt_p, u, u_p, v, v_p, w, w_p )
-    !$acc loop independent
     DO  i = nxlg, nxrg
-       !$acc loop independent
        DO  j = nysg, nyng
-          !$acc loop independent
           DO  k = nzb, nzt+1
              u(k,j,i)  = u_p(k,j,i)
@@ -156,16 +152,8 @@
        ENDDO
     ENDDO
-!    u  = u_p
-!    v  = v_p
-!    w  = w_p
-!    pt = pt_p
-    !$acc end kernels
+
     IF ( .NOT. constant_diffusion )  THEN
-       !$acc kernels present( e, e_p )
-       !$acc loop independent
        DO  i = nxlg, nxrg
-          !$acc loop independent
           DO  j = nysg, nyng
-             !$acc loop independent
              DO  k = nzb, nzt+1
                 e(k,j,i) = e_p(k,j,i)
@@ -173,10 +161,10 @@
           ENDDO
        ENDDO
-!       e = e_p
-       !$acc end kernels
-    ENDIF
+    ENDIF
+
     IF ( ocean )  THEN
        sa = sa_p
     ENDIF
+
     IF ( humidity )  THEN
        q = q_p             
@@ -186,4 +174,5 @@
        ENDIF
     ENDIF
+
     IF ( passive_scalar )  s = s_p             
 
Index: /palm/trunk/SOURCE/time_integration.f90
===================================================================
--- /palm/trunk/SOURCE/time_integration.f90	(revision 2117)
+++ /palm/trunk/SOURCE/time_integration.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! OpenACC directives and related code removed
 ! 
 ! Former revisions:
@@ -273,5 +273,5 @@
                microphysics_seifert, mid, nest_domain,                         &
                neutral, nr_timesteps_this_run, nudging,                        &
-               ocean, on_device, passive_scalar,                               &
+               ocean, passive_scalar,                                          &
                prho_reference, pt_reference, pt_slope_offset, random_heatflux, &
                run_coupled, simulated_time, simulated_time_chr,                &
@@ -298,6 +298,6 @@
 
     USE indices,                                                               &
-        ONLY:  i_left, i_right, j_north, j_south, nbgp, nx, nxl, nxlg, nxr,    &
-               nxrg, nyn, nyng, nys, nysg, nzb, nzt, nzb_u_inner, nzb_v_inner
+        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt, &
+               nzb_u_inner, nzb_v_inner
 
     USE interaction_droplets_ptq_mod,                                          &
@@ -338,6 +338,5 @@
 
     USE prognostic_equations_mod,                                              &
-        ONLY:  prognostic_equations_acc, prognostic_equations_cache,           &
-               prognostic_equations_vector
+        ONLY:  prognostic_equations_cache, prognostic_equations_vector
 
     USE radiation_model_mod,                                                   &
@@ -522,155 +521,4 @@
           ELSEIF ( loop_optimization == 'vector' )  THEN
              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_ocean, nbgp )
-                   CALL exchange_horiz( prho, nbgp )
-                ENDIF
-                IF ( humidity )  THEN
-                   CALL exchange_horiz( q_p, nbgp )
-                   IF ( cloud_physics .AND. microphysics_seifert )  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.  collision_turbulence  .OR.             &
-                     use_sgs_for_particles )  THEN
-                   CALL exchange_horiz( diss, nbgp )
-                ENDIF
-                IF ( passive_scalar )  CALL exchange_horiz( s_p, 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_ocean, nbgp )
-                  CALL exchange_horiz( prho, nbgp )
-                ENDIF
-                IF ( humidity )  THEN
-                   CALL exchange_horiz( q_p, nbgp )
-                   IF ( cloud_physics .AND. microphysics_seifert )  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.  collision_turbulence  .OR.             &
-                     use_sgs_for_particles )  THEN
-                   CALL exchange_horiz( diss, nbgp )
-                ENDIF
-                IF ( passive_scalar )  CALL exchange_horiz( s_p, 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
 
@@ -699,52 +547,36 @@
 !
 !--       Exchange of ghost points (lateral boundary conditions)
-          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_ocean, nbgp )
-                CALL exchange_horiz( prho, nbgp )
-             ENDIF
-             IF ( humidity )  THEN
-                CALL exchange_horiz( q_p, nbgp )
-                IF ( cloud_physics .AND. microphysics_seifert )  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.  collision_turbulence  .OR.                &
-                  use_sgs_for_particles )  THEN
-                CALL exchange_horiz( diss, nbgp )
-             ENDIF
-             IF ( passive_scalar )  CALL exchange_horiz( s_p, 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
+          CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' )
+
+          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_ocean, nbgp )
+             CALL exchange_horiz( prho, nbgp )
+          ENDIF
+          IF ( humidity )  THEN
+             CALL exchange_horiz( q_p, nbgp )
+             IF ( cloud_physics .AND. microphysics_seifert )  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.  collision_turbulence  .OR.                &
+               use_sgs_for_particles )  THEN
+             CALL exchange_horiz( diss, nbgp )
+          ENDIF
+          IF ( passive_scalar )  CALL exchange_horiz( s_p, nbgp )
+
+          CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
 
 !
@@ -821,6 +653,4 @@
              time_disturb = time_disturb + dt_3d
              IF ( time_disturb >= dt_disturb )  THEN
-                !$acc update host( u, v )
-                IF ( numprocs == 1 )  on_device = .FALSE.  ! workaround, remove later
                 IF ( disturbance_energy_limit /= 0.0_wp  .AND.                 &
                      hom(nzb+5,1,pr_palm,0) < disturbance_energy_limit )  THEN
@@ -836,6 +666,4 @@
                    dist_range = 0
                 ENDIF
-                IF ( numprocs == 1 )  on_device = .TRUE.  ! workaround, remove later
-                !$acc update device( u, v )
                 time_disturb = time_disturb - dt_disturb
              ENDIF
@@ -854,5 +682,4 @@
           IF ( cloud_physics )  THEN
              CALL calc_liquid_water_content
-             !$acc update device( ql )
           ENDIF
 ! 
@@ -860,5 +687,4 @@
           IF ( humidity )  THEN 
              CALL compute_vpt 
-             !$acc update device( vpt ) 
           ENDIF 
 
Index: /palm/trunk/SOURCE/timestep.f90
===================================================================
--- /palm/trunk/SOURCE/timestep.f90	(revision 2117)
+++ /palm/trunk/SOURCE/timestep.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! OpenACC directives and related part of code removed
 ! 
 ! Former revisions:
@@ -182,5 +182,4 @@
           u_gtrans_l = 0.0_wp
           v_gtrans_l = 0.0_wp
-          !$acc parallel present( u, v )
           DO  i = nxl, nxr
              DO  j = nys, nyn
@@ -191,5 +190,4 @@
              ENDDO
           ENDDO
-          !$acc end parallel
           uv_gtrans_l(1) = u_gtrans_l / REAL( (nxr-nxl+1)*(nyn-nys+1)*(nzt-nzb), KIND=wp )
           uv_gtrans_l(2) = v_gtrans_l / REAL( (nxr-nxl+1)*(nyn-nys+1)*(nzt-nzb), KIND=wp )
@@ -210,62 +208,4 @@
 !-- Determine the maxima of the velocity components, including their
 !-- grid index positions.
-#if defined( __openacc )
-    IF ( dt_fixed )  THEN  ! otherwise do it further below for better cache usage
-       u_max_l = -999999.9_wp
-       u_min_l =  999999.9_wp
-       v_max_l = -999999.9_wp
-       v_min_l =  999999.9_wp
-       w_max_l = -999999.9_wp
-       w_min_l =  999999.9_wp
-       !$acc parallel present( u, v, w )
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
-             DO  k = nzb+1, nzt
-                u_max_l = MAX( u_max_l, u(k,j,i) )
-                u_min_l = MIN( u_min_l, u(k,j,i) )
-                v_max_l = MAX( v_max_l, v(k,j,i) )
-                v_min_l = MIN( v_min_l, v(k,j,i) )
-                w_max_l = MAX( w_max_l, w(k,j,i) )
-                w_min_l = MIN( w_min_l, w(k,j,i) )
-             ENDDO
-          ENDDO
-       ENDDO
-       !$acc end parallel
-#if defined( __parallel )
-       reduce_l(1) = u_max_l
-       reduce_l(2) = v_max_l
-       reduce_l(3) = w_max_l
-       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MAX, comm2d, ierr )
-       u_max = reduce(1)
-       v_max = reduce(2)
-       w_max = reduce(3)
-       reduce_l(1) = u_min_l
-       reduce_l(2) = v_min_l
-       reduce_l(3) = w_min_l
-       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MIN, comm2d, ierr )
-       IF ( ABS( reduce(1) ) > u_max )  u_max = reduce(1)
-       IF ( ABS( reduce(2) ) > v_max )  v_max = reduce(2)
-       IF ( ABS( reduce(3) ) > w_max )  w_max = reduce(3)
-#else
-       IF ( ABS( u_min_l ) > u_max_l )  THEN
-          u_max = u_min_l
-       ELSE
-          u_max = u_max_l
-       ENDIF
-       IF ( ABS( v_min_l ) > v_max_l )  THEN
-          v_max = v_min_l
-       ELSE
-          v_max = v_max_l
-       ENDIF
-       IF ( ABS( w_min_l ) > w_max_l )  THEN
-          w_max = w_min_l
-       ELSE
-          w_max = w_max_l
-       ENDIF
-#endif
-    ENDIF
-#else
     CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, u, 'abs', 0.0_wp, &
                          u_max, u_max_ijk )
@@ -274,88 +214,6 @@
     CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, w, 'abs', 0.0_wp, &
                          w_max, w_max_ijk )
-#endif
 
     IF ( .NOT. dt_fixed )  THEN
-#if defined( __openacc )
-!
-!--    Variable time step:
-!--    Calculate the maximum time step according to the CFL-criterion,
-!--    individually for each velocity component
-       dt_u_l  =  999999.9_wp
-       dt_v_l  =  999999.9_wp
-       dt_w_l  =  999999.9_wp
-       u_max_l = -999999.9_wp
-       u_min_l =  999999.9_wp
-       v_max_l = -999999.9_wp
-       v_min_l =  999999.9_wp
-       w_max_l = -999999.9_wp
-       w_min_l =  999999.9_wp
-       !$acc parallel loop collapse(3) present( u, v, w )
-       DO  i = nxl, nxr
-          DO  j = nys, nyn
-             DO  k = nzb+1, nzt
-                dt_u_l  = MIN( dt_u_l, ( dx     / ( ABS( u(k,j,i) - u_gtrans ) + 1.0E-10_wp ) ) )
-                dt_v_l  = MIN( dt_v_l, ( dy     / ( ABS( v(k,j,i) - v_gtrans ) + 1.0E-10_wp ) ) )
-                dt_w_l  = MIN( dt_w_l, ( dzu(k) / ( ABS( w(k,j,i) )            + 1.0E-10_wp ) ) )
-                u_max_l = MAX( u_max_l, u(k,j,i) )
-                u_min_l = MIN( u_min_l, u(k,j,i) )
-                v_max_l = MAX( v_max_l, v(k,j,i) )
-                v_min_l = MIN( v_min_l, v(k,j,i) )
-                w_max_l = MAX( w_max_l, w(k,j,i) )
-                w_min_l = MIN( w_min_l, w(k,j,i) )
-             ENDDO
-          ENDDO
-       ENDDO
-       !$acc end parallel
-
-#if defined( __parallel )
-       reduce_l(1) = dt_u_l
-       reduce_l(2) = dt_v_l
-       reduce_l(3) = dt_w_l
-       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MIN, comm2d, ierr )
-       dt_u = reduce(1)
-       dt_v = reduce(2)
-       dt_w = reduce(3)
-
-       reduce_l(1) = u_max_l
-       reduce_l(2) = v_max_l
-       reduce_l(3) = w_max_l
-       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MAX, comm2d, ierr )
-       u_max = reduce(1)
-       v_max = reduce(2)
-       w_max = reduce(3)
-       reduce_l(1) = u_min_l
-       reduce_l(2) = v_min_l
-       reduce_l(3) = w_min_l
-       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( reduce_l, reduce, 3, MPI_REAL, MPI_MIN, comm2d, ierr )
-       IF ( ABS( reduce(1) ) > u_max )  u_max = reduce(1)
-       IF ( ABS( reduce(2) ) > v_max )  v_max = reduce(2)
-       IF ( ABS( reduce(3) ) > w_max )  w_max = reduce(3)
-#else
-       dt_u = dt_u_l
-       dt_v = dt_v_l
-       dt_w = dt_w_l
-
-       IF ( ABS( u_min_l ) > u_max_l )  THEN
-          u_max = u_min_l
-       ELSE
-          u_max = u_max_l
-       ENDIF
-       IF ( ABS( v_min_l ) > v_max_l )  THEN
-          v_max = v_min_l
-       ELSE
-          v_max = v_max_l
-       ENDIF
-       IF ( ABS( w_min_l ) > w_max_l )  THEN
-          w_max = w_min_l
-       ELSE
-          w_max = w_max_l
-       ENDIF
-#endif
-
-#else
 !
 !--    Variable time step:
@@ -390,6 +248,4 @@
 #endif
 
-#endif
-
 !
 !--    Compute time step according to the diffusion criterion.
@@ -404,7 +260,6 @@
        ENDDO
 
-!$OMP PARALLEL private(i,j,k,value) reduction(MIN: dt_diff_l)
-!$OMP DO
-       !$acc parallel loop collapse(3) present( kh, km )
+       !$OMP PARALLEL private(i,j,k,value) reduction(MIN: dt_diff_l)
+       !$OMP DO
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -415,6 +270,5 @@
           ENDDO
        ENDDO
-       !$acc end parallel
-!$OMP END PARALLEL 
+       !$OMP END PARALLEL
 #if defined( __parallel )
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
Index: /palm/trunk/SOURCE/transpose.f90
===================================================================
--- /palm/trunk/SOURCE/transpose.f90	(revision 2117)
+++ /palm/trunk/SOURCE/transpose.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC directives removed
 ! 
 ! Former revisions:
@@ -107,5 +107,4 @@
     !$OMP  PARALLEL PRIVATE ( i, j, k )
     !$OMP  DO
-    !$acc kernels present( f_in, f_inv )
      DO  i = 0, nx
          DO  k = nzb_x, nzt_x
@@ -115,5 +114,4 @@
          ENDDO
      ENDDO
-     !$acc end kernels
      !$OMP  END PARALLEL
 
@@ -165,5 +163,4 @@
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'start', cpu_log_nowait )
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       !$acc update host( f_inv )
        CALL MPI_ALLTOALL( f_inv(nys_x,nzb_x,0),  sendrecvcount_xy, MPI_REAL, &
                           work(1,nzb_y,nxl_y,0), sendrecvcount_xy, MPI_REAL, &
@@ -175,8 +172,6 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k, l, ys )
 !$OMP  DO
-       !$acc data copyin( work )
        DO  l = 0, pdims(2) - 1
           ys = 0 + l * ( nyn_x - nys_x + 1 )
-          !$acc kernels present( f_out, work )
           DO  i = nxl_y, nxr_y
              DO  k = nzb_y, nzt_y
@@ -186,7 +181,5 @@
              ENDDO
           ENDDO
-          !$acc end kernels
-       ENDDO
-       !$acc end data
+       ENDDO
 !$OMP  END PARALLEL
 #endif
@@ -198,5 +191,4 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k )
 !$OMP  DO
-       !$acc kernels present( f_inv, f_out )
        DO  k = nzb_y, nzt_y
           DO  i = nxl_y, nxr_y
@@ -206,5 +198,4 @@
           ENDDO
        ENDDO
-       !$acc end kernels
 !$OMP  END PARALLEL
 
@@ -243,5 +234,4 @@
     !$OMP  PARALLEL PRIVATE ( i, j, k )
     !$OMP  DO
-    !$acc kernels present( f_inv, f_out )
      DO  k = 1, nz
          DO  i = nxl, nxr
@@ -251,5 +241,4 @@
          ENDDO
      ENDDO
-     !$acc end kernels
      !$OMP  END PARALLEL
 
@@ -304,8 +293,6 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k, l, xs )
 !$OMP  DO
-       !$acc data copyout( work )
        DO  l = 0, pdims(1) - 1
           xs = 0 + l * nnx
-          !$acc kernels present( f_in, work )
           DO  k = nzb_x, nzt_x
              DO  i = xs, xs + nnx - 1
@@ -315,7 +302,5 @@
              ENDDO
           ENDDO
-          !$acc end kernels
-       ENDDO
-       !$acc end data
+       ENDDO
 !$OMP  END PARALLEL
 
@@ -327,5 +312,4 @@
                           f_inv(nys,nxl,1),      sendrecvcount_zx, MPI_REAL, &
                           comm1dx, ierr )
-       !$acc update device( f_inv )
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'stop' )
 #endif
@@ -337,5 +321,4 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k )
 !$OMP  DO
-       !$acc kernels present( f_in, f_inv )
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -345,5 +328,4 @@
           ENDDO
        ENDDO
-       !$acc end kernels
 !$OMP  END PARALLEL
 
@@ -384,5 +366,4 @@
     !$OMP  PARALLEL PRIVATE ( i, j, k )
     !$OMP  DO
-    !$acc kernels present( f_inv, f_out )
      DO  i = 0, nx
          DO  k = nzb_x, nzt_x
@@ -392,5 +373,4 @@
          ENDDO
      ENDDO
-     !$acc end kernels
      !$OMP  END PARALLEL
 
@@ -442,8 +422,6 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k, l, ys )
 !$OMP  DO
-       !$acc data copyout( work )
        DO  l = 0, pdims(2) - 1
           ys = 0 + l * ( nyn_x - nys_x + 1 )
-          !$acc kernels present( f_in, work )
           DO  i = nxl_y, nxr_y
              DO  k = nzb_y, nzt_y
@@ -453,7 +431,5 @@
              ENDDO
           ENDDO
-          !$acc end kernels
-       ENDDO
-       !$acc end data
+       ENDDO
 !$OMP  END PARALLEL
 
@@ -465,5 +441,4 @@
                           f_inv(nys_x,nzb_x,0),  sendrecvcount_xy, MPI_REAL, &
                           comm1dy, ierr )
-       !$acc update device( f_inv )
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'stop' )
 #endif
@@ -475,5 +450,4 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k )
 !$OMP  DO
-       !$acc kernels present( f_in, f_inv )
        DO  i = nxl_y, nxr_y
           DO  k = nzb_y, nzt_y
@@ -483,5 +457,4 @@
           ENDDO
        ENDDO
-       !$acc end kernels
 !$OMP  END PARALLEL
 
@@ -602,5 +575,4 @@
     !$OMP  PARALLEL PRIVATE ( i, j, k )
     !$OMP  DO
-    !$acc kernels present( f_in, f_inv )
      DO  j = 0, ny
          DO  k = nzb_y, nzt_y
@@ -610,5 +582,4 @@
          ENDDO
      ENDDO
-     !$acc end kernels
      !$OMP  END PARALLEL
 
@@ -660,5 +631,4 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k )
 !$OMP  DO
-       !$acc kernels present( f_inv, f_out )
        DO  j = 0, ny
           DO  k = nzb_y, nzt_y
@@ -668,5 +638,4 @@
           ENDDO
        ENDDO
-       !$acc end kernels
 !$OMP  END PARALLEL
 
@@ -678,5 +647,4 @@
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'start', cpu_log_nowait )
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       !$acc update host( f_inv )
        CALL MPI_ALLTOALL( f_inv(nxl_y,nzb_y,0),  sendrecvcount_yz, MPI_REAL, &
                           work(nxl_z,1,nys_z,0), sendrecvcount_yz, MPI_REAL, &
@@ -688,8 +656,6 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k, l, zs )
 !$OMP  DO
-       !$acc data copyin( work )
        DO  l = 0, pdims(1) - 1
           zs = 1 + l * ( nzt_y - nzb_y + 1 )
-          !$acc kernels present( f_out )
           DO  j = nys_z, nyn_z
              DO  k = zs, zs + nzt_y - nzb_y
@@ -699,7 +665,5 @@
              ENDDO
           ENDDO
-          !$acc end kernels
-       ENDDO
-       !$acc end data
+       ENDDO
 !$OMP  END PARALLEL
 #endif
@@ -738,5 +702,4 @@
     !$OMP  PARALLEL PRIVATE ( i, j, k )
     !$OMP  DO
-    !$acc kernels present( f_in, f_inv )
      DO  k = 1,nz
          DO  i = nxl, nxr
@@ -746,5 +709,4 @@
          ENDDO
      ENDDO
-     !$acc end kernels
      !$OMP  END PARALLEL
 
@@ -796,5 +758,4 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k )
 !$OMP  DO
-       !$acc kernels present( f_inv, f_out )
        DO  k = 1, nz
           DO  i = nxl, nxr
@@ -804,5 +765,4 @@
           ENDDO
        ENDDO
-       !$acc end kernels
 !$OMP  END PARALLEL
 
@@ -814,5 +774,4 @@
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'start', cpu_log_nowait )
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       !$acc update host( f_inv )
        CALL MPI_ALLTOALL( f_inv(nys,nxl,1),      sendrecvcount_zx, MPI_REAL, &
                           work(nys_x,1,nzb_x,0), sendrecvcount_zx, MPI_REAL, &
@@ -824,8 +783,6 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k, l, xs )
 !$OMP  DO
-       !$acc data copyin( work )
        DO  l = 0, pdims(1) - 1
           xs = 0 + l * nnx
-          !$acc kernels present( f_out )
           DO  k = nzb_x, nzt_x
              DO  i = xs, xs + nnx - 1
@@ -835,7 +792,5 @@
              ENDDO
           ENDDO
-          !$acc end kernels
-       ENDDO
-       !$acc end data
+       ENDDO
 !$OMP  END PARALLEL
 #endif
@@ -878,5 +833,4 @@
     !$OMP  PARALLEL PRIVATE ( i, j, k )
     !$OMP  DO
-    !$acc kernels present( f_inv, f_out )
      DO  k = nzb_y, nzt_y
          DO  j = 0, ny
@@ -886,5 +840,4 @@
          ENDDO
      ENDDO
-     !$acc end kernels
      !$OMP  END PARALLEL
 
@@ -938,8 +891,6 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k, l, zs )
 !$OMP  DO
-       !$acc data copyout( work )
        DO  l = 0, pdims(1) - 1
           zs = 1 + l * ( nzt_y - nzb_y + 1 )
-          !$acc kernels present( f_in, work )
           DO  j = nys_z, nyn_z
              DO  k = zs, zs + nzt_y - nzb_y
@@ -949,7 +900,5 @@
              ENDDO
           ENDDO
-          !$acc end kernels
-       ENDDO
-       !$acc end data
+       ENDDO
 !$OMP  END PARALLEL
 
@@ -961,5 +910,4 @@
                           f_inv(nxl_y,nzb_y,0),  sendrecvcount_yz, MPI_REAL, &
                           comm1dx, ierr )
-       !$acc update device( f_inv )
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'stop' )
 #endif
@@ -970,5 +918,4 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k )
 !$OMP  DO
-       !$acc kernels present( f_in, f_inv )
        DO  k = nzb_y, nzt_y
           DO  j = 0, ny
@@ -978,5 +925,4 @@
           ENDDO
        ENDDO
-       !$acc end kernels
 !$OMP  END PARALLEL
 
Index: /palm/trunk/SOURCE/tridia_solver_mod.f90
===================================================================
--- /palm/trunk/SOURCE/tridia_solver_mod.f90	(revision 2117)
+++ /palm/trunk/SOURCE/tridia_solver_mod.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! OpenACC directives removed
 ! 
 ! Former revisions:
@@ -195,5 +195,4 @@
 
           REAL(wp)    ::  ll(nxl_z:nxr_z,nys_z:nyn_z) !< 
-          !$acc declare create( ll )
 
 
@@ -201,5 +200,4 @@
           nnyh = ( ny + 1 ) / 2
 
-          !$acc kernels present( tric )
           DO  j = nys_z, nyn_z
              DO  i = nxl_z, nxr_z
@@ -239,8 +237,6 @@
              ENDDO
           ENDDO
-          !$acc end kernels
 
           IF ( ibc_p_b == 1 )  THEN
-             !$acc kernels present( tric )
              DO  j = nys_z, nyn_z
                 DO  i = nxl_z, nxr_z
@@ -248,8 +244,6 @@
                 ENDDO
              ENDDO
-             !$acc end kernels
           ENDIF
           IF ( ibc_p_t == 1 )  THEN
-             !$acc kernels present( tric )
              DO  j = nys_z, nyn_z
                 DO  i = nxl_z, nxr_z
@@ -257,5 +251,4 @@
                 ENDDO
              ENDDO
-             !$acc end kernels
           ENDIF
 
@@ -288,10 +281,8 @@
 
           REAL(wp), DIMENSION(nxl_z:nxr_z,nys_z:nyn_z,0:nz-1)   ::  ar1 !< 
-          !$acc declare create( ar1 )
 
 !
 !--       Forward substitution
           DO  k = 0, nz - 1
-             !$acc kernels present( ar, tri )
              DO  j = nys_z, nyn_z
                 DO  i = nxl_z, nxr_z
@@ -305,5 +296,4 @@
                 ENDDO
              ENDDO
-             !$acc end kernels
           ENDDO
 
@@ -314,5 +304,4 @@
 !--       the model domain.
           DO  k = nz-1, 0, -1
-             !$acc kernels present( ar, tri )
              DO  j = nys_z, nyn_z
                 DO  i = nxl_z, nxr_z
@@ -326,5 +315,4 @@
                 ENDDO
              ENDDO
-             !$acc end kernels
           ENDDO
 
@@ -335,9 +323,7 @@
           IF ( ibc_p_b == 1  .AND.  ibc_p_t == 1 )  THEN
              IF ( nys_z == 0  .AND.  nxl_z == 0 )  THEN
-                !$acc kernels loop present( ar )
                 DO  k = 1, nz
                    ar(nxl_z,nys_z,k) = 0.0_wp
                 ENDDO
-                !$acc end kernels loop
              ENDIF
           ENDIF
@@ -372,11 +358,8 @@
 
           REAL(wp), DIMENSION(nxl_z:nxr_z,nys_z:nyn_z,0:nz-1) ::  ar1 !<
-          !$acc declare create( ar1 )
 
 !
 !--       Forward substitution
           DO  k = 0, nz - 1
-             !$acc kernels present( ar, tri )
-             !$acc loop
              DO  j = nys_z, nyn_z
                 DO  i = nxl_z, nxr_z
@@ -390,5 +373,4 @@
                 ENDDO
              ENDDO
-             !$acc end kernels
           ENDDO
 
@@ -399,6 +381,4 @@
 !--       the model domain.
           DO  k = nz-1, 0, -1
-             !$acc kernels present( ar, tri )
-             !$acc loop
              DO  j = nys_z, nyn_z
                 DO  i = nxl_z, nxr_z
@@ -412,5 +392,4 @@
                 ENDDO
              ENDDO
-             !$acc end kernels
           ENDDO
 
@@ -421,5 +400,4 @@
           IF ( ibc_p_b == 1  .AND.  ibc_p_t == 1 )  THEN
              IF ( nys_z == 0  .AND.  nxl_z == 0 )  THEN
-                !$acc kernels loop present( ar )
                 DO  k = 1, nz
                    ar(nxl_z,nys_z,k) = 0.0_wp
@@ -451,19 +429,12 @@
 !
 !--       Splitting
-          !$acc kernels present( tri, tric )
-          !$acc loop
           DO  j = nys_z, nyn_z
-             !$acc loop vector( 32 )
              DO  i = nxl_z, nxr_z
                 tri(i,j,0,1) = tric(i,j,0)
              ENDDO
           ENDDO
-          !$acc end kernels
 
           DO  k = 1, nz-1
-             !$acc kernels present( tri, tric )
-             !$acc loop
-             DO  j = nys_z, nyn_z
-                !$acc loop vector( 32 )
+             DO  j = nys_z, nyn_z
                 DO  i = nxl_z, nxr_z
                    tri(i,j,k,2) = ddzuw(k,1) / tri(i,j,k-1,1)
@@ -471,5 +442,4 @@
                 ENDDO
              ENDDO
-             !$acc end kernels
           ENDDO
 
Index: /palm/trunk/SOURCE/wall_fluxes.f90
===================================================================
--- /palm/trunk/SOURCE/wall_fluxes.f90	(revision 2117)
+++ /palm/trunk/SOURCE/wall_fluxes.f90	(revision 2118)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! OpenACC versions of subroutines removed
 ! 
 ! Former revisions:
@@ -90,5 +90,5 @@
  
     PRIVATE
-    PUBLIC wall_fluxes, wall_fluxes_acc, wall_fluxes_e, wall_fluxes_e_acc
+    PUBLIC wall_fluxes, wall_fluxes_e
     
     INTERFACE wall_fluxes
@@ -97,8 +97,4 @@
     END INTERFACE wall_fluxes
     
-    INTERFACE wall_fluxes_acc
-       MODULE PROCEDURE wall_fluxes_acc
-    END INTERFACE wall_fluxes_acc
-
     INTERFACE wall_fluxes_e
        MODULE PROCEDURE wall_fluxes_e
@@ -106,8 +102,4 @@
     END INTERFACE wall_fluxes_e
  
-    INTERFACE wall_fluxes_e_acc
-       MODULE PROCEDURE wall_fluxes_e_acc
-    END INTERFACE wall_fluxes_e_acc
-
  CONTAINS
 
@@ -299,8 +291,7 @@
 ! Description:
 ! ------------
-!> Call for all grid points - accelerator version
-!------------------------------------------------------------------------------!
-    SUBROUTINE wall_fluxes_acc( wall_flux, a, b, c1, c2, nzb_uvw_inner,        &
-                                nzb_uvw_outer, wall )
+!> Call for all grid point i,j
+!------------------------------------------------------------------------------!
+    SUBROUTINE wall_fluxes_ij( i, j, nzb_w, nzt_w, wall_flux, a, b, c1, c2 )
 
        USE arrays_3d,                                                          &
@@ -314,6 +305,5 @@
        
        USE indices,                                                            &
-           ONLY:  i_left, i_right, j_north, j_south, nxl, nxlg, nxr, nxrg,     &
-                  nyn, nyng, nys, nysg, nzb, nzt
+           ONLY:  nzb, nzt
        
        USE kinds
@@ -327,14 +317,7 @@
        INTEGER(iwp) ::  j            !< 
        INTEGER(iwp) ::  k            !< 
-       INTEGER(iwp) ::  max_outer    !< 
-       INTEGER(iwp) ::  min_inner    !< 
+       INTEGER(iwp) ::  nzb_w        !< 
+       INTEGER(iwp) ::  nzt_w        !< 
        INTEGER(iwp) ::  wall_index   !< 
-
-       INTEGER(iwp),                                                           &
-          DIMENSION(nysg:nyng,nxlg:nxrg) ::                                    &
-             nzb_uvw_inner   !< 
-       INTEGER(iwp),                                                           &
-          DIMENSION(nysg:nyng,nxlg:nxrg) ::                                    &
-             nzb_uvw_outer   !< 
        
        REAL(wp) ::  a           !< 
@@ -355,190 +338,4 @@
        REAL(wp) ::  wspts       !< 
 
-       REAL(wp),                                                               &
-          DIMENSION(nysg:nyng,nxlg:nxrg) ::                                    &
-             wall   !< 
-       
-       REAL(wp),                                                               &
-          DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::                              &
-             wall_flux   !< 
-
-
-       zp         = 0.5_wp * ( (a+c1) * dy + (b+c2) * dx )
-       wall_flux  = 0.0_wp
-       wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 )
-
-       min_inner = MINVAL( nzb_uvw_inner(nys:nyn,nxl:nxr) ) + 1
-       max_outer = MINVAL( nzb_uvw_outer(nys:nyn,nxl:nxr) )
-
-       !$acc kernels present( hom, nzb_uvw_inner, nzb_uvw_outer, pt, rif_wall ) &
-       !$acc         present( u, v, w, wall, wall_flux, z0 )
-       !$acc loop independent
-       DO  i = i_left, i_right
-          DO  j = j_south, j_north
-
-             IF ( wall(j,i) /= 0.0_wp )  THEN
-!
-!--             All subsequent variables are computed for the respective
-!--             location where the respective flux is defined.
-                !$acc loop independent
-                DO  k = nzb_uvw_inner(j,i)+1, nzb_uvw_outer(j,i)
-
-!
-!--                (1) Compute rifs, u_i, v_i, ws, pt' and w'pt'
-                   rifs  = rif_wall(k,j,i,wall_index)
-
-                   u_i   = a * u(k,j,i) + c1 * 0.25_wp *                       &
-                           ( u(k+1,j,i+1) + u(k+1,j,i) + u(k,j,i+1) + u(k,j,i) )
-
-                   v_i   = b * v(k,j,i) + c2 * 0.25_wp *                       &
-                           ( v(k+1,j+1,i) + v(k+1,j,i) + v(k,j+1,i) + v(k,j,i) )
-
-                   ws    = ( c1 + c2 ) * w(k,j,i) + 0.25_wp * (                &
-                     a * ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + w(k,j,i) ) &
-                   + b * ( w(k-1,j-1,i) + w(k-1,j,i) + w(k,j-1,i) + w(k,j,i) ) &
-                                                              )
-                   pt_i  = 0.5_wp * ( pt(k,j,i) + a *  pt(k,j,i-1) +           &
-                                   b * pt(k,j-1,i) + ( c1 + c2 ) * pt(k+1,j,i) )
-
-                   pts   = pt_i - hom(k,1,4,0)
-                   wspts = ws * pts
-
-!
-!--                (2) Compute wall-parallel absolute velocity vel_total
-                   vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 )
-
-!
-!--                (3) Compute wall friction velocity us_wall
-                   IF ( rifs >= 0.0_wp )  THEN
-
-!
-!--                   Stable stratification (and neutral)
-                      us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) +    &
-                                         5.0_wp * rifs * ( zp - z0(j,i) ) / zp &
-                                                    )
-                   ELSE
-
-!
-!--                   Unstable stratification
-                      h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
-                      h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
-
-                      us_wall = kappa * vel_total / (                          &
-                           LOG( zp / z0(j,i) ) -                               &
-                           LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (    &
-                                ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +&
-                                2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )           &
-                                                    )
-                   ENDIF
-
-!
-!--                (4) Compute zp/L (corresponds to neutral Richardson flux
-!--                    number rifs)
-                   rifs = -1.0_wp * zp * kappa * g * wspts /                   &
-                          ( pt_i * ( us_wall**3 + 1E-30 ) )
-
-!
-!--                Limit the value range of the Richardson numbers.
-!--                This is necessary for very small velocities (u,w --> 0),
-!--                because the absolute value of rif can then become very
-!--                large, which in consequence would result in very large
-!--                shear stresses and very small momentum fluxes (both are
-!--                generally unrealistic).
-                   IF ( rifs < zeta_min )  rifs = zeta_min
-                   IF ( rifs > zeta_max )  rifs = zeta_max
-
-!
-!--                (5) Compute wall_flux (u'v', v'u', w'v', or w'u')
-                   IF ( rifs >= 0.0_wp )  THEN
-
-!
-!--                   Stable stratification (and neutral)
-                      wall_flux(k,j,i) = kappa *                               &
-                              ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / &
-                              (  LOG( zp / z0(j,i) ) +                         &
-                                 5.0_wp * rifs * ( zp - z0(j,i) ) / zp         &
-                              )
-                   ELSE
-
-!
-!--                   Unstable stratification
-                      h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
-                      h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
-
-                      wall_flux(k,j,i) = kappa *                               &
-                           ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / (  &
-                           LOG( zp / z0(j,i) ) -                               &
-                           LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (    &
-                                ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +&
-                                2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )           &
-                                                                            )
-                   ENDIF
-                   wall_flux(k,j,i) = -wall_flux(k,j,i) * us_wall
-
-!
-!--                store rifs for next time step
-                   rif_wall(k,j,i,wall_index) = rifs
-
-                ENDDO
-
-             ENDIF
-
-          ENDDO
-       ENDDO
-       !$acc end kernels
-
-    END SUBROUTINE wall_fluxes_acc
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Call for all grid point i,j
-!------------------------------------------------------------------------------!
-    SUBROUTINE wall_fluxes_ij( i, j, nzb_w, nzt_w, wall_flux, a, b, c1, c2 )
-
-       USE arrays_3d,                                                          &
-           ONLY:  rif_wall, pt, u, v, w, z0
-       
-       USE control_parameters,                                                 &
-           ONLY:  g, kappa, zeta_max, zeta_min
-       
-       USE grid_variables,                                                     &
-           ONLY:  dx, dy
-       
-       USE indices,                                                            &
-           ONLY:  nzb, nzt
-       
-       USE kinds
-       
-       USE statistics,                                                         &
-           ONLY:  hom
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i            !< 
-       INTEGER(iwp) ::  j            !< 
-       INTEGER(iwp) ::  k            !< 
-       INTEGER(iwp) ::  nzb_w        !< 
-       INTEGER(iwp) ::  nzt_w        !< 
-       INTEGER(iwp) ::  wall_index   !< 
-       
-       REAL(wp) ::  a           !< 
-       REAL(wp) ::  b           !< 
-       REAL(wp) ::  c1          !< 
-       REAL(wp) ::  c2          !< 
-       REAL(wp) ::  h1          !< 
-       REAL(wp) ::  h2          !< 
-       REAL(wp) ::  zp          !< 
-       REAL(wp) ::  pts         !< 
-       REAL(wp) ::  pt_i        !< 
-       REAL(wp) ::  rifs        !< 
-       REAL(wp) ::  u_i         !< 
-       REAL(wp) ::  v_i         !< 
-       REAL(wp) ::  us_wall     !< 
-       REAL(wp) ::  vel_total   !< 
-       REAL(wp) ::  ws          !< 
-       REAL(wp) ::  wspts       !< 
-
        REAL(wp), DIMENSION(nzb:nzt+1) ::  wall_flux   !< 
 
@@ -811,11 +608,7 @@
 ! Description:
 ! ------------
-!> Call for all grid points - accelerator version
-!> Calculates momentum fluxes at vertical walls for routine production_e
-!> assuming Monin-Obukhov similarity.
-!> Indices: usvs a=1, vsus b=1, wsvs c1=1, wsus c2=1 (other=0).
-!------------------------------------------------------------------------------!
-    SUBROUTINE wall_fluxes_e_acc( wall_flux, a, b, c1, c2, wall )
-
+!> Call for grid point i,j
+!------------------------------------------------------------------------------!
+    SUBROUTINE wall_fluxes_e_ij( i, j, nzb_w, nzt_w, wall_flux, a, b, c1, c2 )
 
        USE arrays_3d,                                                          &
@@ -829,7 +622,5 @@
        
        USE indices,                                                            &
-           ONLY:  i_left, i_right, j_north, j_south, nxl, nxlg, nxr, nxrg,     &
-                  nyn, nyng, nys, nysg, nzb, nzb_diff_s_inner,                 &
-                  nzb_diff_s_outer, nzt
+           ONLY:  nzb, nzt
        
        USE kinds
@@ -841,6 +632,6 @@
        INTEGER(iwp) ::  k            !< 
        INTEGER(iwp) ::  kk           !< 
-       INTEGER(iwp) ::  max_outer    !< 
-       INTEGER(iwp) ::  min_inner    !< 
+       INTEGER(iwp) ::  nzb_w        !< 
+       INTEGER(iwp) ::  nzt_w        !< 
        INTEGER(iwp) ::  wall_index   !< 
        
@@ -860,162 +651,4 @@
        REAL(wp) ::  rifs        !< 
 
-       REAL(wp),                                                               &
-          DIMENSION(nysg:nyng,nxlg:nxrg) ::                                    &
-             wall   !< 
-       
-       REAL(wp),                                                               &
-          DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::                              &
-             wall_flux   !< 
-
-
-       zp         = 0.5_wp * ( (a+c1) * dy + (b+c2) * dx )
-       wall_flux  = 0.0_wp
-       wall_index = NINT( a+ 2*b + 3*c1 + 4*c2 )
-
-       min_inner = MINVAL( nzb_diff_s_inner(nys:nyn,nxl:nxr) ) - 1
-       max_outer = MAXVAL( nzb_diff_s_outer(nys:nyn,nxl:nxr) ) - 2
-
-       !$acc kernels present( nzb_diff_s_inner, nzb_diff_s_outer, rif_wall )   &
-       !$acc         present( u, v, w, wall, wall_flux, z0 )
-       DO  i = i_left, i_right
-          DO  j = j_south, j_north
-             DO  k = min_inner, max_outer
-!
-!--             All subsequent variables are computed for scalar locations
-                IF ( k >= nzb_diff_s_inner(j,i)-1  .AND.                       &
-                     k <= nzb_diff_s_outer(j,i)-2  .AND.                       &
-                     wall(j,i) /= 0.0_wp )         THEN
-!
-!--                (1) Compute rifs, u_i, v_i, and ws
-                   IF ( k == nzb_diff_s_inner(j,i)-1 )  THEN
-                      kk = nzb_diff_s_inner(j,i)-1
-                   ELSE
-                      kk = k-1
-                   ENDIF
-                   rifs  = 0.5_wp * (      rif_wall(k,j,i,wall_index) +        &
-                                      a  * rif_wall(k,j,i+1,1)        +        &
-                                      b  * rif_wall(k,j+1,i,2)        +        &
-                                      c1 * rif_wall(kk,j,i,3)         +        &
-                                      c2 * rif_wall(kk,j,i,4)                  &
-                                    )
-
-                   u_i   = 0.5_wp * ( u(k,j,i) + u(k,j,i+1) )
-                   v_i   = 0.5_wp * ( v(k,j,i) + v(k,j+1,i) )
-                   ws    = 0.5_wp * ( w(k,j,i) + w(k-1,j,i) )
-!
-!--                (2) Compute wall-parallel absolute velocity vel_total and
-!--                interpolate appropriate velocity component vel_zp.
-                   vel_total = SQRT( ws**2 + (a+c1) * u_i**2 + (b+c2) * v_i**2 )
-                   vel_zp    = 0.5_wp * ( a * u_i + b * v_i + (c1+c2) * ws )
-!
-!--                (3) Compute wall friction velocity us_wall
-                   IF ( rifs >= 0.0_wp )  THEN
-
-!
-!--                   Stable stratification (and neutral)
-                      us_wall = kappa * vel_total / ( LOG( zp / z0(j,i) ) +    &
-                                         5.0_wp * rifs * ( zp - z0(j,i) ) / zp &
-                                                    )
-                   ELSE
-
-!
-!--                   Unstable stratification
-                      h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
-                      h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
-
-                      us_wall = kappa * vel_total / (                          &
-                           LOG( zp / z0(j,i) ) -                               &
-                           LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (    &
-                                ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +&
-                                2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )           &
-                                                    )
-                   ENDIF
-
-!
-!--                Skip step (4) of wall_fluxes, because here rifs is already
-!--                available from (1)
-!
-!--                (5) Compute wall_flux (u'v', v'u', w'v', or w'u')
-
-                   IF ( rifs >= 0.0_wp )  THEN
-
-!
-!--                   Stable stratification (and neutral)
-                      wall_flux(k,j,i) = kappa *  vel_zp / (                   &
-                                         LOG( zp/z0(j,i) ) +                   &
-                                         5.0_wp * rifs * ( zp-z0(j,i) ) / zp   &
-                                                           )
-                   ELSE
-
-!
-!--                   Unstable stratification
-                      h1 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs ) )
-                      h2 = SQRT( SQRT( 1.0_wp - 16.0_wp * rifs * z0(j,i) / zp ) )
-
-                      wall_flux(k,j,i) = kappa * vel_zp / (                    &
-                           LOG( zp / z0(j,i) ) -                               &
-                           LOG( ( 1.0_wp + h1 )**2 * ( 1.0_wp + h1**2 ) / (    &
-                                ( 1.0_wp + h2 )**2 * ( 1.0_wp + h2**2 )   ) ) +&
-                                2.0_wp * ( ATAN( h1 ) - ATAN( h2 ) )           &
-                                                          )
-                   ENDIF
-                   wall_flux(k,j,i) = - wall_flux(k,j,i) * us_wall
-
-                ENDIF
-
-             ENDDO
-          ENDDO
-       ENDDO
-       !$acc end kernels
-
-    END SUBROUTINE wall_fluxes_e_acc
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Call for grid point i,j
-!------------------------------------------------------------------------------!
-    SUBROUTINE wall_fluxes_e_ij( i, j, nzb_w, nzt_w, wall_flux, a, b, c1, c2 )
-
-       USE arrays_3d,                                                          &
-           ONLY:  rif_wall, u, v, w, z0
-       
-       USE control_parameters,                                                 &
-           ONLY:  kappa
-       
-       USE grid_variables,                                                     &
-           ONLY:  dx, dy
-       
-       USE indices,                                                            &
-           ONLY:  nzb, nzt
-       
-       USE kinds
-
-       IMPLICIT NONE
-
-       INTEGER(iwp) ::  i            !< 
-       INTEGER(iwp) ::  j            !< 
-       INTEGER(iwp) ::  k            !< 
-       INTEGER(iwp) ::  kk           !< 
-       INTEGER(iwp) ::  nzb_w        !< 
-       INTEGER(iwp) ::  nzt_w        !< 
-       INTEGER(iwp) ::  wall_index   !< 
-       
-       REAL(wp) ::  a           !< 
-       REAL(wp) ::  b           !< 
-       REAL(wp) ::  c1          !< 
-       REAL(wp) ::  c2          !< 
-       REAL(wp) ::  h1          !< 
-       REAL(wp) ::  h2          !< 
-       REAL(wp) ::  u_i         !< 
-       REAL(wp) ::  v_i         !< 
-       REAL(wp) ::  us_wall     !< 
-       REAL(wp) ::  vel_total   !< 
-       REAL(wp) ::  vel_zp      !< 
-       REAL(wp) ::  ws          !< 
-       REAL(wp) ::  zp          !< 
-       REAL(wp) ::  rifs        !< 
-
        REAL(wp), DIMENSION(nzb:nzt+1) ::  wall_flux   !< 
 
