1 | |
---|
2 | ! $Id: calwake.F90 2787 2017-01-30 16:54:45Z aborella $ |
---|
3 | |
---|
4 | SUBROUTINE calwake(iflag_wake_tend, paprs, pplay, dtime, & |
---|
5 | t, q, omgb, & |
---|
6 | dt_dwn, dq_dwn, m_dwn, m_up, dt_a, dq_a, & |
---|
7 | sigd, & |
---|
8 | wake_deltat, wake_deltaq, wake_s, wake_dens, & |
---|
9 | wake_dth, wake_h, & |
---|
10 | wake_pe, wake_fip, wake_gfl, & |
---|
11 | dt_wake, dq_wake, wake_k, t_x, q_x, wake_omgbdth, & |
---|
12 | wake_dp_omgb, & |
---|
13 | wake_dtke, wake_dqke, & |
---|
14 | wake_omg, wake_dp_deltomg, & |
---|
15 | wake_spread, wake_cstar, wake_d_deltat_gw, & |
---|
16 | wake_ddeltat, wake_ddeltaq, wake_ds, wake_ddens) |
---|
17 | ! ************************************************************** |
---|
18 | ! * |
---|
19 | ! CALWAKE * |
---|
20 | ! interface avec le schema de calcul de la poche * |
---|
21 | ! froide * |
---|
22 | ! * |
---|
23 | ! written by : CHERUY Frederique, 13/03/2000, 10.31.05 * |
---|
24 | ! modified by : ROEHRIG Romain, 01/30/2007 * |
---|
25 | ! ************************************************************** |
---|
26 | |
---|
27 | USE dimphy |
---|
28 | USE phys_state_var_mod, ONLY: pctsrf |
---|
29 | USE indice_sol_mod, ONLY: is_oce |
---|
30 | USE print_control_mod, ONLY: mydebug=>debug , lunout, prt_level |
---|
31 | IMPLICIT NONE |
---|
32 | ! ====================================================================== |
---|
33 | include "YOMCST.h" |
---|
34 | |
---|
35 | ! Arguments |
---|
36 | ! ---------- |
---|
37 | ! Input |
---|
38 | ! ---- |
---|
39 | INTEGER, INTENT (IN) :: iflag_wake_tend |
---|
40 | REAL, INTENT (IN) :: dtime |
---|
41 | REAL, DIMENSION(klon, klev), INTENT (IN) :: pplay |
---|
42 | REAL, DIMENSION(klon, klev+1), INTENT (IN) :: paprs |
---|
43 | REAL, DIMENSION(klon, klev), INTENT (IN) :: t, q, omgb |
---|
44 | REAL, DIMENSION(klon, klev), INTENT (IN) :: dt_dwn, dq_dwn |
---|
45 | REAL, DIMENSION(klon, klev), INTENT (IN) :: m_up, m_dwn |
---|
46 | REAL, DIMENSION(klon, klev), INTENT (IN) :: dt_a, dq_a |
---|
47 | REAL, DIMENSION(klon), INTENT (IN) :: sigd |
---|
48 | ! Input/Output |
---|
49 | ! ------------ |
---|
50 | REAL, DIMENSION(klon, klev), INTENT (INOUT) :: wake_deltat, wake_deltaq |
---|
51 | REAL, DIMENSION(klon), INTENT (INOUT) :: wake_s |
---|
52 | REAL, DIMENSION(klon), INTENT (INOUT) :: wake_dens |
---|
53 | ! Output |
---|
54 | ! ------ |
---|
55 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: dt_wake, dq_wake |
---|
56 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_k |
---|
57 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_d_deltat_gw |
---|
58 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_h |
---|
59 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_dth |
---|
60 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_pe, wake_fip, wake_gfl |
---|
61 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: t_x, q_x |
---|
62 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_omgbdth, wake_dp_omgb |
---|
63 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_dtke, wake_dqke |
---|
64 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_omg, wake_dp_deltomg |
---|
65 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_spread |
---|
66 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_cstar |
---|
67 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_ddeltat, wake_ddeltaq |
---|
68 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_ds, wake_ddens |
---|
69 | |
---|
70 | |
---|
71 | ! Variable internes |
---|
72 | ! ----------------- |
---|
73 | INTEGER :: i, l |
---|
74 | INTEGER, DIMENSION(klon) :: znatsurf ! 0 if pctsrf(is_oce)>0.1; 1 else. |
---|
75 | REAL :: aire |
---|
76 | REAL, DIMENSION(klon, klev) :: p, pi |
---|
77 | REAL, DIMENSION(klon, klev+1) :: ph |
---|
78 | REAL, DIMENSION(klon, klev) :: omgbe |
---|
79 | REAL, DIMENSION(klon, klev) :: te, qe |
---|
80 | REAL, DIMENSION(klon, klev) :: dtdwn, dqdwn |
---|
81 | REAL, DIMENSION(klon, klev) :: dta, dqa |
---|
82 | REAL, DIMENSION(klon, klev) :: amdwn, amup |
---|
83 | REAL, DIMENSION(klon, klev) :: dtw, dqw, dth |
---|
84 | REAL, DIMENSION(klon, klev) :: dtls, dqls |
---|
85 | REAL, DIMENSION(klon, klev) :: tx, qx |
---|
86 | REAL, DIMENSION(klon) :: hw, wape, fip, gfl |
---|
87 | REAL, DIMENSION(klon) :: sigmaw, wdens |
---|
88 | REAL, DIMENSION(klon, klev) :: omgbdth |
---|
89 | REAL, DIMENSION(klon, klev) :: dp_omgb |
---|
90 | REAL, DIMENSION(klon, klev) :: dtke, dqke |
---|
91 | REAL, DIMENSION(klon, klev) :: omg |
---|
92 | REAL, DIMENSION(klon, klev) :: dp_deltomg, spread |
---|
93 | REAL, DIMENSION(klon) :: cstar |
---|
94 | REAL, DIMENSION(klon) :: sigd0 |
---|
95 | INTEGER, DIMENSION(klon) :: ktopw |
---|
96 | REAL, DIMENSION(klon, klev) :: d_deltat_gw |
---|
97 | REAL, DIMENSION(klon, klev) :: d_deltatw, d_deltaqw |
---|
98 | REAL, DIMENSION(klon) :: d_sigmaw, d_wdens |
---|
99 | |
---|
100 | REAL :: rdcp |
---|
101 | |
---|
102 | |
---|
103 | IF (prt_level >= 10) THEN |
---|
104 | print *, '-> calwake, wake_s input ', wake_s(1) |
---|
105 | ENDIF |
---|
106 | |
---|
107 | rdcp = 1./3.5 |
---|
108 | |
---|
109 | znatsurf(:) = 0 |
---|
110 | DO i = 1,klon |
---|
111 | IF (pctsrf(i,is_oce) < 0.1) znatsurf(i) = 1 |
---|
112 | ENDDO |
---|
113 | |
---|
114 | |
---|
115 | ! ----------------------------------------------------------- |
---|
116 | ! IM 290108 DO 999 i=1,klon ! a vectoriser |
---|
117 | ! ---------------------------------------------------------- |
---|
118 | |
---|
119 | |
---|
120 | DO l = 1, klev |
---|
121 | DO i = 1, klon |
---|
122 | p(i, l) = pplay(i, l) |
---|
123 | ph(i, l) = paprs(i, l) |
---|
124 | pi(i, l) = (pplay(i,l)/100000.)**rdcp |
---|
125 | |
---|
126 | te(i, l) = t(i, l) |
---|
127 | qe(i, l) = q(i, l) |
---|
128 | omgbe(i, l) = omgb(i, l) |
---|
129 | |
---|
130 | dtdwn(i, l) = dt_dwn(i, l) |
---|
131 | dqdwn(i, l) = dq_dwn(i, l) |
---|
132 | dta(i, l) = dt_a(i, l) |
---|
133 | dqa(i, l) = dq_a(i, l) |
---|
134 | END DO |
---|
135 | END DO |
---|
136 | |
---|
137 | !---------------------------------------------------------------- |
---|
138 | ! Initialize tendencies to zero |
---|
139 | !---------------------------------------------------------------- |
---|
140 | dtls(:,:) = 0. |
---|
141 | dqls(:,:) = 0. |
---|
142 | d_deltat_gw(:,:) = 0. |
---|
143 | d_deltatw(:,:) = 0. |
---|
144 | d_deltaqw(:,:) = 0. |
---|
145 | d_sigmaw(:) = 0. |
---|
146 | d_wdens(:) = 0. |
---|
147 | ! |
---|
148 | |
---|
149 | DO i = 1, klon |
---|
150 | sigd0(i) = sigd(i) |
---|
151 | END DO |
---|
152 | ! print*, 'sigd0,sigd', sigd0, sigd(i) |
---|
153 | DO i = 1, klon |
---|
154 | ph(i, klev+1) = 0. |
---|
155 | END DO |
---|
156 | |
---|
157 | !!jyg! DO i = 1, klon |
---|
158 | !!jyg! ktopw(i) = NINT(wake_k(i)) |
---|
159 | !!jyg! END DO |
---|
160 | |
---|
161 | DO i = 1, klon |
---|
162 | hw(i) = wake_h(i) |
---|
163 | END DO |
---|
164 | ! |
---|
165 | ! Make a copy of state variables |
---|
166 | DO l = 1, klev |
---|
167 | DO i = 1, klon |
---|
168 | dtw(i, l) = wake_deltat(i, l) |
---|
169 | dqw(i, l) = wake_deltaq(i, l) |
---|
170 | END DO |
---|
171 | END DO |
---|
172 | |
---|
173 | DO i = 1, klon |
---|
174 | sigmaw(i) = wake_s(i) |
---|
175 | END DO |
---|
176 | |
---|
177 | DO i = 1, klon |
---|
178 | wdens(i) = wake_dens(i) |
---|
179 | END DO |
---|
180 | |
---|
181 | ! fkc les flux de masses sont evalues aux niveaux et valent 0 a la surface |
---|
182 | ! fkc on veut le flux de masse au milieu des couches |
---|
183 | |
---|
184 | DO l = 1, klev - 1 |
---|
185 | DO i = 1, klon |
---|
186 | amdwn(i, l) = 0.5*(m_dwn(i,l)+m_dwn(i,l+1)) |
---|
187 | amdwn(i, l) = (m_dwn(i,l+1)) |
---|
188 | END DO |
---|
189 | END DO |
---|
190 | |
---|
191 | ! au sommet le flux de masse est nul |
---|
192 | |
---|
193 | DO i = 1, klon |
---|
194 | amdwn(i, klev) = 0.5*m_dwn(i, klev) |
---|
195 | END DO |
---|
196 | |
---|
197 | DO l = 1, klev |
---|
198 | DO i = 1, klon |
---|
199 | amup(i, l) = m_up(i, l) |
---|
200 | END DO |
---|
201 | END DO |
---|
202 | |
---|
203 | CALL wake(znatsurf, p, ph, pi, dtime, & |
---|
204 | te, qe, omgbe, & |
---|
205 | dtdwn, dqdwn, amdwn, amup, dta, dqa, & |
---|
206 | sigd0, & |
---|
207 | dtw, dqw, sigmaw, wdens, & ! state variables |
---|
208 | dth, hw, wape, fip, gfl, & |
---|
209 | dtls, dqls, ktopw, omgbdth, dp_omgb, tx, qx, & |
---|
210 | dtke, dqke, omg, dp_deltomg, spread, cstar, & |
---|
211 | d_deltat_gw, & |
---|
212 | d_deltatw, d_deltaqw, d_sigmaw, d_wdens) ! tendencies |
---|
213 | |
---|
214 | ! |
---|
215 | DO l = 1, klev |
---|
216 | DO i = 1, klon |
---|
217 | IF (ktopw(i)>0) THEN |
---|
218 | wake_d_deltat_gw(i, l) = d_deltat_gw(i, l) |
---|
219 | wake_omgbdth(i, l) = omgbdth(i, l) |
---|
220 | wake_dp_omgb(i, l) = dp_omgb(i, l) |
---|
221 | wake_dtke(i, l) = dtke(i, l) |
---|
222 | wake_dqke(i, l) = dqke(i, l) |
---|
223 | wake_omg(i, l) = omg(i, l) |
---|
224 | wake_dp_deltomg(i, l) = dp_deltomg(i, l) |
---|
225 | wake_spread(i, l) = spread(i, l) |
---|
226 | wake_dth(i, l) = dth(i, l) |
---|
227 | dt_wake(i, l) = dtls(i, l)*dtime ! derivative -> tendency |
---|
228 | dq_wake(i, l) = dqls(i, l)*dtime ! derivative -> tendency |
---|
229 | t_x(i, l) = tx(i, l) |
---|
230 | q_x(i, l) = qx(i, l) |
---|
231 | ELSE |
---|
232 | wake_d_deltat_gw(i, l) = 0. |
---|
233 | wake_omgbdth(i, l) = 0. |
---|
234 | wake_dp_omgb(i, l) = 0. |
---|
235 | wake_dtke(i, l) = 0. |
---|
236 | wake_dqke(i, l) = 0. |
---|
237 | wake_omg(i, l) = 0. |
---|
238 | wake_dp_deltomg(i, l) = 0. |
---|
239 | wake_spread(i, l) = 0. |
---|
240 | wake_dth(i, l) = 0. |
---|
241 | dt_wake(i, l) = 0. |
---|
242 | dq_wake(i, l) = 0. |
---|
243 | t_x(i, l) = te(i, l) |
---|
244 | q_x(i, l) = qe(i, l) |
---|
245 | END IF |
---|
246 | END DO |
---|
247 | END DO |
---|
248 | |
---|
249 | DO i = 1, klon |
---|
250 | wake_h(i) = hw(i) |
---|
251 | wake_pe(i) = wape(i) |
---|
252 | wake_fip(i) = fip(i) |
---|
253 | wake_gfl(i) = gfl(i) |
---|
254 | wake_k(i) = ktopw(i) |
---|
255 | wake_cstar(i) = cstar(i) |
---|
256 | END DO |
---|
257 | |
---|
258 | ! Tendencies of state variables |
---|
259 | DO l = 1, klev |
---|
260 | DO i = 1, klon |
---|
261 | IF (ktopw(i)>0) THEN |
---|
262 | wake_ddeltat(i, l) = d_deltatw(i, l)*dtime |
---|
263 | wake_ddeltaq(i, l) = d_deltaqw(i, l)*dtime |
---|
264 | ELSE |
---|
265 | wake_ddeltat(i, l) = -wake_deltat(i, l) |
---|
266 | wake_ddeltaq(i, l) = -wake_deltaq(i, l) |
---|
267 | END IF |
---|
268 | END DO |
---|
269 | END DO |
---|
270 | DO i = 1, klon |
---|
271 | IF (ktopw(i)>0) THEN |
---|
272 | wake_ds(i) = d_sigmaw(i)*dtime |
---|
273 | wake_ddens(i) = d_wdens(i)*dtime |
---|
274 | ELSE |
---|
275 | wake_ds(i) = -wake_s(i) |
---|
276 | wake_ddens(i)= -wake_dens(i) |
---|
277 | END IF |
---|
278 | END DO |
---|
279 | ! |
---|
280 | |
---|
281 | !jyg< |
---|
282 | IF (iflag_wake_tend .EQ. 0) THEN |
---|
283 | ! Update State variables |
---|
284 | DO l = 1, klev |
---|
285 | DO i = 1, klon |
---|
286 | IF (ktopw(i)>0) THEN |
---|
287 | wake_deltat(i, l) = dtw(i, l) |
---|
288 | wake_deltaq(i, l) = dqw(i, l) |
---|
289 | ELSE |
---|
290 | wake_deltat(i, l) = 0. |
---|
291 | wake_deltaq(i, l) = 0. |
---|
292 | END IF |
---|
293 | END DO |
---|
294 | END DO |
---|
295 | DO i = 1, klon |
---|
296 | wake_s(i) = sigmaw(i) |
---|
297 | wake_dens(i) = wdens(i) |
---|
298 | END DO |
---|
299 | ENDIF |
---|
300 | !>jyg |
---|
301 | |
---|
302 | RETURN |
---|
303 | END SUBROUTINE calwake |
---|
304 | |
---|