source: LMDZ6/branches/Amaury_dev/libf/phylmd/wx_pbl_var_mod.F90 @ 5116

Last change on this file since 5116 was 5112, checked in by abarral, 4 months ago

Rename modules in phy_common from *_mod > lmdz_*

File size: 26.4 KB
Line 
1MODULE wx_pbl_var_mod
2
3  ! Split Planetary Boundary Layer variables
4
5  ! This module manages the variables necessary for the splitting of the boundary layer
6
7  USE dimphy
8  USE lmdz_abort_physic, ONLY: abort_physic
9
10  IMPLICIT NONE
11
12  REAL, PROTECTED, SAVE :: eps_1, fqsat, smallestreal
13  !$OMP THREADPRIVATE(eps_1, fqsat, smallestreal)
14
15  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: C_p, L_v
16  !$OMP THREADPRIVATE(C_p, L_v)
17  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: Ts0, dTs0
18  !$OMP THREADPRIVATE(Ts0, dTs0)
19  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: Ts0_x, Ts0_w
20  !$OMP THREADPRIVATE(Ts0_x, Ts0_w)
21  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: qsat0, dqsatdT0
22  !$OMP THREADPRIVATE(qsat0, dqsatdT0)
23  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: qsat0_x, dqsatdT0_x
24  !$OMP THREADPRIVATE(qsat0_x, dqsatdT0_x)
25  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: qsat0_w, dqsatdT0_w
26  !$OMP THREADPRIVATE(qsat0_w, dqsatdT0_w)
27  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: QQ_b, dd_QQ
28  !$OMP THREADPRIVATE(QQ_b, dd_QQ)
29  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: QQ_x, QQ_w
30  !$OMP THREADPRIVATE(QQ_x, QQ_w)
31  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: qsatsrf0_x, qsatsrf0_w
32  !$OMP THREADPRIVATE(qsatsrf0_x, qsatsrf0_w)
33  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: dqsatsrf0
34  !$OMP THREADPRIVATE(dqsatsrf0)
35  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: q1_0b
36  !$OMP THREADPRIVATE(q1_0b)
37  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: dd_Cdragh, dd_Cdragm, dd_Cdragq
38  !$OMP THREADPRIVATE(dd_Cdragh, dd_Cdragm, dd_Cdragq )
39  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: Kech_h, Kech_h_x, Kech_h_w   ! Energy exchange coefficients
40  !$OMP THREADPRIVATE(Kech_h, Kech_h_x, Kech_h_w)
41  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: Kech_q, Kech_q_x, Kech_q_w   ! Moisture exchange coefficients
42  !$OMP THREADPRIVATE(Kech_q, Kech_q_x, Kech_q_w)
43  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: Kech_m, Kech_m_x, Kech_m_w   ! Momentum exchange coefficients
44  !$OMP THREADPRIVATE(Kech_m, Kech_m_x, Kech_m_w)
45  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: Kech_Tp, Kech_T_px, Kech_T_pw
46  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: dd_KTp, KxKwTp
47  !$OMP THREADPRIVATE(Kech_Tp, Kech_T_px, Kech_T_pw, dd_KTp, KxKwTp)
48  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: dd_AT, dd_BT
49  !$OMP THREADPRIVATE(dd_AT, dd_BT)
50  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: Kech_Qp, Kech_Q_px, Kech_Q_pw
51  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: dd_KQp, KxKwQp
52  !$OMP THREADPRIVATE(Kech_Qp, Kech_Q_px, Kech_Q_pw, dd_KQp, KxKwQp)
53  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: Kech_Qs, Kech_Q_sx, Kech_Q_sw
54  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: dd_KQs, KxKwQs
55  !$OMP THREADPRIVATE(Kech_Qs, Kech_Q_sx, Kech_Q_sw, dd_KQs, KxKwQs)
56  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: dd_AQ, dd_BQ
57  !$OMP THREADPRIVATE(dd_AQ, dd_BQ)
58  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: AQ_x, AQ_w, BQ_x, BQ_w
59  !$OMP THREADPRIVATE(AQ_x, AQ_w, BQ_x, BQ_w)
60  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: Kech_Up, Kech_U_px, Kech_U_pw
61  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: dd_KUp, KxKwUp
62  !$OMP THREADPRIVATE(Kech_Up, Kech_U_px, Kech_U_pw, dd_KUp, KxKwUp)
63  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: dd_AU, dd_BU
64  !$OMP THREADPRIVATE(dd_AU, dd_BU)
65  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: Kech_Vp, Kech_V_px, Kech_V_pw
66  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: dd_KVp, KxKwVp
67  !$OMP THREADPRIVATE(Kech_Vp, Kech_V_px, Kech_V_pw, dd_KVp, KxKwVp)
68  REAL, ALLOCATABLE, PROTECTED, DIMENSION(:), SAVE :: dd_AV, dd_BV
69  !$OMP THREADPRIVATE(dd_AV, dd_BV)
70
71CONTAINS
72
73  !****************************************************************************************
74
75  SUBROUTINE wx_pbl_init
76
77    ! Local variables
78    !****************************************************************************************
79    INTEGER :: ierr
80
81
82    !****************************************************************************************
83    ! Allocate module variables
84
85    !****************************************************************************************
86
87    ierr = 0
88
89    ALLOCATE(C_p(klon), stat = ierr)
90    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
91
92    ALLOCATE(L_v(klon), stat = ierr)
93    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
94
95    ALLOCATE(Ts0(klon), stat = ierr)
96    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
97
98    ALLOCATE(dTs0(klon), stat = ierr)
99    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
100
101    ALLOCATE(Ts0_x(klon), stat = ierr)
102    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
103
104    ALLOCATE(Ts0_w(klon), stat = ierr)
105    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
106
107    ALLOCATE(qsat0(klon), stat = ierr)
108    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
109
110    ALLOCATE(dqsatdT0(klon), stat = ierr)
111    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
112
113    ALLOCATE(qsat0_x(klon), stat = ierr)
114    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
115
116    ALLOCATE(dqsatdT0_x(klon), stat = ierr)
117    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
118
119    ALLOCATE(qsat0_w(klon), stat = ierr)
120    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
121
122    ALLOCATE(dqsatdT0_w(klon), stat = ierr)
123    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
124
125    ALLOCATE(q1_0b(klon), stat = ierr)
126    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
127
128    ALLOCATE(QQ_b(klon), stat = ierr)
129    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
130
131    ALLOCATE(dd_QQ(klon), stat = ierr)
132    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
133
134    ALLOCATE(QQ_x(klon), stat = ierr)
135    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
136
137    ALLOCATE(QQ_w(klon), stat = ierr)
138    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
139
140    ALLOCATE(qsatsrf0_x(klon), stat = ierr)
141    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
142
143    ALLOCATE(qsatsrf0_w(klon), stat = ierr)
144    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
145
146    ALLOCATE(dqsatsrf0(klon), stat = ierr)
147    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
148
149    ALLOCATE(dd_Cdragh(klon), stat = ierr)
150    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
151
152    ALLOCATE(dd_Cdragm(klon), stat = ierr)
153    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
154
155    ALLOCATE(dd_Cdragq(klon), stat = ierr)
156    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
157
158    ALLOCATE(Kech_h(klon), stat = ierr)
159    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
160
161    ALLOCATE(Kech_h_x(klon), stat = ierr)
162    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
163
164    ALLOCATE(Kech_h_w(klon), stat = ierr)
165    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
166
167    ALLOCATE(Kech_q(klon), stat = ierr)
168    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
169
170    ALLOCATE(Kech_q_x(klon), stat = ierr)
171    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
172
173    ALLOCATE(Kech_q_w(klon), stat = ierr)
174    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
175
176    ALLOCATE(Kech_m(klon), stat = ierr)
177    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
178
179    ALLOCATE(Kech_m_x(klon), stat = ierr)
180    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
181
182    ALLOCATE(Kech_m_w(klon), stat = ierr)
183    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
184
185    ALLOCATE(Kech_Tp(klon), stat = ierr)
186    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
187
188    ALLOCATE(Kech_T_px(klon), stat = ierr)
189    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
190
191    ALLOCATE(Kech_T_pw(klon), stat = ierr)
192    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
193
194    ALLOCATE(dd_KTp(klon), stat = ierr)
195    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
196
197    ALLOCATE(KxKwTp(klon), stat = ierr)
198    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
199
200    ALLOCATE(dd_AT(klon), stat = ierr)
201    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
202
203    ALLOCATE(dd_BT(klon), stat = ierr)
204    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
205
206    !----------------------------------------------------------------------------
207    ALLOCATE(Kech_Qp(klon), stat = ierr)
208    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
209
210    ALLOCATE(Kech_Q_px(klon), stat = ierr)
211    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
212
213    ALLOCATE(Kech_Q_pw(klon), stat = ierr)
214    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
215
216    ALLOCATE(dd_KQp(klon), stat = ierr)
217    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
218
219    ALLOCATE(KxKwQp(klon), stat = ierr)
220    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
221
222    ALLOCATE(Kech_Qs(klon), stat = ierr)
223    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
224
225    ALLOCATE(Kech_Q_sx(klon), stat = ierr)
226    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
227
228    ALLOCATE(Kech_Q_sw(klon), stat = ierr)
229    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
230
231    ALLOCATE(dd_KQs(klon), stat = ierr)
232    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
233
234    ALLOCATE(KxKwQs(klon), stat = ierr)
235    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
236
237    !!!!!!!!!!
238    ALLOCATE(AQ_x(klon), stat = ierr)
239    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
240
241    ALLOCATE(AQ_w(klon), stat = ierr)
242    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
243
244    ALLOCATE(BQ_x(klon), stat = ierr)
245    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
246
247    ALLOCATE(BQ_w(klon), stat = ierr)
248    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
249
250    ALLOCATE(dd_AQ(klon), stat = ierr)
251    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
252
253    ALLOCATE(dd_BQ(klon), stat = ierr)
254    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
255
256    !----------------------------------------------------------------------------
257    ALLOCATE(Kech_Up(klon), stat = ierr)
258    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
259
260    ALLOCATE(Kech_U_px(klon), stat = ierr)
261    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
262
263    ALLOCATE(Kech_U_pw(klon), stat = ierr)
264    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
265
266    ALLOCATE(dd_KUp(klon), stat = ierr)
267    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
268
269    ALLOCATE(KxKwUp(klon), stat = ierr)
270    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
271
272    ALLOCATE(dd_AU(klon), stat = ierr)
273    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
274
275    ALLOCATE(dd_BU(klon), stat = ierr)
276    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
277
278    !----------------------------------------------------------------------------
279    ALLOCATE(Kech_Vp(klon), stat = ierr)
280    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
281
282    ALLOCATE(Kech_V_px(klon), stat = ierr)
283    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
284
285    ALLOCATE(Kech_V_pw(klon), stat = ierr)
286    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
287
288    ALLOCATE(dd_KVp(klon), stat = ierr)
289    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
290
291    ALLOCATE(KxKwVp(klon), stat = ierr)
292    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
293
294    ALLOCATE(dd_AV(klon), stat = ierr)
295    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
296
297    ALLOCATE(dd_BV(klon), stat = ierr)
298    IF (ierr /= 0) CALL abort_physic('wx_pbl_init', 'pb in allocation', 1)
299
300    !----------------------------------------------------------------------------
301
302  END SUBROUTINE wx_pbl_init
303
304  SUBROUTINE wx_pbl_prelim_0(knon, nsrf, dtime, ypplay, ypaprs, sigw, &
305          yt_s, ydeltat_s, ygustiness, &
306          yt_x, yt_w, yq_x, yq_w, &
307          yu_x, yu_w, yv_x, yv_w, &
308          ycdragh_x, ycdragh_w, ycdragq_x, ycdragq_w, &
309          ycdragm_x, ycdragm_w, &
310          AcoefT_x, AcoefT_w, AcoefQ_x, AcoefQ_w, &
311          AcoefU_x, AcoefU_w, AcoefV_x, AcoefV_w, &
312          BcoefT_x, BcoefT_w, BcoefQ_x, BcoefQ_w, &
313          BcoefU_x, BcoefU_w, BcoefV_x, BcoefV_w, &
314          Kech_h_x_out, Kech_h_w_out, Kech_h_out  &
315          )
316
317    USE lmdz_print_control, ONLY: prt_level, lunout
318    USE indice_sol_mod, ONLY: is_oce
319
320    INCLUDE "YOMCST.h"
321    INCLUDE "FCTTRE.h"
322    INCLUDE "YOETHF.h"
323    INCLUDE "clesphys.h"
324
325    INTEGER, INTENT(IN) :: knon    ! number of grid cells
326    INTEGER, INTENT(IN) :: nsrf    ! surface type
327    REAL, INTENT(IN) :: dtime   ! time step size (s)
328    REAL, DIMENSION(knon, klev), INTENT(IN) :: ypplay  ! mid-layer pressure (Pa)
329    REAL, DIMENSION(knon, klev), INTENT(IN) :: ypaprs  ! pressure at layer interfaces (pa)
330    REAL, DIMENSION(knon), INTENT(IN) :: sigw ! cold pools fractional area
331    REAL, DIMENSION(knon), INTENT(IN) :: yt_s
332    REAL, DIMENSION(knon), INTENT(IN) :: ydeltat_s
333    REAL, DIMENSION(knon), INTENT(IN) :: ygustiness
334    REAL, DIMENSION(knon, klev), INTENT(IN) :: yt_x, yt_w, yq_x, yq_w
335    REAL, DIMENSION(knon, klev), INTENT(IN) :: yu_x, yu_w, yv_x, yv_w
336    REAL, DIMENSION(knon), INTENT(IN) :: ycdragh_x, ycdragh_w, ycdragq_x, ycdragq_w
337    REAL, DIMENSION(knon), INTENT(IN) :: ycdragm_x, ycdragm_w
338    REAL, DIMENSION(knon), INTENT(IN) :: AcoefT_x, AcoefT_w, AcoefQ_x, AcoefQ_w
339    REAL, DIMENSION(knon), INTENT(IN) :: AcoefU_x, AcoefU_w, AcoefV_x, AcoefV_w
340    REAL, DIMENSION(knon), INTENT(IN) :: BcoefT_x, BcoefT_w, BcoefQ_x, BcoefQ_w
341    REAL, DIMENSION(knon), INTENT(IN) :: BcoefU_x, BcoefU_w, BcoefV_x, BcoefV_w
342
343    REAL, DIMENSION(knon), INTENT(OUT) :: Kech_h_x_out, Kech_h_w_out, Kech_h_out
344
345    ! Local variables
346    INTEGER :: j
347    REAL :: rho1
348    REAL :: mod_wind_x
349    REAL :: mod_wind_w
350    REAL :: dd_Kh
351    REAL :: dd_Kq
352    REAL :: dd_Km
353
354    REAL :: zdelta, zcvm5, zcor, qsat
355
356    REAL, DIMENSION(knon) :: sigx       ! fractional area of (x) region
357
358    !!!
359    !!! jyg le 09/04/2013 ; passage aux nouvelles expressions en differences
360
361    !  First computations
362    !  ------------------
363    eps_1 = 0.5
364    smallestreal = tiny(smallestreal)
365
366    sigx(1:knon) = 1. - sigw(1:knon)
367    ! Compute Cp, Lv, qsat, dqsat_dT.
368    L_v(1:knon) = RLvtt
369    Ts0(1:knon) = yt_s(1:knon)
370    dTs0(1:knon) = ydeltat_s(1:knon)
371    q1_0b(1:knon) = sigw(1:knon) * yq_w(1:knon, 1) + sigx(1:knon) * yq_x(1:knon, 1)
372
373    ! fqsat determination
374    ! -------------------
375    IF (nsrf == is_oce) THEN
376      fqsat = f_qsat_oce
377    ELSE
378      fqsat = 1.
379    ENDIF
380
381
382    !  Reference state
383    !  ---------------
384    DO j = 1, knon
385      zdelta = MAX(0., SIGN(1., RTT - Ts0(j)))
386      zcvm5 = R5LES * (1. - zdelta) + R5IES * zdelta
387      qsat = R2ES * FOEEW(Ts0(j), zdelta) / ypaprs(j, 1)
388      qsat = MIN(0.5, qsat)
389      zcor = 1. / (1. - RETV * qsat)
390      qsat0(j) = fqsat * qsat * zcor
391      dqsatdT0(j) = fqsat * FOEDE(Ts0(j), zdelta, zcvm5, qsat0(j), zcor)
392      C_p(j) = RCpd + qsat0(j) * (RCpv - RCpd)
393      C_p(j) = RCpd
394
395      !      print *,' AAAA wx_pbl0, C_p(j), qsat0(j), Ts0(j) : ', C_p(j), qsat0(j), Ts0(j)
396    ENDDO
397    DO j = 1, knon
398      Ts0_x(j) = Ts0(j) - sigw(j) * dTs0(j)
399      zdelta = MAX(0., SIGN(1., RTT - Ts0_x(j)))
400      zcvm5 = R5LES * (1. - zdelta) + R5IES * zdelta
401      !!      zcvm5 = R5LES*RLVTT*(1.-zdelta) + R5IES*RLSTT*zdelta
402      qsat = R2ES * FOEEW(Ts0_x(j), zdelta) / ypaprs(j, 1)
403      qsat = MIN(0.5, qsat)
404      zcor = 1. / (1. - RETV * qsat)
405      qsat0_x(j) = fqsat * qsat * zcor
406      dqsatdT0_x(j) = fqsat * FOEDE(Ts0_x(j), zdelta, zcvm5, qsat0_x(j), zcor)
407      !!      dqsatdT0_x(j) = (RLvtt*(1.-zdelta)+RLSTT*zdelta)*qsat0_x(j)/(Rv*Ts0_x(j)*Ts0_x(j))
408    ENDDO
409    DO j = 1, knon
410      Ts0_w(j) = Ts0(j) + sigx(j) * dTs0(j)
411      zdelta = MAX(0., SIGN(1., RTT - Ts0_w(j)))
412      zcvm5 = R5LES * (1. - zdelta) + R5IES * zdelta
413      !!      zcvm5 = R5LES*RLVTT*(1.-zdelta) + R5IES*RLSTT*zdelta
414      qsat = R2ES * FOEEW(Ts0_w(j), zdelta) / ypaprs(j, 1)
415      qsat = MIN(0.5, qsat)
416      zcor = 1. / (1. - RETV * qsat)
417      qsat0_w(j) = fqsat * qsat * zcor
418      dqsatdT0_w(j) = fqsat * FOEDE(Ts0_w(j), zdelta, zcvm5, qsat0_w(j), zcor)
419      !!      dqsatdT0_w(j) = (RLvtt*(1.-zdelta)+RLSTT*zdelta)*qsat0_w(j)/(Rv*Ts0_w(j)*Ts0_w(j))
420    ENDDO
421
422    QQ_x(1:knon) = 1. / dqsatdT0_x(1:knon)
423    QQ_w(1:knon) = 1. / dqsatdT0_w(1:knon)
424    QQ_b(1:knon) = sigw(1:knon) * QQ_w(1:knon) + sigx(1:knon) * QQ_x(1:knon)
425    dd_QQ(1:knon) = QQ_w(1:knon) - QQ_x(1:knon)
426
427    DO j = 1, knon
428
429      ! Exchange coefficients computation
430      ! ---------------------------------
431
432      ! Wind factor (Warning : this is not valid when using land_surf_orchidee)
433      mod_wind_x = min_wind_speed + SQRT(ygustiness(j) + yu_x(j, 1)**2 + yv_x(j, 1)**2)
434      mod_wind_w = min_wind_speed + SQRT(ygustiness(j) + yu_w(j, 1)**2 + yv_w(j, 1)**2)
435
436      !!         rho1 = ypplay(j,1)/(RD*yt(j,1))
437      rho1 = ypplay(j, 1) / (RD * (yt_x(j, 1) + sigw(j) * (yt_w(j, 1) - yt_x(j, 1))))
438
439      ! (w) and (x) Exchange coefficients
440      Kech_h_x(j) = ycdragh_x(j) * mod_wind_x * rho1
441      Kech_h_w(j) = ycdragh_w(j) * mod_wind_w * rho1
442      Kech_q_x(j) = ycdragq_x(j) * mod_wind_x * rho1
443      Kech_q_w(j) = ycdragq_w(j) * mod_wind_w * rho1
444      Kech_m_x(j) = ycdragm_x(j) * mod_wind_x * rho1
445      Kech_m_w(j) = ycdragm_w(j) * mod_wind_w * rho1
446      !!  Print *,'YYYYpbl0: ycdragh_x, ycdragq_x, mod_wind_x, rho1, Kech_q_x, Kech_h_x ', &
447      !!                     ycdragh_x(j), ycdragq_x(j), mod_wind_x, rho1, Kech_q_x(j), Kech_h_x(j)
448      !!  Print *,'YYYYpbl0: ycdragh_w, ycdragq_w, mod_wind_w, rho1, Kech_q_w, Kech_h_w ', &
449      !!                     ycdragh_w(j), ycdragq_w(j), mod_wind_w, rho1, Kech_q_w(j), Kech_h_w(j)
450
451      ! Merged exchange coefficients
452      dd_Kh = Kech_h_w(j) - Kech_h_x(j)
453      dd_Kq = Kech_q_w(j) - Kech_q_x(j)
454      dd_Km = Kech_m_w(j) - Kech_m_x(j)
455      IF (prt_level >=10) THEN
456        print *, ' mod_wind_x, mod_wind_w ', mod_wind_x, mod_wind_w
457        print *, ' rho1 ', rho1
458        print *, ' ycdragh_x(j),ycdragm_x(j) ', ycdragh_x(j), ycdragm_x(j)
459        print *, ' ycdragh_w(j),ycdragm_w(j) ', ycdragh_w(j), ycdragm_w(j)
460        print *, ' dd_Kh: ', dd_Kh
461      ENDIF
462
463      Kech_h(j) = Kech_h_x(j) + sigw(j) * dd_Kh
464      Kech_q(j) = Kech_q_x(j) + sigw(j) * dd_Kq
465      Kech_m(j) = Kech_m_x(j) + sigw(j) * dd_Km
466
467      Kech_h_x_out(j) = Kech_h_x(j)
468      Kech_h_w_out(j) = Kech_h_w(j)
469      Kech_h_out(j) = Kech_h(j)
470
471      ! Effective exchange coefficient computation
472      ! ------------------------------------------
473      Kech_T_px(j) = Kech_h_x(j) / (1. - BcoefT_x(j) * Kech_h_x(j) * dtime)
474      Kech_T_pw(j) = Kech_h_w(j) / (1. - BcoefT_w(j) * Kech_h_w(j) * dtime)
475
476      Kech_Q_px(j) = Kech_q_x(j) / (1. - BcoefQ_x(j) * Kech_q_x(j) * dtime)
477      Kech_Q_pw(j) = Kech_q_w(j) / (1. - BcoefQ_w(j) * Kech_q_w(j) * dtime)
478
479      Kech_U_px(j) = Kech_m_x(j) / (1. - BcoefU_x(j) * Kech_m_x(j) * dtime)
480      Kech_U_pw(j) = Kech_m_w(j) / (1. - BcoefU_w(j) * Kech_m_w(j) * dtime)
481
482      Kech_V_px(j) = Kech_m_x(j) / (1. - BcoefV_x(j) * Kech_m_x(j) * dtime)
483      Kech_V_pw(j) = Kech_m_w(j) / (1. - BcoefV_w(j) * Kech_m_w(j) * dtime)
484
485      dd_KTp(j) = Kech_T_pw(j) - Kech_T_px(j)
486      dd_KQp(j) = Kech_Q_pw(j) - Kech_Q_px(j)
487      dd_KUp(j) = Kech_U_pw(j) - Kech_U_px(j)
488      dd_KVp(j) = Kech_V_pw(j) - Kech_V_px(j)
489
490      Kech_Tp(j) = Kech_T_px(j) + sigw(j) * dd_KTp(j)
491      Kech_Qp(j) = Kech_Q_px(j) + sigw(j) * dd_KQp(j)
492      Kech_Up(j) = Kech_U_px(j) + sigw(j) * dd_KUp(j)
493      Kech_Vp(j) = Kech_V_px(j) + sigw(j) * dd_KVp(j)
494
495      ! Store AQ and BQ in the module variables
496      AQ_x(j) = AcoefQ_x(j)
497      AQ_w(j) = AcoefQ_w(j)
498      BQ_x(j) = BcoefQ_x(j)
499      BQ_w(j) = BcoefQ_w(j)
500
501      ! Calcul des differences w-x
502      dd_Cdragm(j) = ycdragm_w(j) - ycdragm_x(j)
503      dd_Cdragh(j) = ycdragh_w(j) - ycdragh_x(j)
504      dd_Cdragq(j) = ycdragq_w(j) - ycdragq_x(j)
505
506      dd_AT(j) = AcoefT_w(j) - AcoefT_x(j)
507      dd_AQ(j) = AcoefQ_w(j) - AcoefQ_x(j)
508      dd_AU(j) = AcoefU_w(j) - AcoefU_x(j)
509      dd_AV(j) = AcoefV_w(j) - AcoefV_x(j)
510      dd_BT(j) = BcoefT_w(j) - BcoefT_x(j)
511      dd_BQ(j) = BcoefQ_w(j) - BcoefQ_x(j)
512      dd_BU(j) = BcoefU_w(j) - BcoefU_x(j)
513      dd_BV(j) = BcoefV_w(j) - BcoefV_x(j)
514
515      KxKwTp(j) = Kech_T_px(j) * Kech_T_pw(j)
516      KxKwQp(j) = Kech_Q_px(j) * Kech_Q_pw(j)
517      KxKwUp(j) = Kech_U_px(j) * Kech_U_pw(j)
518      KxKwVp(j) = Kech_V_px(j) * Kech_V_pw(j)
519
520      IF (prt_level >=10) THEN
521        print *, 'Variables pour la fusion : Kech_T_px(j)', Kech_T_px(j)
522        print *, 'Variables pour la fusion : Kech_T_pw(j)', Kech_T_pw(j)
523        print *, 'Variables pour la fusion : Kech_Tp(j)', Kech_Tp(j)
524        print *, 'Variables pour la fusion : Kech_h(j)', Kech_h(j)
525      ENDIF
526
527    ENDDO  ! j = 1, knon
528
529  END SUBROUTINE wx_pbl_prelim_0
530
531  SUBROUTINE wx_pbl_prelim_beta(knon, dtime, &
532          sigw, beta, &
533          BcoefQ_x, BcoefQ_w &
534          )
535
536    USE lmdz_print_control, ONLY: prt_level, lunout
537    USE indice_sol_mod, ONLY: is_oce
538
539    INTEGER, INTENT(IN) :: knon    ! number of grid cells
540    REAL, INTENT(IN) :: dtime   ! time step size (s)
541    REAL, DIMENSION(knon), INTENT(IN) :: sigw ! cold pools fractional area
542    REAL, DIMENSION(knon), INTENT(IN) :: beta ! evaporation by potential evaporation
543    REAL, DIMENSION(knon), INTENT(IN) :: BcoefQ_x, BcoefQ_w
544
545    ! Local variables
546    INTEGER :: j
547
548    DO j = 1, knon
549
550      qsatsrf0_x(j) = beta(j) * qsat0_x(j)
551      qsatsrf0_w(j) = beta(j) * qsat0_w(j)
552      dqsatsrf0(j) = qsatsrf0_w(j) - qsatsrf0_x(j)
553
554      Kech_Q_sx(j) = Kech_q_x(j) / (1. - beta(j) * BcoefQ_x(j) * Kech_q_x(j) * dtime)
555      Kech_Q_sw(j) = Kech_q_w(j) / (1. - beta(j) * BcoefQ_w(j) * Kech_q_w(j) * dtime)
556
557      dd_KQs(j) = Kech_Q_sw(j) - Kech_Q_sx(j)
558
559      Kech_Qs(j) = Kech_Q_sx(j) + sigw(j) * dd_KQs(j)
560
561      KxKwQs(j) = Kech_Q_sx(j) * Kech_Q_sw(j)
562
563      !!  print *,'BBBBwx_prelim_beta : beta ', beta(j)
564
565    ENDDO ! j = 1, knon
566
567  END SUBROUTINE wx_pbl_prelim_beta
568
569  SUBROUTINE wx_pbl_final
570
571    !****************************************************************************************
572    ! Deallocate module variables
573
574    !****************************************************************************************
575
576    IF (ALLOCATED(C_p))           DEALLOCATE(C_p)
577    IF (ALLOCATED(L_v))           DEALLOCATE(L_v)
578    IF (ALLOCATED(Ts0))           DEALLOCATE(Ts0)
579    IF (ALLOCATED(dTs0))          DEALLOCATE(dTs0)
580    IF (ALLOCATED(Ts0_x))         DEALLOCATE(Ts0_x)
581    IF (ALLOCATED(Ts0_w))         DEALLOCATE(Ts0_w)
582    IF (ALLOCATED(qsat0))         DEALLOCATE(qsat0)
583    IF (ALLOCATED(dqsatdT0))      DEALLOCATE(dqsatdT0)
584    IF (ALLOCATED(qsat0_x))       DEALLOCATE(qsat0_x)
585    IF (ALLOCATED(dqsatdT0_x))    DEALLOCATE(dqsatdT0_x)
586    IF (ALLOCATED(qsat0_w))       DEALLOCATE(qsat0_w)
587    IF (ALLOCATED(dqsatdT0_w))    DEALLOCATE(dqsatdT0_w)
588    IF (ALLOCATED(q1_0b))         DEALLOCATE(q1_0b)
589    IF (ALLOCATED(QQ_b))          DEALLOCATE(QQ_b)
590    IF (ALLOCATED(dd_QQ))         DEALLOCATE(dd_QQ)
591    IF (ALLOCATED(QQ_x))          DEALLOCATE(QQ_x)
592    IF (ALLOCATED(QQ_w))          DEALLOCATE(QQ_w)
593    IF (ALLOCATED(qsatsrf0_x))    DEALLOCATE(qsatsrf0_x)
594    IF (ALLOCATED(qsatsrf0_w))    DEALLOCATE(qsatsrf0_w)
595    IF (ALLOCATED(dqsatsrf0))     DEALLOCATE(dqsatsrf0)
596    IF (ALLOCATED(dd_Cdragh))     DEALLOCATE(dd_Cdragh)
597    IF (ALLOCATED(dd_Cdragm))     DEALLOCATE(dd_Cdragm)
598    IF (ALLOCATED(dd_Cdragq))     DEALLOCATE(dd_Cdragq)
599    IF (ALLOCATED(Kech_h))        DEALLOCATE(Kech_h)
600    IF (ALLOCATED(Kech_h_x))      DEALLOCATE(Kech_h_x)
601    IF (ALLOCATED(Kech_h_w))      DEALLOCATE(Kech_h_w)
602    IF (ALLOCATED(Kech_q))        DEALLOCATE(Kech_q)
603    IF (ALLOCATED(Kech_q_x))      DEALLOCATE(Kech_q_x)
604    IF (ALLOCATED(Kech_q_w))      DEALLOCATE(Kech_q_w)
605    IF (ALLOCATED(Kech_m))        DEALLOCATE(Kech_m)
606    IF (ALLOCATED(Kech_m_x))      DEALLOCATE(Kech_m_x)
607    IF (ALLOCATED(Kech_m_w))      DEALLOCATE(Kech_m_w)
608    IF (ALLOCATED(Kech_Tp))       DEALLOCATE(Kech_Tp)
609    IF (ALLOCATED(Kech_T_px))     DEALLOCATE(Kech_T_px)
610    IF (ALLOCATED(Kech_T_pw))     DEALLOCATE(Kech_T_pw)
611    IF (ALLOCATED(dd_KTp))        DEALLOCATE(dd_KTp)
612    IF (ALLOCATED(KxKwTp))        DEALLOCATE(KxKwTp)
613    IF (ALLOCATED(dd_AT))         DEALLOCATE(dd_AT)
614    IF (ALLOCATED(dd_BT))         DEALLOCATE(dd_BT)
615    IF (ALLOCATED(Kech_Qp))       DEALLOCATE(Kech_Qp)
616    IF (ALLOCATED(Kech_Q_px))     DEALLOCATE(Kech_Q_px)
617    IF (ALLOCATED(Kech_Q_pw))     DEALLOCATE(Kech_Q_pw)
618    IF (ALLOCATED(dd_KQp))        DEALLOCATE(dd_KQp)
619    IF (ALLOCATED(KxKwQp))        DEALLOCATE(KxKwQp)
620    IF (ALLOCATED(Kech_Qs))       DEALLOCATE(Kech_Qs)
621    IF (ALLOCATED(Kech_Q_sx))     DEALLOCATE(Kech_Q_sx)
622    IF (ALLOCATED(Kech_Q_sw))     DEALLOCATE(Kech_Q_sw)
623    IF (ALLOCATED(dd_KQs))        DEALLOCATE(dd_KQs)
624    IF (ALLOCATED(KxKwQs))       DEALLOCATE(KxKwQs)
625    IF (ALLOCATED(AQ_x))          DEALLOCATE(AQ_x)
626    IF (ALLOCATED(AQ_w))          DEALLOCATE(AQ_w)
627    IF (ALLOCATED(BQ_x))          DEALLOCATE(BQ_x)
628    IF (ALLOCATED(BQ_w))          DEALLOCATE(BQ_w)
629    IF (ALLOCATED(dd_AQ))         DEALLOCATE(dd_AQ)
630    IF (ALLOCATED(dd_BQ))        DEALLOCATE(dd_BQ)
631    IF (ALLOCATED(Kech_Up))       DEALLOCATE(Kech_Up)
632    IF (ALLOCATED(Kech_U_px))     DEALLOCATE(Kech_U_px)
633    IF (ALLOCATED(Kech_U_pw))     DEALLOCATE(Kech_U_pw)
634    IF (ALLOCATED(dd_KUp))        DEALLOCATE(dd_KUp)
635    IF (ALLOCATED(KxKwUp))        DEALLOCATE(KxKwUp)
636    IF (ALLOCATED(dd_AU))         DEALLOCATE(dd_AU)
637    IF (ALLOCATED(dd_BU))         DEALLOCATE(dd_BU)
638    IF (ALLOCATED(Kech_Vp))       DEALLOCATE(Kech_Vp)
639    IF (ALLOCATED(Kech_V_px))     DEALLOCATE(Kech_V_px)
640    IF (ALLOCATED(Kech_V_pw))     DEALLOCATE(Kech_V_pw)
641    IF (ALLOCATED(dd_KVp))        DEALLOCATE(dd_KVp)
642    IF (ALLOCATED(KxKwVp))        DEALLOCATE(KxKwVp)
643    IF (ALLOCATED(dd_AV))         DEALLOCATE(dd_AV)
644    IF (ALLOCATED(dd_BV))         DEALLOCATE(dd_BV)
645
646  END SUBROUTINE wx_pbl_final
647
648END MODULE wx_pbl_var_mod
649
Note: See TracBrowser for help on using the repository browser.