/[MITgcm]/MITgcm/pkg/zonal_filt/zonal_filter.F
ViewVC logotype

Contents of /MITgcm/pkg/zonal_filt/zonal_filter.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Fri Feb 2 21:36:30 2001 UTC (23 years, 3 months ago) by adcroft
Branch: MAIN
Changes since 1.1: +99 -0 lines
Merged changes from branch "branch-atmos-merge" into MAIN (checkpoint34)
 - substantial modifications to algorithm sequence (dynamics.F)
 - packaged OBCS, Shapiro filter, Zonal filter, Atmospheric Physics

1 C $Header: /u/gcmpack/models/MITgcmUV/pkg/zonal_filt/Attic/zonal_filter.F,v 1.1.2.1 2001/01/24 16:56:07 adcroft Exp $
2
3 #include "ZONAL_FILT_OPTIONS.h"
4
5 SUBROUTINE ZONAL_FILTER(
6 U field, fieldMask,
7 I jMin, jMax, kMin, kMax, bi, bj, gridLoc, myThid )
8 C /==========================================================\
9 C | S/R ZONAL_FILTER |
10 C | o Apply FFT filter to a latitude circle. |
11 C \==========================================================/
12 IMPLICIT NONE
13
14 C == Global data ==
15 #include "SIZE.h"
16 #include "ZONAL_FILT.h"
17 #include "FFTPACK.h"
18
19 C == Routine arguments ==
20 C jMin - Range of points to filter
21 C jMax
22 C kMin
23 C kMax
24 C bi
25 C bj
26 C myThid - Thread number of this instance of FILTER_LATCIRC_FFT_APPLY
27 C field - Field to filter
28 C gridLoc - Orientation (U or V) of field.
29 INTEGER myThid
30 INTEGER gridLoc
31 Real*8 field(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
32 Real*8 fieldMask(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
33 INTEGER jMin, jMax, kMin, kMax, bi, bj
34
35 #ifdef ALLOW_ZONAL_FILT
36
37 C == Local data ==
38 Real*8 phi(Nx)
39 Real*8 phiMask(Nx)
40 Real*8 avPhi
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 phiMask(I) = fieldMask(i,j,k,bi,bj)
50 ENDDO
51
52 C Interpolate through land
53 CALL ZONAL_FILT_PRESMOOTH( phiMask,phi,avPhi,sNx,myThid )
54
55 C o Forward transform (using specific FFT package)
56 C CALL R8FFTF( Nx, phi, FFTPACKWS(1,bj) )
57 CALL R8FFTF1( Nx, phi,
58 & FFTPACKWS1(1,bj), FFTPACKWS2(1,bj),FFTPACKWS3(1,bj) )
59
60 C o Apply amplitude filter and normalize
61 IF (gridLoc .EQ. 1) THEN
62 DO i=1, Nx
63 phi(i)=phi(i)*ampFactor(i,j,bi,bj)/float(Nx)
64 ENDDO
65 ELSEIF (gridLoc .EQ. 2) THEN
66 DO i=1, Nx
67 phi(i)=phi(i)*ampFactorV(i,j,bi,bj)/float(Nx)
68 ENDDO
69 ELSE
70 WRITE(0,*) 'Error: gridLoc = ',gridLoc
71 STOP 'Error: gridLoc has illegal value'
72 ENDIF
73
74 C o Backward transform (using specific FFT package)
75 C CALL R8FFTB( Nx, phi, FFTPACKWS(1,bj) )
76 CALL R8FFTB1( Nx, phi,
77 & FFTPACKWS1(1,bj), FFTPACKWS2(1,bj),FFTPACKWS3(1,bj) )
78
79 C De-interpolate through land
80 CALL ZONAL_FILT_POSTSMOOTH(phiMask,phi,avPhi,sNx,myThid)
81
82 C o Do periodic wrap around by hand
83 DO i=1-OLx,0
84 field(i,j,k,bi,bj) = phi(sNx+i)
85 ENDDO
86 DO i=1,sNx
87 field(i,j,k,bi,bj) = phi(I)
88 ENDDO
89 DO i=sNx+1,sNx+OLx
90 field(i,j,k,bi,bj) = phi(i-sNx)
91 ENDDO
92
93 ENDDO
94 ENDDO
95
96 #endif /* ALLOW_ZONAL_FILT */
97
98 RETURN
99 END

  ViewVC Help
Powered by ViewVC 1.1.22