1 |
C $Header: /u/gcmpack/models/MITgcmUV/pkg/zonal_filt/zonal_filt_nofill.F,v 1.3 2001/02/04 14:38:51 cnh Exp $ |
2 |
C $Name: checkpoint37 $ |
3 |
|
4 |
#include "ZONAL_FILT_OPTIONS.h" |
5 |
|
6 |
SUBROUTINE ZONAL_FILT_NOFILL( |
7 |
U field, |
8 |
I jMin, jMax, kMin, kMax, bi, bj, gridLoc, myThid ) |
9 |
C /==========================================================\ |
10 |
C | S/R ZONAL_FILT_NOFILL | |
11 |
C | o Apply FFT filter to a latitude circle. | |
12 |
C | *No fill* | |
13 |
C \==========================================================/ |
14 |
IMPLICIT NONE |
15 |
|
16 |
C == Global data == |
17 |
#include "SIZE.h" |
18 |
#include "ZONAL_FILT.h" |
19 |
#include "FFTPACK.h" |
20 |
|
21 |
C == Routine arguments == |
22 |
C jMin - Range of points to filter |
23 |
C jMax |
24 |
C kMin |
25 |
C kMax |
26 |
C bi |
27 |
C bj |
28 |
C myThid - Thread number of this instance of FILTER_LATCIRC_FFT_APPLY |
29 |
C field - Field to filter |
30 |
C gridLoc - Orientation (U or V) of field. |
31 |
INTEGER myThid |
32 |
INTEGER gridLoc |
33 |
C Real*8 field(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
34 |
Real*8 field(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1,nSx,nSy) |
35 |
INTEGER jMin, jMax, kMin, kMax, bi, bj |
36 |
|
37 |
#ifdef ALLOW_ZONAL_FILT |
38 |
|
39 |
C == Local data == |
40 |
Real*8 phi(Nx) |
41 |
INTEGER I, J, K |
42 |
|
43 |
DO k=kMin, kMax |
44 |
DO j=jMin, jMax |
45 |
|
46 |
C o Copy zonal line of field into local workspace |
47 |
DO i=1,sNx |
48 |
phi(I) = field(i,j,k,bi,bj) |
49 |
ENDDO |
50 |
|
51 |
C o Forward transform (using specific FFT package) |
52 |
C CALL R8FFTF( Nx, phi, FFTPACKWS(1,bj) ) |
53 |
CALL R8FFTF1( Nx, phi, |
54 |
& FFTPACKWS1(1,bj), FFTPACKWS2(1,bj),FFTPACKWS3(1,bj) ) |
55 |
|
56 |
C o Apply amplitude filter and normalize |
57 |
IF (gridLoc .EQ. 1) THEN |
58 |
DO i=1, Nx |
59 |
phi(i)=phi(i)*ampFactor(i,j,bi,bj)/float(Nx) |
60 |
ENDDO |
61 |
ELSEIF (gridLoc .EQ. 2) THEN |
62 |
DO i=1, Nx |
63 |
phi(i)=phi(i)*ampFactorV(i,j,bi,bj)/float(Nx) |
64 |
ENDDO |
65 |
ELSE |
66 |
WRITE(*,*) 'Error: gridLoc = ',gridLoc |
67 |
STOP 'Error: gridLoc has illegal value' |
68 |
ENDIF |
69 |
|
70 |
C o Backward transform (using specific FFT package) |
71 |
C CALL R8FFTB( Nx, phi, FFTPACKWS(1,bj) ) |
72 |
CALL R8FFTB1( Nx, phi, |
73 |
& FFTPACKWS1(1,bj), FFTPACKWS2(1,bj),FFTPACKWS3(1,bj) ) |
74 |
|
75 |
C o Do periodic wrap around by hand |
76 |
DO i=1-OLx,0 |
77 |
field(i,j,k,bi,bj) = phi(sNx+i) |
78 |
ENDDO |
79 |
DO i=1,sNx |
80 |
field(i,j,k,bi,bj) = phi(I) |
81 |
ENDDO |
82 |
DO i=sNx+1,sNx+OLx |
83 |
field(i,j,k,bi,bj) = phi(i-sNx) |
84 |
ENDDO |
85 |
|
86 |
ENDDO |
87 |
ENDDO |
88 |
|
89 |
#endif /* ALLOW_ZONAL_FILT */ |
90 |
|
91 |
RETURN |
92 |
END |