PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
mode_turb_ver_dyn_flux.F90
Go to the documentation of this file.
1!MNH_LIC Copyright 1994-2026 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 turb_ver_dyn_flux(D,CST,CSTURB,TURBN,TLES,KSV,O2D,OFLAT, &
12 KRR,OOCEAN,OCOUPLES, &
13 PEXPL,PTSTEP,TPFILE, &
14 PDXX,PDYY,PDZZ,PDZX,PDZY,PDIRCOSZW,PZZ, &
15 PCOSSLOPE,PSINSLOPE, &
16 PSEA_UCU,PSEA_VCU, &
17 PRHODJ, &
18 PSFUM,PSFVM, &
19 PCDUEFF,PTAU11M,PTAU12M,PTAU33M, &
20 PTHLM,PRM,PSVM,PUM,PVM,PWM,PUSLOPEM,PVSLOPEM, &
21 PTKEM,PLM,MFMOIST,PWU,PWV, &
22 PRUS,PRVS,PRWS,PDP,PTP, &
23 PTURB_SPP,PSSUFL_C,PSSVFL_C,PSSUFL,PSSVFL )
24! ###############################################################
25!
26!
27!!**** *TURB_VER_DYN_FLUX* -compute the source terms due to the vertical turbulent
28!! fluxes.
29!!
30!! PURPOSE
31!! -------
32! The purpose of this routine is to compute the vertical turbulent
33! fluxes of the evolutive variables and give back the source
34! terms to the main program. In the case of large horizontal meshes,
35! the divergence of these vertical turbulent fluxes represent the whole
36! effect of the turbulence but when the three-dimensionnal version of
37! the turbulence scheme is activated (CTURBDIM="3DIM"), these divergences
38! are completed in the next routine TURB_HOR.
39! An arbitrary degree of implicitness has been implemented for the
40! temporal treatment of these diffusion terms.
41! The vertical boundary conditions are as follows:
42! * at the bottom, the surface fluxes are prescribed at the same
43! as the other turbulent fluxes
44! * at the top, the turbulent fluxes are set to 0.
45! It should be noted that the condensation has been implicitely included
46! in this turbulence scheme by using conservative variables and computing
47! the subgrid variance of a statistical variable s indicating the presence
48! or not of condensation in a given mesh.
49!
50!!** METHOD
51!! ------
52!! 1D type calculations are made;
53!! The vertical turbulent fluxes are computed in an off-centered
54!! implicit scheme (a Crank-Nicholson type with coefficients different
55!! than 0.5), which allows to vary the degree of implicitness of the
56!! formulation.
57!! The different prognostic variables are treated one by one.
58!! The contributions of each turbulent fluxes are cumulated into the
59!! tendency PRvarS, and into the dynamic and thermal production of
60!! TKE if necessary.
61!!
62!! In section 2 and 3, the thermodynamical fields are considered.
63!! Only the turbulent fluxes of the conservative variables
64!! (Thetal and Rnp stored in PRx(:,:,:,1)) are computed.
65!! Note that the turbulent fluxes at the vertical
66!! boundaries are given either by the soil scheme for the surface one
67!! ( at the same instant as the others fluxes) and equal to 0 at the
68!! top of the model. The thermal production is computed by vertically
69!! averaging the turbulent flux and multiply this flux at the mass point by
70!! a function ETHETA or EMOIST, which preform the transformation from the
71!! conservative variables to the virtual potential temperature.
72!!
73!! In section 4, the variance of the statistical variable
74!! s indicating presence or not of condensation, is determined in function
75!! of the turbulent moments of the conservative variables and its
76!! squarred root is stored in PSIGS. This information will be completed in
77!! the horizontal turbulence if the turbulence dimensionality is not
78!! equal to "1DIM".
79!!
80!! In section 5, the x component of the stress tensor is computed.
81!! The surface flux <u'w'> is computed from the value of the surface
82!! fluxes computed in axes linked to the orography ( i", j" , k"):
83!! i" is parallel to the surface and in the direction of the maximum
84!! slope
85!! j" is also parallel to the surface and in the normal direction of
86!! the maximum slope
87!! k" is the normal to the surface
88!! In order to prevent numerical instability, the implicit scheme has
89!! been extended to the surface flux regarding to its dependence in
90!! function of U. The dependence in function of the other components
91!! introduced by the different rotations is only explicit.
92!! The turbulent fluxes are used to compute the dynamic production of
93!! TKE. For the last TKE level ( located at PDZZ(:,:,IKB)/2 from the
94!! ground), an harmonic extrapolation from the dynamic production at
95!! PDZZ(:,:,IKB) is used to avoid an evaluation of the gradient of U
96!! in the surface layer.
97!!
98!! In section 6, the same steps are repeated but for the y direction
99!! and in section 7, a diagnostic computation of the W variance is
100!! performed.
101!!
102!! In section 8, the turbulent fluxes for the scalar variables are
103!! computed by the same way as the conservative thermodynamical variables
104!!
105!!
106!! EXTERNAL
107!! --------
108!! GX_U_M, GY_V_M, GZ_W_M : cartesian gradient operators
109!! GX_U_UW,GY_V_VW (X,Y,Z) represent the direction of the gradient
110!! _(M,U,...)_ represent the localization of the
111!! field to be derivated
112!! _(M,UW,...) represent the localization of the
113!! field derivated
114!!
115!!
116!! MXM,MXF,MYM,MYF,MZM,MZF
117!! : Shuman functions (mean operators)
118!! DXF,DYF,DZM
119!! : Shuman functions (difference operators)
120!!
121!! SUBROUTINE TRIDIAG_WIND: to compute the split implicit evolution
122!! of a variable located at a wind point
123!!
124!! FUNCTIONs ETHETA and EMOIST :
125!! allows to compute:
126!! - the coefficients for the turbulent correlation between
127!! any variable and the virtual potential temperature, of its
128!! correlations with the conservative potential temperature and
129!! the humidity conservative variable:
130!! ------- ------- -------
131!! A' Thv' = ETHETA A' Thl' + EMOIST A' Rnp'
132!!
133!!
134!! IMPLICIT ARGUMENTS
135!! ------------------
136!! Module MODD_CST : contains physical constants
137!!
138!! CST%XG : gravity constant
139!!
140!! Module MODD_CTURB: contains the set of constants for
141!! the turbulence scheme
142!!
143!! CSTURB%XCMFS,XCMFB : cts for the momentum flux
144!! CSTURB%XCSHF : ct for the sensible heat flux
145!! CSTURB%XCHF : ct for the moisture flux
146!! CSTURB%XCTV,CSTURB%XCHV : cts for the T and moisture variances
147!!
148!! Module MODD_PARAMETERS
149!!
150!! JPVEXT_TURB : number of vertical external points
151!! JPHEXT : number of horizontal external points
152!!
153!!
154!! REFERENCE
155!! ---------
156!! Book 1 of documentation (Chapter: Turbulence)
157!!
158!! AUTHOR
159!! ------
160!! Joan Cuxart * INM and Meteo-France *
161!!
162!! MODIFICATIONS
163!! -------------
164!! Original August 19, 1994
165!! Modifications: February 14, 1995 (J.Cuxart and J.Stein)
166!! Doctorization and Optimization
167!! Modifications: March 21, 1995 (J.M. Carriere)
168!! Introduction of cloud water
169!! Modifications: June 14, 1995 (J.Cuxart and J. Stein)
170!! Phi3 and Psi3 at w-point + bug in the all
171!! or nothing condens.
172!! Modifications: Sept 15, 1995 (J.Cuxart and J. Stein)
173!! Change the DP computation at the ground
174!! Modifications: October 10, 1995 (J.Cuxart and J. Stein)
175!! Psi for scal var and LES tools
176!! Modifications: November 10, 1995 (J. Stein)
177!! change the surface relations
178!! Modifications: February 20, 1995 (J. Stein) optimization
179!! Modifications: May 21, 1996 (J. Stein)
180!! bug in the vertical flux of the V wind
181!! component for explicit computation
182!! Modifications: May 21, 1996 (N. wood)
183!! modify the computation of the vertical
184!! part or the surface tangential flux
185!! Modifications: May 21, 1996 (P. Jabouille)
186!! same modification in the Y direction
187!!
188!! Modifications: Sept 17, 1996 (J. Stein) change the moist case by using
189!! Pi instead of Piref + use Atheta and Amoist
190!!
191!! Modifications: Nov 24, 1997 (V. Masson) removes the DO loops
192!! Modifications: Mar 31, 1998 (V. Masson) splits the routine TURB_VER_DYN_FLUX
193!! Modifications: Oct 18, 2000 (J. Stein) Bug in some computations for IKB level
194!! Modifications: Oct 18, 2000 (V. Masson) LES computations + OFLAT switch
195!! Nov 06, 2002 (V. Masson) LES budgets
196!! October 2009 (G. Tanguy) add ILENCH=LEN(YCOMMENT) after
197!! change of YCOMMENT
198!! 2012-02 Y. Seity, add possibility to run with reversed vertical levels
199!! Modifications July 2015 (Wim de Rooy) TURBN%LHARATU switch
200!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1
201!! 04/2016 (M.Moge) Use openACC directives to port the TURB part of Meso-NH on GPU
202!! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O
203!! Q. Rodier 17/01/2019 : cleaning : remove cyclic conditions on DP and ZA
204!! Modification June 2019 (Wim de Rooy) 50*MF term can be removed with
205!! inclusion of energy cascade
206!! JL Redelsperger 03/2021 : Add Ocean & O-A Autocoupling LES Cases
207!!--------------------------------------------------------------------------
208!
209!* 0. DECLARATIONS
210! ------------
211!
212USE yomhook, ONLY: lhook, dr_hook, jphook
213!
214USE modd_cst, ONLY: cst_t
215USE modd_cturb, ONLY: csturb_t
216USE modd_dimphyex, ONLY: dimphyex_t
218USE modd_io, ONLY: tfiledata
219USE modd_les, ONLY: tles_t
220USE modd_parameters, ONLY: xundef
221USE modd_turb_n, ONLY: turb_t, ncmfs, nturb_s
222!
225!
227USE modi_second_mnh, ONLY: second_mnh
228!
229#ifdef MNH_COMPILER_CCE
230!$mnh_undef(LOOP)
231!$mnh_undef(OPENACC)
232#endif
233!
234IMPLICIT NONE
235!
236!* 0.1 declarations of arguments
237!
238!
239!
240TYPE(dimphyex_t), INTENT(IN) :: D
241TYPE(cst_t), INTENT(IN) :: CST
242TYPE(csturb_t), INTENT(IN) :: CSTURB
243TYPE(turb_t), INTENT(IN) :: TURBN
244TYPE(tles_t), INTENT(INOUT):: TLES ! modd_les structure
245INTEGER, INTENT(IN) :: KSV ! number of scalar variables
246LOGICAL, INTENT(IN) :: OOCEAN ! switch for Ocean model version
247LOGICAL, INTENT(IN) :: O2D ! Logical for 2D model version (modd_conf)
248LOGICAL, INTENT(IN) :: OFLAT ! Logical for zero ororography
249LOGICAL, INTENT(IN) :: OCOUPLES ! switch to activate atmos-ocean LES version
250INTEGER, INTENT(IN) :: KRR ! number of moist var.
251REAL, INTENT(IN) :: PEXPL ! Coef. for temporal disc.
252REAL, INTENT(IN) :: PTSTEP ! Double Time Step
253TYPE(tfiledata), INTENT(INOUT) :: TPFILE ! Output file
254!
255REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PDXX, PDYY, PDZZ, PDZX, PDZY
256 ! Metric coefficients
257REAL, DIMENSION(D%NIJT), INTENT(IN) :: PDIRCOSZW ! Director Cosinus of the
258 ! normal to the ground surface
259REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PZZ ! altitude of flux points
260REAL, DIMENSION(D%NIJT), INTENT(IN) :: PCOSSLOPE ! cosinus of the angle
261 ! between i and the slope vector
262REAL, DIMENSION(D%NIJT), INTENT(IN) :: PSINSLOPE ! sinus of the angle
263 ! between i and the slope vector
264!
265REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODJ ! dry density * grid volum
266REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: MFMOIST ! moist mass flux dual scheme
267
268!
269REAL, DIMENSION(D%NIJT), INTENT(IN) :: PSFUM,PSFVM ! normal momentum sfc flux
270REAL, DIMENSION(D%NIJT), INTENT(IN) :: PCDUEFF ! Cd * || u || at time t
271REAL, DIMENSION(D%NIJT), INTENT(IN) :: PTAU11M ! <uu> in the axes linked
272 ! to the maximum slope direction and the surface normal and the binormal
273 ! at time t - dt
274REAL, DIMENSION(D%NIJT), INTENT(IN) :: PTAU12M ! <uv> in the same axes
275REAL, DIMENSION(D%NIJT), INTENT(IN) :: PTAU33M ! <ww> in the same axes
276!
277REAL, DIMENSION(D%NIJT), INTENT(IN) :: PSEA_UCU ! ocean current along X
278REAL, DIMENSION(D%NIJT), INTENT(IN) :: PSEA_VCU ! ocean current along Y
279!
280REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PUM,PVM,PWM, PTHLM
281 ! Wind at t-Delta t
282REAL, DIMENSION(D%NIJT,D%NKT,KRR), INTENT(IN) :: PRM
283REAL, DIMENSION(D%NIJT,D%NKT,KSV), INTENT(IN) :: PSVM
284REAL, DIMENSION(D%NIJT), INTENT(IN) :: PUSLOPEM ! wind component along the
285 ! maximum slope direction
286REAL, DIMENSION(D%NIJT), INTENT(IN) :: PVSLOPEM ! wind component along the
287 ! direction normal to the maximum slope one
288!
289REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTKEM ! TKE at time t
290REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PLM ! Turb. mixing length
291REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PWU ! momentum flux u'w'
292REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PWV ! momentum flux v'w'
293!
294REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PRUS, PRVS, PRWS
295 ! cumulated sources for the prognostic variables
296!
297REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PDP ! Dynamic TKE production term
298REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTP ! Thermal TKE production term
299REAL, DIMENSION(D%NIJT,D%NKT,NTURB_S), INTENT(IN) :: PTURB_SPP ! Thermal TKE production term
300REAL, DIMENSION(MERGE(D%NIJT,0,OCOUPLES)), INTENT(IN),OPTIONAL :: PSSUFL_C ! Time evol Flux of U at sea surface (LOCEAN)
301REAL, DIMENSION(MERGE(D%NIJT,0,OCOUPLES)), INTENT(IN),OPTIONAL :: PSSVFL_C !
302REAL, DIMENSION(MERGE(D%NIJT,0,OCOUPLES)), INTENT(IN),OPTIONAL :: PSSUFL
303REAL, DIMENSION(MERGE(D%NIJT,0,OCOUPLES)), INTENT(IN),OPTIONAL :: PSSVFL !
304!
305!
306!
307!
308!* 0.2 declaration of local variables
309!
310!
311REAL, DIMENSION(D%NIJT) :: ZDIRSINZW ! sinus of the angle
312 ! between the normal and the vertical at the surface
313REAL, DIMENSION(D%NIJT):: ZCOEFS ! coeff. for the implicit scheme for the wind at the surface
314REAL, DIMENSION(D%NIJT,D%NKT) :: &
315 ZA, & ! under diagonal elements of the tri-diagonal matrix involved
316 ! in the temporal implicit scheme (also used to store coefficient
317 ! J in Section 5)
318 zres, & ! guess of the treated variable at t+ deltat when the turbu-
319 ! lence is the only source of evolution added to the ones
320 ! considered in ZSOURCE
321 zflxz, & ! vertical flux of the treated variable
322 zsource, & ! source of evolution for the treated variable
323 zkeff, & ! effectif diffusion coeff = LT * SQRT( TKE )
324 zwork1, & ! working var. for shuman operators (array syntax)
325 zwkles ! working var. for LES calls
326!
327INTEGER :: IIJE,IIJB,IKB,IKE,IKA,IKU ! index value for the mass points of the domain
328INTEGER :: IKT ! array size in k direction
329INTEGER :: IKTB,IKTE ! start, end of k loops in physical domain
330INTEGER :: JSV,JIJ,JK ! scalar loop counter
331INTEGER :: IKL
332REAL, DIMENSION(D%NIJT) :: ZCOEFFLXU, &
333 ZCOEFFLXV, ZUSLOPEM, ZVSLOPEM, &
334 ZFLUXSFCU,ZFLUXSFCV
335 ! coefficients for the surface flux
336 ! evaluation and copy of PUSLOPEM and
337 ! PVSLOPEM in local 3D arrays
338!
339REAL, DIMENSION(D%NIJT,D%NKT) :: ZCMFS ! (possibly perturbed) constant for the momentum fluxes
340REAL :: ZTIME1, ZTIME2
341TYPE(tfieldmetadata) :: TZFIELD
342LOGICAL :: GOCEAN !Intermediate variable used to work around a Cray compiler bug (CCE 13.0.0)
343!----------------------------------------------------------------------------
344!
345!* 1. PRELIMINARIES
346! -------------
347REAL(KIND=jphook) :: zhook_handle
348IF (lhook) CALL dr_hook('TURB_VER_DYN_FLUX',0,zhook_handle)
349!
350ikt=d%NKT
351iktb=d%NKTB
352ikte=d%NKTE
353ikb=d%NKB
354ike=d%NKE
355ika=d%NKA
356iku=d%NKU
357ikl=d%NKL
358iije=d%NIJE
359iijb=d%NIJB
360!
361gocean= oocean
362!
363!$acc kernels present_cr(ZA,ZSOURCE)
364za(:,:)=xundef
365pdp(:,:)=xundef
366!
367zsource(:,:) = 0.
368zflxz(:,:) = 0.
369IF (turbn%LHARAT) THEN
370 zcmfs(:,:)=1.
371ELSE
372 zcmfs(:,:) = pturb_spp(:,:,ncmfs)
373ENDIF
374!
375!$mnh_expand_array(JIJ=IIJB:IIJE)
376zdirsinzw(iijb:iije) = sqrt(1.-pdircoszw(iijb:iije)**2)
377!$mnh_end_expand_array(JIJ=IIJB:IIJE)
378!$acc end kernels
379! compute the coefficients for the uncentred gradient computation near the
380! ground
381!
382! With TURBN%LHARATU length scale and TKE are at half levels so remove MZM
383!
384IF (turbn%LHARAT) THEN
385!$acc kernels
386 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
387 zkeff(iijb:iije,1:ikt) = plm(iijb:iije,1:ikt) * sqrt(ptkem(iijb:iije,1:ikt))
388 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
389!$acc end kernels
390ELSE
391!$acc kernels
392 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
393 zwork1(iijb:iije,1:ikt) = plm(iijb:iije,1:ikt) * sqrt(ptkem(iijb:iije,1:ikt))
394 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
395!$acc end kernels
396 zkeff=mzm(zwork1)
397ENDIF
398!
399!$acc kernels
400zuslopem(iijb:iije)=puslopem(iijb:iije)
401zvslopem(iijb:iije)=pvslopem(iijb:iije)
402zfluxsfcu(iijb:iije)=psfum(iijb:iije)
403zfluxsfcv(iijb:iije)=psfvm(iijb:iije)
404!$acc end kernels
405!
406!----------------------------------------------------------------------------
407!
408!
409!* 5. SOURCES OF U,W WIND COMPONENTS AND PARTIAL DYNAMIC PRODUCTION
410! -------------------------------------------------------------
411!
412!* 5.1 Source of U wind component
413!
414! Preparation of the arguments for TRIDIAG_WIND
415!
416za(iijb:iije,:) = -ptstep * zcmfs(iijb:iije,:) * mxm( zkeff(iijb:iije,:) ) * &
417 mxm(mzm( prhodj(iijb:iije,:) )) / mxm(pdzz(iijb:iije,:))**2
418!
419!
420! Compute the source of U wind component
421!
422! compute the coefficient between the vertical flux and the 2 components of the
423! wind following the slope
424!$acc kernels
425!$mnh_expand_array(JIJ=IIJB:IIJE)
426zcoefflxu(iijb:iije) = pcdueff(iijb:iije) * (pdircoszw(iijb:iije)**2 - zdirsinzw(iijb:iije)**2) &
427 * pcosslope(iijb:iije)
428zcoefflxv(iijb:iije) = pcdueff(iijb:iije) * pdircoszw(iijb:iije) * psinslope(iijb:iije)
429!
430! prepare the implicit scheme coefficients for the surface flux
431zcoefs(iijb:iije)= zcoefflxu(iijb:iije) * pcosslope(iijb:iije) * pdircoszw(iijb:iije) &
432 +zcoefflxv(iijb:iije) * psinslope(iijb:iije)
433!
434! average this flux to be located at the U,W vorticity point
435!$mnh_end_expand_array(JIJ=IIJB:IIJE)
436!$acc end kernels
437!
438zcoefs(iijb:iije)=mxm2d(zcoefs(iijb:iije) / pdzz(iijb:iije,ikb) )
439!
440!
441!$acc kernels
442!$mnh_expand_array(JIJ=IIJB:IIJE,JK=IKTB+1:IKTE-1)
443zsource(iijb:iije,iktb+1:ikte-1) = 0.
444!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=IKTB+1:IKTE-1)
445!$acc end kernels
446! ZSOURCE= sfc FLUX /DZ
447! Sfx flux assumed to be in SI & at vorticity point
448!
449IF (gocean) THEN ! Ocean model
450 zsource(iijb:iije,ike) = mxm2d(zfluxsfcu(iijb:iije)/pdzz(iijb:iije,ike)) &
451 *0.5 * ( 1. + mxm2d(prhodj(iijb:iije,iku)) / mxm2d(prhodj(iijb:iije,ike)))
452 !
453 ! Zero flux at the ocean domain bottom
454!$acc kernels
455!$mnh_expand_array(JIJ=IIJB:IIJE)
456 zsource(iijb:iije,ikb) = 0.
457!$mnh_end_expand_array(JIJ=IIJB:IIJE)
458!$acc end kernels
459 !
460ELSE ! Atmosphere
461 ! Compute the explicit tangential flux at the W point
462!$acc kernels
463 !$mnh_expand_array(JIJ=IIJB:IIJE)
464 zsource(iijb:iije,ikb) = &
465 ptau11m(iijb:iije) * pcosslope(iijb:iije) * pdircoszw(iijb:iije) * zdirsinzw(iijb:iije) &
466 -ptau12m(iijb:iije) * psinslope(iijb:iije) * zdirsinzw(iijb:iije) &
467 -ptau33m(iijb:iije) * pcosslope(iijb:iije) * zdirsinzw(iijb:iije) * pdircoszw(iijb:iije)
468 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
469!$acc end kernels
470!
471 ! add the vertical part or the surface flux at the U,W vorticity point
472!
473 zsource(iijb:iije,ikb) = &
474 ( mxm2d( zsource(iijb:iije,ikb) / pdzz(iijb:iije,ikb) ) &
475 + mxm2d( zcoefflxu(iijb:iije) / pdzz(iijb:iije,ikb) &
476 *zuslopem(iijb:iije) &
477 -zcoefflxv(iijb:iije) / pdzz(iijb:iije,ikb) &
478 *zvslopem(iijb:iije) ) &
479 - zcoefs(iijb:iije) * pum(iijb:iije,ikb) * turbn%XIMPL &
480 ) * 0.5 * ( 1. + mxm2d(prhodj(iijb:iije,ika)) / mxm2d(prhodj(iijb:iije,ikb)) )
481!
482!$acc kernels
483 !$mnh_expand_array(JIJ=IIJB:IIJE)
484 zsource(iijb:iije,ike) = 0.
485 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
486!$acc end kernels
487ENDIF
488!
489! Obtention of the split U at t+ deltat
490!
491CALL tridiag_wind(d,pum,psea_ucu,za,zcoefs,ptstep,pexpl,turbn%XIMPL, &
492 mxm(prhodj),zsource,zres)
493!
494! Compute the equivalent tendency for the U wind component
495!
496prus(iijb:iije,:)=prus(iijb:iije,:)+mxm(prhodj(iijb:iije,:))*(zres(iijb:iije,:)-pum(iijb:iije,:))/ptstep
497!
498!* 5.2 Partial TKE Dynamic Production
499!
500! vertical flux of the U wind component
501!
502zflxz(iijb:iije,:) = -zcmfs(iijb:iije,:) * mxm(zkeff(iijb:iije,:)) * &
503 dzm(turbn%XIMPL*zres(iijb:iije,:) + pexpl*pum(iijb:iije,:)) / mxm(pdzz(iijb:iije,:))
504!
505IF (gocean) THEN
506!$acc kernels
507 !$mnh_expand_array(JIJ=IIJB:IIJE)
508 zflxz(iijb:iije,ike+1) = zfluxsfcu(iijb:iije)
509 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
510!$acc end kernels
511ELSE
512 ! surface flux
513 zflxz(iijb:iije,ikb) = mxm2d(pdzz(iijb:iije,ikb)) * &
514 ( zsource(iijb:iije,ikb) &
515 +zcoefs(iijb:iije) * zres(iijb:iije,ikb) * turbn%XIMPL &
516 ) / 0.5 / ( 1. + mxm2d(prhodj(iijb:iije,ika)) / mxm2d(prhodj(iijb:iije,ikb)) )
517 !
518!$acc kernels
519 !$mnh_expand_array(JIJ=IIJB:IIJE)
520 zflxz(iijb:iije,ika) = zflxz(iijb:iije,ikb)
521 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
522!$acc end kernels
523END IF
524!
525IF ( turbn%LTURB_FLX .AND. tpfile%LOPENED ) THEN
526!$acc update self(ZFLXZ)
527 ! stores the U wind component vertical flux
528 CALL io_field_write_phy(d,tpfile,'UW_FLX',zflxz)
529END IF
530!
531! first part of total momentum flux
532!
533!$acc kernels present_cr(PWU)
534pwu(iijb:iije,1:ikt) = zflxz(iijb:iije,1:ikt)
535!$acc end kernels
536!
537! Contribution to the TKE dynamic production of TKE
538! (computed at mass point)
539!
540pdp(iijb:iije,:)=-mzf(mxf(zflxz(iijb:iije,:) * gz_u_uw(turbn%XIMPL*zres(iijb:iije,:) + pexpl*pum(iijb:iije,:), pdzz(iijb:iije,:))))
541!
542! Special cases near surface
543IF (gocean) THEN
544 ! evaluate the dynamic production at w(IKE) and store in PDP(IKE)
545 ! before to be extrapolated in tke_eps routine
546 pdp(iijb:iije,ike) = -mxf2d(zflxz(iijb:iije,ike-ikl) * (turbn%XIMPL*(zres(iijb:iije,ike)-zres(iijb:iije,ike-ikl)) + &
547 pexpl*(pum(iijb:iije,ike)-pum(iijb:iije,ike-ikl)))/ mxm2d(pdzz(iijb:iije,ike-ikl)))
548ELSE ! Atmosphere
549 ! evaluate the dynamic production at w(IKB+KKL) in PDP(IKB)
550 pdp(iijb:iije,ikb) = -mxf2d(zflxz(iijb:iije,ikb+ikl) * (turbn%XIMPL*(zres(iijb:iije,ikb+ikl)-zres(iijb:iije,ikb)) + &
551 pexpl*(pum(iijb:iije,ikb+ikl)-pum(iijb:iije,ikb)))/ mxm2d(pdzz(iijb:iije,ikb+ikl)))
552!
553END IF
554!
555! Storage in the LES configuration
556!
557IF (tles%LLES_CALL) THEN
558 CALL second_mnh(ztime1)
559 zwkles = mzf(mxf(zflxz))
560 CALL les_mean_subgrid_phy(d, tles, zwkles, tles%X_LES_SUBGRID_WU )
561 zwkles = mzf(mxf(gz_u_uw(pum,pdzz) *zflxz))
562 CALL les_mean_subgrid_phy(d, tles, zwkles, tles%X_LES_RES_ddxa_U_SBG_UaU )
563 zwkles(:,:) = zcmfs(:,:) * zkeff(:,:)
564 CALL les_mean_subgrid_phy(d, tles, zwkles, tles%X_LES_SUBGRID_Km )
565 CALL second_mnh(ztime2)
566 tles%XTIME_LES = tles%XTIME_LES + ztime2 - ztime1
567END IF
568!
569!* 5.3 Source of W wind component
570!
571!
572IF(turbn%CTURBDIM=='3DIM') THEN
573 ! Compute the source for the W wind component
574 ! used to compute the W source at the ground
575!$acc kernels present_cr(ZFLXZ)
576 !$mnh_expand_array(JIJ=IIJB:IIJE)
577 zflxz(iijb:iije,ika) = 2 * zflxz(iijb:iije,ikb) - zflxz(iijb:iije,ikb+ikl) ! extrapolation
578 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
579!$acc end kernels
580 IF (gocean) THEN
581!$acc kernels present_cr(ZFLXZ)
582 !$mnh_expand_array(JIJ=IIJB:IIJE)
583 zflxz(iijb:iije,iku) = 2 * zflxz(iijb:iije,ike) - zflxz(iijb:iije,ike-ikl) ! extrapolation
584 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
585!$acc end kernels
586 END IF
587 !
588 IF (.NOT. oflat) THEN
589 !
590 prws(iijb:iije,:)= prws(iijb:iije,:) &
591 -dxf( mzm( mxm(prhodj(iijb:iije,:)) /pdxx(iijb:iije,:) ) * zflxz(iijb:iije,:) ) &
592 +dzm( prhodj(iijb:iije,:) / mzf(pdzz(iijb:iije,:) ) * &
593 mxf( mzf( zflxz(iijb:iije,:)*pdzx(iijb:iije,:) ) / pdxx(iijb:iije,:) ) &
594 )
595 ELSE
596 prws(iijb:iije,:)= prws(iijb:iije,:) -dxf( mzm( mxm(prhodj(iijb:iije,:)) /pdxx(iijb:iije,:) ) * zflxz(iijb:iije,:) )
597 END IF
598 !
599 ! Complete the TKE dynamical production with the W wind contribution
600 !
601 za(iijb:iije,:)=-mzf(mxf(zflxz(iijb:iije,:) * &
602 gx_w_uw(oflat,pwm(iijb:iije,:),pdxx(iijb:iije,:),pdzz(iijb:iije,:),pdzx(iijb:iije,:))))
603 !
604 ! Special cases near surface
605 IF (gocean) THEN
606 ! evaluate the dynamic production at w(IKE) in PDP(IKE)
607 !
608 za(iijb:iije,ike) = - mxf2d(zflxz(iijb:iije,ike) * dxm2d(pwm(iijb:iije,ike)) &
609 / (0.5*(pdxx(iijb:iije,ike-ikl)+pdxx(iijb:iije,ike))) )
610 !
611 ELSE !Atmosphere
612 ! evaluate the dynamic production at w(IKB+IKL) in PDP(IKB)
613 za(iijb:iije,ikb) = - mxf2d( &
614 zflxz(iijb:iije,ikb+ikl) * &
615 ( dxm2d( pwm(iijb:iije,ikb+ikl) ) &
616 -mxm2d( (pwm(iijb:iije,ikb+2*ikl )-pwm(iijb:iije,ikb+ikl)) &
617 /(pdzz(iijb:iije,ikb+2*ikl)+pdzz(iijb:iije,ikb+ikl)) &
618 +(pwm(iijb:iije,ikb+ikl)-pwm(iijb:iije,ikb )) &
619 /(pdzz(iijb:iije,ikb+ikl)+pdzz(iijb:iije,ikb )) &
620 ) &
621 * pdzx(iijb:iije,ikb+ikl) &
622 ) / (0.5*(pdxx(iijb:iije,ikb+ikl)+pdxx(iijb:iije,ikb))) &
623 )
624 END IF
625 !
626!$acc kernels
627 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
628 pdp(iijb:iije,1:ikt)=pdp(iijb:iije,1:ikt)+za(iijb:iije,1:ikt)
629 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
630!$acc end kernels
631 !
632 ! Storage in the LES configuration
633 !
634 IF (tles%LLES_CALL) THEN
635 CALL second_mnh(ztime1)
636 zwkles = mzf(mxf(gx_w_uw(oflat, pwm,pdxx,pdzz,pdzx)*zflxz))
637 CALL les_mean_subgrid_phy(d, tles, zwkles, tles%X_LES_RES_ddxa_W_SBG_UaW )
638 zwkles = mxf(gx_m_u(oflat, pthlm,pdxx,pdzz,pdzx)* mzf(zflxz))
639 CALL les_mean_subgrid_phy(d, tles, zwkles, tles%X_LES_RES_ddxa_Thl_SBG_UaW )
640 IF (krr>=1) THEN
641 zwkles = mxf(gx_u_m(oflat, prm(:,:,1),pdxx,pdzz,pdzx)*mzf(zflxz))
642 CALL les_mean_subgrid_phy(d, tles, zwkles, tles%X_LES_RES_ddxa_Rt_SBG_UaW )
643 END IF
644 DO jsv=1,ksv
645 zwkles = mxf(gx_u_m(oflat, psvm(:,:,jsv),pdxx,pdzz,pdzx)*mzf(zflxz))
646 CALL les_mean_subgrid_phy(d, tles, zwkles, tles%X_LES_RES_ddxa_Sv_SBG_UaW(:,:,:,jsv) )
647 END DO
648 CALL second_mnh(ztime2)
649 tles%XTIME_LES = tles%XTIME_LES + ztime2 - ztime1
650 END IF
651END IF
652!
653!----------------------------------------------------------------------------
654!
655!
656!* 6. SOURCES OF V,W WIND COMPONENTS AND COMPLETE 1D TKE DYNAMIC PRODUCTION
657! -----------------------------------------------------------------
658!
659!* 6.1 Source of V wind component
660!
661! Preparation of the arguments for TRIDIAG_WIND
662!!
663za(iijb:iije,:) = -ptstep * zcmfs(iijb:iije,:) * mym(zkeff(iijb:iije,:)) * mym(mzm(prhodj(iijb:iije,:))) / mym(pdzz(iijb:iije,:))**2
664!
665! Compute the source of V wind component
666! compute the coefficient between the vertical flux and the 2 components of the
667! wind following the slope
668!$acc kernels
669!$mnh_expand_array(JIJ=IIJB:IIJE)
670zcoefflxu(iijb:iije) = pcdueff(iijb:iije) * (pdircoszw(iijb:iije)**2 - zdirsinzw(iijb:iije)**2) &
671 * psinslope(iijb:iije)
672zcoefflxv(iijb:iije) = pcdueff(iijb:iije) * pdircoszw(iijb:iije) * pcosslope(iijb:iije)
673
674! prepare the implicit scheme coefficients for the surface flux
675zcoefs(iijb:iije)= zcoefflxu(iijb:iije) * psinslope(iijb:iije) * pdircoszw(iijb:iije) &
676 +zcoefflxv(iijb:iije) * pcosslope(iijb:iije)
677!$mnh_end_expand_array(JIJ=IIJB:IIJE)
678!$acc end kernels
679!
680! average this flux to be located at the V,W vorticity point
681zcoefs(iijb:iije)=mym2d(zcoefs(iijb:iije) / pdzz(iijb:iije,ikb) )
682!
683! No flux in SOURCE TERM NULL OUTSIDE BC
684!$acc kernels
685!$mnh_expand_array(JIJ=IIJB:IIJE,JK=IKB+1:IKE-1)
686zsource(iijb:iije,ikb+1:ike-1) = 0.
687!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=IKB+1:IKE-1)
688!$acc end kernels
689!
690! Surface case
691IF (gocean) THEN ! Ocean case
692!$acc kernels
693 !$mnh_expand_array(JIJ=IIJB:IIJE)
694 zcoefflxu(iijb:iije) = pcdueff(iijb:iije)
695 zcoefflxv(iijb:iije) = pcdueff(iijb:iije)
696 zcoefs(iijb:iije)=zcoefflxu(iijb:iije)
697 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
698!$acc end kernels
699 ! average this flux to be located at the U,W vorticity point
700 zsource(iijb:iije,ike) = mym2d(zfluxsfcv(iijb:iije) / pdzz(iijb:iije,ike)) &
701 *0.5 * ( 1. + mym2d(prhodj(iijb:iije,iku)) / mym2d(prhodj(iijb:iije,ike)))
702 !No flux at the ocean domain bottom
703!$acc kernels present_cr(ZSOURCE)
704 !$mnh_expand_array(JIJ=IIJB:IIJE)
705 zsource(iijb:iije,ikb) = 0.
706 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
707!$acc end kernels
708!
709ELSE ! Atmos case
710!
711 ! compute the explicit tangential flux at the W point
712!$acc kernels present_cr(ZSOURCE)
713 !$mnh_expand_array(JIJ=IIJB:IIJE)
714 zsource(iijb:iije,ikb) = &
715 ptau11m(iijb:iije) * psinslope(iijb:iije) * pdircoszw(iijb:iije) * zdirsinzw(iijb:iije) &
716 +ptau12m(iijb:iije) * pcosslope(iijb:iije) * zdirsinzw(iijb:iije) &
717 -ptau33m(iijb:iije) * psinslope(iijb:iije) * zdirsinzw(iijb:iije) * pdircoszw(iijb:iije)
718 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
719!$acc end kernels
720!
721 zsource(iijb:iije,ikb) = &
722 ( mym2d( zsource(iijb:iije,ikb) / pdzz(iijb:iije,ikb) ) &
723 + mym2d( zcoefflxu(iijb:iije) / pdzz(iijb:iije,ikb) &
724 *zuslopem(iijb:iije) &
725 +zcoefflxv(iijb:iije) / pdzz(iijb:iije,ikb) &
726 *zvslopem(iijb:iije) ) &
727 - zcoefs(iijb:iije) * pvm(iijb:iije,ikb) * turbn%XIMPL &
728 ) * 0.5 * ( 1. + mym2d(prhodj(iijb:iije,ika)) / mym2d(prhodj(iijb:iije,ikb)) )
729!
730 !No flux at the atmosphere top
731!$acc kernels present_cr(ZSOURCE)
732 !$mnh_expand_array(JIJ=IIJB:IIJE)
733 zsource(iijb:iije,ike) = 0.
734 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
735!$acc end kernels
736ENDIF ! End of Ocean or Atmospher Cases
737!
738! Obtention of the split V at t+ deltat
739CALL tridiag_wind(d,pvm,psea_vcu,za,zcoefs,ptstep,pexpl,turbn%XIMPL, &
740 mym(prhodj),zsource,zres)
741!
742! Compute the equivalent tendency for the V wind component
743!
744prvs(iijb:iije,:)=prvs(iijb:iije,:)+mym(prhodj(iijb:iije,:))*(zres(iijb:iije,:)-pvm(iijb:iije,:))/ptstep
745!
746!
747!* 6.2 Complete 1D dynamic Production
748!
749! vertical flux of the V wind component
750!
751zflxz(iijb:iije,:) = -zcmfs(iijb:iije,:) * mym(zkeff(iijb:iije,:)) * &
752 dzm( turbn%XIMPL*zres(iijb:iije,:) + pexpl*pvm(iijb:iije,:) ) / mym(pdzz(iijb:iije,:))
753!
754IF (gocean) THEN
755!$acc kernels
756 !$mnh_expand_array(JIJ=IIJB:IIJE)
757 zflxz(iijb:iije,ike+1) = zfluxsfcv(iijb:iije)
758 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
759!$acc end kernels
760ELSE
761zflxz(iijb:iije,ikb) = mym2d(pdzz(iijb:iije,ikb)) * &
762 ( zsource(iijb:iije,ikb) &
763 +zcoefs(iijb:iije) * zres(iijb:iije,ikb) * turbn%XIMPL &
764 ) / 0.5 / ( 1. + mym2d(prhodj(iijb:iije,ika)) / mym2d(prhodj(iijb:iije,ikb)) )
765 !
766!$acc kernels
767 !$mnh_expand_array(JIJ=IIJB:IIJE)
768 zflxz(iijb:iije,ika) = zflxz(iijb:iije,ikb)
769 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
770!$acc end kernels
771END IF
772!
773IF ( turbn%LTURB_FLX .AND. tpfile%LOPENED ) THEN
774 ! stores the V wind component vertical flux
775!$acc update self(ZFLXZ)
776 CALL io_field_write_phy(d,tpfile,'VW_FLX',zflxz)
777END IF
778!
779! second part of total momentum flux
780!
781!$acc kernels present_cr(PWV)
782!$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
783pwv(iijb:iije,1:ikt) = zflxz(iijb:iije,1:ikt)
784!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
785!$acc end kernels
786!
787! Contribution to the TKE dynamical production
788! computed at mass point
789!
790za(iijb:iije,:)=-mzf(myf(zflxz(iijb:iije,:) * gz_v_vw(turbn%XIMPL*zres(iijb:iije,:) + pexpl*pvm(iijb:iije,:), pdzz(iijb:iije,:))))
791!
792! Special cases at surface
793IF (gocean) THEN
794 ! evaluate the dynamic production at w(IKE) in PDP(IKE)
795 ! before extrapolation done in routine tke_eps_source
796 za(iijb:iije,ike) = -myf2d(zflxz(iijb:iije,ike-ikl) * (turbn%XIMPL*(zres(iijb:iije,ike)-zres(iijb:iije,ike-ikl)) + &
797 pexpl*(pvm(iijb:iije,ike)-pvm(iijb:iije,ike-ikl)))/ mym2d(pdzz(iijb:iije,ike-ikl)))
798!
799ELSE ! Atmosphere
800 ! evaluate the dynamic production at w(IKB+IKL) in PDP(IKB)
801 za(iijb:iije,ikb) = -myf2d(zflxz(iijb:iije,ikb+ikl) * (turbn%XIMPL*(zres(iijb:iije,ikb+ikl)-zres(iijb:iije,ikb)) + &
802 pexpl*(pvm(iijb:iije,ikb+ikl)-pvm(iijb:iije,ikb)))/ mym2d(pdzz(iijb:iije,ikb+ikl)))
803END IF
804!
805!$acc kernels
806!$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
807pdp(iijb:iije,1:ikt)=pdp(iijb:iije,1:ikt)+za(iijb:iije,1:ikt)
808!$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
809!$acc end kernels
810!
811! Storage in the LES configuration
812!
813IF (tles%LLES_CALL) THEN
814 CALL second_mnh(ztime1)
815 zwkles = mzf(myf(zflxz))
816 CALL les_mean_subgrid_phy(d, tles, zwkles, tles%X_LES_SUBGRID_WV )
817 zwkles = mzf(myf(gz_v_vw(pvm,pdzz)*zflxz))
818 CALL les_mean_subgrid_phy(d, tles, zwkles, tles%X_LES_RES_ddxa_V_SBG_UaV )
819 CALL second_mnh(ztime2)
820 tles%XTIME_LES = tles%XTIME_LES + ztime2 - ztime1
821END IF
822!
823!
824!* 6.3 Source of W wind component
825!
826IF(turbn%CTURBDIM=='3DIM') THEN
827 ! Compute the source for the W wind component
828 IF (gocean) THEN
829!$acc kernels present_cr(ZFLXZ)
830 !$mnh_expand_array(JIJ=IIJB:IIJE)
831 zflxz(iijb:iije,ike+ikl) = 2 * zflxz(iijb:iije,ike) - zflxz(iijb:iije,ike-ikl) ! extrapolation
832 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
833!$acc end kernels
834 ELSE
835!$acc kernels present_cr(ZFLXZ)
836 !$mnh_expand_array(JIJ=IIJB:IIJE)
837 zflxz(iijb:iije,ika) = 2 * zflxz(iijb:iije,ikb) - zflxz(iijb:iije,ikb+ikl) ! extrapolation
838 !$mnh_end_expand_array(JIJ=IIJB:IIJE)
839!$acc end kernels
840 END IF
841 !
842 IF (.NOT. o2d) THEN
843 IF (.NOT. oflat) THEN
844 prws(iijb:iije,:)= prws(iijb:iije,:) &
845 -dyf( mzm( mym(prhodj(iijb:iije,:)) /pdyy(iijb:iije,:) ) * zflxz(iijb:iije,:) ) &
846 +dzm( prhodj(iijb:iije,:) / mzf(pdzz(iijb:iije,:) ) * &
847 myf( mzf( zflxz(iijb:iije,:)*pdzy(iijb:iije,:) ) / pdyy(iijb:iije,:) ) &
848 )
849 ELSE
850 prws(iijb:iije,:)= prws(iijb:iije,:) -dyf( mzm( mym(prhodj(iijb:iije,:)) /pdyy(iijb:iije,:) ) * zflxz(iijb:iije,:) )
851 END IF
852 END IF
853 !
854 ! Complete the Dynamical production with the W wind component
855 IF (.NOT. o2d) THEN
856 za(iijb:iije,:)=-mzf(myf(zflxz(iijb:iije,:) * &
857 gy_w_vw(oflat, pwm(iijb:iije,:),pdyy(iijb:iije,:),pdzz(iijb:iije,:),pdzy(iijb:iije,:))))
858 ! Special case near surface
859 IF (gocean) THEN
860 ! evaluate the dynamic production at w(IKE) and stored in PDP(IKE)
861 za(iijb:iije,ike) = -myf2d(zflxz(iijb:iije,ike) * dym2d(pwm(iijb:iije,ike)) &
862 / (0.5*(pdyy(iijb:iije,ike-ikl)+pdyy(iijb:iije,ike))))
863 ELSE ! Atmosphere
864 ! evaluate the dynamic production at w(IKB+IKL) and stored in PDP(IKB)
865 za(iijb:iije,ikb) = - myf2d( &
866 zflxz(iijb:iije,ikb+ikl) * &
867 ( dym2d( pwm(iijb:iije,ikb+ikl) ) &
868 -mym2d( (pwm(iijb:iije,ikb+2*ikl)-pwm(iijb:iije,ikb+ikl)) &
869 /(pdzz(iijb:iije,ikb+2*ikl)+pdzz(iijb:iije,ikb+ikl)) &
870 +(pwm(iijb:iije,ikb+ikl)-pwm(iijb:iije,ikb )) &
871 /(pdzz(iijb:iije,ikb+ikl)+pdzz(iijb:iije,ikb )) &
872 ) &
873 * pdzy(iijb:iije,ikb+ikl) &
874 ) / (0.5*(pdyy(iijb:iije,ikb+ikl)+pdyy(iijb:iije,ikb))) &
875 )
876 !
877 END IF
878!
879!$acc kernels
880 !$mnh_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
881 pdp(iijb:iije,1:ikt)=pdp(iijb:iije,1:ikt)+za(iijb:iije,1:ikt)
882 !$mnh_end_expand_array(JIJ=IIJB:IIJE,JK=1:IKT)
883!$acc end kernels
884 !
885 END IF
886 !
887 ! Storage in the LES configuration
888 !
889 IF (tles%LLES_CALL) THEN
890 CALL second_mnh(ztime1)
891 zwkles = mzf(myf(gy_w_vw(oflat, pwm,pdyy,pdzz,pdzy)*zflxz(:,:)))
892 CALL les_mean_subgrid_phy(d, tles, zwkles, tles%X_LES_RES_ddxa_W_SBG_UaW , .true. )
893 zwkles = myf(gy_m_v(oflat, pthlm,pdyy,pdzz,pdzy)*mzf(zflxz))
894 CALL les_mean_subgrid_phy(d, tles, zwkles, tles%X_LES_RES_ddxa_Thl_SBG_UaW , .true. )
895 IF (krr>=1) THEN
896 zwkles = myf(gy_v_m(oflat, prm(:,:,1),pdyy,pdzz,pdzy)*mzf(zflxz(:,:)))
897 CALL les_mean_subgrid_phy(d, tles, zwkles, tles%X_LES_RES_ddxa_Rt_SBG_UaW , .true. )
898 END IF
899 CALL second_mnh(ztime2)
900 tles%XTIME_LES = tles%XTIME_LES + ztime2 - ztime1
901 END IF
902 !
903END IF
904!
905!
906!----------------------------------------------------------------------------
907!
908!* 7. DIAGNOSTIC COMPUTATION OF THE 1D <W W> VARIANCE
909! -----------------------------------------------
910!
911IF ( turbn%LTURB_FLX .AND. tpfile%LOPENED .AND. turbn%CTURBDIM == '1DIM') THEN
912 zflxz(iijb:iije,:)= (2./3.) * ptkem(iijb:iije,:) &
913 -zcmfs(iijb:iije,:)*plm(iijb:iije,:)*sqrt(ptkem(iijb:iije,:))*gz_w_m(pwm(iijb:iije,:),pdzz(iijb:iije,:))
914 ! to be tested &
915 ! +XCMFB*(4./3.)*PLM(:,:,:)/SQRT(PTKEM(:,:,:))*PTP(:,:,:)
916 ! stores the W variance
917 tzfield = tfieldmetadata( &
918 cmnhname = 'W_VVAR', &
919 cstdname = '', &
920 clongname = 'W_VVAR', &
921 cunits = 'm2 s-2', &
922 cdir = 'XY', &
923 ccomment = 'X_Y_Z_W_VVAR', &
924 ngrid = 1, &
925 ntype = typereal, &
926 ndims = 3, &
927 ltimedep = .true. )
928!$acc update self(ZFLXZ)
929 CALL io_field_write_phy(d,tpfile,tzfield,zflxz)
930END IF
931!
932!----------------------------------------------------------------------------
933!
934IF (lhook) CALL dr_hook('TURB_VER_DYN_FLUX',1,zhook_handle)
935CONTAINS
936include "shugrad.h"
937END SUBROUTINE turb_ver_dyn_flux
938END MODULE mode_turb_ver_dyn_flux
integer, parameter typereal
Definition modd_field.F90:9
real, parameter xundef
integer, parameter nturb_s
integer, parameter ncmfs
subroutine tridiag_wind(d, pvarm, psea_cu, pa, pcoefs, ptstep, in_pexpl, in_pimpl, prhodja, psource, pvarp)
subroutine turb_ver_dyn_flux(d, cst, csturb, turbn, tles, ksv, o2d, oflat, krr, oocean, ocouples, pexpl, ptstep, tpfile, pdxx, pdyy, pdzz, pdzx, pdzy, pdircoszw, pzz, pcosslope, psinslope, psea_ucu, psea_vcu, prhodj, psfum, psfvm, pcdueff, ptau11m, ptau12m, ptau33m, pthlm, prm, psvm, pum, pvm, pwm, puslopem, pvslopem, ptkem, plm, mfmoist, pwu, pwv, prus, prvs, prws, pdp, ptp, pturb_spp, pssufl_c, pssvfl_c, pssufl, pssvfl)
subroutine second_mnh(xt)
Definition second_mnh.F90:2
real function, dimension(size(pin, 1), size(pin, 2)) dyf(pin)
Definition shugrad.h:236
real function, dimension(size(pin, 1), size(pin, 2)) mym(pin)
Definition shugrad.h:111
real function, dimension(size(pin, 1), size(pin, 2)) mzf(pin)
Definition shugrad.h:142
real function, dimension(size(pin, 1), size(pin, 2)) dxf(pin)
Definition shugrad.h:174
real function, dimension(size(pin, 1)) dym2d(pin)
Definition shugrad.h:282
real function, dimension(size(pa, 1), size(pa, 2)) gz_v_vw(pa, pdzz)
Definition shugrad.h:579
real function, dimension(size(py, 1), size(py, 2)) gy_m_v(oflat, py, pdyy, pdzz, pdzy)
Definition shugrad.h:392
real function, dimension(size(pin, 1)) dxm2d(pin)
Definition shugrad.h:220
real function, dimension(size(pin, 1), size(pin, 2)) myf(pin)
Definition shugrad.h:80
real function, dimension(size(pa, 1), size(pa, 2)) gz_w_m(pa, pdzz)
Definition shugrad.h:598
real function, dimension(size(pin, 1), size(pin, 2)) mxm(pin)
Definition shugrad.h:49
real function, dimension(size(pa, 1), size(pa, 2)) gx_u_m(oflat, pa, pdxx, pdzz, pdzx)
Definition shugrad.h:456
real function, dimension(size(pin, 1)) mxf2d(pin)
Definition shugrad.h:33
real function, dimension(size(pin, 1), size(pin, 2)) mxf(pin)
Definition shugrad.h:18
real function, dimension(size(pin, 1)) myf2d(pin)
Definition shugrad.h:95
real function, dimension(size(pa, 1), size(pa, 2)) gy_w_vw(oflat, pa, pdyy, pdzz, pdzy)
Definition shugrad.h:643
real function, dimension(size(pin, 1), size(pin, 2)) mzm(pin)
Definition shugrad.h:2
real function, dimension(size(pin, 1)) mxm2d(pin)
Definition shugrad.h:64
real function, dimension(size(pa, 1), size(pa, 2)) gx_w_uw(oflat, pa, pdxx, pdzz, pdzx)
Definition shugrad.h:617
real function, dimension(size(pin, 1)) mym2d(pin)
Definition shugrad.h:126
real function, dimension(size(pin, 1), size(pin, 2)) dzm(pin)
Definition shugrad.h:298
real function, dimension(size(py, 1), size(py, 2)) gx_m_u(oflat, py, pdxx, pdzz, pdzx)
Definition shugrad.h:340
real function, dimension(size(pa, 1), size(pa, 2)) gz_u_uw(pa, pdzz)
Definition shugrad.h:508
real function, dimension(size(pa, 1), size(pa, 2)) gy_v_m(oflat, pa, pdyy, pdzz, pdzy)
Definition shugrad.h:553