PROGRAM complextocomplex IMPLICIT NONE !_________________________________ !Autor: Max TheoDOr Kuchel 28.04.2009 ! !kompiliert mit: ifort c2c.f90 -fpp -lfftw3 !_______________________________________________________________________________ #include'fftw3.f' !_______________________________________________________________________________ INTEGER :: k PARAMETER N=2048 DOUBLE PRECISION :: pi,kvec DOUBLE COMPLEX :: imi DOUBLE COMPLEX :: in, out DIMENSION in(N), out(N),kvec(N) INTEGER*8:: plan_hin,plan_her !_______________________________________________________________________________ imi=(0.0d0,1.0d0) pi=DACOS(-1.0d0) !_______________________________________________________________________________ !Initialisierung der Felder open(10,File='Ausgangsfunktion.dat') DO k=1,N in(k)=dsin(2.0*pi*(k-1)/REAL(N)) write(10,*) k-1,REAL(in(k)) END DO close(10) !_______________________________________________________________________________ ! Wellenzahlen initialisieren DO k=1,N/2+1 kvec(k)=k-1 END DO DO k=N/2+2,N kvec(k)=k-1-N END DO !_______________________________________________________________________________ ! Plaene initialisieren CALL dfftw_plan_dft_1d(plan_hin,N,in,out,FFTW_FORWARD,FFTW_ESTIMATE) CALL dfftw_plan_dft_1d(plan_her,N,out,in,FFTW_BACKWARD,FFTW_ESTIMATE) !_______________________________________________________________________________ ! in den Fourierraum CALL dfftw_execute_dft(plan_hin, in, out) out=out/DBLE(N)**0.5d0 open(11,File='Fouriertransformierte.dat') DO k=1,N/2+1 write(11,*) k-1,REAL(out(k))*2.0/DBLE(N)**0.5d0,AIMAG(out(k))*2.0/DBLE(N)**0.5d0 END DO DO k=N/2+2,N write(11,*) k-1-N,REAL(out(k))*2.0/DBLE(N)**0.5d0,AIMAG(out(k))*2.0/DBLE(N)**0.5d0 END DO close(11) !_______________________________________________________________________________ ! in den Ortsraum CALL dfftw_execute_dft(plan_her, out, in) in=in/DBLE(N)**0.5d0 open(12,File='Ruecktransformierte.dat') DO k=1,N write(12,*) (k-1),REAL(in(k)) END DO close(12) !_______________________________________________________________________________ !ZerstÃ¶rung der Plaene CALL dfftw_destroy_plan(plan_hin) CALL dfftw_destroy_plan(plan_her) !_______________________________________________________________________________ END PROGRAM