NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3ft12.f
Go to the documentation of this file.
1C> @file
2C> @brief Fast fourier for 2.5 degree grid.
3C> @author Joe Sela @date 1980-11-21
4
5C> Fast fourier to compute 145 grid values at desired
6C> latitude from 31 complex fourier coefficients. This subroutine
7C> is special purpose for converting coefficients to a 2.5 degree
8C> lat,lon grid.
9C>
10C> ### Program History Log:
11C> Date | Programmer | Comment
12C> -----|------------|--------
13C> 1980-11-21 | Joe Sela | Initial.
14C> 1984-06-21 | Ralph Jones | Change to ibm vs fortran.
15C> 1993-04-12 | Ralph Jones | Change to cray cft77 fortran.
16C>
17C> @param[in] COEF 31 complex fourier coefficients.
18C> @param[in] TRIGS 216 trig functions assumed precomputed by w3fa13() before
19C> first call to w3ft12().
20C> @param[in] WORK 144 real work space
21C> @param[out] GRID 145 grid values, grid(1)=grid(145)
22C>
23C> @author Joe Sela @date 1980-11-21
24 SUBROUTINE w3ft12(COEF,WORK,GRID,TRIGS)
25 REAL COEF( 62 )
26 REAL GRID(145)
27 REAL TRIGS(216)
28 REAL WORK(144)
29C
30 SAVE
31C
32 DATA sin60/0.866025403784437/
33C
34 grid(1) = coef(1)
35 grid(2) = coef(1)
36 k = 147
37 j = 143
38 DO 100 i=3, 61 ,2
39 temp = coef(i)*trigs(k+1) - coef(i+1)*trigs(k)
40 grid(i) = coef(i) - temp
41 grid(j) = coef(i) + temp
42 temp = coef(i)*trigs(k) + coef(i+1)*trigs(k+1)
43 grid(i+1) = temp - coef(i+1)
44 grid(j+1) = temp + coef(i+1)
45 k = k + 2
46 j = j - 2
47100 CONTINUE
48 DO 110 i= 63 , 84
49 grid(i) = 0.0
50110 CONTINUE
51C
52 a0 = grid(1) + grid(73)
53 a2 = grid(1) - grid(73)
54 b0 = grid(2) + grid(74)
55 b2 = grid(2) - grid(74)
56 a1 = grid(37) + grid(109)
57 a3 = grid(37) - grid(109)
58 b1 = grid(38) + grid(110)
59 b3 = grid(38) - grid(110)
60 work(1) = a0 + a1
61 work(5) = a0 - a1
62 work(2) = b0 + b1
63 work(6) = b0 - b1
64 work(3) = a2 - b3
65 work(7) = a2 + b3
66 work(4) = b2 + a3
67 work(8) = b2 - a3
68 kb = 3
69 kc = 5
70 kd = 7
71 j = 75
72 k = 39
73 l = 111
74 m = 9
75 DO 300 i=3,35,2
76 a0 = grid(i) + grid(j)
77 a2 = grid(i) - grid(j)
78 b0 = grid(i+1) + grid(j+1)
79 b2 = grid(i+1) - grid(j+1)
80 a1 = grid(k) + grid(l)
81 a3 = grid(k) - grid(l)
82 b1 = grid(k+1) + grid(l+1)
83 b3 = grid(k+1) - grid(l+1)
84 work(m ) = a0 + a1
85 work(m+4) = a0 - a1
86 work(m+1) = b0 + b1
87 work(m+5) = b0 - b1
88 work(m+2) = a2 - b3
89 work(m+6) = a2 + b3
90 work(m+3) = b2 + a3
91 work(m+7) = b2 - a3
92 temp = work(m+2)*trigs(kb) - work(m+3)*trigs(kb+1)
93 work(m+3) = work(m+2)*trigs(kb+1) + work(m+3)*trigs(kb)
94 work(m+2) = temp
95 temp = work(m+4)*trigs(kc) - work(m+5)*trigs(kc+1)
96 work(m+5) = work(m+4)*trigs(kc+1) + work(m+5)*trigs(kc)
97 work(m+4) = temp
98 temp = work(m+6)*trigs(kd) - work(m+7)*trigs(kd+1)
99 work(m+7) = work(m+6)*trigs(kd+1) + work(m+7)*trigs(kd)
100 work(m+6) = temp
101 j = j + 2
102 k = k + 2
103 l = l + 2
104 kb = kb + 2
105 kc = kc + 4
106 kd = kd + 6
107 m = m + 8
108300 CONTINUE
109C
110 i = 1
111 j = 1
112 k = 73
113 DO 440 l=1,4
114 grid(i) = work(j) + work(k)
115 grid(i+8) = work(j) - work(k)
116 grid(i+1) = work(j+1) + work(k+1)
117 grid(i+9) = work(j+1) - work(k+1)
118 i = i + 2
119 j = j + 2
120 k = k + 2
121440 CONTINUE
122 DO 500 kb=9,65,8
123 i = i + 8
124 DO 460 l=1,4
125 grid(i) = work(j) + work(k)
126 grid(i+8) = work(j) - work(k)
127 grid(i+1) = work(j+1) + work(k+1)
128 grid(i+9) = work(j+1) - work(k+1)
129 temp = grid(i+8)*trigs(kb) - grid(i+9)*trigs(kb+1)
130 grid(i+9) = grid(i+8)*trigs(kb+1) + grid(i+9)*trigs(kb)
131 grid(i+8) = temp
132 i = i + 2
133 j = j + 2
134 k = k + 2
135460 CONTINUE
136500 CONTINUE
137C
138 i = 1
139 l = 1
140 kc = 1
141 j = 49
142 k = 97
143 m = 17
144 n = 33
145 DO 660 ll=1,8
146 a1 = grid(j) + grid(k)
147 a3 = sin60*(grid(j)-grid(k))
148 b1 = grid(j+1) + grid(k+1)
149 b3 = sin60*(grid(j+1)-grid(k+1))
150 work(l) = grid(i) + a1
151 a2 = grid(i) - 0.5*a1
152 work(l+1) = grid(i+1) + b1
153 b2 = grid(i+1) - 0.5*b1
154 work(n) = a2 + b3
155 work(m) = a2 - b3
156 work(m+1) = b2 + a3
157 work(n+1) = b2 - a3
158 i = i + 2
159 j = j + 2
160 k = k + 2
161 l = l + 2
162 m = m + 2
163 n = n + 2
164660 CONTINUE
165 DO 700 kb=17,33,16
166 l = l + 32
167 m = m + 32
168 n = n + 32
169 kc = kc + 32
170 DO 680 ll=1,8
171 a1 = grid(j) + grid(k)
172 a3 = sin60*(grid(j)-grid(k))
173 b1 = grid(j+1) + grid(k+1)
174 b3 = sin60*(grid(j+1)-grid(k+1))
175 work(l) = grid(i) + a1
176 a2 = grid(i) - 0.5*a1
177 work(l+1) = grid(i+1) + b1
178 b2 = grid(i+1) - 0.5*b1
179 work(n) = a2 + b3
180 work(m) = a2 - b3
181 work(m+1) = b2 + a3
182 work(n+1) = b2 - a3
183 temp = work(m)*trigs(kb) - work(m+1)*trigs(kb+1)
184 work(m+1) = work(m)*trigs(kb+1) + work(m+1)*trigs(kb)
185 work(m) = temp
186 temp = work(n)*trigs(kc) - work(n+1)*trigs(kc+1)
187 work(n+1) = work(n)*trigs(kc+1) + work(n+1)*trigs(kc)
188 work(n) = temp
189 i = i + 2
190 j = j + 2
191 k = k + 2
192 l = l + 2
193 m = m + 2
194 n = n + 2
195680 CONTINUE
196700 CONTINUE
197C
198 j = 49
199 k = 97
200 l = 144
201 m = 96
202 n = 48
203 DO 900 i=1,47,2
204 a1 = work(j) + work(k)
205 a3 = sin60 * (work(j)-work(k))
206 b3 = sin60 * (work(j+1)-work(k+1))
207 b1 = work(j+1) + work(k+1)
208 grid(l+1) = work(i) + a1
209 a2 = work(i) - 0.5*a1
210 b2 = work(i+1) - 0.5*b1
211 grid(l) = work(i+1) + b1
212 grid(n+1) = a2 + b3
213 grid(m+1) = a2 - b3
214 grid(m) = b2 + a3
215 grid(n) = b2 - a3
216 j = j + 2
217 k = k + 2
218 l = l - 2
219 m = m - 2
220 n = n - 2
221900 CONTINUE
222 grid(1) = grid(145)
223C
224 RETURN
225 END
subroutine w3ft12(coef, work, grid, trigs)
Fast fourier to compute 145 grid values at desired latitude from 31 complex fourier coefficients.
Definition w3ft12.f:25