1 |
cnh |
1.4 |
C $Header: /u/gcmpack/models/MITgcmUV/pkg/zonal_filt/zonal_filt_init.F,v 1.3 2001/02/04 14:38:51 cnh Exp $ |
2 |
|
|
C $Name: $ |
3 |
adcroft |
1.2 |
|
4 |
|
|
#include "ZONAL_FILT_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
SUBROUTINE ZONAL_FILT_INIT(myThid) |
7 |
|
|
|
8 |
|
|
C /==========================================================\ |
9 |
|
|
C | S/R ZONAL_FILT_INIT | |
10 |
|
|
C | o Initialise FFT filter for latitude circle. | |
11 |
|
|
C |==========================================================| |
12 |
|
|
C | The details of particular FFT libraries may differ. | |
13 |
|
|
C | Changing to a different library may entail modifying the | |
14 |
|
|
C | code here. However, the broad process is usually the | |
15 |
|
|
C | same. | |
16 |
|
|
C | Note - Fourier modes for sNx and sNx+1 are damped in the | |
17 |
|
|
C | same way. This is because we have not implemented | |
18 |
|
|
C | a scheme that sets the damping factor for the | |
19 |
|
|
C | highest wave number for odd sNx. Instead the | |
20 |
|
|
C | highest wave number for odd sNx. Instead only | |
21 |
|
|
C | wave numbers 1:INT(sNx/2) are partially damped. | |
22 |
|
|
C | Wave number sNx/2 (if it exists) is removed | |
23 |
|
|
C | altogether. | |
24 |
|
|
C \==========================================================/ |
25 |
|
|
IMPLICIT NONE |
26 |
|
|
|
27 |
|
|
C == Global data == |
28 |
|
|
#include "SIZE.h" |
29 |
|
|
#include "EEPARAMS.h" |
30 |
|
|
#include "PARAMS.h" |
31 |
|
|
#include "GRID.h" |
32 |
|
|
#include "ZONAL_FILT.h" |
33 |
|
|
#include "FFTPACK.h" |
34 |
|
|
|
35 |
|
|
C == Routine arguments == |
36 |
|
|
C myThid - Thread number of this instance of FILTER_LATCIRC_FFT_INIT |
37 |
|
|
INTEGER myThid |
38 |
|
|
|
39 |
|
|
#ifdef ALLOW_ZONAL_FILT |
40 |
|
|
|
41 |
|
|
C == Local variables == |
42 |
|
|
C alpha - Used to evaluate frequency and latitude dependent |
43 |
|
|
C amplitude damping factor. |
44 |
|
|
C wvNum - Wave number |
45 |
|
|
C lat - Temporary holding latitude |
46 |
|
|
C nWv - No. of waves that fit on grid. |
47 |
|
|
_RL alpha, wvNum, lat |
48 |
|
|
INTEGER I, J, bi, bj, nPoints, nWv |
49 |
|
|
_RL one |
50 |
|
|
PARAMETER( one = 1.0 ) |
51 |
|
|
_RS ampfact,Y |
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 |
cnh |
1.4 |
_BEGIN_MASTER(myThid) |
59 |
adcroft |
1.2 |
C o Initialise specific library FFT package |
60 |
|
|
DO bj=1,nSy |
61 |
|
|
C CALL R8FFTI( Nx, FFTPACKWS(1,bj) ) |
62 |
|
|
CALL R8FFTI1( Nx, FFTPACKWS2(1,bj), FFTPACKWS3(1,bj) ) |
63 |
|
|
ENDDO |
64 |
|
|
|
65 |
|
|
C o Set amplitude scale factor as function of latitude and mode number |
66 |
|
|
DO bj=1,nSy |
67 |
|
|
DO bi=1,nSx |
68 |
|
|
DO j=1-oLy,sNy+Oly |
69 |
|
|
ampFactor(1,J,bi,bj) = one |
70 |
|
|
ampFactorV(1,J,bi,bj) = one |
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( yG(1,J,bi,bj) , 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(1,J,bi,bj) , I ) |
85 |
|
|
Cajatest |
86 |
|
|
ENDDO |
87 |
|
|
ENDDO |
88 |
|
|
ENDDO |
89 |
cnh |
1.4 |
_END_MASTER(myThid) |
90 |
|
|
CALL BAR2(myThid) |
91 |
adcroft |
1.2 |
|
92 |
|
|
CALL WRITE_REC_XY_RL( 'ampFactor', ampFactor, 1, 0, myThid ) |
93 |
|
|
|
94 |
|
|
#endif /* ALLOW_ZONAL_FILT */ |
95 |
|
|
|
96 |
|
|
RETURN |
97 |
|
|
END |