forked from NOAA-PSL/stochastic_physics
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dezouv_stochy.f
273 lines (268 loc) · 7.33 KB
/
dezouv_stochy.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
!>@brief The module 'dezouv_stochy_mod' contains the subroutine dezouv_stochy
! of divergence and odd harmonics of vorticty
module dezouv_stochy_mod
implicit none
contains
!>@brief The subroutine 'dezouv_stochy' caculates even u and odd v winds harmonics from the even harmonics
! of divergence and odd harmonics of vorticty
!>@details This code is taken from the legacy spectral GFS
subroutine dezouv_stochy(dev,zod,uev,vod,epsedn,epsodn,
& snnp1ev,snnp1od,ls_node)
cc
cc
use spectral_layout_mod
use kinddef
implicit none
cc
real(kind_dbl_prec) dev(len_trie_ls,2)
real(kind_dbl_prec) zod(len_trio_ls,2)
real(kind_dbl_prec) uev(len_trie_ls,2)
real(kind_dbl_prec) vod(len_trio_ls,2)
cc
real(kind_dbl_prec) epsedn(len_trie_ls)
real(kind_dbl_prec) epsodn(len_trio_ls)
cc
real(kind_dbl_prec) snnp1ev(len_trie_ls)
real(kind_dbl_prec) snnp1od(len_trio_ls)
cc
integer ls_node(ls_dim,3)
cc
!cmr ls_node(1,1) ... ls_node(ls_max_node,1) : values of L
!cmr ls_node(1,2) ... ls_node(ls_max_node,2) : values of jbasev
!cmr ls_node(1,3) ... ls_node(ls_max_node,3) : values of jbasod
cc
integer l,locl,n
cc
integer indev,indev1,indev2
integer indod,indod1,indod2
integer inddif
cc
real(kind_dbl_prec) rl
cc
real(kind_dbl_prec) cons0 !constant
cc
integer indlsev,jbasev
integer indlsod,jbasod
real(kind_evod) rerth
cc
include 'function2'
cc
cc
cc......................................................................
cc
cc
cons0 = 0.d0 !constant
rerth =6.3712e+6 ! radius of earth (m)
cc
cc
do locl=1,ls_max_node
l=ls_node(locl,1)
jbasev=ls_node(locl,2)
cc
uev(indlsev(l,l),1) = cons0 !constant
uev(indlsev(l,l),2) = cons0 !constant
cc
cc
enddo
cc
cc......................................................................
cc
do locl=1,ls_max_node
l=ls_node(locl,1)
jbasev=ls_node(locl,2)
jbasod=ls_node(locl,3)
indev1 = indlsev(L,L) + 1
if (mod(L,2).eq.mod(jcap+1,2)) then
indev2 = indlsev(jcap+1,L)
else
indev2 = indlsev(jcap ,L)
endif
indod1 = indlsod(l+1,l)
inddif = indev1 - indod1
cc
do indev = indev1 , indev2
cc
uev(indev,1) = -epsedn(indev)
x * zod(indev-inddif,1)
cc
uev(indev,2) = -epsedn(indev)
x * zod(indev-inddif,2)
cc
enddo
cc
enddo
cc
cc......................................................................
cc
do locl=1,ls_max_node
l=ls_node(locl,1)
jbasev=ls_node(locl,2)
jbasod=ls_node(locl,3)
indev1 = indlsev(L,L)
if (mod(L,2).eq.mod(jcap+1,2)) then
indev2 = indlsev(jcap-1,L)
else
indev2 = indlsev(jcap ,L)
endif
indod1 = indlsod(l+1,l)
inddif = indev1 - indod1
cc
do indev = indev1 , indev2
cc
vod(indev-inddif,1) = epsodn(indev-inddif)
x * dev(indev,1)
cc
vod(indev-inddif,2) = epsodn(indev-inddif)
x * dev(indev,2)
cc
enddo
cc
enddo
cc
cc......................................................................
cc
do locl=1,ls_max_node
l=ls_node(locl,1)
jbasev=ls_node(locl,2)
indev1 = indlsev(L,L)
if (mod(L,2).eq.mod(jcap+1,2)) then
indev2 = indlsev(jcap-1,L)
else
indev2 = indlsev(jcap ,L)
endif
if ( l .ge. 1 ) then
rl = l
do indev = indev1 , indev2
cc u(l,n)=-i*l*d(l,n)/(n*(n+1))
cc
uev(indev,1) = uev(indev,1)
1 + rl * dev(indev,2)
2 / snnp1ev(indev)
cc
uev(indev,2) = uev(indev,2)
1 - rl * dev(indev,1)
2 / snnp1ev(indev)
cc
enddo
endif
cc
enddo
cc
cc......................................................................
cc
do locl=1,ls_max_node
l=ls_node(locl,1)
jbasod=ls_node(locl,3)
indod1 = indlsod(L+1,L)
if (mod(L,2).eq.mod(jcap+1,2)) then
indod2 = indlsod(jcap ,L)
else
indod2 = indlsod(jcap+1,L) - 1
endif
if ( l .ge. 1 ) then
rl = l
do indod = indod1 , indod2
cc u(l,n)=-i*l*d(l,n)/(n*(n+1))
cc
vod(indod,1) = vod(indod,1)
1 + rl * zod(indod,2)
2 / snnp1od(indod)
cc
vod(indod,2) = vod(indod,2)
1 - rl * zod(indod,1)
2 / snnp1od(indod)
cc
enddo
endif
cc
enddo
cc
cc......................................................................
cc
do locl=1,ls_max_node
l=ls_node(locl,1)
jbasev=ls_node(locl,2)
jbasod=ls_node(locl,3)
indev1 = indlsev(L,L)
if (mod(L,2).eq.mod(jcap+1,2)) then
indev2 = indlsev(jcap+1,L) - 1
else
indev2 = indlsev(jcap ,L) - 1
endif
indod1 = indlsod(l+1,l)
inddif = indev1 - indod1
cc
do indev = indev1 , indev2
cc
uev(indev,1) = uev(indev ,1)
1 + epsodn(indev-inddif) * zod(indev-inddif,1)
cc
uev(indev,2) = uev(indev ,2)
1 + epsodn(indev-inddif) * zod(indev-inddif,2)
cc
enddo
cc
enddo
cc
cc......................................................................
cc
do locl=1,ls_max_node
l=ls_node(locl,1)
jbasev=ls_node(locl,2)
jbasod=ls_node(locl,3)
indev1 = indlsev(L,L) + 1
if (mod(L,2).eq.mod(jcap+1,2)) then
indev2 = indlsev(jcap-1,L)
else
indev2 = indlsev(jcap ,L)
endif
indod1 = indlsod(l+1,l)
inddif = indev1 - indod1
cc
do indev = indev1 , indev2
cc
vod(indev-inddif,1) = vod(indev-inddif,1)
1 - epsedn(indev) * dev(indev ,1)
cc
vod(indev-inddif,2) = vod(indev-inddif,2)
1 - epsedn(indev) * dev(indev ,2)
cc
enddo
cc
enddo
cc
cc......................................................................
cc
cc
do locl=1,ls_max_node
l=ls_node(locl,1)
jbasev=ls_node(locl,2)
jbasod=ls_node(locl,3)
indev1 = indlsev(L,L)
indod1 = indlsod(L+1,L)
if (mod(L,2).eq.mod(jcap+1,2)) then
indev2 = indlsev(jcap+1,L)
indod2 = indlsod(jcap ,L)
else
indev2 = indlsev(jcap ,L)
indod2 = indlsod(jcap+1,L)
endif
do indev = indev1 , indev2
cc
uev(indev,1) = uev(indev,1) * rerth
uev(indev,2) = uev(indev,2) * rerth
cc
enddo
cc
do indod = indod1 , indod2
cc
vod(indod,1) = vod(indod,1) * rerth
vod(indod,2) = vod(indod,2) * rerth
cc
enddo
cc
enddo
cc
return
end
end module dezouv_stochy_mod