Index: /palm/trunk/SOURCE/init_pegrid.f90
===================================================================
--- /palm/trunk/SOURCE/init_pegrid.f90	(revision 1921)
+++ /palm/trunk/SOURCE/init_pegrid.f90	(revision 1922)
@@ -19,5 +19,6 @@
 ! Current revisions:
 ! ------------------
-! 
+! Bugfix: array transposition checks restricted to cases if a fourier 
+! transform is used , removed unused variable nnx_z
 ! 
 ! Former revisions:
@@ -168,5 +169,5 @@
 
     USE spectra_mod,                                                           &
-        ONLY:  dt_dosp
+        ONLY:  calculate_spectra, dt_dosp
 
     USE transpose_indices,                                                     &
@@ -381,68 +382,76 @@
 !-- 1. transposition  z --> x
 !-- This transposition is not neccessary in case of a 1d-decomposition along x
-    nys_x = nys
-    nyn_x = nyn
-    nny_x = nny
-    nnz_x = nz / pdims(1)
-    nzb_x = 1 + myidx * nnz_x
-    nzt_x = ( myidx + 1 ) * nnz_x
-    sendrecvcount_zx = nnx * nny * nnz_x
-
-    IF ( pdims(2) /= 1 )  THEN
-       IF ( MOD( nz , pdims(1) ) /= 0 )  THEN
-          WRITE( message_string, * ) 'transposition z --> x:',                &
-                       '&nz=',nz,' is not an integral divisior of pdims(1)=', &
+    IF ( psolver == 'poisfft'  .OR.  calculate_spectra )  THEN
+
+       IF ( pdims(2) /= 1 )  THEN
+          IF ( MOD( nz , pdims(1) ) /= 0 )  THEN
+             WRITE( message_string, * ) 'transposition z --> x:',              &
+                       '&nz=',nz,' is not an integral divisior of pdims(1)=',  &
                                                                    pdims(1)
-          CALL message( 'init_pegrid', 'PA0230', 1, 2, 0, 6, 0 )
-       ENDIF
-    ENDIF
-
-!
-!-- 2. transposition  x --> y
-    nnz_y = nnz_x
-    nzb_y = nzb_x
-    nzt_y = nzt_x
-    IF ( MOD( nx+1 , pdims(2) ) /= 0 )  THEN
-       WRITE( message_string, * ) 'transposition x --> y:',                &
-                         '&nx+1=',nx+1,' is not an integral divisor of ',&
-                         'pdims(2)=',pdims(2)
-       CALL message( 'init_pegrid', 'PA0231', 1, 2, 0, 6, 0 )
-    ENDIF
-    nnx_y = (nx+1) / pdims(2)
-    nxl_y = myidy * nnx_y
-    nxr_y = ( myidy + 1 ) * nnx_y - 1
-    sendrecvcount_xy = nnx_y * nny_x * nnz_y
-
-!
-!-- 3. transposition  y --> z  (ELSE:  x --> y  in case of 1D-decomposition
-!-- along x)
-    nnx_z = nnx_y
-    nxl_z = nxl_y
-    nxr_z = nxr_y
-    nny_z = (ny+1) / pdims(1)
-    nys_z = myidx * nny_z
-    nyn_z = ( myidx + 1 ) * nny_z - 1
-    sendrecvcount_yz = nnx_y * nny_z * nnz_y
-
-    IF ( pdims(2) /= 1 )  THEN
-!
-!--    y --> z
-!--    This transposition is not neccessary in case of a 1d-decomposition
-!--    along x, except that the uptream-spline method is switched on
-       IF ( MOD( ny+1 , pdims(1) ) /= 0 )  THEN
-          WRITE( message_string, * ) 'transposition y --> z:',            &
-                            '& ny+1=',ny+1,' is not an integral divisor of ',&
-                            'pdims(1)=',pdims(1)
-          CALL message( 'init_pegrid', 'PA0232', 1, 2, 0, 6, 0 )
-       ENDIF
-
-    ELSE
-!
-!--    x --> y. This condition must be fulfilled for a 1D-decomposition along x
-       IF ( MOD( ny+1 , pdims(1) ) /= 0 )  THEN
-          WRITE( message_string, * ) 'transposition x --> y:',               &
-                            '& ny+1=',ny+1,' is not an integral divisor of ',&
-                            'pdims(1)=',pdims(1)
-          CALL message( 'init_pegrid', 'PA0233', 1, 2, 0, 6, 0 )
+             CALL message( 'init_pegrid', 'PA0230', 1, 2, 0, 6, 0 )
+          ENDIF
+       ENDIF
+
+       nys_x = nys
+       nyn_x = nyn
+       nny_x = nny
+       nnz_x = nz / pdims(1)
+       nzb_x = 1 + myidx * nnz_x
+       nzt_x = ( myidx + 1 ) * nnz_x
+       sendrecvcount_zx = nnx * nny * nnz_x
+
+    ENDIF
+
+
+    IF ( psolver == 'poisfft' )  THEN 
+!
+!--    2. transposition  x --> y
+       IF ( MOD( nx+1 , pdims(2) ) /= 0 )  THEN
+          WRITE( message_string, * ) 'transposition x --> y:',                 &
+                            '&nx+1=',nx+1,' is not an integral divisor of ',   &
+                            'pdims(2)=',pdims(2)
+          CALL message( 'init_pegrid', 'PA0231', 1, 2, 0, 6, 0 )
+       ENDIF
+
+       nnz_y = nnz_x
+       nzb_y = nzb_x
+       nzt_y = nzt_x
+       nnx_y = (nx+1) / pdims(2)
+       nxl_y = myidy * nnx_y
+       nxr_y = ( myidy + 1 ) * nnx_y - 1
+       sendrecvcount_xy = nnx_y * nny_x * nnz_y
+!
+!--    3. transposition  y --> z  
+!--    (ELSE:  x --> y  in case of 1D-decomposition along x)
+       nxl_z = nxl_y
+       nxr_z = nxr_y
+       nny_z = (ny+1) / pdims(1)
+       nys_z = myidx * nny_z
+       nyn_z = ( myidx + 1 ) * nny_z - 1
+       sendrecvcount_yz = nnx_y * nny_z * nnz_y
+
+       IF ( pdims(2) /= 1 )  THEN
+!
+!--       y --> z
+!--       This transposition is not neccessary in case of a 1d-decomposition
+!--       along x, except that the uptream-spline method is switched on
+          IF ( MOD( ny+1 , pdims(1) ) /= 0 )  THEN
+             WRITE( message_string, * ) 'transposition y --> z:',              &
+                               '& ny+1=',ny+1,' is not an integral divisor of',&
+                               ' pdims(1)=',pdims(1)
+             CALL message( 'init_pegrid', 'PA0232', 1, 2, 0, 6, 0 )
+          ENDIF
+
+       ELSE
+!
+!--       x --> y
+!--       This condition must be fulfilled for a 1D-decomposition along x
+          IF ( MOD( ny+1 , pdims(1) ) /= 0 )  THEN
+             WRITE( message_string, * ) 'transposition x --> y:',              &
+                               '& ny+1=',ny+1,' is not an integral divisor of',&
+                               ' pdims(1)=',pdims(1)
+             CALL message( 'init_pegrid', 'PA0233', 1, 2, 0, 6, 0 )
+          ENDIF
+
        ENDIF
 
@@ -451,8 +460,8 @@
 !
 !-- Indices for direct transpositions z --> y (used for calculating spectra)
-    IF ( dt_dosp /= 9999999.9_wp )  THEN
+    IF ( calculate_spectra )  THEN
        IF ( MOD( nz, pdims(2) ) /= 0 )  THEN
-          WRITE( message_string, * ) 'direct transposition z --> y (needed ', &
-                    'for spectra):& nz=',nz,' is not an integral divisor of ',&
+          WRITE( message_string, * ) 'direct transposition z --> y (needed ',  &
+                    'for spectra):& nz=',nz,' is not an integral divisor of ', &
                     'pdims(2)=',pdims(2)
           CALL message( 'init_pegrid', 'PA0234', 1, 2, 0, 6, 0 )
@@ -466,26 +475,32 @@
     ENDIF
 
-!
-!-- Indices for direct transpositions y --> x (they are only possible in case
-!-- of a 1d-decomposition along x)
-    IF ( pdims(2) == 1 )  THEN
-       nny_x = nny / pdims(1)
-       nys_x = myid * nny_x
-       nyn_x = ( myid + 1 ) * nny_x - 1
-       nzb_x = 1
-       nzt_x = nz
-       sendrecvcount_xy = nnx * nny_x * nz
-    ENDIF
-
-!
-!-- Indices for direct transpositions x --> y (they are only possible in case
-!-- of a 1d-decomposition along y)
-    IF ( pdims(1) == 1 )  THEN
-       nnx_y = nnx / pdims(2)
-       nxl_y = myid * nnx_y
-       nxr_y = ( myid + 1 ) * nnx_y - 1
-       nzb_y = 1
-       nzt_y = nz
-       sendrecvcount_xy = nnx_y * nny * nz
+    IF ( psolver == 'poisfft'  .OR.  calculate_spectra )  THEN
+!
+!--    Indices for direct transpositions y --> x 
+!--    (they are only possible in case of a 1d-decomposition along x)
+       IF ( pdims(2) == 1 )  THEN
+          nny_x = nny / pdims(1)
+          nys_x = myid * nny_x
+          nyn_x = ( myid + 1 ) * nny_x - 1
+          nzb_x = 1
+          nzt_x = nz
+          sendrecvcount_xy = nnx * nny_x * nz
+       ENDIF
+
+    ENDIF
+
+    IF ( psolver == 'poisfft' )  THEN
+!
+!--    Indices for direct transpositions x --> y 
+!--    (they are only possible in case of a 1d-decomposition along y)
+       IF ( pdims(1) == 1 )  THEN
+          nnx_y = nnx / pdims(2)
+          nxl_y = myid * nnx_y
+          nxr_y = ( myid + 1 ) * nnx_y - 1
+          nzb_y = 1
+          nzt_y = nz
+          sendrecvcount_xy = nnx_y * nny * nz
+       ENDIF
+
     ENDIF
 
