Index: palm/trunk/SOURCE/fft_xy.f90
===================================================================
--- palm/trunk/SOURCE/fft_xy.f90	(revision 1391)
+++ palm/trunk/SOURCE/fft_xy.f90	(revision 1392)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! bugfix: KIND attribute added to CMPLX functions
 ! 
 ! Former revisions:
@@ -424,5 +424,5 @@
 
                    DO  i = 0, nx
-                      cwork(i) = CMPLX( ar(i,j,k) )
+                      cwork(i) = CMPLX( ar(i,j,k), KIND=wp )
                    ENDDO
 
@@ -448,10 +448,12 @@
                 DO  j = nys_x, nyn_x
 
-                   cwork(0) = CMPLX( ar(0,j,k), 0.0_wp )
+                   cwork(0) = CMPLX( ar(0,j,k), 0.0_wp, KIND=wp )
                    DO  i = 1, (nx+1)/2 - 1
-                      cwork(i)      = CMPLX( ar(i,j,k), -ar(nx+1-i,j,k) )
-                      cwork(nx+1-i) = CMPLX( ar(i,j,k),  ar(nx+1-i,j,k) )
-                   ENDDO
-                   cwork((nx+1)/2) = CMPLX( ar((nx+1)/2,j,k), 0.0_wp )
+                      cwork(i)      = CMPLX( ar(i,j,k), -ar(nx+1-i,j,k),       &
+                                             KIND=wp )
+                      cwork(nx+1-i) = CMPLX( ar(i,j,k),  ar(nx+1-i,j,k),       &
+                                             KIND=wp )
+                   ENDDO
+                   cwork((nx+1)/2) = CMPLX( ar((nx+1)/2,j,k), 0.0_wp, KIND=wp )
 
                    ishape = SHAPE( cwork )
@@ -566,17 +568,20 @@
                    IF ( PRESENT( ar_2d ) )  THEN
 
-                      x_out(0) = CMPLX( ar_2d(0,j), 0.0_wp )
+                      x_out(0) = CMPLX( ar_2d(0,j), 0.0_wp, KIND=wp )
                       DO  i = 1, (nx+1)/2 - 1
-                         x_out(i) = CMPLX( ar_2d(i,j), ar_2d(nx+1-i,j) )
+                         x_out(i) = CMPLX( ar_2d(i,j), ar_2d(nx+1-i,j),        &
+                                           KIND=wp )
                       ENDDO
-                      x_out((nx+1)/2) = CMPLX( ar_2d((nx+1)/2,j), 0.0_wp )
+                      x_out((nx+1)/2) = CMPLX( ar_2d((nx+1)/2,j), 0.0_wp,      &
+                                               KIND=wp )
 
                    ELSE
 
-                      x_out(0) = CMPLX( ar(0,j,k), 0.0_wp )
+                      x_out(0) = CMPLX( ar(0,j,k), 0.0_wp, KIND=wp )
                       DO  i = 1, (nx+1)/2 - 1
-                         x_out(i) = CMPLX( ar(i,j,k), ar(nx+1-i,j,k) )
+                         x_out(i) = CMPLX( ar(i,j,k), ar(nx+1-i,j,k), KIND=wp )
                       ENDDO
-                      x_out((nx+1)/2) = CMPLX( ar((nx+1)/2,j,k), 0.0_wp )
+                      x_out((nx+1)/2) = CMPLX( ar((nx+1)/2,j,k), 0.0_wp,       &
+                                               KIND=wp )
 
                    ENDIF
@@ -726,10 +731,12 @@
                 DO  j = nys_x, nyn_x
 
-                   ar_tmp(0,j,k) = CMPLX( ar(0,j,k), 0.0_wp )
+                   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) )
-                   ENDDO
-                   ar_tmp((nx+1)/2,j,k) = CMPLX( ar((nx+1)/2,j,k), 0.0_wp )
+                      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
@@ -807,5 +814,5 @@
 
              DO  i = 0, nx
-                cwork(i) = CMPLX( ar(i) )
+                cwork(i) = CMPLX( ar(i), KIND=wp )
              ENDDO
              ishape = SHAPE( cwork )
@@ -820,10 +827,10 @@
           ELSE
 
-             cwork(0) = CMPLX( ar(0), 0.0_wp )
+             cwork(0) = CMPLX( ar(0), 0.0_wp, KIND=wp )
              DO  i = 1, (nx+1)/2 - 1
-                cwork(i)      = CMPLX( ar(i), -ar(nx+1-i) )
-                cwork(nx+1-i) = CMPLX( ar(i),  ar(nx+1-i) )
-             ENDDO
-             cwork((nx+1)/2) = CMPLX( ar((nx+1)/2), 0.0_wp )
+                cwork(i)      = CMPLX( ar(i), -ar(nx+1-i), KIND=wp )
+                cwork(nx+1-i) = CMPLX( ar(i),  ar(nx+1-i), KIND=wp )
+             ENDDO
+             cwork((nx+1)/2) = CMPLX( ar((nx+1)/2), 0.0_wp, KIND=wp )
 
              ishape = SHAPE( cwork )
@@ -888,9 +895,9 @@
          ELSE
 
-             x_out(0) = CMPLX( ar(0), 0.0_wp )
+             x_out(0) = CMPLX( ar(0), 0.0_wp, KIND=wp )
              DO  i = 1, (nx+1)/2 - 1
-                x_out(i) = CMPLX( ar(i), ar(nx+1-i) )
-             ENDDO
-             x_out((nx+1)/2) = CMPLX( ar((nx+1)/2), 0.0_wp )
+                x_out(i) = CMPLX( ar(i), ar(nx+1-i), KIND=wp )
+             ENDDO
+             x_out((nx+1)/2) = CMPLX( ar((nx+1)/2), 0.0_wp, KIND=wp )
 
              CALL FFTW_EXECUTE_DFT_C2R( plan_xi, x_out, x_in)
@@ -1067,5 +1074,5 @@
 
                    DO  j = 0, ny
-                      cwork(j) = CMPLX( ar(j,i,k) )
+                      cwork(j) = CMPLX( ar(j,i,k), KIND=wp )
                    ENDDO
 
@@ -1091,10 +1098,13 @@
                 DO  i = nxl_y_l, nxr_y_l
 
-                   cwork(0) = CMPLX( ar_tr(0,i,k), 0.0_wp )
+                   cwork(0) = CMPLX( ar_tr(0,i,k), 0.0_wp, KIND=wp )
                    DO  j = 1, (ny+1)/2 - 1
-                      cwork(j)      = CMPLX( ar_tr(j,i,k), -ar_tr(ny+1-j,i,k) )
-                      cwork(ny+1-j) = CMPLX( ar_tr(j,i,k),  ar_tr(ny+1-j,i,k) )
-                   ENDDO
-                   cwork((ny+1)/2) = CMPLX( ar_tr((ny+1)/2,i,k), 0.0_wp )
+                      cwork(j)      = CMPLX( ar_tr(j,i,k), -ar_tr(ny+1-j,i,k), &
+                                             KIND=wp )
+                      cwork(ny+1-j) = CMPLX( ar_tr(j,i,k),  ar_tr(ny+1-j,i,k), &
+                                             KIND=wp )
+                   ENDDO
+                   cwork((ny+1)/2) = CMPLX( ar_tr((ny+1)/2,i,k), 0.0_wp,       &
+                                            KIND=wp )
 
                    jshape = SHAPE( cwork )
@@ -1195,9 +1205,11 @@
                 DO  i = nxl_y_l, nxr_y_l
 
-                   y_out(0) = CMPLX( ar_tr(0,i,k), 0.0_wp )
+                   y_out(0) = CMPLX( ar_tr(0,i,k), 0.0_wp, KIND=wp )
                    DO  j = 1, (ny+1)/2 - 1
-                      y_out(j) = CMPLX( ar_tr(j,i,k), ar_tr(ny+1-j,i,k) )
-                   ENDDO
-                   y_out((ny+1)/2) = CMPLX( ar_tr((ny+1)/2,i,k), 0.0_wp )
+                      y_out(j) = CMPLX( ar_tr(j,i,k), ar_tr(ny+1-j,i,k,        &
+                                        KIND=wp) )
+                   ENDDO
+                   y_out((ny+1)/2) = CMPLX( ar_tr((ny+1)/2,i,k), 0.0_wp,       &
+                                            KIND=wp )
 
                    CALL FFTW_EXECUTE_DFT_C2R( plan_yi, y_out, y_in )
@@ -1342,10 +1354,12 @@
                 DO  i = nxl_y, nxr_y
 
-                   ar_tmp(0,i,k) = CMPLX( ar(0,i,k), 0.0_wp )
+                   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) )
-                   ENDDO
-                   ar_tmp((ny+1)/2,i,k) = CMPLX( ar((ny+1)/2,i,k), 0.0_wp )
+                      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
@@ -1423,5 +1437,5 @@
 
              DO  j = 0, ny
-                cwork(j) = CMPLX( ar(j) )
+                cwork(j) = CMPLX( ar(j), KIND=wp )
              ENDDO
 
@@ -1438,10 +1452,10 @@
           ELSE
 
-             cwork(0) = CMPLX( ar(0), 0.0_wp )
+             cwork(0) = CMPLX( ar(0), 0.0_wp, KIND=wp )
              DO  j = 1, (ny+1)/2 - 1
-                cwork(j)      = CMPLX( ar(j), -ar(ny+1-j) )
-                cwork(ny+1-j) = CMPLX( ar(j),  ar(ny+1-j) )
-             ENDDO
-             cwork((ny+1)/2) = CMPLX( ar((ny+1)/2), 0.0_wp )
+                cwork(j)      = CMPLX( ar(j), -ar(ny+1-j), KIND=wp )
+                cwork(ny+1-j) = CMPLX( ar(j),  ar(ny+1-j), KIND=wp )
+             ENDDO
+             cwork((ny+1)/2) = CMPLX( ar((ny+1)/2), 0.0_wp, KIND=wp )
 
              jshape = SHAPE( cwork )
@@ -1506,9 +1520,9 @@
           ELSE
 
-             y_out(0) = CMPLX( ar(0), 0.0_wp )
+             y_out(0) = CMPLX( ar(0), 0.0_wp, KIND=wp )
              DO  j = 1, (ny+1)/2 - 1
-                y_out(j) = CMPLX( ar(j), ar(ny+1-j) )
-             ENDDO
-             y_out((ny+1)/2) = CMPLX( ar((ny+1)/2), 0.0_wp )
+                y_out(j) = CMPLX( ar(j), ar(ny+1-j), KIND=wp )
+             ENDDO
+             y_out((ny+1)/2) = CMPLX( ar((ny+1)/2), 0.0_wp, KIND=wp )
 
              CALL FFTW_EXECUTE_DFT_C2R( plan_yi, y_out, y_in )
@@ -1711,9 +1725,9 @@
              ENDIF
              DO  k = 1, nz
-                work(1,k) = CMPLX( ar(0,k), 0.0_wp )
+                work(1,k) = CMPLX( ar(0,k), 0.0_wp, KIND=wp )
                 DO  i = 1, (nx+1)/2 - 1
-                   work(i+1,k) = CMPLX( ar(i,k), ar(nx+1-i,k) )
-                ENDDO
-                work(((nx+1)/2)+1,k) = CMPLX( ar((nx+1)/2,k), 0.0_wp )
+                   work(i+1,k) = CMPLX( ar(i,k), ar(nx+1-i,k), KIND=wp )
+                ENDDO
+                work(((nx+1)/2)+1,k) = CMPLX( ar((nx+1)/2,k), 0.0_wp, KIND=wp )
              ENDDO
 
@@ -1854,9 +1868,9 @@
              ENDIF
              DO  k = 1, nz
-                work(1,k) = CMPLX( ar(0,k), 0.0_wp )
+                work(1,k) = CMPLX( ar(0,k), 0.0_wp, KIND=wp )
                 DO  j = 1, (ny+1)/2 - 1
-                   work(j+1,k) = CMPLX( ar(j,k), ar(ny+1-j,k) )
-                ENDDO
-                work(((ny+1)/2)+1,k) = CMPLX( ar((ny+1)/2,k), 0.0_wp )
+                   work(j+1,k) = CMPLX( ar(j,k), ar(ny+1-j,k), KIND=wp )
+                ENDDO
+                work(((ny+1)/2)+1,k) = CMPLX( ar((ny+1)/2,k), 0.0_wp, KIND=wp )
              ENDDO
 
