subroutine yspacee(aky,ay) c c Transform a variable from ky space into y space. c implicit none include 'itg.par' include 'itg.cmn' integer l,m,n,index,imode complex aky(nzz,mz*kz) complex ay(mzz/2,nzz*kz) c real ayr(mzz, nzz*kz) c c The complex ay can be considered equivalenced to the real ayr. c The transform is done in place: c the complex ay is for ky space before the transform, c the real ayr is for y space after the transform. c c We will use a complex-to-real FFT. malias points in real space c requires malias/2+1 complex Fourier coefficients. (This formula works c for even or odd malias, using standard fortran rules for integer c division. The k=0 coefficient will be purely real, and if malias is c even, the k=malias/2+1 coefficient will also be purely real...) c real scale integer isign scale=1.0 isign=1 c c Need to transpose the data from c aky(n,index) where index=l+(m-1)*kd to c ay(m,imode) where imode=l+(n-1)*kd c c First get the ky=0 (m=1) component: c do n=1,nalias c Tell the compiler to vectorize this and not the outer loop: cfpp$ select (vector) do l=1,kd imode=l+(n-1)*kd ay(1,imode)=aky(n,l) enddo enddo c c get the ky>0 components (factor of 1/2 from sin/cos versus complex c conventions...): c c GWH: rewrote the following loop to optimize better on the CRAY C-90. c The C-90 is most efficient if there are only linear functions of c the do-loop indices. Usually, only the innermost loop is vectorized, c but kd is usually large enough (>=64) for this to be efficient. c The next outer loop is sometimes unrolled, and for large runs (md>6-8) c this should be efficient also. Finally, when compiled with -Zp, the c parallelization is usually applied to the outer most loop. Best c results come when the loop count exceeds the number of processors, c which is usually the case for nalias... do n=1,nalias do m=2,md cfpp$ select (vector) do l=1,kd imode=l+(n-1)*kd index=l+(m-1)*kd ay(m,imode)=aky(n,index)/2. enddo enddo enddo c c dealias for high ky: c do m=md+1,malias/2+1 cfpp$ select (vector) do imode=1,nalias*kd ay(m,imode)=0.0 enddo enddo call csfftm(isign,malias,kd*nalias,scale, & ay,mzz/2,ay,mzz,tabley,worky,0) return end