Index: palm/trunk/SOURCE/bulk_cloud_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4366)
+++ palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4370)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! vector directives added to force vectorization on Intel19 compiler
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Introduction of wall_flags_total_0, which currently sets bits based on static
 ! topography information used in wall_flags_static_0
@@ -1397,4 +1400,6 @@
           DO  i = nxl, nxr
              DO  j = nys, nyn
+                !following directive is required to vectorize on Intel19
+                !DIR$ IVDEP
                 DO  k = nzb+1, nzt
                    qc_p(k,j,i) = qc(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +   &
@@ -1487,4 +1492,6 @@
           DO  i = nxl, nxr
              DO  j = nys, nyn
+                !following directive is required to vectorize on Intel19
+                !DIR$ IVDEP
                 DO  k = nzb+1, nzt
                    nc_p(k,j,i) = nc(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +   &
@@ -1584,4 +1591,6 @@
           DO  i = nxl, nxr
              DO  j = nys, nyn
+                !following directive is required to vectorize on Intel19
+                !DIR$ IVDEP
                 DO  k = nzb+1, nzt
                    qr_p(k,j,i) = qr(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +   &
@@ -1674,4 +1683,6 @@
           DO  i = nxl, nxr
              DO  j = nys, nyn
+                !following directive is required to vectorize on Intel19
+                !DIR$ IVDEP
                 DO  k = nzb+1, nzt
                    nr_p(k,j,i) = nr(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +   &
Index: palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4366)
+++ palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4370)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! vector directives added to force vectorization on Intel19 compiler
+! 
+! 4346 2019-12-18 11:55:56Z motisi
 ! Introduction of wall_flags_total_0, which currently sets bits based on static
 ! topography information used in wall_flags_static_0
@@ -2744,4 +2747,6 @@
        DO  i = nxl, nxr
           DO  j = nys, nyn
+             !following directive is required to vectorize on Intel19
+             !DIR$ IVDEP
              DO  k = nzb+1, nzt
                 chem_species(ilsp)%conc_p(k,j,i) =   chem_species(ilsp)%conc(k,j,i)                &
Index: palm/trunk/SOURCE/fft_xy_mod.f90
===================================================================
--- palm/trunk/SOURCE/fft_xy_mod.f90	(revision 4366)
+++ palm/trunk/SOURCE/fft_xy_mod.f90	(revision 4370)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix for Temperton-fft usage on GPU
+! 
+! 4366 2020-01-09 08:12:43Z raasch
 ! Vectorized Temperton-fft added
 ! 
@@ -76,5 +79,5 @@
 
     PRIVATE
-    PUBLIC fft_x, fft_x_1d, fft_y, fft_y_1d, fft_init, fft_x_m, fft_y_m, f_vec, temperton_fft_vec
+    PUBLIC fft_x, fft_x_1d, fft_y, fft_y_1d, fft_init, fft_x_m, fft_y_m, f_vec_x, temperton_fft_vec
 
     INTEGER(iwp), DIMENSION(:), ALLOCATABLE, SAVE ::  ifax_x  !<
@@ -92,5 +95,5 @@
     REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  trigs_y  !<
 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE, SAVE ::  f_vec
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, SAVE ::  f_vec_x
 
 #if defined( __ibm )
@@ -105,5 +108,5 @@
     REAL(wp), DIMENSION(nau1), SAVE ::  auy3  !<
     
-#elif defined( __nec )
+#elif defined( __nec_fft )
     INTEGER(iwp), SAVE ::  nz1  !<
     
@@ -180,4 +183,7 @@
     SUBROUTINE fft_init
 
+       USE pegrid,                                                                                 &
+           ONLY:  pdims
+
        IMPLICIT NONE
 
@@ -192,5 +198,5 @@
        REAL(wp), DIMENSION(nau2)   ::  aux4   !< 
        REAL(wp), DIMENSION(nau2)   ::  auy4   !<
-#elif defined( __nec )
+#elif defined( __nec_fft )
        REAL(wp), DIMENSION(0:nx+3,nz+1)   ::  work_x  !<
        REAL(wp), DIMENSION(0:ny+3,nz+1)   ::  work_y  !<
@@ -207,14 +213,14 @@
        ENDIF
 
+#if defined( _OPENACC ) && defined( __cuda_fft )
+       fft_method = 'system-specific'
+#endif
+
 !
 !--    Switch to tell the Poisson-solver that the vectorized version of Temperton-fft is to be used.
-       IF ( fft_method == 'temperton-algorithm' .AND. loop_optimization == 'vector' )  THEN
+       IF ( fft_method == 'temperton-algorithm'  .AND.  loop_optimization == 'vector'  .AND.       &
+            pdims(1) /= 1  .AND.  pdims(2) /= 1 )  THEN
           temperton_fft_vec = .TRUE.
        ENDIF
-
-
-#if defined( _OPENACC ) && defined( __cuda_fft )
-       fft_method = 'system-specific'
-#endif
 
        IF ( fft_method == 'system-specific' )  THEN
@@ -237,5 +243,5 @@
           CALL DCRFT( 1, worky, 1, worky, 1, ny+1, 1, -1, sqr_dny, auy3, nau1, &
                       auy4, nau2 )
-#elif defined( __nec )
+#elif defined( __nec_fft )
           message_string = 'fft method "' // TRIM( fft_method) // &
                            '" currently does not work on NEC'
@@ -285,5 +291,5 @@
 
           IF ( temperton_fft_vec )  THEN
-             ALLOCATE( f_vec((nyn_x-nys_x+1)*(nzt_x-nzb_x+1),0:nx+2) )
+             ALLOCATE( f_vec_x((nyn_x-nys_x+1)*(nzt_x-nzb_x+1),0:nx+2) )
           ENDIF
 
@@ -361,5 +367,5 @@
        REAL(wp), DIMENSION(nau2) ::  aux2  !< 
        REAL(wp), DIMENSION(nau2) ::  aux4  !<
-#elif defined( __nec )
+#elif defined( __nec_fft )
        REAL(wp), DIMENSION(6*(nx+1)) ::  work2  !<
 #elif defined( __cuda_fft )
@@ -475,6 +481,6 @@
                 ALLOCATE( work_vec( (nyn_x-nys_x+1)*(nzt_x-nzb_x+1),nx+2) )
 !
-!--             f_vec is already set in transpose_zx
-                CALL fft991cy_vec( f_vec, work_vec, trigs_x, ifax_x, nx+1, -1 )
+!--             f_vec_x is already set in transpose_zx
+                CALL fft991cy_vec( f_vec_x, work_vec, trigs_x, ifax_x, nx+1, -1 )
                 DEALLOCATE( work_vec )
 
@@ -485,8 +491,8 @@
                          mm = j-nys_x+1+(k-nzb_x)*(nyn_x-nys_x+1)
                          DO  i = 0, (nx+1)/2
-                            ar_inv(j,k,i) = f_vec(mm,2*i)
+                            ar_inv(j,k,i) = f_vec_x(mm,2*i)
                          ENDDO
                          DO  i = 1, (nx+1)/2-1
-                            ar_inv(j,k,nx+1-i) = f_vec(mm,2*i+1)
+                            ar_inv(j,k,nx+1-i) = f_vec_x(mm,2*i+1)
                          ENDDO
                       ENDDO
@@ -499,8 +505,8 @@
                          mm = j-nys_x+1+(k-nzb_x)*(nyn_x-nys_x+1)
                          DO  i = 0, (nx+1)/2
-                            ar(i,j,k) = f_vec(mm,2*i)
+                            ar(i,j,k) = f_vec_x(mm,2*i)
                          ENDDO
                          DO  i = 1, (nx+1)/2-1
-                            ar(nx+1-i,j,k) = f_vec(mm,2*i+1)
+                            ar(nx+1-i,j,k) = f_vec_x(mm,2*i+1)
                          ENDDO
                       ENDDO
@@ -546,8 +552,8 @@
                          mm = j-nys_x+1+(k-nzb_x)*(nyn_x-nys_x+1)
                          DO  i = 0, (nx+1)/2
-                            f_vec(mm,2*i) = ar_inv(j,k,i)
+                            f_vec_x(mm,2*i) = ar_inv(j,k,i)
                          ENDDO
                          DO  i = 1, (nx+1)/2-1
-                            f_vec(mm,2*i+1) = ar_inv(j,k,nx+1-i)
+                            f_vec_x(mm,2*i+1) = ar_inv(j,k,nx+1-i)
                          ENDDO
                       ENDDO
@@ -560,8 +566,8 @@
                          mm = j-nys_x+1+(k-nzb_x)*(nyn_x-nys_x+1)
                          DO  i = 0, (nx+1)/2
-                            f_vec(mm,2*i) = ar(i,j,k)
+                            f_vec_x(mm,2*i) = ar(i,j,k)
                          ENDDO
                          DO  i = 1, (nx+1)/2-1
-                            f_vec(mm,2*i+1) = ar(nx+1-i,j,k)
+                            f_vec_x(mm,2*i+1) = ar(nx+1-i,j,k)
                          ENDDO
                       ENDDO
@@ -569,9 +575,9 @@
 
                 ENDIF
-                f_vec(:,1)    = 0.0_wp
-                f_vec(:,nx+2) = 0.0_wp
+                f_vec_x(:,1)    = 0.0_wp
+                f_vec_x(:,nx+2) = 0.0_wp
 
                 ALLOCATE( work_vec((nyn_x-nys_x+1)*(nzt_x-nzb_x+1),nx+2) )
-                CALL fft991cy_vec( f_vec, work_vec, trigs_x, ifax_x, nx+1, 1 )
+                CALL fft991cy_vec( f_vec_x, work_vec, trigs_x, ifax_x, nx+1, 1 )
                 DEALLOCATE( work_vec )
 
@@ -707,5 +713,5 @@
           ENDIF
 
-#elif defined( __nec )
+#elif defined( __nec_fft )
 
           IF ( forward_fft )  THEN
@@ -842,5 +848,5 @@
        REAL(wp), DIMENSION(nau2) ::  aux2       !<
        REAL(wp), DIMENSION(nau2) ::  aux4       !<
-#elif defined( __nec )
+#elif defined( __nec_fft )
        REAL(wp), DIMENSION(6*(nx+1)) ::  work2  !<
 #endif
@@ -989,5 +995,5 @@
 
           ENDIF
-#elif defined( __nec )
+#elif defined( __nec_fft )
           IF ( forward_fft )  THEN
 
@@ -1072,5 +1078,5 @@
        REAL(wp), DIMENSION(ny+2)   ::  work1  !<
        
-       REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  f_vec
+       REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  f_vec_y
        REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  work_vec
 
@@ -1084,5 +1090,5 @@
        REAL(wp), DIMENSION(nau2) ::  auy2  !<
        REAL(wp), DIMENSION(nau2) ::  auy4  !<
-#elif defined( __nec )
+#elif defined( __nec_fft )
        REAL(wp), DIMENSION(6*(ny+1)) ::  work2  !<
 #elif defined( __cuda_fft )
@@ -1194,10 +1200,10 @@
 !
 !--             Vector version of Temperton-fft. Computes multiple 1-D FFT's.
-                ALLOCATE( f_vec((nxr_y_l-nxl_y_l+1)*(nzt_y-nzb_y+1),0:ny+2) )
+                ALLOCATE( f_vec_y((nxr_y_l-nxl_y_l+1)*(nzt_y-nzb_y+1),0:ny+2) )
 
                 mm = 1
                 DO  k = nzb_y, nzt_y
                    DO  i = nxl_y_l, nxr_y_l
-                      f_vec(mm,0:nx) = ar(0:nx,i,k)
+                      f_vec_y(mm,0:nx) = ar(0:nx,i,k)
                       mm = mm+1
                    ENDDO
@@ -1205,5 +1211,5 @@
 
                 ALLOCATE( work_vec( (nxr_y_l-nxl_y_l+1)*(nzt_y-nzb_y+1),ny+2) )
-                CALL fft991cy_vec( f_vec, work_vec, trigs_y, ifax_y, ny+1, -1 )
+                CALL fft991cy_vec( f_vec_y, work_vec, trigs_y, ifax_y, ny+1, -1 )
                 DEALLOCATE( work_vec )
 
@@ -1214,8 +1220,8 @@
                          mm = i-nxl_y_l+1+(k-nzb_y)*(nxr_y_l-nxl_y_l+1)
                          DO  j = 0, (ny+1)/2
-                            ar_inv(i,k,j) = f_vec(mm,2*j)
+                            ar_inv(i,k,j) = f_vec_y(mm,2*j)
                          ENDDO
                          DO  j = 1, (ny+1)/2 - 1
-                            ar_inv(i,k,ny+1-j) = f_vec(mm,2*j+1)
+                            ar_inv(i,k,ny+1-j) = f_vec_y(mm,2*j+1)
                          ENDDO
                       ENDDO
@@ -1228,8 +1234,8 @@
                          mm = i-nxl_y_l+1+(k-nzb_y)*(nxr_y_l-nxl_y_l+1)
                          DO  j = 0, (ny+1)/2
-                            ar(j,i,k) = f_vec(mm,2*j)
+                            ar(j,i,k) = f_vec_y(mm,2*j)
                          ENDDO
                          DO  j = 1, (ny+1)/2 - 1
-                            ar(ny+1-j,i,k) = f_vec(mm,2*j+1)
+                            ar(ny+1-j,i,k) = f_vec_y(mm,2*j+1)
                          ENDDO
                       ENDDO
@@ -1238,5 +1244,5 @@
                 ENDIF
 
-                DEALLOCATE( f_vec )
+                DEALLOCATE( f_vec_y )
 
              ENDIF
@@ -1269,5 +1275,5 @@
              ELSE
 
-                ALLOCATE( f_vec((nxr_y_l-nxl_y_l+1)*(nzt_y-nzb_y+1),0:ny+2) )
+                ALLOCATE( f_vec_y((nxr_y_l-nxl_y_l+1)*(nzt_y-nzb_y+1),0:ny+2) )
 
                 IF ( PRESENT( ar_inv ) )  THEN
@@ -1277,8 +1283,8 @@
                          mm = i-nxl_y_l+1+(k-nzb_y)*(nxr_y_l-nxl_y_l+1)
                          DO  j = 0, (ny+1)/2
-                            f_vec(mm,2*j) = ar_inv(i,k,j)
+                            f_vec_y(mm,2*j) = ar_inv(i,k,j)
                          ENDDO
                          DO  j = 1, (ny+1)/2 - 1
-                            f_vec(mm,2*j+1) = ar_inv(i,k,ny+1-j)
+                            f_vec_y(mm,2*j+1) = ar_inv(i,k,ny+1-j)
                          ENDDO
                       ENDDO
@@ -1291,8 +1297,8 @@
                          mm = i-nxl_y_l+1+(k-nzb_y)*(nxr_y_l-nxl_y_l+1)
                          DO  j = 0, (ny+1)/2
-                            f_vec(mm,2*j) = ar(j,i,k)
+                            f_vec_y(mm,2*j) = ar(j,i,k)
                          ENDDO
                          DO  j = 1, (ny+1)/2 - 1
-                            f_vec(mm,2*j+1) = ar(ny+1-j,i,k)
+                            f_vec_y(mm,2*j+1) = ar(ny+1-j,i,k)
                          ENDDO
                       ENDDO
@@ -1301,9 +1307,9 @@
                 ENDIF
 
-                f_vec(:,1)    = 0.0_wp
-                f_vec(:,ny+2) = 0.0_wp
+                f_vec_y(:,1)    = 0.0_wp
+                f_vec_y(:,ny+2) = 0.0_wp
 
                 ALLOCATE( work_vec((nxr_y_l-nxl_y_l+1)*(nzt_y-nzb_y+1),ny+2) )
-                CALL fft991cy_vec( f_vec, work_vec, trigs_y, ifax_y, ny+1, 1 )
+                CALL fft991cy_vec( f_vec_y, work_vec, trigs_y, ifax_y, ny+1, 1 )
                 DEALLOCATE( work_vec )
 
@@ -1311,10 +1317,10 @@
                 DO  k = nzb_y, nzt_y
                    DO  i = nxl_y_l, nxr_y_l
-                      ar(0:ny,i,k) = f_vec(mm,0:ny)
+                      ar(0:ny,i,k) = f_vec_y(mm,0:ny)
                       mm = mm+1
                    ENDDO
                 ENDDO
 
-                DEALLOCATE( f_vec )
+                DEALLOCATE( f_vec_y )
 
              ENDIF
@@ -1423,5 +1429,5 @@
 
           ENDIF
-#elif defined( __nec )
+#elif defined( __nec_fft )
           IF ( forward_fft )  THEN
 
@@ -1556,5 +1562,5 @@
        REAL(wp), DIMENSION(nau2) ::  auy2  !<
        REAL(wp), DIMENSION(nau2) ::  auy4  !<
-#elif defined( __nec )
+#elif defined( __nec_fft )
        REAL(wp), DIMENSION(6*(ny+1)) ::  work2  !<
 #endif
@@ -1705,5 +1711,5 @@
 
           ENDIF
-#elif defined( __nec )
+#elif defined( __nec_fft )
           IF ( forward_fft )  THEN
 
@@ -1760,5 +1766,5 @@
        INTEGER(iwp) ::  k     !<
        INTEGER(iwp) ::  siza  !<
-#if defined( __nec )
+#if defined( __nec_fft )
        INTEGER(iwp) ::  sizw
 #endif
@@ -1768,5 +1774,5 @@
        REAL(wp), DIMENSION(6*(nx+4),nz+1) ::  work1  !<
        
-#if defined( __nec )
+#if defined( __nec_fft )
        COMPLEX(wp), DIMENSION(:,:), ALLOCATABLE ::  work
 #endif
@@ -1813,5 +1819,5 @@
        ELSEIF ( fft_method == 'system-specific' )  THEN
 
-#if defined( __nec )
+#if defined( __nec_fft )
           ALLOCATE( work((nx+4)/2+1,nz+1) )
           siza = SIZE( ai, 1 )
@@ -1896,5 +1902,5 @@
        INTEGER(iwp) ::  ny1   !<
        INTEGER(iwp) ::  siza  !<
-#if defined( __nec )
+#if defined( __nec_fft )
        INTEGER(iwp) ::  sizw
 #endif
@@ -1904,5 +1910,5 @@
        REAL(wp), DIMENSION(6*(ny+4),nz+1) ::  work1  !<
 
-#if defined( __nec )
+#if defined( __nec_fft )
        COMPLEX(wp), DIMENSION(:,:), ALLOCATABLE ::  work
 #endif
@@ -1950,5 +1956,5 @@
        ELSEIF ( fft_method == 'system-specific' )  THEN
 
-#if defined( __nec )
+#if defined( __nec_fft )
           ALLOCATE( work((ny+4)/2+1,nz+1) )
           siza = SIZE( ai, 1 )
Index: palm/trunk/SOURCE/netcdf_data_input_mod.f90
===================================================================
--- palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 4366)
+++ palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 4370)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! collective read switched off on NEC Aurora to avoid hang situations
+! 
+! 4362 2020-01-07 17:15:02Z suehring
 ! Input of plant canopy variables from static driver moved to plant-canopy 
 ! model
@@ -4135,5 +4138,9 @@
           collective_read = .FALSE.
        ELSE
+#if defined( __nec )
+          collective_read = .FALSE.   ! collective read causes hang situations on NEC Aurora
+#else
           collective_read = .TRUE.
+#endif
        ENDIF
 #else
Index: palm/trunk/SOURCE/ocean_mod.f90
===================================================================
--- palm/trunk/SOURCE/ocean_mod.f90	(revision 4366)
+++ palm/trunk/SOURCE/ocean_mod.f90	(revision 4370)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! vector directives added to force vectorization on Intel19 compiler
+! 
+! 4346 2019-12-18 11:55:56Z motisi
 ! Introduction of wall_flags_total_0, which currently sets bits based on static
 ! topography information used in wall_flags_static_0
@@ -1679,4 +1682,6 @@
        DO  i = nxl, nxr
           DO  j = nys, nyn
+             !following directive is required to vectorize on Intel19
+             !DIR$ IVDEP
              DO  k = nzb+1, nzt
                 sa_p(k,j,i) = sa(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +            &
Index: palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- palm/trunk/SOURCE/prognostic_equations.f90	(revision 4366)
+++ palm/trunk/SOURCE/prognostic_equations.f90	(revision 4370)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! vector directives added to force vectorization on Intel19 compiler
+! 
+! 4360 2020-01-07 11:25:50Z suehring
 ! Introduction of wall_flags_total_0, which currently sets bits based on static
 ! topography information used in wall_flags_static_0
@@ -936,4 +939,6 @@
     DO  i = nxlu, nxr
        DO  j = nys, nyn
+          !following directive is required to vectorize on Intel19
+          !DIR$ IVDEP
           DO  k = nzb+1, nzt
              u_p(k,j,i) = u(k,j,i) + ( dt_3d * ( tsc(2) * tend(k,j,i) +          &
@@ -1039,4 +1044,6 @@
     DO  i = nxl, nxr
        DO  j = nysv, nyn
+          !following directive is required to vectorize on Intel19
+          !DIR$ IVDEP
           DO  k = nzb+1, nzt
              v_p(k,j,i) = v(k,j,i) + ( dt_3d * ( tsc(2) * tend(k,j,i) +        &
@@ -1138,4 +1145,6 @@
     DO  i = nxl, nxr
        DO  j = nys, nyn
+          !following directive is required to vectorize on Intel19
+          !DIR$ IVDEP
           DO  k = nzb+1, nzt-1
              w_p(k,j,i) = w(k,j,i) + ( dt_3d * ( tsc(2) * tend(k,j,i) +        &
@@ -1277,4 +1286,6 @@
        DO  i = nxl, nxr
           DO  j = nys, nyn
+             !following directive is required to vectorize on Intel19
+             !DIR$ IVDEP
              DO  k = nzb+1, nzt
                 pt_p(k,j,i) = pt(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +      &
@@ -1400,4 +1411,6 @@
        DO  i = nxl, nxr
           DO  j = nys, nyn
+             !following directive is required to vectorize on Intel19
+             !DIR$ IVDEP
              DO  k = nzb+1, nzt
                 q_p(k,j,i) = q(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +        &
@@ -1520,4 +1533,6 @@
        DO  i = nxl, nxr
           DO  j = nys, nyn
+             !following directive is required to vectorize on Intel19
+             !DIR$ IVDEP
              DO  k = nzb+1, nzt
                 s_p(k,j,i) = s(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +        &
Index: palm/trunk/SOURCE/surface_layer_fluxes_mod.f90
===================================================================
--- palm/trunk/SOURCE/surface_layer_fluxes_mod.f90	(revision 4366)
+++ palm/trunk/SOURCE/surface_layer_fluxes_mod.f90	(revision 4370)
@@ -26,4 +26,7 @@
 ! -----------------
 ! $Id$
+! bugfix: openacc porting for vector version of OL calculation added
+! 
+! 4366 2020-01-09 08:12:43Z raasch
 ! vector version for calculation of Obukhov length via Newton iteration added
 ! 
@@ -863,4 +866,5 @@
 
        LOGICAL, DIMENSION(surf%ns) ::  convergence_reached  !< convergence switch for vectorization
+       !$ACC DECLARE CREATE( convergence_reached )
 
        REAL(wp)     :: f,      & !< Function for Newton iteration: f = Ri - [...]/[...]^2 = 0
@@ -873,4 +877,5 @@
        REAL(wp), DIMENSION(surf%ns) ::  ol_old_vec  !< temporary array required for vectorization
        REAL(wp), DIMENSION(surf%ns) ::  z_mo_vec    !< temporary array required for vectorization
+       !$ACC DECLARE CREATE( ol_old_vec, z_mo_vec )
 
 !
@@ -1063,4 +1068,6 @@
 !--       Calculate the Obukhov length using Newton iteration
 !--       First set arrays required for vectorization
+          !$ACC PARALLEL LOOP &
+          !$ACC PRESENT(surf)
           DO  m = 1, surf%ns
 
@@ -1077,4 +1084,7 @@
                 IF ( surf%rib(m) < 0.0_wp ) surf%ol(m) = -0.01_wp
              ENDIF
+!
+!--          Initialize convergence flag
+             convergence_reached(m) = .FALSE.
 
           ENDDO
@@ -1082,5 +1092,4 @@
 !
 !--       Iteration to find Obukhov length
-          convergence_reached(:) = .FALSE.
           iter = 0
           DO
@@ -1090,11 +1099,14 @@
 !--          In case of divergence, use the value(s) of the previous time step
              IF ( iter > 1000 )  THEN
+                !$ACC PARALLEL LOOP &
+                !$ACC PRESENT(surf)
                 DO  m = 1, surf%ns
-                   IF ( .NOT. convergence_reached(m) )  surf%ol(1:surf%ns) = ol_old
+                   IF ( .NOT. convergence_reached(m) )  surf%ol(m) = ol_old_vec(m)
                 ENDDO
                 EXIT
              ENDIF
 
-
+             !$ACC PARALLEL LOOP PRIVATE(ol_m, ol_l, ol_u, f, f_d_ol) &
+             !$ACC PRESENT(surf)
              DO  m = 1, surf%ns
 
@@ -1182,4 +1194,6 @@
 !
 !--          Assure that Obukhov length does not become zero
+             !$ACC PARALLEL LOOP &
+             !$ACC PRESENT(surf)
              DO  m = 1, surf%ns
                 IF ( convergence_reached(m) )  CYCLE
Index: palm/trunk/SOURCE/temperton_fft_mod.f90
===================================================================
--- palm/trunk/SOURCE/temperton_fft_mod.f90	(revision 4366)
+++ palm/trunk/SOURCE/temperton_fft_mod.f90	(revision 4370)
@@ -9,4 +9,7 @@
 ! -----------------
 ! $Id$
+! unused variables removed
+! 
+! 4366 2020-01-09 08:12:43Z raasch
 ! vectorized routines added
 ! 
@@ -2245,13 +2248,9 @@
     INTEGER(iwp) ::  j      !<
     INTEGER(iwp) ::  jbase  !<
-    INTEGER(iwp) ::  jj     !<
     INTEGER(iwp) ::  k      !<
     INTEGER(iwp) ::  la     !<
-    INTEGER(iwp) ::  nb     !<
-    INTEGER(iwp) ::  nblox  !<
     INTEGER(iwp) ::  nfax   !<
     INTEGER(iwp) ::  nvex   !<
     INTEGER(iwp) ::  nx     !<
-    INTEGER(iwp) ::  mm     !<
 
 
@@ -2264,5 +2263,4 @@
     nx   = n + 1
     IF ( MOD(n,2) == 1 )  nx = n
-    nblox = 1
     nvex = 1
 
Index: palm/trunk/SOURCE/transpose.f90
===================================================================
--- palm/trunk/SOURCE/transpose.f90	(revision 4366)
+++ palm/trunk/SOURCE/transpose.f90	(revision 4370)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! vector array renamed
+! 
+! 4366 2020-01-09 08:12:43Z raasch
 ! modifications for NEC vectorization
 ! 
@@ -270,5 +273,5 @@
 
     USE fft_xy,                                                                &
-        ONLY:  f_vec, temperton_fft_vec
+        ONLY:  f_vec_x, temperton_fft_vec
 
     USE indices,                                                               &
@@ -307,5 +310,5 @@
 !
 !--    Reorder input array for transposition. Data from the vectorized Temperton-fft is stored in
-!--    different array format (f_vec).
+!--    different array format (f_vec_x).
        IF ( temperton_fft_vec )  THEN
 
@@ -316,5 +319,5 @@
                    DO  j = nys_x, nyn_x
                       mm = j-nys_x+1+(k-nzb_x)*(nyn_x-nys_x+1)
-                      work(j,i-xs+1,k,l) = f_vec(mm,i)
+                      work(j,i-xs+1,k,l) = f_vec_x(mm,i)
                    ENDDO
                 ENDDO
@@ -862,5 +865,5 @@
 
     USE fft_xy,                                                                &
-        ONLY:  f_vec, temperton_fft_vec
+        ONLY:  f_vec_x, temperton_fft_vec
 
     USE indices,                                                               &
@@ -944,6 +947,6 @@
 !
 !--    Reorder transposed array.
-!--    Data for the vectorized Temperton-fft is stored in different array format (f_vec) which saves
-!--    additional data copy in fft_x.
+!--    Data for the vectorized Temperton-fft is stored in different array format (f_vec_x) which
+!--    saves additional data copy in fft_x.
        IF ( temperton_fft_vec )  THEN
 
@@ -954,5 +957,5 @@
                    DO  j = nys_x, nyn_x
                       mm = j-nys_x+1+(k-nzb_x)*(nyn_x-nys_x+1)
-                      f_vec(mm,i) = work(j,i-xs+1,k,l)
+                      f_vec_x(mm,i) = work(j,i-xs+1,k,l)
                    ENDDO
                 ENDDO
Index: palm/trunk/SOURCE/turbulence_closure_mod.f90
===================================================================
--- palm/trunk/SOURCE/turbulence_closure_mod.f90	(revision 4366)
+++ palm/trunk/SOURCE/turbulence_closure_mod.f90	(revision 4370)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! vector directives added to force vectorization on Intel19 compiler
+! 
+! 4346 2019-12-18 11:55:56Z motisi
 ! Introduction of wall_flags_total_0, which currently sets bits based on static
 ! topography information used in wall_flags_static_0
@@ -2272,4 +2275,6 @@
        DO  i = nxl, nxr
           DO  j = nys, nyn
+             !following directive is required to vectorize on Intel19
+             !DIR$ IVDEP
              DO  k = nzb+1, nzt
                 e_p(k,j,i) = e(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +        &
