1 | ! |
---|
2 | ! |
---|
3 | ! |
---|
4 | SUBROUTINE thermcell_env(ngrid,nlay,nq,pq,pt,pu,pv,pplay,pplev, & |
---|
5 | zqt,zql,zt,ztv,zhl,zu,zv,zpopsk,zqs) |
---|
6 | |
---|
7 | |
---|
8 | !=============================================================================== |
---|
9 | ! Purpose: calcul des caracteristiques de l'environnement necessaires au calcul |
---|
10 | ! des proprietes dans le thermique. |
---|
11 | ! |
---|
12 | ! Modif 2019/04 (AB alexandre.boissinot@lmd.jussieu.fr) |
---|
13 | ! |
---|
14 | ! Nota Bene |
---|
15 | ! ql means "non-gaseous water mass mixing ratio" (liquid and solid) |
---|
16 | ! qv means "vapor mass mixing ratio" |
---|
17 | ! qt means "total water mass mixing ratio" |
---|
18 | ! TP means "potential temperature" |
---|
19 | ! TRPV means "virtual potential temperature with latent heat release" |
---|
20 | ! TPV means "virtual potential temperature" |
---|
21 | ! TR means "temperature with latent heat release" |
---|
22 | !=============================================================================== |
---|
23 | |
---|
24 | USE print_control_mod, ONLY: prt_level |
---|
25 | USE thermcell_mod, ONLY: RKAPPA |
---|
26 | USE watercommon_h, ONLY: RLvCp, RETV, Psat_water |
---|
27 | USE tracer_h, ONLY: igcm_h2o_vap, igcm_h2o_ice |
---|
28 | USE callkeys_mod, ONLY: water, generic_condensation |
---|
29 | USE comcstfi_mod, ONLY: r, cpp, mugaz |
---|
30 | USE generic_cloud_common_h, ONLY: Psat_generic, epsi_generic, RLVTT_generic |
---|
31 | USE generic_tracer_index_mod, ONLY: generic_tracer_index |
---|
32 | |
---|
33 | IMPLICIT NONE |
---|
34 | |
---|
35 | |
---|
36 | !=============================================================================== |
---|
37 | ! Declaration |
---|
38 | !=============================================================================== |
---|
39 | |
---|
40 | ! Inputs: |
---|
41 | ! ------- |
---|
42 | |
---|
43 | INTEGER, INTENT(in) :: ngrid |
---|
44 | INTEGER, INTENT(in) :: nlay |
---|
45 | INTEGER, INTENT(in) :: nq |
---|
46 | |
---|
47 | REAL, INTENT(in) :: pq(ngrid,nlay,nq) ! Large scale water |
---|
48 | REAL, INTENT(in) :: pt(ngrid,nlay) ! Large scale temperature |
---|
49 | REAL, INTENT(in) :: pu(ngrid,nlay) ! Large scale zonal wind |
---|
50 | REAL, INTENT(in) :: pv(ngrid,nlay) ! Large scale meridional wind |
---|
51 | REAL, INTENT(in) :: pplay(ngrid,nlay) ! Layers pressure |
---|
52 | REAL, INTENT(in) :: pplev(ngrid,nlay+1) ! Levels pressure |
---|
53 | REAL, INTENT(in) :: zpopsk(ngrid,nlay) ! Exner function |
---|
54 | |
---|
55 | ! Outputs: |
---|
56 | ! -------- |
---|
57 | |
---|
58 | REAL, INTENT(out) :: zt(ngrid,nlay) ! T environment |
---|
59 | REAL, INTENT(out) :: ztv(ngrid,nlay) ! TRPV environment |
---|
60 | REAL, INTENT(out) :: zhl(ngrid,nlay) ! TP environment |
---|
61 | REAL, INTENT(out) :: zu(ngrid,nlay) ! u environment |
---|
62 | REAL, INTENT(out) :: zv(ngrid,nlay) ! v environment |
---|
63 | REAL, INTENT(out) :: zqt(ngrid,nlay) ! qt environment |
---|
64 | REAL, INTENT(out) :: zql(ngrid,nlay) ! ql environment |
---|
65 | REAL, INTENT(out) :: zqs(ngrid,nlay) ! qsat environment |
---|
66 | |
---|
67 | ! Local: |
---|
68 | ! ------ |
---|
69 | |
---|
70 | INTEGER ig, k, iq |
---|
71 | |
---|
72 | REAL psat ! Dummy argument for Psat_water() |
---|
73 | |
---|
74 | !ALS24 declaration for generic tracer |
---|
75 | INTEGER :: igcm_generic_vap, igcm_generic_ice! index of the vap and ice of generic_tracer |
---|
76 | LOGICAL :: call_ice_vap_generic ! to call only one time the ice/vap pair of a tracer |
---|
77 | REAL, SAVE :: metallicity ! metallicity of planet --- is not used here, but necessary to call function Psat_generic |
---|
78 | !$OMP THREADPRIVATE(metallicity) |
---|
79 | REAL :: RETV_generic, RV_generic, RLvCp_generic |
---|
80 | |
---|
81 | !=============================================================================== |
---|
82 | ! Initialization |
---|
83 | !=============================================================================== |
---|
84 | |
---|
85 | zu(:,:) = pu(:,:) |
---|
86 | zv(:,:) = pv(:,:) |
---|
87 | |
---|
88 | zhl(:,:) = pt(:,:) / zpopsk(:,:) |
---|
89 | |
---|
90 | zqt(:,:) = 0. |
---|
91 | zql(:,:) = 0. |
---|
92 | |
---|
93 | metallicity=0.0 ! default value --- is not used here but necessary to call function Psat_generic |
---|
94 | |
---|
95 | !=============================================================================== |
---|
96 | ! Condensation and latent heat release |
---|
97 | !=============================================================================== |
---|
98 | |
---|
99 | IF (water) THEN |
---|
100 | |
---|
101 | zqt(:,:) = pq(:,:,igcm_h2o_vap) |
---|
102 | |
---|
103 | DO k=1,nlay |
---|
104 | DO ig=1,ngrid |
---|
105 | CALL Psat_water(pt(ig,k), pplev(ig,k), psat, zqs(ig,k)) |
---|
106 | ENDDO |
---|
107 | ENDDO |
---|
108 | |
---|
109 | DO k=1,nlay |
---|
110 | DO ig=1,ngrid |
---|
111 | zql(ig,k) = max(0.,pq(ig,k,igcm_h2o_vap) - zqs(ig,k)) |
---|
112 | zt(ig,k) = pt(ig,k) + RLvCp * zql(ig,k) |
---|
113 | ztv(ig,k) = zt(ig,k) / zpopsk(ig,k) & |
---|
114 | & * (1. + RETV * (zqt(ig,k)-zql(ig,k)) - zql(ig,k)) |
---|
115 | ENDDO |
---|
116 | ENDDO |
---|
117 | |
---|
118 | ELSEIF (generic_condensation .AND. .NOT. water ) THEN |
---|
119 | |
---|
120 | DO iq=1,nq |
---|
121 | |
---|
122 | CALL generic_tracer_index(nq,iq,igcm_generic_vap,igcm_generic_ice,call_ice_vap_generic) |
---|
123 | |
---|
124 | IF (call_ice_vap_generic) THEN ! to call only one time the ice/vap pair of a tracer |
---|
125 | |
---|
126 | zqt(:,:) = pq(:,:,igcm_generic_vap) |
---|
127 | |
---|
128 | DO k = 1,nlay |
---|
129 | DO ig=1,ngrid |
---|
130 | CALL Psat_generic(pt(ig,k),pplev(ig,k),metallicity,psat,zqs(ig,k)) |
---|
131 | ENDDO |
---|
132 | ENDDO |
---|
133 | |
---|
134 | RV_generic = (8.314511*1000.)/(epsi_generic*mugaz) |
---|
135 | RETV_generic = RV_generic/r-1. |
---|
136 | RLvCp_generic = RLVTT_generic/cpp |
---|
137 | |
---|
138 | DO k = 1,nlay |
---|
139 | DO ig=1,ngrid |
---|
140 | zql(ig,k) = max(0.,pq(ig,k,igcm_generic_vap) - zqs(ig,k)) |
---|
141 | zt(ig,k) = pt(ig,k) + RLvCp_generic * zql(ig,k) |
---|
142 | ztv(ig,k) = zt(ig,k) / zpopsk(ig,k) & |
---|
143 | & * (1. + RETV_generic * (zqt(ig,k)-zql(ig,k)) - zql(ig,k)) |
---|
144 | ENDDO |
---|
145 | ENDDO |
---|
146 | |
---|
147 | ENDIF !call_ice_vap_generic |
---|
148 | |
---|
149 | ENDDO!nq |
---|
150 | |
---|
151 | ELSE |
---|
152 | |
---|
153 | zt(:,:) = pt(:,:) |
---|
154 | ztv(:,:) = pt(:,:) / zpopsk(:,:) |
---|
155 | |
---|
156 | ENDIF |
---|
157 | |
---|
158 | |
---|
159 | RETURN |
---|
160 | END |
---|