My Project
 All Classes Files Functions Variables Macros
thermcell_env.F90
Go to the documentation of this file.
1  SUBROUTINE thermcell_env(ngrid,nlay,po,pt,pu,pv,pplay, &
2  & pplev,zo,zh,zl,ztv,zthl,zu,zv,zpspsk,pqsat,lev_out)
3 
4 !--------------------------------------------------------------
5 !thermcell_env: calcule les caracteristiques de l environnement
6 !necessaires au calcul des proprietes dans le thermique
7 !--------------------------------------------------------------
8 
9  IMPLICIT NONE
10 
11 #include "YOMCST.h"
12 #include "YOETHF.h"
13 #include "FCTTRE.h"
14 #include "iniprint.h"
15 
16  INTEGER ngrid,nlay
17  REAL po(ngrid,nlay)
18  REAL pt(ngrid,nlay)
19  REAL pu(ngrid,nlay)
20  REAL pv(ngrid,nlay)
21  REAL pplay(ngrid,nlay)
22  REAL pplev(ngrid,nlay+1)
23  integer lev_out ! niveau pour les print
24 
25  REAL zo(ngrid,nlay)
26  REAL zl(ngrid,nlay)
27  REAL zh(ngrid,nlay)
28  REAL ztv(ngrid,nlay)
29  REAL zthl(ngrid,nlay)
30  REAL zpspsk(ngrid,nlay)
31  REAL zu(ngrid,nlay)
32  REAL zv(ngrid,nlay)
33  REAL pqsat(ngrid,nlay)
34 
35  INTEGER ig,ll
36 
37  real dqsat_dt
38  real rlvcp
39 
40 logical mask(ngrid,nlay)
41 
42 
43 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44 ! Initialisations :
45 !------------------
46 
47 mask(:,:)=.true.
48 rlvcp = rlvtt/rcpd
49 
50 !
51 ! calcul des caracteristiques de l environnement
52  DO ll=1,nlay
53  DO ig=1,ngrid
54  zo(ig,ll)=po(ig,ll)
55  zl(ig,ll)=0.
56  zh(ig,ll)=pt(ig,ll)
57  EndDO
58  EndDO
59 !
60 !
61 ! Condensation :
62 !---------------
63 ! Calcul de l'humidite a saturation et de la condensation
64 
65 call thermcell_qsat(ngrid*nlay,mask,pplev,pt,po,pqsat)
66 DO ll=1,nlay
67  DO ig=1,ngrid
68  zl(ig,ll) = max(0.,po(ig,ll)-pqsat(ig,ll))
69  zh(ig,ll) = pt(ig,ll)+rlvcp*zl(ig,ll) ! T = Tl + Lv/Cp ql
70  zo(ig,ll) = po(ig,ll)-zl(ig,ll)
71  ENDDO
72 ENDDO
73 !
74 !
75 !-----------------------------------------------------------------------
76 
77  if (prt_level.ge.1) print*,'0 OK convect8'
78 
79  DO ll=1,nlay
80  DO ig=1,ngrid
81  zpspsk(ig,ll)=(pplay(ig,ll)/100000.)**rkappa
82  zu(ig,ll)=pu(ig,ll)
83  zv(ig,ll)=pv(ig,ll)
84 !attention zh est maintenant le profil de T et plus le profil de theta !
85 ! Quelle horreur ! A eviter.
86 !
87 ! T-> Theta
88  ztv(ig,ll)=zh(ig,ll)/zpspsk(ig,ll)
89 !Theta_v
90  ztv(ig,ll)=ztv(ig,ll)*(1.+retv*(zo(ig,ll))-zl(ig,ll))
91 !Thetal
92  zthl(ig,ll)=pt(ig,ll)/zpspsk(ig,ll)
93 !
94  ENDDO
95  ENDDO
96 
97  RETURN
98  END