source: LMDZ4/branches/LMDZ4_AR5/libf/filtrez/mod_fft_mathkeisan.F90 @ 3536

Last change on this file since 3536 was 1601, checked in by Ehouarn Millour, 13 years ago

Updates and upgrades of filter:

  • add minor corrections (r1591 of trunk) in filtreg_mod.F90: some arrays were oversized and the computation of the indexes from which the filter is applied could go wrong in extreme cases.
  • adapt filtreg_p.F (r1597 of trunk) so that BLAS routine DGEMM is only used if 'BLAS' preprocessing flag is set.
  • update FFT filter routines to match current 'trunk' versions (mostly cosmetic changes, exept for the implementation of use of FFTW in mod_fft_fftw.F90).
  • update "arch-PW6_VARGAS.fcm" to enable use of FFTW

NB: implemented FFTs assume working precision to be double precision ; trying to use them when working precision is single precision will clearly end in tragedy.
EM

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1MODULE mod_fft_mathkeisan
2#ifdef FFT_MATHKEISAN
3
4  REAL,SAVE,ALLOCATABLE    :: Table_forward(:)
5  REAL,SAVE,ALLOCATABLE    :: Table_backward(:)
6  REAL,SAVE                :: scale_factor
7  INTEGER,SAVE             :: vsize
8  INTEGER,PARAMETER        :: inc=2
9
10CONTAINS
11 
12  SUBROUTINE Init_fft(iim,nb_vect_max)
13  IMPLICIT NONE
14    INTEGER :: iim
15    INTEGER :: nb_vect_max
16    REAL    :: rtmp=1.
17    COMPLEX :: ctmp
18    INTEGER :: itmp=1
19    INTEGER :: isign=0
20    INTEGER :: ierr
21   
22    vsize=iim
23    scale_factor=1./SQRT(1.*vsize)
24    ALLOCATE(Table_forward(2*vsize+64))
25    ALLOCATE(Table_backward(2*vsize+64))
26   
27    CALL DZFFTM(isign,vsize,itmp,scale_factor,rtmp,vsize+inc,ctmp,vsize/2+1,table_forward,rtmp,ierr)
28   
29    CALL ZDFFTM(isign,vsize,itmp,scale_factor,ctmp,vsize/2+1,rtmp,vsize+inc,table_backward,rtmp,ierr)
30
31   
32  END SUBROUTINE Init_fft
33 
34 
35  SUBROUTINE fft_forward(vect,TF_vect,nb_vect)
36    IMPLICIT NONE
37    INTEGER,INTENT(IN)  :: nb_vect
38    REAL,INTENT(IN)     :: vect(vsize+inc,nb_vect)
39    COMPLEX,INTENT(OUT) :: TF_vect(vsize/2+1,nb_vect)
40    REAL                :: work(4*vsize*nb_vect)
41    INTEGER             :: ierr
42    INTEGER, PARAMETER :: isign=-1
43   
44    work=0
45    CALL DZFFTM(isign,vsize,nb_vect,scale_factor,vect,vsize+inc,TF_vect,vsize/2+1,table_forward,work,ierr)
46 
47  END SUBROUTINE fft_forward
48 
49  SUBROUTINE fft_backward(TF_vect,vect,nb_vect)
50    IMPLICIT NONE
51    INTEGER,INTENT(IN)  :: nb_vect
52    REAL,INTENT(OUT)    :: vect(vsize+inc,nb_vect)
53    COMPLEX,INTENT(IN ) :: TF_vect(vsize/2+1,nb_vect)
54    REAL                :: work(4*vsize*nb_vect)
55    INTEGER             :: ierr
56    INTEGER, PARAMETER :: isign=1
57   
58    work(:)=0
59    CALL ZDFFTM(isign,vsize,nb_vect,scale_factor,TF_vect,vsize/2+1,vect,vsize+inc,table_backward,work,ierr)
60 
61  END SUBROUTINE fft_backward
62
63#endif
64 
65END MODULE mod_fft_mathkeisan
66
67
Note: See TracBrowser for help on using the repository browser.