PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
mode_turb_hor_uv.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!-----------------------------------------------------------------
7IMPLICIT NONE
8CONTAINS
9! ################################################################
10 SUBROUTINE turb_hor_uv(D, TURBN,TLES,KSPLT,OFLAT,O2D, &
11 TPFILE, &
12 PK,PINV_PDXX,PINV_PDYY,PINV_PDZZ,PMZM_PRHODJ, &
13 PDXX,PDYY,PDZZ,PDZX,PDZY, &
14 PDIRCOSZW, &
15 PCOSSLOPE,PSINSLOPE, &
16 PRHODJ, &
17 PCDUEFF,PTAU11M,PTAU12M,PTAU22M,PTAU33M, &
18 PUM,PVM,PUSLOPEM,PVSLOPEM, &
19 PTURB_SPP,PDP, &
20 PRUS,PRVS )
21! ################################################################
22!
23!
24!!**** *TURB_HOR* -routine to compute the source terms in the meso-NH
25!! model equations due to the non-vertical turbulent fluxes.
26!!
27!! PURPOSE
28!! -------
29!!
30!! see TURB_HOR
31!!
32!!** METHOD
33!! ------
34!!
35!! EXTERNAL
36!! --------
37!!
38!! IMPLICIT ARGUMENTS
39!! ------------------
40!!
41!! REFERENCE
42!! ---------
43!!
44!! AUTHOR
45!! ------
46!!
47!! Joan Cuxart * INM and Meteo-France *
48!!
49!! MODIFICATIONS
50!! -------------
51!! Aug , 1997 (V. Saravane) spliting of TURB_HOR
52!! Nov 27, 1997 (V. Masson) clearing of the routine
53!! Oct 18, 2000 (V. Masson) LES computations + OFLAT switch
54!! Nov 06, 2002 (V. Masson) LES budgets
55!! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O
56!! --------------------------------------------------------------------------
57!
58!* 0. DECLARATIONS
59! ------------
60!
63!
65USE modd_io, ONLY: tfiledata
66USE modd_parameters, ONLY: jpvext
67USE modd_les, ONLY: tles_t
68!
70!
72!
73USE modi_second_mnh, ONLY: second_mnh
74!
75#ifdef MNH_COMPILER_CCE
76!$mnh_undef(LOOP)
77!$mnh_undef(OPENACC)
78#endif
79!
80IMPLICIT NONE
81!
82!
83!* 0.1 declaration of arguments
84!
85!
86!
87TYPE(dimphyex_t), INTENT(IN) :: D
88TYPE(turb_t), INTENT(IN) :: TURBN
89TYPE(tles_t), INTENT(INOUT) :: TLES ! modd_les structure
90INTEGER, INTENT(IN) :: KSPLT ! split process index
91TYPE(tfiledata), INTENT(INOUT) :: TPFILE ! Output file
92LOGICAL, INTENT(IN) :: OFLAT ! Logical for zero ororography
93LOGICAL, INTENT(IN) :: O2D ! Logical for 2D model version (modd_conf)
94!
95REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PK ! Turbulent diffusion doef.
96 ! PK = PLM * SQRT(PTKEM)
97REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PINV_PDXX ! 1./PDXX
98REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PINV_PDYY ! 1./PDYY
99REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PINV_PDZZ ! 1./PDZZ
100REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PMZM_PRHODJ ! MZM(PRHODJ)
101REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PDXX, PDYY, PDZZ, PDZX, PDZY
102 ! Metric coefficients
103REAL, DIMENSION(D%NIJT), INTENT(IN) :: PDIRCOSZW
104! Director Cosinus along z directions at surface w-point
105REAL, DIMENSION(D%NIJT), INTENT(IN) :: PCOSSLOPE ! cosinus of the angle
106 ! between i and the slope vector
107REAL, DIMENSION(D%NIJT), INTENT(IN) :: PSINSLOPE ! sinus of the angle
108 ! between i and the slope vector
109REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODJ ! density * grid volume
110!
111REAL, DIMENSION(D%NIJT), INTENT(IN) :: PCDUEFF ! Cd * || u || at time t
112REAL, DIMENSION(D%NIJT), INTENT(IN) :: PTAU11M ! <uu> in the axes linked
113 ! to the maximum slope direction and the surface normal and the binormal
114 ! at time t - dt
115REAL, DIMENSION(D%NIJT), INTENT(IN) :: PTAU12M ! <uv> in the same axes
116REAL, DIMENSION(D%NIJT), INTENT(IN) :: PTAU22M ! <vv> in the same axes
117REAL, DIMENSION(D%NIJT), INTENT(IN) :: PTAU33M ! <ww> in the same axes
118!
119! Variables at t-1
120REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PUM,PVM
121REAL, DIMENSION(D%NIJT), INTENT(IN) :: PUSLOPEM ! wind component along the
122 ! maximum slope direction
123REAL, DIMENSION(D%NIJT), INTENT(IN) :: PVSLOPEM ! wind component along the
124 ! direction normal to the maximum slope one
125!
126REAL, DIMENSION(D%NIJT,D%NKT,NTURB_S), INTENT(IN) :: PTURB_SPP ! SPP for turbulence
127!
128REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PRUS, PRVS ! var. at t+1 -split-
129REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PDP ! TKE production terms
130!
131!
132!
133!* 0.2 declaration of local variables
134!
135REAL, DIMENSION(D%NIJT,D%NKT) :: ZFLX,ZWORK ! work arrays
136!
137REAL, DIMENSION(D%NIJT) :: ZDIRSINZW
138 ! sinus of the angle between the vertical and the normal to the orography
139INTEGER :: IKB,IKE,IIJT,IKT, JIJ,JK
140 ! Index values for the Beginning and End
141 ! mass points of the domain
142!
143REAL, DIMENSION(D%NIJT,D%NKT) :: GY_U_UV_PUM
144REAL, DIMENSION(D%NIJT,D%NKT) :: GX_V_UV_PVM
145!
146REAL :: ZTIME1, ZTIME2
147TYPE(tfieldmetadata) :: TZFIELD
148!
149!
150! ---------------------------------------------------------------------------
151!
152!* 1. PRELIMINARY COMPUTATIONS
153! ------------------------
154!
155!
156ikb = 1+jpvext
157ike = SIZE(pum,2)-jpvext
158iijt=d%NIJT
159ikt=d%NKT
160!
161!$acc kernels
162!$mnh_expand_array(JIJ=1:IIJT)
163zdirsinzw(1:iijt) = sqrt( 1. - pdircoszw(1:iijt)**2 )
164!$mnh_end_expand_array(JIJ=1:IIJT)
165!$acc end kernels
166!
167gx_v_uv_pvm = gx_v_uv(oflat,pvm,pdxx,pdzz,pdzx)
168IF (.NOT. o2d) gy_u_uv_pum = gy_u_uv(oflat,pum,pdyy,pdzz,pdzy)
169!
170!
171!* 12. < U'V'>
172! -------
173!
174!
175IF (.NOT. o2d) THEN
176 zflx(:,:)= - pturb_spp(:,:,ncmfs) * mym(mxm(pk)) * &
177 (gy_u_uv_pum + gx_v_uv_pvm)
178ELSE
179 zflx(:,:)= - pturb_spp(:,:,ncmfs) * mym(mxm(pk)) * &
180 (gx_v_uv_pvm)
181END IF
182!
183!$acc kernels
184!$mnh_expand_array(JIJ=1:IIJT)
185zflx(1:iijt,ike+1)= zflx(1:iijt,ike)
186!$mnh_end_expand_array(JIJ=1:IIJT)
187!$acc end kernels
188!
189!
190! Compute the correlation at the first physical level with the following
191! hypothesis du/dz vary in 1/z and w=0 at the ground
192zflx(:,ikb) = - pturb_spp(:,ikb,ncmfs) * mym2d(mxm2d(pk(:,ikb))) * ( &
193 ( dym2d( pum(:,ikb) ) &
194 -mym2d( (pum(:,ikb+1)-pum(:,ikb)) &
195 *(1./mxm2d(pdzz(:,ikb+1))+1./mxm2d(pdzz(:,ikb))))&
196 *0.5*mxm2d(pdzy(:,ikb+1)+pdzy(:,ikb)) &
197 ) / mxm2d(pdyy(:,ikb)) &
198 +( dxm2d( pvm(:,ikb) ) &
199 -mxm2d( (pvm(:,ikb+1)-pvm(:,ikb)) &
200 *(1./mym2d(pdzz(:,ikb+1))+1./mym2d(pdzz(:,ikb))))&
201 *0.5*mym2d(pdzx(:,ikb+1)+pdzx(:,ikb)) &
202 ) / mym2d(pdxx(:,ikb)) )
203!
204! extrapolates this flux under the ground with the surface flux
205!$acc kernels present_cr(ZFLX,ZDIRSINZW)
206!$mnh_expand_array(JIJ=1:IIJT)
207zflx(1:iijt,ikb-1) = &
208 ptau11m(1:iijt) * pcosslope(1:iijt) * psinslope(1:iijt) * pdircoszw(1:iijt)**2 &
209 +ptau12m(1:iijt) * (pcosslope(1:iijt)**2 - psinslope(1:iijt)**2) * &
210 pdircoszw(1:iijt)**2 &
211 -ptau22m(1:iijt) * pcosslope(1:iijt) * psinslope(1:iijt) &
212 +ptau33m(1:iijt) * pcosslope(1:iijt) * psinslope(1:iijt) * zdirsinzw(1:iijt)**2 &
213 -pcdueff(1:iijt) * ( &
214 2. * puslopem(1:iijt) * pcosslope(1:iijt) * psinslope(1:iijt) * &
215 pdircoszw(1:iijt) * zdirsinzw(1:iijt) &
216 +pvslopem(1:iijt) * (pcosslope(1:iijt)**2 - psinslope(1:iijt)**2) * zdirsinzw(1:iijt) &
217 )
218!
219!$mnh_end_expand_array(JIJ=1:IIJT)
220!$acc end kernels
221!
222zflx(:,ikb-1) = 2. * mxm2d( mym2d( zflx(:,ikb-1) ) ) &
223 - zflx(:,ikb)
224!
225! stores <U V>
226IF ( tpfile%LOPENED .AND. turbn%LTURB_FLX ) THEN
227 tzfield = tfieldmetadata( &
228 cmnhname = 'UV_FLX', &
229 cstdname = '', &
230 clongname = 'UV_FLX', &
231 cunits = 'm2 s-2', &
232 cdir = 'XY', &
233 ccomment = 'X_Y_Z_UV_FLX', &
234 ngrid = 5, &
235 ntype = typereal, &
236 ndims = 3, &
237 ltimedep = .true. )
238!$acc update self(ZFLX)
239 CALL io_field_write_phy(d,tpfile,tzfield,zflx)
240END IF
241!
242!
243!
244!computation of the source for rho*V due to this flux
245IF (.NOT. oflat) THEN
246 prus(:,:) = prus(:,:) &
247 - dyf(zflx * mxm(mym(prhodj) * pinv_pdyy) ) &
248 + dzf( myf( mzm(zflx)*mxm(pdzy/mzm(pdyy))) &
249 * mxm(pmzm_prhodj * pinv_pdzz) )
250ELSE
251 prus(:,:) = prus(:,:) - dyf(zflx * mxm(mym(prhodj) * pinv_pdyy) )
252END IF
253!
254!computation of the source for rho*V due to this flux
255IF (.NOT. oflat) THEN
256 prvs(:,:) = prvs(:,:) &
257 - dxf(zflx * mym(mxm(prhodj) * pinv_pdxx) ) &
258 + dzf( mxf( mzm(zflx)*mym(pdzx/mzm(pdxx))) &
259 * mym(pmzm_prhodj * pinv_pdzz) )
260ELSE
261 prvs(:,:) = prvs(:,:) - dxf(zflx * mym(mxm(prhodj) * pinv_pdxx) )
262END IF
263!
264IF (ksplt==1) THEN
265 !
266 !Contribution to the dynamic production of TKE:
267 !
268 IF (.NOT. o2d) THEN
269 zwork(:,:) = - mxf( myf( zflx * &
270 (gy_u_uv_pum + gx_v_uv_pvm) ) )
271 ELSE
272 zwork(:,:) = - mxf( myf( zflx * &
273 (gx_v_uv_pvm) ) )
274 ENDIF
275 !
276 ! evaluate the dynamic production at w(IKB+1) in PDP(IKB)
277 !
278 zwork(:,ikb) = - &
279 mxf2d( myf2d( 0.5 * (zflx(:,ikb+1)+zflx(:,ikb)) ) ) &
280 *(mxf2d( myf2d( &
281 dym2d( 0.5 * (pum(:,ikb+1)+pum(:,ikb)) ) &
282 / mxm2d( 0.5*(pdyy(:,ikb)+pdyy(:,ikb+1)) ) &
283 +dxm2d( 0.5 * (pvm(:,ikb+1)+pvm(:,ikb)) ) &
284 / mym2d( 0.5*(pdxx(:,ikb)+pdxx(:,ikb+1)) ) &
285 ) ) &
286 -mxf2d( (pum(:,ikb+1)-pum(:,ikb)) / &
287 mxm2d(pdzz(:,ikb+1)) * pdzy(:,ikb+1) &
288 ) / myf2d(mxm2d( 0.5*(pdyy(:,ikb)+pdyy(:,ikb+1)) ) )&
289 -myf2d( (pvm(:,ikb+1)-pvm(:,ikb)) / &
290 mym2d(pdzz(:,ikb+1)) * pdzx(:,ikb+1) &
291 ) / mxf2d(mym2d( 0.5*(pdxx(:,ikb)+pdxx(:,ikb+1)) ) )&
292 )
293 !
294 ! dynamic production
295 !$acc kernels present_crm(PDP)
296 !$mnh_expand_array(JIJ=1:IIJT,JK=1:IKT)
297 pdp(1:iijt,1:ikt) = pdp(1:iijt,1:ikt) + zwork(1:iijt,1:ikt)
298 !$mnh_end_expand_array(JIJ=1:IIJT,JK=1:IKT)
299 !$acc end kernels
300 !
301END IF
302!
303! Storage in the LES configuration
304!
305IF (tles%LLES_CALL .AND. ksplt==1) THEN
306 CALL second_mnh(ztime1)
307 CALL les_mean_subgrid_phy(d, tles, mxf(myf(zflx)), tles%X_LES_SUBGRID_UV )
308 CALL les_mean_subgrid_phy(d, tles, mxf(myf(gy_u_uv(oflat,pum,pdyy,pdzz,pdzy)*zflx)), tles%X_LES_RES_ddxa_U_SBG_UaU , .true.)
309 CALL les_mean_subgrid_phy(d, tles, mxf(myf(gx_v_uv(oflat,pvm,pdxx,pdzz,pdzx)*zflx)), tles%X_LES_RES_ddxa_V_SBG_UaV , .true.)
310 CALL second_mnh(ztime2)
311 tles%XTIME_LES = tles%XTIME_LES + ztime2 - ztime1
312END IF
313!
314!
315CONTAINS
316include "shugrad.h"
317END SUBROUTINE turb_hor_uv
318END MODULE mode_turb_hor_uv
integer, parameter typereal
Definition modd_field.F90:9
integer, parameter jpvext
integer, parameter nturb_s
integer, parameter ncmfs
subroutine turb_hor_uv(d, turbn, tles, ksplt, oflat, o2d, tpfile, pk, pinv_pdxx, pinv_pdyy, pinv_pdzz, pmzm_prhodj, pdxx, pdyy, pdzz, pdzx, pdzy, pdircoszw, pcosslope, psinslope, prhodj, pcdueff, ptau11m, ptau12m, ptau22m, ptau33m, pum, pvm, puslopem, pvslopem, pturb_spp, pdp, prus, prvs)
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(pa, 1), size(pa, 2)) gy_u_uv(oflat, pa, pdyy, pdzz, pdzy)
Definition shugrad.h:482
real function, dimension(size(pin, 1), size(pin, 2)) mym(pin)
Definition shugrad.h:111
real function, dimension(size(pin, 1), size(pin, 2)) dxf(pin)
Definition shugrad.h:174
real function, dimension(size(pin, 1), size(pin, 2)) dzf(pin)
Definition shugrad.h:158
real function, dimension(size(pin, 1)) dym2d(pin)
Definition shugrad.h:282
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(pin, 1), size(pin, 2)) mxm(pin)
Definition shugrad.h:49
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)) gx_v_uv(oflat, pa, pdxx, pdzz, pdzx)
Definition shugrad.h:527
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(pin, 1)) mym2d(pin)
Definition shugrad.h:126