PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
mode_emoist.F90
Go to the documentation of this file.
1!MNH_LIC Copyright 1995-2025 CNRS, Meteo-France and Universite Paul Sabatier
2!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
3!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4!MNH_LIC for details. version 1.
6
7!$ACDC singlecolumn
8
9IMPLICIT NONE
10CONTAINS
11SUBROUTINE emoist(D,CST,KRR,KRRI,PTHLM,PRM,PLOCPEXNM,PAMOIST,PSRCM,OOCEAN,PEMOIST)
12USE yomhook , ONLY : lhook, dr_hook, jphook
13! ############################################################################
14!
15! PURPOSE
16!! -------
17! EMOIST computes the coefficient Emoist in the flottability turbulent
18! flux. This coefficient relates the vertical flux of the virtual potential
19! temperature ( <Thv' W'> ) to the vertical flux of the conservative mixing
20! ratio ( <Rnp' W'> ).
21!
22!!** METHOD
23!! ------
24!! The virtual potential temperature perturbation is linearized in function
25!! of Thl' and Rnp'. The result is
26!! Thv'= ( ZA + ZC * Atheta * 2 * SRC ) Thl'
27!! +( ZB + ZC * Amoist * 2 * SRC ) Rnp'
28!! From this relation, we can compute the verical turbulent fluxes.
29!!
30!! EXTERNAL
31!! --------
32!! NONE
33!!
34!! IMPLICIT ARGUMENTS
35!! ------------------
36!! Module MODD_CST : contains physical constants.
37!! XRV, XRD : R for water vapor and dry air
38!!
39!! REFERENCE
40!! ---------
41!!
42!! NONE
43!!
44!!
45!! AUTHOR
46!! ------
47!! Jean-Marie Carriere * Meteo-France *
48!!
49!! MODIFICATIONS
50!! -------------
51!! Original 20/03/95
52!!
53!! J. Stein Feb 28, 1996 optimization + Doctorization
54!! J. Stein Spet 15, 1996 Amoist previously computed
55!! J.-P. Pinty May 20, 2003 Improve EMOIST expression
56!! 03/2021 (JL Redelsperger) Ocean model case
57!!
58!! ----------------------------------------------------------------------
59!
60!* 0. DECLARATIONS
61! ------------
62USE modd_cst, ONLY : cst_t
64
65!
66IMPLICIT NONE
67!
68!* 0.1 declarations of arguments and result
69!
70!
71TYPE(dimphyex_t), INTENT(IN) :: D
72TYPE(cst_t), INTENT(IN) :: CST
73INTEGER, INTENT(IN) :: KRR ! number of moist var.
74INTEGER, INTENT(IN) :: KRRI ! number of ice var.
75LOGICAL, INTENT(IN) :: OOCEAN ! switch for Ocean model version
76!
77REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTHLM ! Conservative pot. temperature
78REAL, DIMENSION(D%NIJT,D%NKT,KRR), INTENT(IN) :: PRM ! Mixing ratios, where
79! PRM(:,:,:,1) = conservative mixing ratio
80REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PLOCPEXNM ! Lv(T)/Cp/Exner at time t-1
81REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PAMOIST ! Amoist
82REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PSRCM ! Normalized 2dn_order
83 ! moment s'r'c/2Sigma_s2
84!
85REAL,DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PEMOIST ! result
86!
87!* 0.2 declarations of local variables
88!
89REAL,DIMENSION(D%NIJT,D%NKT) :: &
90 ZA, ZRW
91! ZA = coeft A, ZRW = total mixing ratio rw
92REAL :: ZDELTA ! = Rv/Rd - 1
93INTEGER :: JRR ! moist loop counter
94INTEGER :: JIJ,JK ! loop counter
95INTEGER :: IIJB,IIJE,IKT
96!
97!---------------------------------------------------------------------------
98!
99!
100!* 1. COMPUTE EMOIST
101! --------------
102!
103REAL(KIND=jphook) :: zhook_handle
104IF (lhook) CALL dr_hook('EMOIST',0,zhook_handle)
105!
106iijb=d%NIJB
107iije=d%NIJE
108ikt=d%NKT
109!
110IF (oocean) THEN
111 IF ( krr == 0 ) THEN ! Unsalted
112!$acc kernels
113 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
114 pemoist(iijb:iije,:) = 0.
115 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
116!$acc end kernels
117 ELSE
118!$acc kernels
119 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
120 pemoist(iijb:iije,:) = 1. ! Salted case
121 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
122!$acc end kernels
123 END IF
124 !
125ELSE
126 !
127 IF ( krr == 0 ) THEN ! dry case
128!$acc kernels
129 pemoist(iijb:iije,:) = 0.
130!$acc end kernels
131 ELSE IF ( krr == 1 ) THEN ! only vapor
132!$acc kernels
133 zdelta = (cst%XRV/cst%XRD) - 1.
134 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
135 pemoist(iijb:iije,:) = zdelta*pthlm(iijb:iije,:)
136 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
137!$acc end kernels
138 ELSE ! liquid water & ice present
139!$acc kernels present_cr(ZRW)
140 zdelta = (cst%XRV/cst%XRD) - 1.
141 zrw(iijb:iije,:) = prm(iijb:iije,:,1)
142!$acc end kernels
143 !
144 IF ( krri>0) THEN ! rc and ri case
145!$acc kernels
146 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
147 zrw(iijb:iije,:) = zrw(iijb:iije,:) + prm(iijb:iije,:,3)
148 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
149!$acc loop seq
150 DO jrr=5,krr
151 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
152 zrw(iijb:iije,:) = zrw(iijb:iije,:) + prm(iijb:iije,:,jrr)
153 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
154 ENDDO
155 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
156 za(iijb:iije,:) = 1. + ( & ! Compute A
157 (1.+zdelta) * (prm(iijb:iije,:,1) - prm(iijb:iije,:,2) - prm(iijb:iije,:,4)) &
158 -zrw(iijb:iije,:) &
159 ) / (1. + zrw(iijb:iije,:))
160 !
161 ! Emoist = ZB + ZC * Amoist
162 ! ZB is computed from line 1 to line 2
163 ! ZC is computed from line 3 to line 5
164 ! Amoist* 2 * SRC is computed at line 6
165 !
166 pemoist(iijb:iije,:) = zdelta * (pthlm(iijb:iije,:) + plocpexnm(iijb:iije,:)*( &
167 prm(iijb:iije,:,2)+prm(iijb:iije,:,4)))&
168 / (1. + zrw(iijb:iije,:)) &
169 +( plocpexnm(iijb:iije,:) * za(iijb:iije,:) &
170 -(1.+zdelta) * (pthlm(iijb:iije,:) + plocpexnm(iijb:iije,:)*( &
171 prm(iijb:iije,:,2)+prm(iijb:iije,:,4)))&
172 / (1. + zrw(iijb:iije,:)) &
173 ) * pamoist(iijb:iije,:) * 2. * psrcm(iijb:iije,:)
174 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
175!$acc end kernels
176 ELSE
177!$acc kernels
178!$acc loop seq
179 DO jrr=3,krr
180 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
181 zrw(iijb:iije,:) = zrw(iijb:iije,:) + prm(iijb:iije,:,jrr)
182 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
183 ENDDO
184 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
185 za(iijb:iije,:) = 1. + ( & ! Compute ZA
186 (1.+zdelta) * (prm(iijb:iije,:,1) - prm(iijb:iije,:,2)) &
187 -zrw(iijb:iije,:) &
188 ) / (1. + zrw(iijb:iije,:))
189 !
190 ! Emoist = ZB + ZC * Amoist
191 ! ZB is computed from line 1 to line 2
192 ! ZC is computed from line 3 to line 5
193 ! Amoist* 2 * SRC is computed at line 6
194 !
195 pemoist(iijb:iije,:) = zdelta * (pthlm(iijb:iije,:) + plocpexnm(iijb:iije,:)* &
196 prm(iijb:iije,:,2)) / (1. + zrw(iijb:iije,:)) &
197 +( plocpexnm(iijb:iije,:) * za(iijb:iije,:) &
198 -(1.+zdelta) * (pthlm(iijb:iije,:) + plocpexnm(iijb:iije,:)* &
199 prm(iijb:iije,:,2)) / (1. + zrw(iijb:iije,:)) &
200 ) * pamoist(iijb:iije,:) * 2. * psrcm(iijb:iije,:)
201 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
202!$acc end kernels
203 END IF
204 END IF
205 !
206END IF
207!---------------------------------------------------------------------------
208!
209IF (lhook) CALL dr_hook('EMOIST',1,zhook_handle)
210END SUBROUTINE emoist
211END MODULE mode_emoist
subroutine emoist(d, cst, krr, krri, pthlm, prm, plocpexnm, pamoist, psrcm, oocean, pemoist)