FE-Project
Loading...
Searching...
No Matches
scale_atm_phy_tb_dgm_driver.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module FElib / Physics turbulence / Atmosphere / driver
3!!
4!! @par Description
5!! Driver module for turbulent model based on DGM
6!!
7!! @author Yuta Kawai, Team SCALE
8!<
9!-------------------------------------------------------------------------------
10#include "scaleFElib.h"
12 !-----------------------------------------------------------------------------
13 !
14 !++ Used modules
15 !
16 use scale_precision
17 use scale_io
18 use scale_prc
19 use scale_tracer, only: qa
20
21 use scale_prof
22 use scale_const, only: &
23 grav => const_grav, &
24 rdry => const_rdry, &
25 cpdry => const_cpdry, &
26 cvdry => const_cvdry, &
27 pres00 => const_pre00
28
29 use scale_sparsemat, only: sparsemat
30
35 use scale_element_base, only: &
38 use scale_meshfield_base, only: &
40
42 use scale_model_var_manager, only: &
43 modelvarmanager, variableinfo
44
46
47 use scale_atm_phy_tb_dgm_dns, only: &
51
52 use scale_atm_phy_tb_dgm_smg, only: &
56
64
66 prgvar_num, &
67 dens_vid => prgvar_ddens_id, therm_vid => prgvar_therm_id,&
68 momx_vid => prgvar_momx_id, momy_vid => prgvar_momy_id, &
69 momz_vid => prgvar_momz_id, &
70 auxvar_num, &
71 preshyd_vid => auxvar_preshydro_id, denshyd_vid => auxvar_denshydro_id, &
72 pres_vid => auxvar_pres_id, pt_vid => auxvar_pt_id, &
73 cptot_vid => auxvar_cptot_id, rtot_vid => auxvar_rtot_id
74
80 tb_momx_t_vid => atmos_phy_tb_momx_t_id,tb_momy_t_vid => atmos_phy_tb_momy_t_id, &
81 tb_momz_t_vid => atmos_phy_tb_momz_t_id, tb_rhot_t_vid => atmos_phy_tb_rhot_t_id, &
90 !-----------------------------------------------------------------------------
91 implicit none
92 private
93 !-----------------------------------------------------------------------------
94 !
95 !++ Public type & procedure
96 !
97 abstract interface
98 subroutine atm_phy_tb_final()
99 implicit none
100 end subroutine atm_phy_tb_final
101 end interface
102
103 abstract interface
104 subroutine atm_phy_tb_cal_grad( &
105 T11, T12, T13, T21, T22, T23, T31, T32, T33, & ! (out)
106 df1, df2, df3, & ! (out)
107 tke, nu, kh, & ! (out)
108 ddens_, momx_, momy_, momz_, drhot_, dens_hyd, pres_hyd, & ! (in)
109 pres, pt, & ! (in)
110 dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, & ! (in)
111 is_bound ) ! (in)
112 import rp
113 import localmesh3d
114 import localmesh2d
115 import elementbase3d
116 import elementbase2d
117 import sparsemat
118 implicit none
119
120 class(LocalMesh3D), intent(in) :: lmesh
121 class(ElementBase3D), intent(in) :: elem
122 class(LocalMesh2D), intent(in) :: lmesh2D
123 class(ElementBase2D), intent(in) :: elem2D
124 real(RP), intent(out) :: T11(elem%Np,lmesh%NeA), T12(elem%Np,lmesh%NeA), T13(elem%Np,lmesh%NeA)
125 real(RP), intent(out) :: T21(elem%Np,lmesh%NeA), T22(elem%Np,lmesh%NeA), T23(elem%Np,lmesh%NeA)
126 real(RP), intent(out) :: T31(elem%Np,lmesh%NeA), T32(elem%Np,lmesh%NeA), T33(elem%Np,lmesh%NeA)
127 real(RP), intent(out) :: DF1(elem%Np,lmesh%NeA)
128 real(RP), intent(out) :: DF2(elem%Np,lmesh%NeA)
129 real(RP), intent(out) :: DF3(elem%Np,lmesh%NeA)
130 real(RP), intent(out) :: TKE(elem%Np,lmesh%NeA)
131 real(RP), intent(out) :: Nu(elem%Np,lmesh%NeA)
132 real(RP), intent(out) :: Kh(elem%Np,lmesh%NeA)
133 real(RP), intent(in) :: DDENS_(elem%Np,lmesh%NeA)
134 real(RP), intent(in) :: MOMX_(elem%Np,lmesh%NeA)
135 real(RP), intent(in) :: MOMY_(elem%Np,lmesh%NeA)
136 real(RP), intent(in) :: MOMZ_(elem%Np,lmesh%NeA)
137 real(RP), intent(in) :: DRHOT_(elem%Np,lmesh%NeA)
138 real(RP), intent(in) :: DENS_hyd(elem%Np,lmesh%NeA)
139 real(RP), intent(in) :: PRES_hyd(elem%Np,lmesh%NeA)
140 real(RP), intent(in) :: PRES(elem%Np,lmesh%NeA)
141 real(RP), intent(in) :: PT(elem%Np,lmesh%NeA)
142 type(SparseMat), intent(in) :: Dx, Dy, Dz
143 type(SparseMat), intent(in) :: Sx, Sy, Sz
144 type(SparseMat), intent(in) :: Lift
145 logical, intent(in) :: is_bound(elem%NfpTot,lmesh%Ne)
146 end subroutine atm_phy_tb_cal_grad
147 end interface
148
149 abstract interface
150 subroutine atm_phy_tb_cal_grad_qtrc( &
151 DFQ1, DFQ2, DFQ3, & ! (out)
152 drdx, drdy, drdz, & ! (inout)
153 kh, qtrc, ddens, dens_hyd, & ! (in)
154 dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, & ! (in)
155 is_bound, cal_grad_dens ) ! (in)
156 import rp
157 import localmesh3d
158 import localmesh2d
159 import elementbase3d
160 import elementbase2d
161 import sparsemat
162 implicit none
163
164 class(LocalMesh3D), intent(in) :: lmesh
165 class(ElementBase3D), intent(in) :: elem
166 class(LocalMesh2D), intent(in) :: lmesh2D
167 class(ElementBase2D), intent(in) :: elem2D
168 real(RP), intent(out) :: DFQ1(elem%Np,lmesh%NeA)
169 real(RP), intent(out) :: DFQ2(elem%Np,lmesh%NeA)
170 real(RP), intent(out) :: DFQ3(elem%Np,lmesh%NeA)
171 real(RP), intent(inout) :: dRdx(elem%Np,lmesh%NeA)
172 real(RP), intent(inout) :: dRdy(elem%Np,lmesh%NeA)
173 real(RP), intent(inout) :: dRdz(elem%Np,lmesh%NeA)
174 real(RP), intent(in) :: Kh(elem%Np,lmesh%NeA)
175 real(RP), intent(in) :: QTRC(elem%Np,lmesh%NeA)
176 real(RP), intent(in) :: DDENS(elem%Np,lmesh%NeA)
177 real(RP), intent(in) :: DENS_hyd(elem%Np,lmesh%NeA)
178 type(SparseMat), intent(in) :: Dx, Dy, Dz
179 type(SparseMat), intent(in) :: Sx, Sy, Sz
180 type(SparseMat), intent(in) :: Lift
181 logical, intent(in) :: is_bound(elem%NfpTot,lmesh%Ne)
182 logical, intent(in) :: cal_grad_dens
183 end subroutine atm_phy_tb_cal_grad_qtrc
184 end interface
185
186 abstract interface
187 subroutine atm_phy_tb_cal_tend( &
188 MOMX_t, MOMY_t, MOMZ_t, RHOT_t, & ! (out)
189 t11, t12, t13, t21, t22, t23, t31, t32, t33, & ! (in)
190 df1, df2, df3, & ! (in)
191 nu, kh, & ! (in)
192 ddens_, momx_, momy_, momz_, drhot_, & ! (in)
193 dens_hyd, pres_hyd, pres_, pt_, & ! (in)
194 dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, & ! (in)
195 is_bound ) ! (in)
196
197 import rp
198 import localmesh3d
199 import localmesh2d
200 import elementbase3d
201 import elementbase2d
202 import sparsemat
203 implicit none
204
205 class(LocalMesh3D), intent(in) :: lmesh
206 class(ElementBase3D), intent(in) :: elem
207 class(LocalMesh2D), intent(in) :: lmesh2D
208 class(ElementBase2D), intent(in) :: elem2D
209 real(RP), intent(out) :: MOMX_t(elem%Np,lmesh%NeA)
210 real(RP), intent(out) :: MOMY_t(elem%Np,lmesh%NeA)
211 real(RP), intent(out) :: MOMZ_t(elem%Np,lmesh%NeA)
212 real(RP), intent(out) :: RHOT_t(elem%Np,lmesh%NeA)
213 real(RP), intent(in) :: T11(elem%Np,lmesh%NeA), T12(elem%Np,lmesh%NeA), T13(elem%Np,lmesh%NeA)
214 real(RP), intent(in) :: T21(elem%Np,lmesh%NeA), T22(elem%Np,lmesh%NeA), T23(elem%Np,lmesh%NeA)
215 real(RP), intent(in) :: T31(elem%Np,lmesh%NeA), T32(elem%Np,lmesh%NeA), T33(elem%Np,lmesh%NeA)
216 real(RP), intent(in) :: DF1(elem%Np,lmesh%NeA)
217 real(RP), intent(in) :: DF2(elem%Np,lmesh%NeA)
218 real(RP), intent(in) :: DF3(elem%Np,lmesh%NeA)
219 real(RP), intent(in) :: Nu (elem%Np,lmesh%NeA) ! Eddy viscosity
220 real(RP), intent(in) :: Kh (elem%Np,lmesh%NeA) ! Eddy diffusivity
221 real(RP), intent(in) :: DDENS_(elem%Np,lmesh%NeA)
222 real(RP), intent(in) :: MOMX_ (elem%Np,lmesh%NeA)
223 real(RP), intent(in) :: MOMY_ (elem%Np,lmesh%NeA)
224 real(RP), intent(in) :: MOMZ_ (elem%Np,lmesh%NeA)
225 real(RP), intent(in) :: DRHOT_(elem%Np,lmesh%NeA)
226 real(RP), intent(in) :: DENS_hyd(elem%Np,lmesh%NeA)
227 real(RP), intent(in) :: PRES_hyd(elem%Np,lmesh%NeA)
228 real(RP), intent(in) :: PRES_(elem%Np,lmesh%NeA)
229 real(RP), intent(in) :: PT_ (elem%Np,lmesh%NeA)
230 type(SparseMat), intent(in) :: Dx, Dy, Dz
231 type(SparseMat), intent(in) :: Sx, Sy, Sz
232 type(SparseMat), intent(in) :: Lift
233 logical, intent(in) :: is_bound(elem%NfpTot,lmesh%Ne)
234
235 end subroutine atm_phy_tb_cal_tend
236 end interface
237
238 abstract interface
239 subroutine atm_phy_tb_cal_tend_qtrc( &
240 RHOQ_t, & ! (out)
241 dfq1, dfq2, dfq3, & ! (in)
242 kh, ddens_,dens_hyd, & ! (in)
243 dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, & ! (in)
244 is_bound ) ! (in)
245
246 import rp
247 import localmesh3d
248 import localmesh2d
249 import elementbase3d
250 import elementbase2d
251 import sparsemat
252 implicit none
253
254 class(LocalMesh3D), intent(in) :: lmesh
255 class(ElementBase3D), intent(in) :: elem
256 class(LocalMesh2D), intent(in) :: lmesh2D
257 class(ElementBase2D), intent(in) :: elem2D
258 real(RP), intent(out) :: RHOQ_t(elem%Np,lmesh%NeA)
259 real(RP), intent(in) :: DFQ1(elem%Np,lmesh%NeA)
260 real(RP), intent(in) :: DFQ2(elem%Np,lmesh%NeA)
261 real(RP), intent(in) :: DFQ3(elem%Np,lmesh%NeA)
262 real(RP), intent(in) :: Kh (elem%Np,lmesh%NeA) ! Eddy diffusivity
263 real(RP), intent(in) :: DDENS_(elem%Np,lmesh%NeA)
264 real(RP), intent(in) :: DENS_hyd(elem%Np,lmesh%NeA)
265 type(SparseMat), intent(in) :: Dx, Dy, Dz
266 type(SparseMat), intent(in) :: Sx, Sy, Sz
267 type(SparseMat), intent(in) :: Lift
268 logical, intent(in) :: is_bound(elem%NfpTot,lmesh%Ne)
269 end subroutine atm_phy_tb_cal_tend_qtrc
270 end interface
271
272 type, public :: atmphytbdgmdriver
273 integer :: tb_typeid !< Index of the turbulent model
274
275 !- Auxiliary variables with tracer
276
277 type(meshfield3d), allocatable :: auxtrcvars(:)
278 type(modelvarmanager) :: auxtrcvars_manager
279 integer :: auxtrcvars_commid
280
281 type(meshfield3d) :: grad_dens(3)
282
283 procedure(atm_phy_tb_cal_grad), pointer, nopass :: tbsolver_cal_grad => null()
284 procedure(atm_phy_tb_cal_grad_qtrc), pointer, nopass :: tbsolver_cal_grad_qtrc => null()
285 procedure(atm_phy_tb_final), pointer, nopass :: tbsolver_final => null()
286 procedure(atm_phy_tb_cal_tend), pointer, nopass :: tbsolver_cal_tend => null()
287 procedure(atm_phy_tb_cal_tend_qtrc), pointer, nopass :: tbsolver_cal_tend_qtrc => null()
288 contains
289 procedure :: init => atmphytbdgmdriver_init
290 procedure :: final => atmphytbdgmdriver_final
291 procedure :: tendency => atmphytbdgmdriver_tendency
292 end type atmphytbdgmdriver
293
294 !-----------------------------------------------------------------------------
295 !
296 !++ Public procedures
297 !
298 !-----------------------------------------------------------------------------
299 !
300 !++ Public parameters & variables
301 !
302
303 !-----------------------------------------------------------------------------
304 !
305 !++ Private procedures & variables
306 !
307 integer, parameter :: tb_typeid_dns = 1
308 integer, parameter :: tb_typeid_smagorinsky = 2
309 integer, parameter :: tb_typeid_smagorinsky_global = 3
310
311 integer, public, parameter :: atmos_phy_tb_auxtrc_dfq3_id = 1
312 integer, public, parameter :: atmos_phy_tb_auxtrc_dfq1_id = 2
313 integer, public, parameter :: atmos_phy_tb_auxtrc_dfq2_id = 3
314 integer, public, parameter :: atmos_phy_tb_auxtrc_scalar_num = 1
315 integer, public, parameter :: atmos_phy_tb_auxtrc_hvec_num = 1
316 integer, public, parameter :: atmos_phy_tb_auxtrc_num = 3
319 variableinfo( atmos_phy_tb_auxtrc_dfq3_id, 'DFQ3', 'Kh * gradient of QTRC (z)', &
320 'm2/s.kg/kg.m-1', 3, 'XYZ', '' ), &
321 variableinfo( atmos_phy_tb_auxtrc_dfq1_id, 'DFQ1', 'Kh * gradient of QTRC (x)', &
322 'm2/s.kg/kg.m-1', 3, 'XYZ', '' ), &
323 variableinfo( atmos_phy_tb_auxtrc_dfq2_id, 'DFQ2', 'Kh * gradient of QTRC (y)', &
324 'm2/s.kg/kg.m-1', 3, 'XYZ', '' ) /
325
326contains
327!OCL SERIAL
328 subroutine atmphytbdgmdriver_init( this, &
329 tb_type_name, dtsec, &
330 model_mesh3D )
332 implicit none
333
334 class(atmphytbdgmdriver), intent(inout) :: this
335 character(len=*), intent(in) :: tb_type_name
336 real(dp), intent(in) :: dtsec
337 class(modelmesh3d), intent(inout), target :: model_mesh3d
338
339 class(meshbase3d), pointer :: mesh3d
340 class(meshcubedspheredom3d), pointer :: gm_mesh3d
341
342 integer :: iv
343 logical :: reg_file_hist
344
345 integer :: idim
346 !-----------------------------------------------------------------------------
347
348 mesh3d => model_mesh3d%ptr_mesh
349
350 !--- Set the type of turbulence scheme
351
352 select case(tb_type_name)
353 case ('DNS')
354 this%TB_TYPEID = tb_typeid_dns
355
356 call atm_phy_tb_dgm_dns_init( mesh3d )
357 this%tbsolver_cal_grad => atm_phy_tb_dgm_dns_cal_grad
358 this%tbsolver_cal_grad_qtrc => atm_phy_tb_dgm_common_cal_grad_qtrc
359 this%tbsolver_cal_tend => atm_phy_tb_dgm_common_cal_tend
360 this%tbsolver_cal_tend_qtrc => atm_phy_tb_dgm_common_cal_tend_qtrc
361 this%tbsolver_final => atm_phy_tb_dgm_dns_final
362 case ('SMAGORINSKY')
363 this%TB_TYPEID = tb_typeid_smagorinsky
364
365 call atm_phy_tb_dgm_smg_init( mesh3d )
366 this%tbsolver_cal_grad => atm_phy_tb_dgm_smg_cal_grad
367 this%tbsolver_cal_grad_qtrc => atm_phy_tb_dgm_common_cal_grad_qtrc
368 this%tbsolver_cal_tend => atm_phy_tb_dgm_common_cal_tend
369 this%tbsolver_cal_tend_qtrc => atm_phy_tb_dgm_common_cal_tend_qtrc
370 this%tbsolver_final => atm_phy_tb_dgm_smg_final
371 case ('SMAGORINSKY_GLOBAL')
372 this%TB_TYPEID = tb_typeid_smagorinsky_global
373
374 select type(mesh3d)
375 class is (meshcubedspheredom3d)
376 gm_mesh3d => mesh3d
377 end select
378 call atm_phy_tb_dgm_globalsmg_init( mesh3d, gm_mesh3d%shallow_approx )
379 this%tbsolver_cal_grad => atm_phy_tb_dgm_globalsmg_cal_grad
380 this%tbsolver_cal_grad_qtrc => atm_phy_tb_dgm_globalsmg_cal_grad_qtrc
381 this%tbsolver_cal_tend => atm_phy_tb_dgm_globalsmg_cal_tend
382 this%tbsolver_cal_tend_qtrc => atm_phy_tb_dgm_globalsmg_cal_tend_qtrc
383 this%tbsolver_final => atm_phy_tb_dgm_globalsmg_final
384 case default
385 log_error("AtmPhyTbDGMDriver_Init",*) 'Invalid TB_TYPE in namelist PARAM_ATMOS_TB. Check!'
386 call prc_abort
387 end select
388
389 !- Initialize variables
390
391 !-
392 if ( qa > 0 ) then
393 call this%auxtrcvars_manager%Init()
394 allocate( this%auxtrcvars(atmos_phy_tb_auxtrc_num) )
395
396 reg_file_hist = .true.
397 do iv = 1, atmos_phy_tb_auxtrc_num
398 call this%auxtrcvars_manager%Regist( &
399 atmos_phy_tb_auxtrc_vinfo(iv), mesh3d, & ! (in)
400 this%auxtrcvars(iv), & ! (inout)
401 reg_file_hist, fill_zero=.true. ) ! (in)
402 end do
403
404 !- Setup communication
405
406 call model_mesh3d%Create_communicator( &
408 this%auxtrcvars_manager, & ! (inout)
409 this%auxtrcvars(:), & ! (in)
410 this%auxtrcvars_commid ) ! (out)
411
412 do idim=1, 3
413 call this%GRAD_DENS(idim)%Init( "Grad_DENS", "kg/m4", mesh3d )
414 end do
415 end if
416
417 return
418 end subroutine atmphytbdgmdriver_init
419
420!OCL SERIAL
421 subroutine atmphytbdgmdriver_tendency( this, &
422 TB_TENDS, PROG_VARS, TRC_VARS, AUX_VARS, &
423 AUX_TB_VARS, DIAG_TB_VARS, &
424 boundary_cond, &
425 Dx, Dy, Dz, Sx, Sy, Sz, Lift, mesh3D, &
426 gfilter_flag, gfilter, diag_nu_kh, &
427 modal_filter_flag, modal_filter )
428
429 use scale_tracer, only: &
430 qa, tracer_advc, tracer_name
431
433
437 implicit none
438
439 class(atmphytbdgmdriver), intent(inout) :: this
440 class(meshbase3d), intent(in), target :: mesh3d
441 class(modelvarmanager), intent(inout) :: tb_tends
442 class(modelvarmanager), intent(inout) :: prog_vars
443 class(modelvarmanager), intent(inout) :: trc_vars
444 class(modelvarmanager), intent(inout) :: aux_vars
445 class(modelvarmanager), intent(inout) :: aux_tb_vars
446 class(modelvarmanager), intent(inout) :: diag_tb_vars
447 type(atmdynbnd), intent(in) :: boundary_cond
448 type(sparsemat), intent(in) :: dx, dy, dz
449 type(sparsemat), intent(in) :: sx, sy, sz
450 type(sparsemat), intent(in) :: lift
451 logical, intent(in) :: gfilter_flag
452 class(meshfieldfilteroperation3d), intent(inout) :: gfilter
453 type(meshfield3d), intent(inout) :: diag_nu_kh(2)
454 logical, intent(in) :: modal_filter_flag
455 type(modalfilter), intent(in) :: modal_filter
456
457 class(localmesh3d), pointer :: lcmesh3d
458 integer :: n
459 integer :: ke
460
461 class(meshfield3d), pointer :: ddens, momx, momy, momz, therm
462 class(meshfield3d), pointer :: pres_hyd, dens_hyd, pres, pt, rtot, cptot
463 class(meshfield3d), pointer :: t11, t12, t13, t21, t22, t23, t31, t32, t33
464 class(meshfield3d), pointer :: df1, df2, df3
465 class(meshfield3d), pointer :: dfq1, dfq2, dfq3
466 class(meshfield3d), pointer :: nu, kh, tke
467 class(meshfield3d), pointer :: tb_momx_t, tb_momy_t, tb_momz_t, tb_rhot_t
468 class(meshfield3d), pointer :: qtrc
469 class(meshfield3d), pointer :: tb_rhoq_t
470
471 type dyn_bndinfo
472 logical, allocatable :: is_bound(:,:)
473 end type
474 type(dyn_bndinfo), allocatable :: bnd_info(:)
475
476 integer :: iq
477 logical :: cal_grad_flag
478 !-----------------------------------------------------------------------------
479
480 !-
481 call prof_rapstart( 'ATM_TB_tendency_pre', 2)
482 call prog_vars%Get3D(dens_vid , ddens)
483 call prog_vars%Get3D(therm_vid, therm)
484 call prog_vars%Get3D(momz_vid , momz )
485 call prog_vars%Get3D(momx_vid , momx )
486 call prog_vars%Get3D(momy_vid , momy )
487
488 call aux_vars%Get3D( preshyd_vid, pres_hyd )
489 call aux_vars%Get3D( denshyd_vid, dens_hyd )
490 call aux_vars%Get3D( pres_vid, pres )
491 call aux_vars%Get3D( pt_vid, pt )
492 call aux_vars%Get3D( rtot_vid, rtot )
493 call aux_vars%Get3D( cptot_vid, cptot )
494
495 call aux_tb_vars%Get3D( t11_vid, t11 )
496 call aux_tb_vars%Get3D( t12_vid, t12 )
497 call aux_tb_vars%Get3D( t13_vid, t13 )
498 call aux_tb_vars%Get3D( t21_vid, t21 )
499 call aux_tb_vars%Get3D( t22_vid, t22 )
500 call aux_tb_vars%Get3D( t23_vid, t23 )
501 call aux_tb_vars%Get3D( t31_vid, t31 )
502 call aux_tb_vars%Get3D( t32_vid, t32 )
503 call aux_tb_vars%Get3D( t33_vid, t33 )
504 call aux_tb_vars%Get3D( df1_vid, df1 )
505 call aux_tb_vars%Get3D( df2_vid, df2 )
506 call aux_tb_vars%Get3D( df3_vid, df3 )
507
508 call diag_tb_vars%Get3D( tke_vid, tke )
509 call diag_tb_vars%Get3D( nu_vid, nu )
510 call diag_tb_vars%Get3D( kh_vid, kh )
511
512 call tb_tends%Get3D( tb_momx_t_vid, tb_momx_t )
513 call tb_tends%Get3D( tb_momy_t_vid, tb_momy_t )
514 call tb_tends%Get3D( tb_momz_t_vid, tb_momz_t )
515 call tb_tends%Get3D( tb_rhot_t_vid, tb_rhot_t )
516
517 if ( qa > 0 ) then
518 call this%auxtrcvars_manager%Get3D( atmos_phy_tb_auxtrc_dfq1_id, dfq1 )
519 call this%auxtrcvars_manager%Get3D( atmos_phy_tb_auxtrc_dfq2_id, dfq2 )
520 call this%auxtrcvars_manager%Get3D( atmos_phy_tb_auxtrc_dfq3_id, dfq3 )
521 end if
522
523 allocate( bnd_info(mesh3d%LOCAL_MESH_NUM) )
524 call prof_rapend( 'ATM_TB_tendency_pre', 2)
525
526 do n=1, mesh3d%LOCAL_MESH_NUM
527 lcmesh3d => mesh3d%lcmesh_list(n)
528
529 !- Apply boundary conditions
530 call prof_rapstart('ATM_PHY_TB_bnd', 2)
531 allocate( bnd_info(n)%is_bound(lcmesh3d%refElem3D%NfpTot,lcmesh3d%Ne) )
532 call boundary_cond%Inquire_bound_flag( bnd_info(n)%is_bound, & ! (out)
533 n, lcmesh3d%VMapM, lcmesh3d%VMapP, lcmesh3d%VMapB, & ! (in)
534 lcmesh3d, lcmesh3d%refElem3D ) ! (in)
535
536 call boundary_cond%ApplyBC_Grad_TBVARS_lc( n, &
537 ddens%local(n)%val, momx%local(n)%val, momy%local(n)%val, momz%local(n)%val, pt%local(n)%val, pres%local(n)%val, & ! (inout)
538 dens_hyd%local(n)%val, pres_hyd%local(n)%val, rtot%local(n)%val, cptot%local(n)%val, & ! (in)
539 lcmesh3d%Gsqrt(:,:), lcmesh3d%GsqrtH(:,:), lcmesh3d%GIJ(:,:,1,1), lcmesh3d%GIJ(:,:,1,2), lcmesh3d%GIJ(:,:,2,2), & ! (in)
540 lcmesh3d%GI3(:,:,1), lcmesh3d%GI3(:,:,2), & ! (in)
541 lcmesh3d%normal_fn(:,:,1), lcmesh3d%normal_fn(:,:,2), lcmesh3d%normal_fn(:,:,3), & ! (in)
542 lcmesh3d%vmapM, lcmesh3d%vmapP, lcmesh3d%vmapB, & ! (in)
543 lcmesh3d, lcmesh3d%refElem3D, lcmesh3d%lcmesh2D, lcmesh3d%lcmesh2D%refElem2D ) ! (in)
544 call prof_rapend('ATM_PHY_TB_bnd', 2)
545
546 call prof_rapstart('ATM_PHY_TB_cal_grad', 2)
547 call this%tbsolver_cal_grad( &
548 t11%local(n)%val, t12%local(n)%val, t13%local(n)%val, & ! (out)
549 t21%local(n)%val, t22%local(n)%val, t23%local(n)%val, & ! (out)
550 t31%local(n)%val, t32%local(n)%val, t33%local(n)%val, & ! (out)
551 df1%local(n)%val, df2%local(n)%val, df3%local(n)%val, & ! (out)
552 tke%local(n)%val, nu%local(n)%val, kh%local(n)%val, & ! (out)
553 ddens%local(n)%val, momx%local(n)%val, momy%local(n)%val, momz%local(n)%val, therm%local(n)%val, & ! (in)
554 dens_hyd%local(n)%val, pres_hyd%local(n)%val, pres%local(n)%val, pt%local(n)%val, & ! (in)
555 dx, dy, dz, sx, sy, sz, lift, lcmesh3d, lcmesh3d%refElem3D, lcmesh3d%lcmesh2D, lcmesh3d%lcmesh2D%refElem2D, & ! (in)
556 bnd_info(n)%is_bound ) ! (in)
557 call prof_rapend('ATM_PHY_TB_cal_grad', 2)
558 end do
559
560 !* Exchange halo data
561 call prof_rapstart('ATM_PHY_TB_exchange_prgv', 2)
562 call aux_tb_vars%MeshFieldComm_Exchange()
563 call prof_rapend('ATM_PHY_TB_exchange_prgv', 2)
564
565 if ( gfilter_flag ) then
566 call prof_rapstart('ATM_PHY_TB_filter_NU_KH', 2)
567 call gfilter%Apply( diag_nu_kh, mesh3d )
568 call prof_rapend('ATM_PHY_TB_filter_NU_KH', 2)
569 end if
570 if ( modal_filter_flag ) then
571 call prof_rapstart('ATM_PHY_TB_filter_NU_KH', 2)
572 do n=1, mesh3d%LOCAL_MESH_NUM
573 lcmesh3d => mesh3d%lcmesh_list(n)
574 !$omp parallel do
575 do ke=lcmesh3d%NeS, lcmesh3d%NeE
576 nu%local(n)%val(:,ke) = matmul( modal_filter%FilterMat, nu%local(n)%val(:,ke) )
577 kh%local(n)%val(:,ke) = matmul( modal_filter%FilterMat, kh%local(n)%val(:,ke) )
578 end do
579 end do
580 call prof_rapend('ATM_PHY_TB_filter_NU_KH', 2)
581 end if
582
583 do n=1, mesh3d%LOCAL_MESH_NUM
584 lcmesh3d => mesh3d%lcmesh_list(n)
585
586 !- Apply boundary conditions for stress tensor
587 call prof_rapstart('ATM_PHY_TB_bnd', 2)
588 call boundary_cond%ApplyBC_Grad_TBStress_lc( n, &
589 t11%local(n)%val, t12%local(n)%val, t13%local(n)%val, & ! (inout)
590 t21%local(n)%val, t22%local(n)%val, t23%local(n)%val, & ! (inout)
591 t31%local(n)%val, t32%local(n)%val, t33%local(n)%val, & ! (inout)
592 df1%local(n)%val, df2%local(n)%val, df3%local(n)%val, & ! (inout)
593 lcmesh3d%Gsqrt(:,:), lcmesh3d%GsqrtH(:,:), lcmesh3d%GIJ(:,:,1,1), lcmesh3d%GIJ(:,:,1,2), lcmesh3d%GIJ(:,:,2,2), & ! (in)
594 lcmesh3d%GI3(:,:,1), lcmesh3d%GI3(:,:,2), & ! (in)
595 lcmesh3d%normal_fn(:,:,1), lcmesh3d%normal_fn(:,:,2), lcmesh3d%normal_fn(:,:,3), & ! (in)
596 lcmesh3d%vmapM, lcmesh3d%vmapP, lcmesh3d%vmapB, & ! (in)
597 lcmesh3d, lcmesh3d%refElem3D, lcmesh3d%lcmesh2D, lcmesh3d%lcmesh2D%refElem2D ) ! (in)
598 call prof_rapend('ATM_PHY_TB_bnd', 2)
599
600 call prof_rapstart('ATM_PHY_TB_cal_tend', 2)
601 call this%tbsolver_cal_tend( &
602 tb_momx_t%local(n)%val, tb_momy_t%local(n)%val, tb_momz_t%local(n)%val, tb_rhot_t%local(n)%val, & ! (out)
603 t11%local(n)%val, t12%local(n)%val, t13%local(n)%val, & ! (in)
604 t21%local(n)%val, t22%local(n)%val, t23%local(n)%val, & ! (in)
605 t31%local(n)%val, t32%local(n)%val, t33%local(n)%val, & ! (in)
606 df1%local(n)%val, df2%local(n)%val, df3%local(n)%val, nu%local(n)%val, kh%local(n)%val, & ! (in)
607 ddens%local(n)%val, momx%local(n)%val, momy%local(n)%val, momz%local(n)%val, therm%local(n)%val, & ! (in)
608 dens_hyd%local(n)%val, pres_hyd%local(n)%val, pres%local(n)%val, pt%local(n)%val, & ! (in)
609 dx, dy, dz, sx, sy, sz, lift, lcmesh3d, lcmesh3d%refElem3D, lcmesh3d%lcmesh2D, lcmesh3d%lcmesh2D%refElem2D, & ! (in)
610 bnd_info(n)%is_bound ) ! (in)
611 call prof_rapend('ATM_PHY_TB_cal_tend', 2)
612 end do
613
614 cal_grad_flag = .true.
615 do iq = 1, qa
616 if ( .not. tracer_advc(iq) ) cycle
617
618 call trc_vars%Get3D( iq, qtrc )
619 call tb_tends%Get3D( atmos_phy_tb_tends_num1 + iq, tb_rhoq_t )
620
621 do n=1, mesh3d%LOCAL_MESH_NUM
622 lcmesh3d => mesh3d%lcmesh_list(n)
623
624 call prof_rapstart('ATM_PHY_TB_cal_grad_qtrc', 2)
625 call this%tbsolver_cal_grad_qtrc( &
626 dfq1%local(n)%val, dfq2%local(n)%val, dfq3%local(n)%val, & ! (out)
627 this%GRAD_DENS(1)%local(n)%val, this%GRAD_DENS(2)%local(n)%val, & ! (inout)
628 this%GRAD_DENS(3)%local(n)%val, & ! (inout)
629 kh%local(n)%val, qtrc%local(n)%val, ddens%local(n)%val, dens_hyd%local(n)%val, & ! (in)
630 dx, dy, dz, sx, sy, sz, lift, lcmesh3d, lcmesh3d%refElem3D, & ! (in)
631 lcmesh3d%lcmesh2D, lcmesh3d%lcmesh2D%refElem2D, & ! (in)
632 bnd_info(n)%is_bound, cal_grad_flag ) ! (in)
633 call prof_rapend('ATM_PHY_TB_cal_grad_qtrc', 2)
634 end do
635 cal_grad_flag = .false.
636
637 call this%auxtrcvars_manager%MeshFieldComm_Exchange()
638
639 do n=1, mesh3d%LOCAL_MESH_NUM
640 lcmesh3d => mesh3d%lcmesh_list(n)
641
642 call prof_rapstart('ATM_PHY_TB_cal_tend_qtrc', 2)
643 call this%tbsolver_cal_tend_qtrc( tb_rhoq_t%local(n)%val, & ! (out)
644 dfq1%local(n)%val, dfq2%local(n)%val, dfq3%local(n)%val, & ! (out)
645 kh%local(n)%val, ddens%local(n)%val, dens_hyd%local(n)%val, & ! (in)
646 dx, dy, dz, sx, sy, sz, lift, lcmesh3d, lcmesh3d%refElem3D, & ! (in)
647 lcmesh3d%lcmesh2D, lcmesh3d%lcmesh2D%refElem2D, & ! (in)
648 bnd_info(n)%is_bound ) ! (in)
649 call prof_rapend('ATM_PHY_TB_cal_tend_qtrc', 2)
650 end do
651 end do
652
653 do n = 1, mesh3d%LOCAL_MESH_NUM
654 deallocate( bnd_info(n)%is_bound )
655 end do
656
657 return
658 end subroutine atmphytbdgmdriver_tendency
659
660!OCL SERIAL
661 subroutine atmphytbdgmdriver_final( this )
662 implicit none
663
664 class(atmphytbdgmdriver), intent(inout) :: this
665
666 integer :: idim
667 !-----------------------------------------------------------------------------
668
669 call this%tbsolver_final()
670
671 if ( qa > 0 ) then
672 do idim=1, 3
673 call this%GRAD_DENS(idim)%Final()
674 end do
675
676 call this%auxtrcvars_manager%Final()
677 end if
678
679 return
680 end subroutine atmphytbdgmdriver_final
681
module FElib / Fluid dyn solver / Atmosphere / Boundary
module FElib / Fluid dyn solver / Atmosphere / Nonhydrostatic model / Common
module FElib / Fluid dyn solver / Atmosphere / Physics turbulence / Common
integer, parameter, public atmos_phy_tb_aux_t21_id
integer, parameter, public atmos_phy_tb_aux_diffflx3_id
subroutine, public atm_phy_tb_dgm_common_cal_tend(momx_t, momy_t, momz_t, rhot_t, t11, t12, t13, t21, t22, t23, t31, t32, t33, df1, df2, df3, nu, kh, ddens_, momx_, momy_, momz_, drhot_, dens_hyd, pres_hyd, pres_, pt_, dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, is_bound)
Calculate tendecies with turbulent model.
integer, parameter, public atmos_phy_tb_aux_t33_id
integer, parameter, public atmos_phy_tb_tends_num1
integer, parameter, public atmos_phy_tb_diag_kh_id
integer, parameter, public atmos_phy_tb_momy_t_id
subroutine, public atm_phy_tb_dgm_common_cal_grad_qtrc(dfq1, dfq2, dfq3, drdx, drdy, drdz, kh, qtrc, ddens, dens_hyd, dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, is_bound, cal_grad_dens)
Calculate parameterized diffusive mass flux of tracer with turbulent model.
integer, parameter, public atmos_phy_tb_aux_t12_id
subroutine, public atm_phy_tb_dgm_common_cal_tend_qtrc(rhoq_t, dfq1, dfq2, dfq3, kh, ddens_, dens_hyd, dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, is_bound)
Calculate tendecies of tracer density with turbulent model.
integer, parameter, public atmos_phy_tb_diag_nu_id
integer, parameter, public atmos_phy_tb_aux_num
integer, parameter, public atmos_phy_tb_momz_t_id
integer, parameter, public atmos_phy_tb_aux_t23_id
integer, parameter, public atmos_phy_tb_diag_tke_id
integer, parameter, public atmos_phy_tb_aux_t31_id
integer, parameter, public atmos_phy_tb_aux_t11_id
integer, parameter, public atmos_phy_tb_aux_t22_id
integer, parameter, public atmos_phy_tb_aux_t13_id
integer, parameter, public atmos_phy_tb_rhot_t_id
integer, parameter, public atmos_phy_tb_momx_t_id
integer, parameter, public atmos_phy_tb_aux_t32_id
integer, parameter, public atmos_phy_tb_aux_diffflx1_id
integer, parameter, public atmos_phy_tb_aux_diffflx2_id
module FElib / Atmosphere / Physics turbulence
subroutine, public atm_phy_tb_dgm_dns_init(mesh)
subroutine, public atm_phy_tb_dgm_dns_cal_grad(t11, t12, t13, t21, t22, t23, t31, t32, t33, df1, df2, df3, tke, nu, kh, ddens_, momx_, momy_, momz_, drhot_, dens_hyd, pres_hyd, pres, pt, dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, is_bound)
Calculate parameterized stress tensor and eddy heat flux with turbulent model.
subroutine, public atm_phy_tb_dgm_dns_final()
module FElib / Physics turbulence / Atmosphere / driver
type(variableinfo), dimension(atmos_phy_tb_auxtrc_num), public atmos_phy_tb_auxtrc_vinfo
integer, parameter, public atmos_phy_tb_auxtrc_dfq2_id
integer, parameter, public atmos_phy_tb_auxtrc_dfq1_id
integer, parameter, public atmos_phy_tb_auxtrc_hvec_num
integer, parameter, public atmos_phy_tb_auxtrc_num
integer, parameter, public atmos_phy_tb_auxtrc_scalar_num
integer, parameter, public atmos_phy_tb_auxtrc_dfq3_id
module FElib / Atmosphere / Physics turbulence
subroutine, public atm_phy_tb_dgm_globalsmg_cal_tend(momx_t, momy_t, momz_t, rhot_t, t11, t12, t13, t21, t22, t23, t31, t32, t33, df1, df2, df3, nu, kh, ddens_, momx_, momy_, momz_, drhot_, dens_hyd, pres_hyd, pres_, pt_, dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, is_bound)
Calculate tendecies with turbulent model.
subroutine, public atm_phy_tb_dgm_globalsmg_cal_tend_qtrc(rhoq_t, dfq1, dfq2, dfq3, kh, ddens_, dens_hyd, dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, is_bound)
Calculate tendecies of tracer density with turbulent model.
subroutine, public atm_phy_tb_dgm_globalsmg_cal_grad(t11, t12, t13, t21, t22, t23, t31, t32, t33, df1, df2, df3, tke, nu, kh, ddens_, momx_, momy_, momz_, drhot_, dens_hyd, pres_hyd, pres, pt, dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, is_bound)
Calculate parameterized stress tensor and eddy heat flux with turbulent model.
subroutine, public atm_phy_tb_dgm_globalsmg_cal_grad_qtrc(dfq1, dfq2, dfq3, drdx, drdy, drdz, kh, qtrc, ddens, dens_hyd, dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, is_bound, cal_grad_dens)
Calculate parameterized diffusive mass flux of tracer with turbulent model.
subroutine, public atm_phy_tb_dgm_globalsmg_init(mesh, shallow_atm_approx)
module FElib / Atmosphere / Physics turbulence
subroutine, public atm_phy_tb_dgm_smg_cal_grad(t11, t12, t13, t21, t22, t23, t31, t32, t33, df1, df2, df3, tke, nu, kh, ddens_, momx_, momy_, momz_, drhot_, dens_hyd, pres_hyd, pres, pt, dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d, is_bound)
Calculate parameterized stress tensor and eddy heat flux with turbulent model.
subroutine, public atm_phy_tb_dgm_smg_final()
subroutine, public atm_phy_tb_dgm_smg_init(mesh)
module FElib / Element / Base
module FElib / Element / hexahedron
module FElib / Element/ ModalFilter
module FElib / Mesh / Local 2D
module FElib / Mesh / Local 3D
module FElib / Mesh / Local, Base
module FElib / Mesh / Base 3D
module FElib / Mesh / Cubed-sphere 3D domain
module FElib / Data / base
FElib / model framework / mesh manager.
FElib / model framework / variable manager.
Module common / sparsemat.
A derived type useful for apply boundary conditions.
Derived type representing a 2D reference element.
Derived type representing a 3D reference element.
Derived type representing an arbitrary finite element.
Derived type representing a hexahedral element.
Derived type representing a modal filter.
Derived type representing a local mesh for 2D domain.
Derived type to manage a local 3D computational domain.
Derived type to manage a local computational domain (base type)
Derived type to manage a computational mesh (base type for 3D domain)
Derived type to manage a cubed-sphere 3D computational domain.
Derived type representing a field with 2D mesh.
Derived type representing a field with 3D mesh.
Derived type representing a field (base type)
Derived type to represent filter operation for 3D mesh field.
Derived type to manage a sparse matrix.