1 |
C $Header: /u/gcmpack/models/MITgcmUV/pkg/zonal_filt/Attic/zonal_filt_init.F,v 1.1.2.3 2001/01/29 02:13:17 adcroft Exp $ |
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 |
ampfact(Y,I) = min( one, |
52 |
& ( cos( abs(Y)*deg2rad ) |
53 |
& /cos( zonal_filt_lat*deg2rad ) )**zonal_filt_cospow |
54 |
& /(sin( PI*float(I)/float(Nx) ) )**zonal_filt_sinpow |
55 |
& ) |
56 |
|
57 |
C o Initialise specific library FFT package |
58 |
DO bj=1,nSy |
59 |
C CALL R8FFTI( Nx, FFTPACKWS(1,bj) ) |
60 |
CALL R8FFTI1( Nx, FFTPACKWS2(1,bj), FFTPACKWS3(1,bj) ) |
61 |
ENDDO |
62 |
|
63 |
C o Set amplitude scale factor as function of latitude and mode number |
64 |
DO bj=1,nSy |
65 |
DO bi=1,nSx |
66 |
DO j=1-oLy,sNy+Oly |
67 |
ampFactor(1,J,bi,bj) = one |
68 |
ampFactorV(1,J,bi,bj) = one |
69 |
DO i=1,Nx/2-1 |
70 |
ampFactor(2*I,J,bi,bj) = ampfact( yC(1,J,bi,bj) , I ) |
71 |
C IF (ampFactor(2*I,J,bi,bj).LE..9) ampFactor(2*I,J,bi,bj)=0. |
72 |
ampFactor(2*I+1,J,bi,bj) = ampFactor(2*I,J,bi,bj) |
73 |
ampFactorV(2*I,J,bi,bj) = ampfact( yG(1,J,bi,bj) , I ) |
74 |
C IF (ampFactorV(2*I,J,bi,bj).LE..9) ampFactorV(2*I,J,bi,bj)=0. |
75 |
ampFactorV(2*I+1,J,bi,bj) = ampFactorV(2*I,J,bi,bj) |
76 |
ENDDO |
77 |
I=Nx/2 |
78 |
Cajatest |
79 |
ampFactor(Nx,J,bi,bj) = 0. |
80 |
ampFactorV(Nx,J,bi,bj) = 0. |
81 |
C ampFactor(Nx,J,bi,bj) = ampfact( yC(1,J,bi,bj) , I ) |
82 |
C ampFactorV(Nx,J,bi,bj) = ampfact( yG(1,J,bi,bj) , I ) |
83 |
Cajatest |
84 |
ENDDO |
85 |
ENDDO |
86 |
ENDDO |
87 |
|
88 |
CALL WRITE_REC_XY_RL( 'ampFactor', ampFactor, 1, 0, myThid ) |
89 |
|
90 |
#endif /* ALLOW_ZONAL_FILT */ |
91 |
|
92 |
RETURN |
93 |
END |