PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
mode_mf_turb.F90
Go to the documentation of this file.
1!MNH_LIC Copyright 1994-2014 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.
5! ######################
7! ######################
8!
9IMPLICIT NONE
10CONTAINS
11 SUBROUTINE mf_turb(D, KSV, PARAMMF, &
12 ONOMIXLG,KSV_LGBEG,KSV_LGEND, &
13 PTSTEP, PDZZ, PRHODJ, &
14 PTHLM,PTHVM,PRTM,PUM,PVM,PSVM,PTKEM, &
15 PTHLDT,PRTDT,PUDT,PVDT,PSVDT,PTKEDT, &
16 PEMF,PTHL_UP,PTHV_UP,PRT_UP,PU_UP,PV_UP,PSV_UP,PTKE_UP, &
17 PFLXZTHMF,PFLXZTHVMF,PFLXZRMF,PFLXZUMF,PFLXZVMF, &
18 PFLXZSVMF,PFLXZTKEMF,PFRAC_UP )
19
20!$ACDC singlecolumn
21
22! #################################################################
23!
24!
25!!**** *MF_TURB* - computes the MF_turbulent source terms for the prognostic
26!! variables.
27!!
28!! PURPOSE
29!! -------
30!!**** The purpose of this routine is to compute the source terms in
31!! the evolution equations due to the MF turbulent mixing.
32!! The source term is computed as the divergence of the turbulent fluxes.
33!
34!!** METHOD
35!! ------
36!!
37!!
38!! EXTERNAL
39!! --------
40!!
41!! IMPLICIT ARGUMENTS
42!! ------------------
43!!
44!!
45!! REFERENCE
46!! ---------
47!!
48!! AUTHOR
49!! ------
50!!
51!!
52!! MODIFICATIONS
53!! -------------
54!! 10/2009 (C.Lac) Introduction of different PTSTEP according to the
55!! advection schemes
56!! 09/2010 (V.Masson) Optimization
57!! S. Riette Jan 2012: support for both order of vertical levels
58!! suppression of useless initialisations
59!! A. Marcel Jan 2025: TKE mixing
60!! A. Marcel Jan 2025: relaxation of the small fraction assumption
61!!
62!! --------------------------------------------------------------------------
63!
64!* 0. DECLARATIONS
65! ------------
66!
69!
70USE mode_shuman_mf, ONLY: mzm_mf
72!
73USE yomhook , ONLY : lhook, dr_hook, jphook
74!
75IMPLICIT NONE
76!
77!
78!* 0.1 declarations of arguments
79!
80!
81TYPE(dimphyex_t), INTENT(IN) :: D
82INTEGER, INTENT(IN) :: KSV
83TYPE(param_mfshall_t), INTENT(IN) :: PARAMMF
84LOGICAL, INTENT(IN) :: ONOMIXLG ! False if mixing of lagrangian tracer
85INTEGER, INTENT(IN) :: KSV_LGBEG ! first index of lag. tracer
86INTEGER, INTENT(IN) :: KSV_LGEND ! last index of lag. tracer
87REAL, INTENT(IN) :: PTSTEP ! Dynamical timestep
88!
89REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PDZZ ! metric coefficients
90
91REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODJ ! dry density * Grid size
92
93! Conservative var. at t-dt
94REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTHLM ! conservative pot. temp.
95REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRTM ! water var. where
96! Virtual potential temperature at t-dt
97REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTHVM
98! Momentum at t-dt
99REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PUM
100REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PVM
101! scalar variables at t-dt
102REAL, DIMENSION(D%NIJT,D%NKT,KSV), INTENT(IN) :: PSVM
103REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTKEM ! TKE at t-dt
104!
105! Tendencies of conservative variables
106REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PTHLDT
107
108REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PRTDT
109! Tendencies of momentum
110REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PUDT
111REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PVDT
112! Tendencies of scalar variables
113REAL, DIMENSION(D%NIJT,D%NKT,KSV), INTENT(OUT) :: PSVDT
114REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PTKEDT ! Tendencies of TKE
115
116
117! Updraft characteritics
118REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PEMF,PTHL_UP,PTHV_UP,PRT_UP,PU_UP,PV_UP,PTKE_UP
119REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PFRAC_UP
120REAL, DIMENSION(D%NIJT,D%NKT,KSV), INTENT(IN) :: PSV_UP
121! Fluxes
122REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PFLXZTHMF,PFLXZTHVMF,PFLXZRMF,PFLXZUMF,PFLXZVMF,PFLXZTKEMF
123
124REAL, DIMENSION(D%NIJT,D%NKT,KSV), INTENT(OUT):: PFLXZSVMF
125!
126!
127!
128!-------------------------------------------------------------------------------
129!
130! 0.2 declaration of local variables
131!
132
133REAL, DIMENSION(D%NIJT,D%NKT) :: ZVARS
134REAL, DIMENSION(D%NIJT,D%NKT) :: ZMEMF !-PEMF
135INTEGER :: JSV !number of scalar variables and Loop counter
136INTEGER :: JIJ, JK
137INTEGER :: IIJB,IIJE ! physical horizontal domain indices
138INTEGER :: IKT
139REAL, DIMENSION(D%NIJT,D%NKT) :: ZRELAX_ALPHA_COEFF ! 1/(1-fraction)
140REAL(KIND=jphook) :: zhook_handle
141!
142!----------------------------------------------------------------------------
143!
144!* 1.PRELIMINARIES
145! -------------
146!
147IF (lhook) CALL dr_hook('MF_TURB',0,zhook_handle)
148!
149iije=d%NIJE
150iijb=d%NIJB
151ikt=d%NKT
152!
153pflxzsvmf(:,:,:) = 0.
154psvdt(:,:,:) = 0.
155!
156IF(parammf%LRELAX_ALPHA_MF) THEN
157 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
158 zrelax_alpha_coeff(iijb:iije, 1:ikt)=1./(1.-pfrac_up(iijb:iije, 1:ikt))
159 zmemf(iijb:iije, 1:ikt)=-pemf(iijb:iije, 1:ikt)*zrelax_alpha_coeff(iijb:iije, 1:ikt)
160 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
161ELSE
162 zrelax_alpha_coeff(iijb:iije, 1:ikt)=1.
163 zmemf(:,:) = -pemf(:,:)
164ENDIF
165!
166!----------------------------------------------------------------------------
167!
168!* 2. COMPUTE THE MEAN FLUX OF CONSERVATIVE VARIABLES at time t-dt
169! (equation (3) of Soares et al)
170! + THE MEAN FLUX OF THETA_V (buoyancy flux)
171! -----------------------------------------------
172! ( Resulting fluxes are in flux level (w-point) as PEMF and PTHL_UP )
173!
174
175CALL mzm_mf(d, pthlm, pflxzthmf)
176CALL mzm_mf(d, prtm, pflxzrmf)
177CALL mzm_mf(d, pthvm, pflxzthvmf)
178
179!$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
180pflxzthmf(iijb:iije,1:ikt) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
181 & (pthl_up(iijb:iije,1:ikt)-pflxzthmf(iijb:iije,1:ikt))
182pflxzrmf(iijb:iije,1:ikt) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
183 & (prt_up(iijb:iije,1:ikt)-pflxzrmf(iijb:iije,1:ikt))
184pflxzthvmf(iijb:iije,1:ikt) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
185 & (pthv_up(iijb:iije,1:ikt)-pflxzthvmf(iijb:iije,1:ikt))
186!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
187
188IF (parammf%LMIXUV) THEN
189 CALL mzm_mf(d, pum, pflxzumf)
190 CALL mzm_mf(d, pvm, pflxzvmf)
191 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
192 pflxzumf(iijb:iije,1:ikt) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
193 & (pu_up(iijb:iije,1:ikt)-pflxzumf(iijb:iije,1:ikt))
194 pflxzvmf(iijb:iije,1:ikt) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
195 & (pv_up(iijb:iije,1:ikt)-pflxzvmf(iijb:iije,1:ikt))
196 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
197ELSE
198 pflxzumf(:,:) = 0.
199 pflxzvmf(:,:) = 0.
200ENDIF
201
202IF (parammf%LMIXTKE) THEN
203 CALL mzm_mf(d, ptkem, pflxztkemf)
204 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
205 pflxztkemf(iijb:iije,1:ikt) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
206 & (ptke_up(iijb:iije,1:ikt)-pflxztkemf(iijb:iije,1:ikt))
207 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
208ELSE
209 pflxztkemf(:,:) = 0.
210ENDIF
211!
212!
213!----------------------------------------------------------------------------
214!
215!* 3. COMPUTE TENDENCIES OF CONSERVATIVE VARIABLES (or treated as such...)
216! (implicit formulation)
217! --------------------------------------------
218!
219
220!
221!
222! 3.1 Compute the tendency for the conservative potential temperature
223! (PDZZ and flux in w-point and PRHODJ is mass point, result in mass point)
224!
225CALL tridiag_massflux(d,pthlm,pflxzthmf,zmemf,ptstep,parammf%XIMPL_MF, &
226 pdzz,prhodj,zvars )
227! compute new flux and THL tendency
228CALL mzm_mf(d, zvars, pflxzthmf)
229!$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
230pflxzthmf(iijb:iije,1:ikt) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
231 & (pthl_up(iijb:iije,1:ikt)-pflxzthmf(iijb:iije,1:ikt))
232pthldt(iijb:iije,1:ikt)= (zvars(iijb:iije,1:ikt)-pthlm(iijb:iije,1:ikt))/ptstep
233!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
234
235!
236! 3.2 Compute the tendency for the conservative mixing ratio
237!
238CALL tridiag_massflux(d,prtm,pflxzrmf,zmemf,ptstep,parammf%XIMPL_MF, &
239 pdzz,prhodj,zvars )
240! compute new flux and RT tendency
241CALL mzm_mf(d, zvars, pflxzrmf)
242!$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
243pflxzrmf(iijb:iije,1:ikt) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
244 & (prt_up(iijb:iije,1:ikt)-pflxzrmf(iijb:iije,1:ikt))
245prtdt(iijb:iije,1:ikt) = (zvars(iijb:iije,1:ikt)-prtm(iijb:iije,1:ikt))/ptstep
246!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
247!
248
249IF (parammf%LMIXUV) THEN
250 !
251 ! 3.3 Compute the tendency for the (non conservative but treated as it) zonal momentum
252 ! (PDZZ and flux in w-point and PRHODJ is mass point, result in mass point)
253 !
254
255 CALL tridiag_massflux(d,pum,pflxzumf,zmemf,ptstep,parammf%XIMPL_MF, &
256 pdzz,prhodj,zvars )
257 ! compute new flux and U tendency
258 CALL mzm_mf(d, zvars, pflxzumf)
259 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
260 pflxzumf(iijb:iije,1:ikt) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
261 & (pu_up(iijb:iije,1:ikt)-pflxzumf(iijb:iije,1:ikt))
262 pudt(iijb:iije,1:ikt)= (zvars(iijb:iije,1:ikt)-pum(iijb:iije,1:ikt))/ptstep
263 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
264 !
265 !
266 ! 3.4 Compute the tendency for the (non conservative but treated as it for the time beiing)
267 ! meridian momentum
268 ! (PDZZ and flux in w-point and PRHODJ is mass point, result in mass point)
269 !
270 CALL tridiag_massflux(d,pvm,pflxzvmf,zmemf,ptstep,parammf%XIMPL_MF, &
271 pdzz,prhodj,zvars )
272 ! compute new flux and V tendency
273 CALL mzm_mf(d, zvars, pflxzvmf)
274 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
275 pflxzvmf(iijb:iije,1:ikt) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
276 & (pv_up(iijb:iije,1:ikt)-pflxzvmf(iijb:iije,1:ikt))
277 pvdt(iijb:iije,1:ikt)= (zvars(iijb:iije,1:ikt)-pvm(iijb:iije,1:ikt))/ptstep
278 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
279ELSE
280 pudt(:,:)=0.
281 pvdt(:,:)=0.
282ENDIF
283
284DO jsv=1,ksv
285
286 IF (onomixlg .AND. jsv >= ksv_lgbeg .AND. jsv<= ksv_lgend) cycle
287
288 !* compute mean flux of scalar variables at time t-dt
289 ! ( Resulting fluxes are in flux level (w-point) as PEMF and PTHL_UP )
290
291 CALL mzm_mf(d, psvm(:,:,jsv), pflxzsvmf(:,:,jsv))
292 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
293 pflxzsvmf(iijb:iije,1:ikt,jsv) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
294 & (psv_up(iijb:iije,1:ikt,jsv)-pflxzsvmf(iijb:iije,1:ikt,jsv))
295 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
296 !
297 ! 3.5 Compute the tendency for scalar variables
298 ! (PDZZ and flux in w-point and PRHODJ is mass point, result in mass point)
299 !
300 CALL tridiag_massflux(d,psvm(:,:,jsv),pflxzsvmf(:,:,jsv),&
301 zmemf,ptstep,parammf%XIMPL_MF,pdzz,prhodj,zvars )
302 ! compute new flux and Sv tendency
303 CALL mzm_mf(d, zvars, pflxzsvmf(:,:,jsv))
304 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
305 pflxzsvmf(iijb:iije,1:ikt,jsv) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
306 & (psv_up(iijb:iije,1:ikt,jsv)-pflxzsvmf(iijb:iije,1:ikt,jsv))
307 psvdt(iijb:iije,1:ikt,jsv)= (zvars(iijb:iije,1:ikt)-psvm(iijb:iije,1:ikt,jsv))/ptstep
308 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
309
310ENDDO
311!
312!
313! 3.6 Compute the tendency for the TKE
314! (PDZZ and flux in w-point and PRHODJ is mass point, result in mass point)
315!
316IF (parammf%LMIXTKE) THEN
317 CALL tridiag_massflux(d,ptkem,pflxztkemf,zmemf,ptstep,parammf%XIMPL_MF,pdzz,prhodj,zvars)
318
319 ! compute new flux and TKE tendency
320 CALL mzm_mf(d, zvars, pflxztkemf)
321 pflxztkemf(iijb:iije,1:ikt) = pemf(iijb:iije,1:ikt)*zrelax_alpha_coeff(iijb:iije,1:ikt)*&
322 & (ptke_up(iijb:iije,1:ikt)-pflxztkemf(iijb:iije,1:ikt))
323 ptkedt(iijb:iije,1:ikt)= (zvars(iijb:iije,1:ikt)-ptkem(iijb:iije,1:ikt))/ptstep
324ELSE
325 ptkedt(:,:)=0.
326ENDIF
327!
328IF (lhook) CALL dr_hook('MF_TURB',1,zhook_handle)
329END SUBROUTINE mf_turb
330END MODULE mode_mf_turb
subroutine mf_turb(d, ksv, parammf, onomixlg, ksv_lgbeg, ksv_lgend, ptstep, pdzz, prhodj, pthlm, pthvm, prtm, pum, pvm, psvm, ptkem, pthldt, prtdt, pudt, pvdt, psvdt, ptkedt, pemf, pthl_up, pthv_up, prt_up, pu_up, pv_up, psv_up, ptke_up, pflxzthmf, pflxzthvmf, pflxzrmf, pflxzumf, pflxzvmf, pflxzsvmf, pflxztkemf, pfrac_up)
subroutine mzm_mf(d, pa, pmzm)
subroutine tridiag_massflux(d, pvarm, pf, pdfdt, ptstep, pimpl, pdzz, prhodj, pvarp)