4 |
|
|
5 |
contains |
contains |
6 |
|
|
7 |
SUBROUTINE HBTM(knon, paprs, pplay, t2m, t10m, q2m, q10m, ustar, flux_t, & |
SUBROUTINE HBTM(knon, paprs, pplay, t2m, q2m, ustar, flux_t, & |
8 |
flux_q, u, v, t, q, pblh, cape, EauLiq, ctei, pblT, therm, trmb1, & |
flux_q, u, v, t, q, pblh, cape, EauLiq, ctei, pblT, therm, trmb1, & |
9 |
trmb2, trmb3, plcl) |
trmb2, trmb3, plcl) |
10 |
|
|
11 |
use dimens_m |
! D'apr\'es Holstag et Boville et Troen et Mahrt |
|
use dimphy |
|
|
use YOMCST |
|
|
use yoethf |
|
|
use fcttre |
|
|
|
|
|
! D'apres Holstag & Boville et Troen & Mahrt |
|
12 |
! JAS 47 BLM |
! JAS 47 BLM |
13 |
! Algorithme thèse Anne Mathieu |
! Algorithme th\'ese Anne Mathieu |
14 |
! Critère d'entraînement Peter Duynkerke (JAS 50) |
! Crit\'ere d'entra\^inement Peter Duynkerke (JAS 50) |
15 |
! written by: Anne MATHIEU and Alain LAHELLEC, 22nd November 1999 |
! written by: Anne MATHIEU and Alain LAHELLEC, 22nd November 1999 |
16 |
! features : implem. exces Mathieu |
! features : implem. exces Mathieu |
17 |
|
|
23 |
|
|
24 |
! fin therm a la HBTM passage a forme Mathieu 12/09/2001 |
! fin therm a la HBTM passage a forme Mathieu 12/09/2001 |
25 |
|
|
26 |
! Adaptation a LMDZ version couplee |
! Adaptation a LMDZ version couplee Pour le moment on fait passer |
27 |
! Pour le moment on fait passer en argument les grandeurs de surface : |
! en argument les grandeurs de surface : flux, t, q2m, t, on va |
28 |
! flux, t, q2m, t, q10m, on va utiliser systematiquement les grandeurs a 2m |
! utiliser systematiquement les grandeurs a 2m mais on garde la |
29 |
! mais on garde la possibilité de changer si besoin est (jusqu'à présent |
! possibilit\'e de changer si besoin est (jusqu'\`a pr\'esent la |
30 |
! la forme de HB avec le 1er niveau modele etait conservee) |
! forme de HB avec le 1er niveau modele etait conservee) |
31 |
|
|
32 |
|
USE dimphy, ONLY: klev, klon |
33 |
|
USE suphec_m, ONLY: rcpd, rd, retv, rg, rkappa, rtt |
34 |
|
USE yoethf_m, ONLY: r2es, rvtmp2 |
35 |
|
USE fcttre, ONLY: foeew |
36 |
|
|
|
REAL RLvCp, REPS |
|
37 |
! Arguments: |
! Arguments: |
38 |
|
|
39 |
! nombre de points a calculer |
! nombre de points a calculer |
40 |
INTEGER, intent(in):: knon |
INTEGER, intent(in):: knon |
41 |
|
|
42 |
REAL, intent(in):: t2m(klon) ! temperature a 2 m |
REAL, intent(in):: t2m(klon) ! temperature a 2 m |
|
real t10m(klon) ! temperature a 10 m |
|
43 |
! q a 2 et 10m |
! q a 2 et 10m |
44 |
REAL q2m(klon), q10m(klon) |
REAL q2m(klon) |
45 |
REAL ustar(klon) |
REAL ustar(klon) |
46 |
! pression a inter-couche (Pa) |
! pression a inter-couche (Pa) |
47 |
REAL paprs(klon, klev+1) |
REAL paprs(klon, klev+1) |
121 |
REAL rhino(klon, klev) |
REAL rhino(klon, klev) |
122 |
! pts w/unstbl pbl (positive virtual ht flx) |
! pts w/unstbl pbl (positive virtual ht flx) |
123 |
LOGICAL unstbl(klon) |
LOGICAL unstbl(klon) |
|
! stable pbl with levels within pbl |
|
|
LOGICAL stblev(klon) |
|
|
! unstbl pbl with levels within pbl |
|
|
LOGICAL unslev(klon) |
|
|
! unstb pbl w/lvls within srf pbl lyr |
|
|
LOGICAL unssrf(klon) |
|
|
! unstb pbl w/lvls in outer pbl lyr |
|
|
LOGICAL unsout(klon) |
|
124 |
LOGICAL check(klon) ! Richardson number > critical |
LOGICAL check(klon) ! Richardson number > critical |
125 |
! flag de prolongerment cape pour pt Omega |
! flag de prolongerment cape pour pt Omega |
126 |
LOGICAL omegafl(klon) |
LOGICAL omegafl(klon) |
137 |
REAL trmb1(klon), trmb2(klon), trmb3(klon) |
REAL trmb1(klon), trmb2(klon), trmb3(klon) |
138 |
! Algorithme thermique |
! Algorithme thermique |
139 |
REAL s(klon, klev) ! [P/Po]^Kappa milieux couches |
REAL s(klon, klev) ! [P/Po]^Kappa milieux couches |
|
! equivalent potential temperature of therma |
|
|
REAL The_th(klon) |
|
140 |
! total water of thermal |
! total water of thermal |
141 |
REAL qT_th(klon) |
REAL qT_th(klon) |
142 |
! T thermique niveau precedent |
! T thermique niveau precedent |
|
REAL Tbef(klon) |
|
143 |
REAL qsatbef(klon) |
REAL qsatbef(klon) |
144 |
! le thermique est sature |
! le thermique est sature |
145 |
LOGICAL Zsat(klon) |
LOGICAL Zsat(klon) |
146 |
! Cape du thermique |
! Cape du thermique |
147 |
REAL Cape(klon) |
REAL Cape(klon) |
|
! Cape locale |
|
|
REAL Kape(klon) |
|
148 |
! Eau liqu integr du thermique |
! Eau liqu integr du thermique |
149 |
REAL EauLiq(klon) |
REAL EauLiq(klon) |
150 |
! Critere d'instab d'entrainmt des nuages de |
! Critere d'instab d'entrainmt des nuages de |
151 |
REAL ctei(klon) |
REAL ctei(klon) |
152 |
REAL the1, the2, aa, zthvd, zthvu, xintpos, qqsat |
REAL zthvd, zthvu, qqsat |
153 |
REAL a1, a2, a3 |
REAL t2 |
|
REAL xhis, rnum, th1, thv1, thv2, ql2 |
|
|
REAL qsat2, qT1, q2, t1, t2, xnull |
|
|
REAL quadsat, spblh, reduc |
|
154 |
|
|
155 |
! inverse phi function for momentum |
! inverse phi function for momentum |
156 |
REAL phiminv(klon) |
REAL phiminv(klon) |
|
! inverse phi function for heat |
|
|
REAL phihinv(klon) |
|
157 |
! turbulent velocity scale for momentum |
! turbulent velocity scale for momentum |
158 |
REAL wm(klon) |
REAL wm(klon) |
|
! k*ustar*pblh |
|
|
REAL fak1(klon) |
|
|
! k*wm*pblh |
|
|
REAL fak2(klon) |
|
|
! fakn*wstr/wm |
|
|
REAL fak3(klon) |
|
|
! level eddy diffusivity for momentum |
|
|
REAL pblk(klon) |
|
|
! Prandtl number for eddy diffusivities |
|
|
REAL pr(klon) |
|
|
! zmzp / Obukhov length |
|
|
REAL zl(klon) |
|
|
! zmzp / pblh |
|
|
REAL zh(klon) |
|
|
! (1-(zmzp/pblh))**2 |
|
|
REAL zzh(klon) |
|
|
! w*, convective velocity scale |
|
|
REAL wstr(klon) |
|
|
! current level height |
|
|
REAL zm(klon) |
|
159 |
! current level height + one level up |
! current level height + one level up |
160 |
REAL zp(klon) |
REAL zp(klon) |
161 |
REAL zcor, zdelta, zcvm5 |
REAL zcor |
162 |
|
|
163 |
REAL fac, pblmin, zmzp, term |
REAL pblmin |
164 |
|
|
165 |
!----------------------------------------------------------------- |
!----------------------------------------------------------------- |
166 |
|
|
171 |
b212=sqrt(b1*b2) |
b212=sqrt(b1*b2) |
172 |
b2sr=sqrt(b2) |
b2sr=sqrt(b2) |
173 |
|
|
|
! Initialisation |
|
|
RLvCp = RLVTT/RCPD |
|
|
REPS = RD/RV |
|
|
|
|
174 |
! Calculer les hauteurs de chaque couche |
! Calculer les hauteurs de chaque couche |
175 |
! (geopotentielle Int_dp/ro = Int_[Rd.T.dp/p] z = geop/g) |
! (geopotentielle Int_dp/ro = Int_[Rd.T.dp/p] z = geop/g) |
176 |
! pourquoi ne pas utiliser Phi/RG ? |
! pourquoi ne pas utiliser Phi/RG ? |
230 |
! until the Richardson number between the first level and the |
! until the Richardson number between the first level and the |
231 |
! current level exceeds the "critical" value. (bonne idee Nu de |
! current level exceeds the "critical" value. (bonne idee Nu de |
232 |
! separer le Ric et l'exces de temp du thermique) |
! separer le Ric et l'exces de temp du thermique) |
|
fac = 100. |
|
233 |
DO k = 2, isommet |
DO k = 2, isommet |
234 |
DO i = 1, knon |
DO i = 1, knon |
235 |
IF (check(i)) THEN |
IF (check(i)) THEN |
294 |
q_star = kqfs(i)/wm(i) |
q_star = kqfs(i)/wm(i) |
295 |
t_star = khfs(i)/wm(i) |
t_star = khfs(i)/wm(i) |
296 |
|
|
|
a1=b1*(1.+2.*RETV*qT_th(i))*t_star**2 |
|
|
a2=(RETV*T2m(i))**2*b2*q_star**2 |
|
|
a3=2.*RETV*T2m(i)*b212*q_star*t_star |
|
|
aa=a1+a2+a3 |
|
|
|
|
297 |
therm(i) = sqrt( b1*(1.+2.*RETV*qT_th(i))*t_star**2 & |
therm(i) = sqrt( b1*(1.+2.*RETV*qT_th(i))*t_star**2 & |
298 |
+ (RETV*T2m(i))**2*b2*q_star**2 & |
+ (RETV*T2m(i))**2*b2*q_star**2 & |
299 |
+ max(0., 2.*RETV*T2m(i)*b212*q_star*t_star)) |
+ max(0., 2.*RETV*T2m(i)*b212*q_star*t_star)) |
369 |
! omegafl utilise pour prolongement CAPE |
! omegafl utilise pour prolongement CAPE |
370 |
omegafl(i) = .FALSE. |
omegafl(i) = .FALSE. |
371 |
Cape(i) = 0. |
Cape(i) = 0. |
|
Kape(i) = 0. |
|
372 |
EauLiq(i) = 0. |
EauLiq(i) = 0. |
373 |
CTEI(i) = 0. |
CTEI(i) = 0. |
|
pblk(i) = 0.0 |
|
|
fak1(i) = ustar(i)*pblh(i)*vk |
|
374 |
|
|
375 |
! Do additional preparation for unstable cases only, set temperature |
! Do additional preparation for unstable cases only, set temperature |
376 |
! and moisture perturbations depending on stability. |
! and moisture perturbations depending on stability. |
380 |
zxt=(T2m(i)-zref*0.5*RG/RCPD/(1.+RVTMP2*qT_th(i))) & |
zxt=(T2m(i)-zref*0.5*RG/RCPD/(1.+RVTMP2*qT_th(i))) & |
381 |
*(1.+RETV*qT_th(i)) |
*(1.+RETV*qT_th(i)) |
382 |
phiminv(i) = (1. - binm*pblh(i)/obklen(i))**onet |
phiminv(i) = (1. - binm*pblh(i)/obklen(i))**onet |
|
phihinv(i) = sqrt(1. - binh*pblh(i)/obklen(i)) |
|
383 |
wm(i) = ustar(i)*phiminv(i) |
wm(i) = ustar(i)*phiminv(i) |
|
fak2(i) = wm(i)*pblh(i)*vk |
|
|
wstr(i) = (heatv(i)*RG*pblh(i)/zxt)**onet |
|
|
fak3(i) = fakn*wstr(i)/wm(i) |
|
384 |
ENDIF |
ENDIF |
|
! Computes Theta_e for thermal (all cases : to be modified) |
|
|
! attention ajout therm(i) = virtuelle |
|
|
The_th(i) = T2m(i) + therm(i) + RLvCp*qT_th(i) |
|
385 |
ENDDO |
ENDDO |
386 |
|
|
387 |
! Main level loop to compute the diffusivities and |
! Main level loop to compute the diffusivities and |
388 |
! counter-gradient terms: |
! counter-gradient terms: |
389 |
DO k = 2, isommet |
loop_level: DO k = 2, isommet |
390 |
! Find levels within boundary layer: |
! Find levels within boundary layer: |
391 |
DO i = 1, knon |
DO i = 1, knon |
|
unslev(i) = .FALSE. |
|
|
stblev(i) = .FALSE. |
|
|
zm(i) = z(i, k-1) |
|
392 |
zp(i) = z(i, k) |
zp(i) = z(i, k) |
393 |
IF (zkmin == 0. .AND. zp(i) > pblh(i)) zp(i) = pblh(i) |
IF (zkmin == 0. .AND. zp(i) > pblh(i)) zp(i) = pblh(i) |
|
IF (zm(i) < pblh(i)) THEN |
|
|
zmzp = 0.5*(zm(i) + zp(i)) |
|
|
zh(i) = zmzp/pblh(i) |
|
|
zl(i) = zmzp/obklen(i) |
|
|
zzh(i) = 0. |
|
|
IF (zh(i) <= 1.) zzh(i) = (1. - zh(i))**2 |
|
|
|
|
|
! stblev for points zm < plbh and stable and neutral |
|
|
! unslev for points zm < plbh and unstable |
|
|
IF (unstbl(i)) THEN |
|
|
unslev(i) = .TRUE. |
|
|
ELSE |
|
|
stblev(i) = .TRUE. |
|
|
ENDIF |
|
|
ENDIF |
|
|
ENDDO |
|
|
|
|
|
! Stable and neutral points; set diffusivities; counter-gradient |
|
|
! terms zero for stable case: |
|
|
DO i = 1, knon |
|
|
IF (stblev(i)) THEN |
|
|
IF (zl(i) <= 1.) THEN |
|
|
pblk(i) = fak1(i)*zh(i)*zzh(i)/(1. + betas*zl(i)) |
|
|
ELSE |
|
|
pblk(i) = fak1(i)*zh(i)*zzh(i)/(betas + zl(i)) |
|
|
ENDIF |
|
|
ENDIF |
|
|
ENDDO |
|
|
|
|
|
! unssrf, unstable within surface layer of pbl |
|
|
! unsout, unstable within outer layer of pbl |
|
|
DO i = 1, knon |
|
|
unssrf(i) = .FALSE. |
|
|
unsout(i) = .FALSE. |
|
|
IF (unslev(i)) THEN |
|
|
IF (zh(i) < sffrac) THEN |
|
|
unssrf(i) = .TRUE. |
|
|
ELSE |
|
|
unsout(i) = .TRUE. |
|
|
ENDIF |
|
|
ENDIF |
|
|
ENDDO |
|
|
|
|
|
! Unstable for surface layer; counter-gradient terms zero |
|
|
DO i = 1, knon |
|
|
IF (unssrf(i)) THEN |
|
|
term = (1. - betam*zl(i))**onet |
|
|
pblk(i) = fak1(i)*zh(i)*zzh(i)*term |
|
|
pr(i) = term/sqrt(1. - betah*zl(i)) |
|
|
ENDIF |
|
|
ENDDO |
|
|
|
|
|
! Unstable for outer layer; counter-gradient terms non-zero: |
|
|
DO i = 1, knon |
|
|
IF (unsout(i)) THEN |
|
|
pblk(i) = fak2(i)*zh(i)*zzh(i) |
|
|
pr(i) = phiminv(i)/phihinv(i) + ccon*fak3(i)/fak |
|
|
ENDIF |
|
394 |
ENDDO |
ENDDO |
395 |
|
|
396 |
! For all layers, compute integral info and CTEI |
! For all layers, compute integral info and CTEI |
397 |
DO i = 1, knon |
DO i = 1, knon |
398 |
if (check(i).or.omegafl(i)) then |
if (check(i) .or. omegafl(i)) then |
399 |
if (.not.Zsat(i)) then |
if (.not. Zsat(i)) then |
400 |
T2 = T2m(i) * s(i, k) |
T2 = T2m(i) * s(i, k) |
401 |
! thermodyn functions |
! thermodyn functions |
402 |
zdelta=MAX(0., SIGN(1., RTT - T2)) |
qqsat= r2es * FOEEW(T2, RTT >= T2) / pplay(i, k) |
|
qqsat= r2es * FOEEW(T2, zdelta) / pplay(i, k) |
|
403 |
qqsat=MIN(0.5, qqsat) |
qqsat=MIN(0.5, qqsat) |
404 |
zcor=1./(1.-retv*qqsat) |
zcor=1./(1.-retv*qqsat) |
405 |
qqsat=qqsat*zcor |
qqsat=qqsat*zcor |
413 |
* (qT_th(i)-qsatbef(i)) / (qsatbef(i)-qqsat) |
* (qT_th(i)-qsatbef(i)) / (qsatbef(i)-qqsat) |
414 |
endif |
endif |
415 |
Zsat(i) = .true. |
Zsat(i) = .true. |
|
Tbef(i) = T2 |
|
416 |
endif |
endif |
417 |
endif |
endif |
418 |
qsatbef(i) = qqsat |
qsatbef(i) = qqsat |
419 |
! cette ligne a deja ete faite normalement ? |
! cette ligne a deja ete faite normalement ? |
420 |
endif |
endif |
421 |
ENDDO |
ENDDO |
422 |
end DO |
end DO loop_level |
423 |
|
|
424 |
END SUBROUTINE HBTM |
END SUBROUTINE HBTM |
425 |
|
|