1 |
|
C $Header$ |
2 |
|
|
3 |
|
#include "ZONAL_FILT_OPTIONS.h" |
4 |
|
|
5 |
|
SUBROUTINE ZONAL_FILT_INIT(myThid) |
6 |
|
|
7 |
|
C /==========================================================\ |
8 |
|
C | S/R ZONAL_FILT_INIT | |
9 |
|
C | o Initialise FFT filter for latitude circle. | |
10 |
|
C |==========================================================| |
11 |
|
C | The details of particular FFT libraries may differ. | |
12 |
|
C | Changing to a different library may entail modifying the | |
13 |
|
C | code here. However, the broad process is usually the | |
14 |
|
C | same. | |
15 |
|
C | Note - Fourier modes for sNx and sNx+1 are damped in the | |
16 |
|
C | same way. This is because we have not implemented | |
17 |
|
C | a scheme that sets the damping factor for the | |
18 |
|
C | highest wave number for odd sNx. Instead the | |
19 |
|
C | highest wave number for odd sNx. Instead only | |
20 |
|
C | wave numbers 1:INT(sNx/2) are partially damped. | |
21 |
|
C | Wave number sNx/2 (if it exists) is removed | |
22 |
|
C | altogether. | |
23 |
|
C \==========================================================/ |
24 |
|
IMPLICIT NONE |
25 |
|
|
26 |
|
C == Global data == |
27 |
|
#include "SIZE.h" |
28 |
|
#include "EEPARAMS.h" |
29 |
|
#include "PARAMS.h" |
30 |
|
#include "GRID.h" |
31 |
|
#include "ZONAL_FILT.h" |
32 |
|
#include "FFTPACK.h" |
33 |
|
|
34 |
|
C == Routine arguments == |
35 |
|
C myThid - Thread number of this instance of FILTER_LATCIRC_FFT_INIT |
36 |
|
INTEGER myThid |
37 |
|
|
38 |
|
#ifdef ALLOW_ZONAL_FILT |
39 |
|
|
40 |
|
C == Local variables == |
41 |
|
C alpha - Used to evaluate frequency and latitude dependent |
42 |
|
C amplitude damping factor. |
43 |
|
C wvNum - Wave number |
44 |
|
C lat - Temporary holding latitude |
45 |
|
C nWv - No. of waves that fit on grid. |
46 |
|
_RL alpha, wvNum, lat |
47 |
|
INTEGER I, J, bi, bj, nPoints, nWv |
48 |
|
_RL one |
49 |
|
PARAMETER( one = 1.0 ) |
50 |
|
_RS ampfact,Y |
51 |
|
_RL yGCur |
52 |
|
ampfact(Y,I) = min( one, |
53 |
|
& ( cos( abs(Y)*deg2rad ) |
54 |
|
& /cos( zonal_filt_lat*deg2rad ) )**zonal_filt_cospow |
55 |
|
& /(sin( PI*float(I)/float(Nx) ) )**zonal_filt_sinpow |
56 |
|
& ) |
57 |
|
|
58 |
|
C o Initialise specific library FFT package |
59 |
|
DO bj=1,nSy |
60 |
|
C CALL R8FFTI( Nx, FFTPACKWS(1,bj) ) |
61 |
|
CALL R8FFTI1( Nx, FFTPACKWS2(1,bj), FFTPACKWS3(1,bj) ) |
62 |
|
ENDDO |
63 |
|
|
64 |
|
C o Set amplitude scale factor as function of latitude and mode number |
65 |
|
DO bj=1,nSy |
66 |
|
DO bi=1,nSx |
67 |
|
DO j=1-oLy,sNy+Oly |
68 |
|
ampFactor(1,J,bi,bj) = one |
69 |
|
ampFactorV(1,J,bi,bj) = one |
70 |
|
yGCur=yG(1,J,bi,bj) |
71 |
|
DO i=1,Nx/2-1 |
72 |
|
ampFactor(2*I,J,bi,bj) = ampfact( yC(1,J,bi,bj) , I ) |
73 |
|
C IF (ampFactor(2*I,J,bi,bj).LE..9) ampFactor(2*I,J,bi,bj)=0. |
74 |
|
ampFactor(2*I+1,J,bi,bj) = ampFactor(2*I,J,bi,bj) |
75 |
|
ampFactorV(2*I,J,bi,bj) = ampfact( yGCur , I ) |
76 |
|
C IF (ampFactorV(2*I,J,bi,bj).LE..9) ampFactorV(2*I,J,bi,bj)=0. |
77 |
|
ampFactorV(2*I+1,J,bi,bj) = ampFactorV(2*I,J,bi,bj) |
78 |
|
ENDDO |
79 |
|
I=Nx/2 |
80 |
|
Cajatest |
81 |
|
ampFactor(Nx,J,bi,bj) = 0. |
82 |
|
ampFactorV(Nx,J,bi,bj) = 0. |
83 |
|
C ampFactor(Nx,J,bi,bj) = ampfact( yC(1,J,bi,bj) , I ) |
84 |
|
C ampFactorV(Nx,J,bi,bj) = ampfact( yG , I ) |
85 |
|
Cajatest |
86 |
|
ENDDO |
87 |
|
ENDDO |
88 |
|
ENDDO |
89 |
|
|
90 |
|
CALL WRITE_REC_XY_RL( 'ampFactor', ampFactor, 1, 0, myThid ) |
91 |
|
|
92 |
|
#endif /* ALLOW_ZONAL_FILT */ |
93 |
|
|
94 |
|
RETURN |
95 |
|
END |