PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
mode_etheta.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 etheta(D,CST,KRR,KRRI,PTHLM,PRM,PLOCPEXNM,PATHETA,PSRCM,OOCEAN,OCOMPUTE_SRC,PETHETA)
12USE yomhook , ONLY : lhook, dr_hook, jphook
13! ############################################################################
14!
15! PURPOSE
16!! -------
17! ETHETA computes the coefficient Etheta 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 potential
20! temperature ( <Thl' W'> ).
21!
22!!** METHOD
23!! ------
24!!
25!! The virtual potential temperature perturbation is linearized in function
26!! of Thl' and Rnp'. The result is
27!! Thv'= ( ZA + ZC * Atheta * 2 * SRC ) Thl'
28!! +( ZB + ZC * Amoist * 2 * SRC ) Rnp'
29!! From this relation, we can compute the vertical turbulent fluxes.
30!!
31!! EXTERNAL
32!! --------
33!!
34!! NONE
35!!
36!! IMPLICIT ARGUMENTS
37!! ------------------
38!! Module MODD_CST : contains physical constants.
39!! XRV, XRD : R for water vapor and dry air
40!!
41!! REFERENCE
42!! ---------
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 Sept 15, 1996 Atheta previously computed
55!! J.-P. Pinty May 20, 2003 Improve ETHETA expression
56!! J.L Redelsperger 03, 2021 Ocean Model Case
57!! ----------------------------------------------------------------------
58!
59!* 0. DECLARATIONS
60! ------------
61USE modd_cst, ONLY : cst_t
63!
64IMPLICIT NONE
65!
66!* 0.1 declarations of arguments and result
67!
68!
69TYPE(dimphyex_t), INTENT(IN) :: D
70TYPE(cst_t), INTENT(IN) :: CST
71INTEGER, INTENT(IN) :: KRR ! number of moist var.
72INTEGER, INTENT(IN) :: KRRI ! number of ice var.
73LOGICAL, INTENT(IN) :: OOCEAN ! switch for Ocean model version
74!
75REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTHLM ! Conservative pot. temperature
76REAL, DIMENSION(D%NIJT,D%NKT,KRR), INTENT(IN) :: PRM ! Mixing ratios, where
77! PRM(:,:,:,1) = conservative mixing ratio
78REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PLOCPEXNM ! Lv(T)/Cp/Exner at time t-1
79REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PATHETA ! Atheta
80!
81LOGICAL, INTENT(IN) :: OCOMPUTE_SRC ! flag to define dimensions of SIGS and
82REAL, DIMENSION(MERGE(D%NIJT,0,OCOMPUTE_SRC),& MERGE(D%NKT,0,OCOMPUTE_SRC)), INTENT(IN) :: PSRCM ! Normalized 2dn_order
83 ! moment s'r'c/2Sigma_s2
84!
85REAL,DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PETHETA ! result
86!
87!
88!
89!* 0.2 declarations of local variables
90!
91REAL,DIMENSION(D%NIJT,D%NKT) :: &
92 ZA, ZRW
93! ZA = coeft A, ZRW = total mixing ratio rw
94REAL :: ZDELTA ! = Rv/Rd - 1
95INTEGER :: JRR ! moist loop counter
96INTEGER :: JIJ,JK ! loop counter
97INTEGER :: IIJB,IIJE,IKT
98!
99!---------------------------------------------------------------------------
100!
101!
102!* 1. COMPUTE ETHETA
103! --------------
104!
105!
106REAL(KIND=jphook) :: zhook_handle
107IF (lhook) CALL dr_hook('ETHETA',0,zhook_handle)
108!
109iijb=d%NIJB
110iije=d%NIJE
111ikt=d%NKT
112!
113IF (oocean) THEN ! ocean case
114!$acc kernels
115 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
116 petheta(iijb:iije,:) = 1.
117 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
118!$acc end kernels
119ELSE
120 IF ( krr == 0) THEN ! dry case
121!$acc kernels
122 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
123 petheta(iijb:iije,:) = 1.
124 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
125!$acc end kernels
126 ELSE IF ( krr == 1 ) THEN ! only vapor
127!$acc kernels
128 zdelta = (cst%XRV/cst%XRD) - 1.
129 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
130 petheta(iijb:iije,:) = 1. + zdelta*prm(iijb:iije,:,1)
131 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
132!$acc end kernels
133 ELSE ! liquid water & ice present
134!$acc kernels
135 zdelta = (cst%XRV/cst%XRD) - 1.
136 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
137 zrw(iijb:iije,:) = prm(iijb:iije,:,1)
138 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
139!$acc end kernels
140 !
141 IF ( krri>0 ) THEN ! rc and ri case
142!$acc kernels
143 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
144 zrw(iijb:iije,:) = zrw(iijb:iije,:) + prm(iijb:iije,:,3)
145 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
146!$acc loop seq
147 DO jrr=5,krr
148 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
149 zrw(iijb:iije,:) = zrw(iijb:iije,:) + prm(iijb:iije,:,jrr)
150 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
151 ENDDO
152 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
153 za(iijb:iije,:) = 1. + ( & ! Compute A
154 (1.+zdelta) * (prm(iijb:iije,:,1) - prm(iijb:iije,:,2) - prm(iijb:iije,:,4)) &
155 -zrw(iijb:iije,:) &
156 ) / (1. + zrw(iijb:iije,:))
157 !
158 ! Etheta = ZA + ZC * Atheta
159 ! ZC is computed from line 2 to line 5
160 ! - Atheta * 2. * SRC is computed at line 6
161 !
162 petheta(iijb:iije,:) = za(iijb:iije,:) &
163 +( plocpexnm(iijb:iije,:) * za(iijb:iije,:) &
164 -(1.+zdelta) * (pthlm(iijb:iije,:) + plocpexnm(iijb:iije,:)*( &
165 prm(iijb:iije,:,2)+prm(iijb:iije,:,4)))&
166 / (1. + zrw(iijb:iije,:)) &
167 ) * patheta(iijb:iije,:) * 2. * psrcm(iijb:iije,:)
168 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
169!$acc end kernels
170 ELSE
171!$acc kernels
172!$acc loop seq
173 DO jrr=3,krr
174 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
175 zrw(iijb:iije,:) = zrw(iijb:iije,:) + prm(iijb:iije,:,jrr)
176 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
177 ENDDO
178 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
179 za(iijb:iije,:) = 1. + ( & ! Compute A
180 (1.+zdelta) * (prm(iijb:iije,:,1) - prm(iijb:iije,:,2)) &
181 -zrw(iijb:iije,:) &
182 ) / (1. + zrw(iijb:iije,:))
183 !
184 ! Etheta = ZA + ZC * Atheta
185 ! ZC is computed from line 2 to line 5
186 ! - Atheta * 2. * SRC is computed at line 6
187 !
188 petheta(iijb:iije,:) = za(iijb:iije,:) &
189 +( plocpexnm(iijb:iije,:) * za(iijb:iije,:) -(1.+zdelta) * (pthlm(iijb:iije,:) &
190 + plocpexnm(iijb:iije,:)*prm(iijb:iije,:,2)) &
191 / (1. + zrw(iijb:iije,:)) &
192 ) * patheta(iijb:iije,:) * 2. * psrcm(iijb:iije,:)
193 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
194!$acc end kernels
195 END IF
196 END IF
197!
198END IF
199!---------------------------------------------------------------------------
200!
201IF (lhook) CALL dr_hook('ETHETA',1,zhook_handle)
202END SUBROUTINE etheta
203END MODULE mode_etheta
204
subroutine etheta(d, cst, krr, krri, pthlm, prm, plocpexnm, patheta, psrcm, oocean, ocompute_src, petheta)