PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
mode_tke_eps_sources.F90
Go to the documentation of this file.
1!MNH_LIC Copyright 1994-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.
5!-----------------------------------------------------------------
7
8!$ACDC singlecolumn
9
10IMPLICIT NONE
11CONTAINS
12 SUBROUTINE tke_eps_sources(D,CST,CSTURB,BUCONF,TURBN,TLES, &
13 & PTKEM,PLM,PLEPS,PDP, &
14 & PTRH,PRHODJ,PDZZ,PDXX,PDYY,PDZX,PDZY,PZZ, &
15 & PTSTEP,PEXPL, &
16 & TPFILE,ODIAG_IN_RUN,OOCEAN, &
17 & PSFUM,PSFVM, &
18 & PTP,PRTKES,PRTHLS,PCOEF_DISS,PTDIFF,PTDISS,PRTKEMS,&
19 & TBUDGETS, KBUDGETS, &
20 & PEDR, PTR,PDISS, PCURRENT_TKE_DISS,PTURB_SPP )
21! ##################################################################
22!
23!
24!!**** *TKE_EPS_SOURCES* - routine to compute the sources of the turbulent
25!! evolutive variables: TKE and its dissipation when it is taken into
26!! account. The contribution to the heating of tke dissipation is computed.
27!!
28!! PURPOSE
29!! -------
30! The purpose of this routine is to compute the sources necessary for
31! the evolution of the turbulent kinetic energy and its dissipation
32! if necessary.
33!
34!!** METHOD
35!! ------
36!! The vertical turbulent flux is computed in an off-centered
37!! implicit scheme (a Crank-Nicholson type with coefficients different
38!! than 0.5), which allows to vary the degree of implicitness of the
39!! formulation.
40!! In high resolution, the horizontal transport terms are also
41!! calculated, but explicitly.
42!! The evolution of the dissipation as a variable is made if
43!! the parameter TURBN%CTURBLEN is set equal to KEPS. The same reasoning
44!! made for TKE applies.
45!!
46!! EXTERNAL
47!! --------
48!! GX_U_M,GY_V_M,GZ_W_M
49!! GX_M_U,GY_M_V : Cartesian vertical gradient operators
50!!
51!! MZF,MZM : Shuman functions (mean operators)
52!! DZF,DZM : Shuman functions (difference operators)
53!!
54!! SUBROUTINE TRIDIAG : to solve an implicit temporal scheme
55!!
56!!
57!! IMPLICIT ARGUMENTS
58!! ------------------
59!! Module MODD_CST : contains physical constants
60!!
61!! XG : gravity constant
62!!
63!! Module MODD_CTURB: contains the set of constants for
64!! the turbulence scheme
65!!
66!! CSTURB%XCET,TURBN%XCED : transport and dissipation cts. for the TKE
67!! XCDP,XCDD,XCDT: constants from the parameterization of
68!! the K-epsilon equation
69!! TURBN%XTKEMIN,XEPSMIN : minimum values for the TKE and its
70!! dissipation
71!!
72!! Module MODD_PARAMETERS:
73!!
74!! JPVEXT_TURB
75!! Module MODD_BUDGET:
76!! NBUMOD : model in which budget is calculated
77!! CBUTYPE : type of desired budget
78!! 'CART' for cartesian box configuration
79!! 'MASK' for budget zone defined by a mask
80!! 'NONE' ' for no budget
81!! LBU_RTKE : logical for budget of RTKE (turbulent kinetic energy)
82!! .TRUE. = budget of RTKE
83!! .FALSE. = no budget of RTKE
84!!
85!!
86!! REFERENCE
87!! ---------
88!! Book 2 of documentation (routine TKE_EPS_SOURCES)
89!! Book 1 of documentation (Chapter: Turbulence)
90!!
91!! AUTHOR
92!! ------
93!! Joan Cuxart * INM and Meteo-France *
94!!
95!! MODIFICATIONS
96!! -------------
97!! Original August 23, 1994
98!! Modifications: Feb 14, 1995 (J.Cuxart and J.Stein)
99!! Doctorization and Optimization
100!! June 29, 1995 (J.Stein) TKE budget
101!! June 28, 1995 (J.Cuxart) Add LES tools
102!! Modifications: February 29, 1996 (J. Stein) optimization
103!! Modifications: May 6, 1996 (N. Wood) Extend some loops over
104!! the outer points
105!! Modifications: August 30, 1996 (P. Jabouille) calcul ZFLX at the
106!! IKU level
107!! October 10, 1996 (J.Stein) set Keff at t-deltat
108!! Oct 8, 1996 (Cuxart,Sanchez) Var.LES: XETR_TF,XDISS_TF
109!! December 20, 1996 (J.-P. Pinty) update the CALL BUDGET
110!! November 24, 1997 (V. Masson) bug in <v'e>
111!! removes the DO loops
112!! Augu. 9, 1999 (J.Stein) TKE budget correction
113!! Mar 07 2001 (V. Masson and J. Stein) remove the horizontal
114!! turbulent transports of Tke computation
115!! Nov 06, 2002 (V. Masson) LES budgets
116!! July 20, 2003 (J.-P. Pinty P Jabouille) add the dissipative heating
117!! May 2006 Remove KEPS
118!! October 2009 (G. Tanguy) add ILENCH=LEN(YCOMMENT) after
119!! change of YCOMMENT
120!! 2012-02 Y. Seity, add possibility to run with reversed
121!! vertical levels
122!! 2014-11 Y. Seity, add output terms for TKE DDHs budgets
123!! 2015-01 (J. Escobar) missing get_halo(ZRES) for JPHEXT<> 1
124!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1
125!! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O
126! P. Wautelet 20/05/2019: add name argument to ADDnFIELD_ll + new ADD4DFIELD_ll subroutine
127! P. Wautelet 02/2020: use the new data structures and subroutines for budgets
128! --------------------------------------------------------------------------
129!
130!* 0. DECLARATIONS
131! ------------
132!
133USE yomhook, ONLY: lhook, dr_hook, jphook
134!
135USE modd_argslist_ll, ONLY: list_ll
137USE modd_cst, ONLY: cst_t
138USE modd_cturb, ONLY: csturb_t
139USE modd_dimphyex, ONLY: dimphyex_t
141USE modd_io, ONLY: tfiledata
142USE modd_les, ONLY: tles_t
143USE modd_turb_n, ONLY: turb_t, nced, nturb_s
144!
148!
152!
153! These macro are handled by pft_tool.py --craybyPassDOCONCURRENT applied on Cray Rules
154#ifdef MNH_COMPILER_CCE
155!$mnh_undef(LOOP)
156!$mnh_undef(OPENACC)
157#endif
158!
159IMPLICIT NONE
160!
161!
162!* 0.1 declarations of arguments
163!
164!
165TYPE(dimphyex_t), INTENT(IN) :: D
166TYPE(cst_t), INTENT(IN) :: CST
167TYPE(csturb_t), INTENT(IN) :: CSTURB
168TYPE(tbudgetconf_t), INTENT(IN) :: BUCONF
169TYPE(turb_t), INTENT(IN) :: TURBN
170TYPE(tles_t), INTENT(INOUT):: TLES
171REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTKEM ! TKE at t-deltat
172REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PLM ! mixing length
173REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PLEPS ! dissipative length
174REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT):: PDP ! Dyn. prod. of TKE
175REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTRH
176REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODJ ! density * grid volume
177REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PDXX,PDYY,PDZZ,PDZX,PDZY ! metric coefficients
178REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PZZ ! physical height w-pt
179REAL, INTENT(IN) :: PTSTEP ! Time step
180REAL, INTENT(IN) :: PEXPL ! Coef. temporal. disc.
181TYPE(tfiledata), INTENT(INOUT) :: TPFILE ! Output file
182LOGICAL, INTENT(IN) :: ODIAG_IN_RUN ! switch to activate online diagnostics (mesonh)
183LOGICAL, INTENT(IN) :: OOCEAN ! switch for Ocean model version
184REAL, DIMENSION(D%NIJT), INTENT(IN) :: PSFUM,PSFVM ! momentum sfc flux
185REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTP ! Ther. prod. of TKE
186REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT):: PRTKES ! RHOD * Jacobian * TKE at t+deltat
187REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT):: PRTHLS ! Source of Theta_l
188REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PCOEF_DISS ! 1/(Cph*Exner)
189REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PTDIFF ! Diffusion TKE term
190REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PTDISS ! Dissipation TKE term
191REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRTKEMS ! Advection source
192TYPE(tbudgetdata_ptr), DIMENSION(KBUDGETS), INTENT(INOUT) :: TBUDGETS
193INTEGER, INTENT(IN) :: KBUDGETS
194REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT), OPTIONAL :: PEDR ! EDR
195REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT), OPTIONAL :: PTR ! Transport prod. of TKE
196REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT), OPTIONAL :: PDISS ! Dissipation of TKE
197REAL, DIMENSION(MERGE(D%NIJT,0,ODIAG_IN_RUN),MERGE(D%NKT,0,ODIAG_IN_RUN)), INTENT(INOUT), OPTIONAL :: PCURRENT_TKE_DISS
198REAL, DIMENSION(D%NIJT,D%NKT,NTURB_S), INTENT(IN) :: PTURB_SPP ! SPP for turbulence
199!
200!
201!
202!* 0.2 declaration of local variables
203!
204REAL, DIMENSION(D%NIJT,D%NKT) :: &
205 ZA, & ! under diagonal elements of the tri-diagonal matrix involved
206 ! in the temporal implicit scheme
207 zres, & ! treated variable at t+ deltat when the turbu-
208 ! lence is the only source of evolution added to the ones
209 ! considered in ZSOURCE. This variable is also used to
210 ! temporarily store some diagnostics stored in FM file
211 zflx,zflx_ptstep, & ! horizontal or vertical flux of the treated variable
212 zsource, & ! source of evolution for the treated variable
213 zkeff, & ! effectif diffusion coeff = LT * SQRT( TKE )
214 ztr, & ! Transport term
215 zmwork1, & ! working var. for MZM/MZF operators (array syntax)
216 zwkles ! working var. for LES calls
217
218LOGICAL,DIMENSION(D%NIJT,D%NKT) :: GTKENEG
219 ! 3D mask .T. if TKE < CSTURB%XTKEMIN
220INTEGER :: IIJB,IIJE,IKB,IKE,IKT,IKA,IKL ! Index value for the mass points of the domain
221!
222TYPE(list_ll), POINTER :: TZFIELDDISS_ll ! list of fields to exchange
223INTEGER :: IINFO_ll ! return code of parallel routine
224TYPE(tfieldmetadata) :: TZFIELD
225REAL(KIND=jphook) :: zhook_handle
226INTEGER :: JIJ,JK
227!
228!----------------------------------------------------------------------------
229!
230!* 1. PRELIMINARY COMPUTATIONS
231! ------------------------
232!
233IF (lhook) CALL dr_hook('TKE_EPS_SOURCES',0,zhook_handle)
234!
235NULLIFY(tzfielddiss_ll)
236!
237ikb=d%NKB
238ike=d%NKE
239iijb=d%NIJB
240iije=d%NIJE
241ikt=d%NKT
242ika=d%NKA
243ikl=d%NKL
244!
245!$acc kernels
246! compute the effective diffusion coefficient at the mass point
247!$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
248zkeff(iijb:iije,1:ikt) = plm(iijb:iije,1:ikt) * sqrt(ptkem(iijb:iije,1:ikt))
249!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
250!
251!----------------------------------------------------------------------------
252!
253!* 2. TKE EQUATION
254! ------------
255!
256!* 2.1 Horizontal turbulent explicit transport
257!
258!
259! Complete the sources of TKE with the horizontal turbulent explicit transport
260!
261IF (turbn%CTURBDIM=='3DIM') THEN
262 ztr(iijb:iije,1:ikt)=ptrh(iijb:iije,1:ikt)
263ELSE
264 ztr(iijb:iije,1:ikt)=0.
265END IF
266!
267!
268!* 2.2 Explicit TKE sources except horizontal turbulent transport
269!
270! extrapolate the dynamic production with a 1/Z law from its value at the
271IF (oocean) THEN
272 ! W(IKE) value stored in PDP(IKE) to the mass localization of tke(IKE)
273 !$mnh_expand_array(JIJ=IIJB:IIJE)
274 pdp(iijb:iije,ike) = pdp(iijb:iije,ike) * (1. + pdzz(iijb:iije,ike)/pdzz(iijb:iije,ike+1))
275 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
276ELSE
277 ! W(IKB+1) value stored in PDP(IKB) to the mass localization tke(IKB)
278 !$mnh_expand_array(JIJ=IIJB:IIJE)
279 pdp(iijb:iije,ikb) = pdp(iijb:iije,ikb) * (1. + pdzz(iijb:iije,ikb+ikl)/pdzz(iijb:iije,ikb))
280 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
281END IF
282!
283! Compute the source terms for TKE: ( ADVECtion + NUMerical DIFFusion + ..)
284! + (Dynamical Production) + (Thermal Production) - (dissipation)
285!
286!$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
287zflx(iijb:iije,1:ikt) = pturb_spp(iijb:iije,1:ikt,nced) * sqrt(ptkem(iijb:iije,1:ikt)) / pleps(iijb:iije,1:ikt)
288zsource(iijb:iije,1:ikt) = ( prtkes(iijb:iije,1:ikt) + prtkems(iijb:iije,1:ikt) ) &
289 / prhodj(iijb:iije,1:ikt) - ptkem(iijb:iije,1:ikt) / ptstep &
290 + pdp(iijb:iije,1:ikt) + ptp(iijb:iije,1:ikt) + ztr(iijb:iije,1:ikt) &
291 - pexpl * zflx(iijb:iije,1:ikt) * ptkem(iijb:iije,1:ikt)
292!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
293!
294!* 2.2 implicit vertical TKE transport
295!
296!
297! To add here in ZSOURCE surface flux of TKE
298!(assumed to be 0 for ATM,
299IF (oocean) THEN
300 !for ocean:wave breaking simple/very rough param wE = 100 Ustar**3 where ustar is the Tau_atmi/rhocea
301 !$mnh_expand_array(JIJ=IIJB:IIJE)
302 zsource(iijb:iije,ike)=zsource(iijb:iije,ike)-1.e2*((psfum(iijb:iije)**2 + psfvm(iijb:iije)**2)**1.5) /pdzz(iijb:iije,ike)
303 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
304END IF
305!$acc end kernels
306! Compute the vector giving the elements just under the diagonal for the
307! matrix inverted in TRIDIAG
308!
309!
310za(iijb:iije,:) = - ptstep * csturb%XCET * mzm(zkeff(iijb:iije,:)) * mzm(prhodj(iijb:iije,:)) / pdzz(iijb:iije,:)**2
311!
312! Compute TKE at time t+deltat: ( stored in ZRES )
313!
314!$acc kernels
315!$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
316zflx_ptstep(iijb:iije,1:ikt) = ptstep*zflx(iijb:iije,1:ikt)
317!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
318!$acc end kernels
319CALL tridiag_tke(d,ptkem,za,ptstep,pexpl,turbn%XIMPL,prhodj,zsource,zflx_ptstep ,zres)
320CALL get_halo_phy(d,zres, oongpu = .true. )
321!$acc update device(ZRES)
322!
323!* diagnose the dissipation
324!
325IF (odiag_in_run) THEN
326 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
327 pcurrent_tke_diss(iijb:iije,1:ikt) = zflx(iijb:iije,1:ikt) &
328 *(pexpl*ptkem(iijb:iije,1:ikt) + turbn%XIMPL*zres(iijb:iije,1:ikt))
329 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
330!
331 CALL add3dfield_ll_phy(d, tzfielddiss_ll, pcurrent_tke_diss, 'TKE_EPS_SOURCES::PCURRENT_TKE_DISS' )
332 CALL update_halo_ll(tzfielddiss_ll,iinfo_ll)
333 CALL cleanlist_ll(tzfielddiss_ll)
334ENDIF
335!
336! TKE must be greater than its minimum value
337! CL : Now done at the end of the time step in ADVECTION_METSV for MesoNH
338IF(turbn%LTKEMINTURB) THEN
339 !$mnh_expand_where(JIJ=IIJB:IIJE,JK=1:IKT)
340 gtkeneg(iijb:iije,1:ikt) = zres(iijb:iije,1:ikt) <= turbn%XTKEMIN
341 WHERE ( gtkeneg(iijb:iije,1:ikt) )
342 zres(iijb:iije,1:ikt) = turbn%XTKEMIN
343 END WHERE
344 !$mnh_end_expand_where(JIJ=IIJB:IIJE,JK=1:IKT)
345END IF
346!
347!$acc kernels
348!$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
349ptdiss(iijb:iije,1:ikt) = - zflx(iijb:iije,1:ikt)*(pexpl*ptkem(iijb:iije,1:ikt) &
350 + turbn%XIMPL*zres(iijb:iije,1:ikt))
351!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
352!$acc end kernels
353!
354IF ( tles%LLES_CALL .OR. &
355 (turbn%LTURB_DIAG .AND. tpfile%LOPENED) ) THEN
356!
357! Compute the cartesian vertical flux of TKE in ZFLX
358!
359 zflx(iijb:iije,:) = - csturb%XCET * mzm(zkeff(iijb:iije,:)) * &
360 dzm(turbn%XIMPL * zres(iijb:iije,:) + pexpl * ptkem(iijb:iije,:) ) / pdzz(iijb:iije,:)
361!
362!$acc kernels
363 zflx(iijb:iije,ikb) = 0.
364 zflx(iijb:iije,ika) = 0.
365!$acc end kernels
366!
367! Compute the whole turbulent TRansport of TKE:
368!
369 ptr(iijb:iije,:)= ptr(iijb:iije,:) - dzf( mzm(prhodj(iijb:iije,:)) * zflx(iijb:iije,:) / pdzz(iijb:iije,:) ) /prhodj(iijb:iije,:)
370!
371! Storage in the LES configuration
372!
373 IF (tles%LLES_CALL) THEN
374 zmwork1=mzf(zflx)
375 CALL les_mean_subgrid_phy(d,tles,zmwork1, tles%X_LES_SUBGRID_WTke )
376 zwkles = -ztr
377 CALL les_mean_subgrid_phy(d,tles, zwkles, tles%X_LES_SUBGRID_ddz_WTke )
378 END IF
379!
380END IF
381!
382!* 2.4 stores the explicit sources for budget purposes
383!
384IF (buconf%LBUDGET_TKE) THEN
385 ! Dynamical production
386 !$acc kernels
387 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
388 zmwork1(iijb:iije,1:ikt) = pdp(iijb:iije,1:ikt) * prhodj(iijb:iije,1:ikt)
389 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
390 !$acc end kernels
391 CALL tbudgets(nbudget_tke)%PTR%ADD_PHY(d, 'DP', zmwork1)
392 !
393 ! Thermal production
394 !$acc kernels
395 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
396 zmwork1(iijb:iije,1:ikt) = ptp(iijb:iije,1:ikt) * prhodj(iijb:iije,1:ikt)
397 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
398 !$acc end kernels
399 CALL tbudgets(nbudget_tke)%PTR%ADD_PHY(d, 'TP', zmwork1)
400 !
401 ! Dissipation
402 !$acc kernels
403 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
404 zmwork1(iijb:iije,1:ikt) = -pturb_spp(iijb:iije,1:ikt,nced) * sqrt(ptkem(iijb:iije,1:ikt))/pleps(iijb:iije,1:ikt) * &
405 (pexpl*ptkem(iijb:iije,1:ikt) + turbn%XIMPL*zres(iijb:iije,1:ikt))*prhodj(iijb:iije,1:ikt)
406 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
407 !$acc end kernels
408 CALL tbudgets(nbudget_tke)%PTR%ADD_PHY(d, 'DISS',zmwork1)
409END IF
410!
411!* 2.5 computes the final RTKE and stores the whole turbulent transport
412! with the removal of the advection part for MesoNH
413
414!Should be in IF LBUDGET_TKE only. Was removed out for a correct comput. of PTDIFF in case of LBUDGET_TKE=F in AROME
415!$acc kernels present_cr(ZRES)
416!$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
417prtkes(iijb:iije,1:ikt) = prtkes(iijb:iije,1:ikt) + prhodj(iijb:iije,1:ikt) * &
418 ( pdp(iijb:iije,1:ikt) + ptp(iijb:iije,1:ikt) &
419 - pturb_spp(iijb:iije,1:ikt,nced) * sqrt(ptkem(iijb:iije,1:ikt)) / pleps(iijb:iije,1:ikt) &
420 * ( pexpl*ptkem(iijb:iije,1:ikt) + turbn%XIMPL*zres(iijb:iije,1:ikt) ) )
421!
422ptdiff(iijb:iije,1:ikt) = zres(iijb:iije,1:ikt) / ptstep - prtkes(iijb:iije,1:ikt)&
423 /prhodj(iijb:iije,1:ikt) &
424 & - pdp(iijb:iije,1:ikt)- ptp(iijb:iije,1:ikt) - ptdiss(iijb:iije,1:ikt)
425!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
426!$acc end kernels
427!
428IF (buconf%LBUDGET_TKE) CALL tbudgets(nbudget_tke)%PTR%INIT_PHY(d, 'TR', prtkes)
429!
430!$acc kernels
431!$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
432prtkes(iijb:iije,1:ikt) = zres(iijb:iije,1:ikt) * prhodj(iijb:iije,1:ikt) / ptstep &
433 - prtkems(iijb:iije,1:ikt)
434!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
435!$acc end kernels
436!
437! stores the whole turbulent transport
438!
439IF (buconf%LBUDGET_TKE) CALL tbudgets(nbudget_tke)%PTR%END_PHY(d, 'TR', prtkes)
440!
441!----------------------------------------------------------------------------
442!
443!* 3. COMPUTE THE DISSIPATIVE HEATING
444! -------------------------------
445!
446!$acc kernels
447!$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
448prthls(iijb:iije,1:ikt) = prthls(iijb:iije,1:ikt) + &
449 pturb_spp(iijb:iije,1:ikt,nced) * sqrt(ptkem(iijb:iije,1:ikt)) / pleps(iijb:iije,1:ikt) * &
450 (pexpl*ptkem(iijb:iije,1:ikt) + turbn%XIMPL*zres(iijb:iije,1:ikt)) &
451 * prhodj(iijb:iije,1:ikt) * pcoef_diss(iijb:iije,1:ikt)
452!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
453!$acc end kernels
454!----------------------------------------------------------------------------
455!
456!* 4. STORES SOME DIAGNOSTICS
457! -----------------------
458!
459IF(PRESENT(ptr)) THEN
460!$acc kernels
461 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
462 ptr(iijb:iije,1:ikt)=ztr(iijb:iije,1:ikt)
463 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
464!$acc end kernels
465END IF
466IF(PRESENT(pdiss)) THEN
467!$acc kernels
468 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
469 pdiss(iijb:iije,1:ikt) = -pturb_spp(iijb:iije,1:ikt,nced) * (ptkem(iijb:iije,1:ikt)**1.5) / pleps(iijb:iije,1:ikt)
470 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
471!$acc end kernels
472END IF
473!
474IF(PRESENT(pedr)) THEN
475!$acc kernels
476 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
477 pedr(iijb:iije,1:ikt) = pturb_spp(iijb:iije,1:ikt,nced) * (ptkem(iijb:iije,1:ikt)**1.5) / pleps(iijb:iije,1:ikt)
478 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
479!$acc end kernels
480END IF
481!
482IF ( turbn%LTURB_DIAG .AND. tpfile%LOPENED ) THEN
483!$acc update self(PDP,PTP,PTR,PDISS)
484!
485! stores the dynamic production
486!
487 tzfield = tfieldmetadata( &
488 cmnhname = 'TKE_DP', &
489 cstdname = '', &
490 clongname = 'Subgrid TKE dynamical production', &
491 cunits = 'm2 s-3', &
492 cdir = 'XY', &
493 ccomment = 'Subgrid dynamical production of TKE', &
494 ngrid = 1, &
495 ntype = typereal, &
496 ndims = 3, &
497 ltimedep = .true. )
498 CALL io_field_write_phy(d,tpfile,tzfield,pdp)
499!
500! stores the thermal production
501!
502 tzfield = tfieldmetadata( &
503 cmnhname = 'TKE_TP', &
504 cstdname = '', &
505 clongname = 'Subgrid TKE thermal production', &
506 cunits = 'm2 s-3', &
507 cdir = 'XY', &
508 ccomment = 'Subgrid thermal production of TKE', &
509 ngrid = 1, &
510 ntype = typereal, &
511 ndims = 3, &
512 ltimedep = .true. )
513 CALL io_field_write_phy(d,tpfile,tzfield,ptp)
514!
515! stores the whole turbulent transport
516!
517 tzfield = tfieldmetadata( &
518 cmnhname = 'TKE_TR', &
519 cstdname = '', &
520 clongname = 'Subgrid TKE turbulent transport', &
521 cunits = 'm2 s-3', &
522 cdir = 'XY', &
523 ccomment = 'Subgrid total turbulent transport of TKE', &
524 ngrid = 1, &
525 ntype = typereal, &
526 ndims = 3, &
527 ltimedep = .true. )
528 CALL io_field_write_phy(d,tpfile,tzfield,ztr)
529!
530! stores the dissipation of TKE
531!
532 tzfield = tfieldmetadata( &
533 cmnhname = 'TKE_DISS', &
534 cstdname = '', &
535 clongname = 'Subgrid TKE dissipation', &
536 cunits = 'm2 s-3', &
537 cdir = 'XY', &
538 ccomment = 'Subgrid dissipation of TKE', &
539 ngrid = 1, &
540 ntype = typereal, &
541 ndims = 3, &
542 ltimedep = .true. )
543 CALL io_field_write_phy(d,tpfile,tzfield,pdiss)
544END IF
545!
546! Storage in the LES configuration of the Dynamic Production of TKE and
547! the dissipation of TKE
548!
549IF (tles%LLES_CALL ) THEN
550 CALL les_mean_subgrid_phy(d,tles, pdiss, tles%X_LES_SUBGRID_DISS_Tke )
551END IF
552!
553!----------------------------------------------------------------------------
554!
555IF (lhook) CALL dr_hook('TKE_EPS_SOURCES',1,zhook_handle)
556CONTAINS
557include "shugrad.h"
558END SUBROUTINE tke_eps_sources
559END MODULE mode_tke_eps_sources
integer, parameter nbudget_tke
integer, parameter typereal
Definition modd_field.F90:9
integer, parameter nced
integer, parameter nturb_s
subroutine add3dfield_ll_phy(d, tplist, pfield, hname)
subroutine update_halo_ll(tplist, kinfo, oongpu)
Definition mode_ll.F90:16
subroutine cleanlist_ll(tplist)
Definition mode_ll.F90:47
subroutine tke_eps_sources(d, cst, csturb, buconf, turbn, tles, ptkem, plm, pleps, pdp, ptrh, prhodj, pdzz, pdxx, pdyy, pdzx, pdzy, pzz, ptstep, pexpl, tpfile, odiag_in_run, oocean, psfum, psfvm, ptp, prtkes, prthls, pcoef_diss, ptdiff, ptdiss, prtkems, tbudgets, kbudgets, pedr, ptr, pdiss, pcurrent_tke_diss, pturb_spp)
subroutine tridiag_tke(d, pvarm, pa, ptstep, pexpl, pimpl, prhodj, psource, pdiag, pvarp)
real function, dimension(size(pin, 1), size(pin, 2)) mzf(pin)
Definition shugrad.h:142
real function, dimension(size(pin, 1), size(pin, 2)) dzf(pin)
Definition shugrad.h:158
real function, dimension(size(pin, 1), size(pin, 2)) mzm(pin)
Definition shugrad.h:2
real function, dimension(size(pin, 1), size(pin, 2)) dzm(pin)
Definition shugrad.h:298