FE-Project
Loading...
Searching...
No Matches
mod_atmos_phy_tb.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Atmosphere / Physics / sub-grid scale turbulence process
3!!
4!! @par Description
5!! Module for sub-grid scale turbulence process
6!!
7!! @author Yuta Kawai, Team SCALE
8!!
9!<
10!-------------------------------------------------------------------------------
11#include "scaleFElib.h"
13 !-----------------------------------------------------------------------------
14 !
15 !++ used modules
16 !
17 use scale_precision
18 use scale_prc
19 use scale_io
20 use scale_prof
21 use scale_const, only: &
22 undef8 => const_undef8
23 use scale_tracer, only: qa
24
25 use scale_mesh_base, only: meshbase
28
32 use scale_element_base, only: &
34
36 use scale_localmeshfield_base, only: &
38
39 use scale_model_mesh_manager, only: modelmeshbase
42
44
48
52
53 !-----------------------------------------------------------------------------
54 implicit none
55 private
56 !-----------------------------------------------------------------------------
57 !
58 !++ Public type & procedure
59 !
60
61 !> Derived type to manage a component of sub-grid scale turbulent process
62 !!
63 type, extends(modelcomponentproc), public :: atmosphytb
64 integer :: tb_typeid !< Type ID of SGS turbulent scheme
65 type(atmphytbdgmdriver) :: tb_driver !< Object to represent a driver for SGS turbulent schemes
66
67 type(atmosphytbvars) :: vars !< Object to manage variables with SGS turbulent model
68 type(atmdynbnd), pointer :: dyn_bnd !< Pointer to object for treating boundary conditions with atmospheric dynamics
69
70 logical :: gfilter_flag !< Flag to specify whether quasi-global filter is applied for SGS eddy viscosity and diffusivity
71 type(meshfieldfilteroperation3d) :: gfilter_phy_tb !< Quasi-global filter for SGS eddy viscosity and diffusivity
72
73 logical :: modalfilter_flag !< Flag to specify whether modal filter is applied for SGS eddy viscosity and diffusivity
74 type(modalfilter) :: modalfilter_3d !< Modal filter for SGS eddy viscosity and diffusivity
75 contains
76 procedure, public :: setup => atmosphytb_setup
77 procedure, public :: calc_tendency => atmosphytb_calc_tendency
78 procedure, public :: update => atmosphytb_update
79 procedure, public :: finalize => atmosphytb_finalize
80 procedure, public :: setdynbc => atmosphytb_setdynbc
81 end type atmosphytb
82
83 !-----------------------------------------------------------------------------
84 !++ Public parameters & variables
85 !-----------------------------------------------------------------------------
86
87 !-----------------------------------------------------------------------------
88 !
89 !++ Private procedure
90 !
91 !-----------------------------------------------------------------------------
92 !
93 !++ Private parameters & variables
94 !
95 !-----------------------------------------------------------------------------
96
97contains
98!> Setup a component of SGS turbulence process
99!!
100!! @param model_mesh Object to manage computational mesh of atmospheric model
101!! @param tm_parent_comp Object to mange a temporal scheme in a parent component
102!!
103!OCL SERIAL
104 subroutine atmosphytb_setup( this, model_mesh, tm_parent_comp )
105 use mod_atmos_mesh, only: atmosmesh
108
109 implicit none
110 class(atmosphytb), intent(inout) :: this
111 class(modelmeshbase), target, intent(in) :: model_mesh
112 class(time_manager_component), intent(inout) :: tm_parent_comp
113
114 real(DP) :: TIME_DT = undef8 !< Timestep for sub-grid scale turbulent process
115 character(len=H_SHORT) :: TIME_DT_UNIT = 'SEC' !< Unit of timestep
116
117 character(len=H_MID) :: TB_TYPE = 'SMAGORINSKY' !< Type of sub-grid scale turbulent scheme
118
119 character(len=H_SHORT) :: PostGLFilter_Type = 'None'
120 character(len=H_SHORT) :: PostGLFilter_ConvFilterShape = 'GAUSSIAN'
121 integer :: PostGLFilter_Nnodeh1D_reconst = -1
122 real(RP) :: PostGLFilter_GaussinWidthFac = 1.5_rp
123 real(RP) :: PostModalFilter_ALPHA_h = 0.0_rp
124 real(RP) :: PostModalFilter_EtaC_h = 0.0_rp
125 integer :: PostModalFilter_ORDER_h = 16
126 real(RP) :: PostModalFilter_ALPHA_v = 0.0_rp
127 integer :: PostModalFilter_ORDER_v = 16
128
129 namelist /param_atmos_phy_tb/ &
130 time_dt, &
131 time_dt_unit, &
132 tb_type, &
133 postglfilter_type, &
134 postglfilter_nnodeh1d_reconst, &
135 postglfilter_gaussinwidthfac, &
136 postmodalfilter_alpha_h, &
137 postmodalfilter_etac_h, &
138 postmodalfilter_order_h, &
139 postmodalfilter_alpha_v, &
140 postmodalfilter_order_v
141
142
143 class(atmosmesh), pointer :: atm_mesh
144 class(meshbase), pointer :: ptr_mesh
145 real(DP) :: dtsec
146
147 integer :: ierr
148 class(elementbase3d), pointer :: elem3D
149 type(hexahedralelement) :: elem3D_hex
150 !--------------------------------------------------
151
152 if (.not. this%IsActivated()) return
153
154 log_newline
155 log_info("ATMOS_PHY_TB_setup",*) 'Setup'
156
157 !--- read namelist
158 rewind(io_fid_conf)
159 read(io_fid_conf,nml=param_atmos_phy_tb,iostat=ierr)
160 if( ierr < 0 ) then !--- missing
161 log_info("ATMOS_PHY_TB_setup",*) 'Not found namelist. Default used.'
162 elseif( ierr > 0 ) then !--- fatal error
163 log_error("ATMOS_PHY_TB_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_PHY_TB. Check!'
164 call prc_abort
165 endif
166 log_nml(param_atmos_phy_tb)
167
168 !- get mesh --------------------------------------------------
169
170 call model_mesh%GetModelMesh( ptr_mesh )
171 select type(model_mesh)
172 class is (atmosmesh)
173 atm_mesh => model_mesh
174 end select
175
176 !--- Register this component in the time manager
177
178 call tm_parent_comp%Regist_process( 'ATMOS_PHY_TB', time_dt, time_dt_unit, & ! (in)
179 this%tm_process_id ) ! (out)
180
181 dtsec = tm_parent_comp%process_list(this%tm_process_id)%dtsec
182
183 !- initialize the variables
184 call this%vars%Init( model_mesh )
185
186 !- Initialize a module for turbulence model
187 call this%tb_driver%Init( tb_type, dtsec, atm_mesh )
188
189 !--
190 this%dyn_bnd => null()
191
192
193 !--
194 select case( trim(postglfilter_type) )
195 case ('ConvolFilter', 'Reconstruction', 'Reconstruction2')
196 this%gFilter_flag = .true.
197 case ('None', 'ModalFilter')
198 this%gFilter_flag = .false.
199 case default
200 log_info("ATMOS_PHY_TB_setup",*) 'Not appropriate names of PostGLFilter_Type in namelist PARAM_ATMOS_PHY_TB. Check!'
201 call prc_abort
202 end select
203
204 !-
205 if ( this%gFilter_flag ) then
206 if ( postglfilter_nnodeh1d_reconst < 0 ) then
207 elem3d=> atm_mesh%ptr_mesh%lcmesh_list(1)%refElem3D
208 postglfilter_nnodeh1d_reconst = elem3d%Nnode_h1D
209 end if
210 call this%gFilter_phy_tb%Init( postglfilter_type, &
211 postglfilter_convfiltershape, postglfilter_gaussinwidthfac, &
212 postglfilter_nnodeh1d_reconst, &
213 2, 0, 0, atm_mesh%ptr_mesh )
214 end if
215 if ( postmodalfilter_alpha_h > 0.0_rp .or. postmodalfilter_alpha_v > 0.0_rp ) then
216 this%modalFilter_flag = .true.
217 elem3d=> atm_mesh%ptr_mesh%lcmesh_list(1)%refElem3D
218 call elem3d_hex%Init( elem3d%PolyOrder_h, elem3d%PolyOrder_v, .false. )
219 call this%modalfilter_3D%Init( elem3d_hex, postmodalfilter_etac_h, postmodalfilter_alpha_h, postmodalfilter_order_h, 0.0_rp, postmodalfilter_alpha_v, postmodalfilter_order_v )
220 call elem3d_hex%Final()
221 else
222 this%modalFilter_flag = .false.
223 end if
224
225 return
226 end subroutine atmosphytb_setup
227
228!> Calculate tendencies associated with a turbulent model
229!!
230!!
231!! @param model_mesh Object to manage computational mesh of atmospheric model
232!! @param prgvars_list Object to mange prognostic variables with atmospheric dynamical core
233!! @param trcvars_list Object to mange auxiliary variables
234!! @param forcing_list Object to mange forcing terms
235!! @param is_update Flag to specify whether the tendencies are updated in this call
236!!
237!OCL SERIAL
238 subroutine atmosphytb_calc_tendency( &
239 this, model_mesh, prgvars_list, trcvars_list, &
240 auxvars_list, forcing_list, is_update )
241
242 use scale_tracer, only: &
243 tracer_advc
246 use scale_atm_phy_tb_dgm_common, only: &
248
249 use mod_atmos_vars, only: &
250 atmosvars_getlocalmeshprgvars, &
251 atmosvars_getlocalmeshprgvar, &
252 atmosvars_getlocalmeshqtrcvar, &
253 atmosvars_getlocalmeshphyauxvars, &
254 atmosvars_getlocalmeshphytends
255 use mod_atmos_phy_tb_vars, only: &
257
258 implicit none
259
260 class(atmosphytb), intent(inout) :: this
261 class(modelmeshbase), intent(in) :: model_mesh
262 class(modelvarmanager), intent(inout) :: prgvars_list
263 class(modelvarmanager), intent(inout) :: trcvars_list
264 class(modelvarmanager), intent(inout) :: auxvars_list
265 class(modelvarmanager), intent(inout) :: forcing_list
266 logical, intent(in) :: is_update
267
268 class(meshbase), pointer :: mesh
269 class(meshbase3d), pointer :: mesh3D
270 class(localmesh3d), pointer :: lcmesh
271 integer :: n
272 integer :: ke
273 integer :: iq
274
275 class(localmeshfieldbase), pointer :: DENS_tp, MOMX_tp, MOMY_tp, MOMZ_tp, RHOT_tp, RHOH_P
276 type(localmeshfieldbaselist) :: RHOQ_tp(QA)
277 class(localmeshfieldbase), pointer :: tb_MOMX_t, tb_MOMY_t, tb_MOMZ_t, tb_RHOT_t
278 class(localmeshfieldbase), pointer :: tb_RHOQ_t
279 type(localmeshfieldbaselist) :: tb_RHOQ_t_list(QA)
280 !--------------------------------------------------
281
282 if (.not. this%IsActivated()) return
283
284 !LOG_INFO('AtmosDyn_tendency',*)
285
286 log_progress(*) 'atmosphere / physics / turbulence'
287
288 call model_mesh%GetModelMesh( mesh )
289 select type(mesh)
290 class is (meshbase3d)
291 mesh3d => mesh
292 end select
293
294 if (is_update) then
295 call this%tb_driver%Tendency( this%vars%tends_manager, &
296 prgvars_list, trcvars_list, auxvars_list, &
297 this%vars%auxvars_manager, this%vars%diagvars_manager, &
298 this%dyn_bnd, &
299 model_mesh%DOptrMat(1), model_mesh%DOptrMat(2), model_mesh%DOptrMat(3), &
300 model_mesh%SOptrMat(1), model_mesh%SOptrMat(2), model_mesh%SOptrMat(3), &
301 model_mesh%LiftOptrMat, mesh3d, &
302 this%gFilter_flag, this%gFilter_phy_tb, this%vars%diagvars(nu_vid:kh_vid), &
303 this%modalFilter_flag, this%modalfilter_3D )
304 end if
305
306 call prof_rapstart('ATM_PHY_TB_add_tend', 2)
307 do n=1, mesh%LOCAL_MESH_NUM
308 call atmosvars_getlocalmeshphytends( n, &
309 mesh, forcing_list, &
310 dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, &
311 rhoh_p, rhoq_tp )
312
314 mesh, this%vars%tends_manager, &
315 tb_momx_t, tb_momy_t, tb_momz_t, tb_rhot_t, tb_rhoq_t_list, &
316 lcmesh )
317
318 !$omp parallel private(ke, iq)
319 !$omp do
320 do ke=lcmesh%NeS, lcmesh%NeE
321 momx_tp%val(:,ke) = momx_tp%val(:,ke) + tb_momx_t%val(:,ke)
322 momy_tp%val(:,ke) = momy_tp%val(:,ke) + tb_momy_t%val(:,ke)
323 momz_tp%val(:,ke) = momz_tp%val(:,ke) + tb_momz_t%val(:,ke)
324 rhot_tp%val(:,ke) = rhot_tp%val(:,ke) + tb_rhot_t%val(:,ke)
325 end do
326 !$omp end do
327 do iq = 1, qa
328 if ( .not. tracer_advc(iq) ) cycle
329 !$omp do
330 do ke = lcmesh%NeS, lcmesh%NeE
331 rhoq_tp(iq)%ptr%val(:,ke) = rhoq_tp(iq)%ptr%val(:,ke) &
332 + tb_rhoq_t_list(iq)%ptr%val(:,ke)
333 end do
334 !$omp end do
335 end do
336 !$omp end parallel
337 end do
338 call prof_rapend('ATM_PHY_TB_add_tend', 2)
339
340 return
341 end subroutine atmosphytb_calc_tendency
342
343!> Update variables in a turbulent model
344!!
345!! @param model_mesh Object to manage computational mesh of atmospheric model
346!! @param prgvars_list Object to mange prognostic variables with atmospheric dynamical core
347!! @param trcvars_list Object to mange auxiliary variables
348!! @param forcing_list Object to mange forcing terms
349!! @param is_update Flag to speicfy whether the tendencies are updated in this call
350!!
351!OCL SERIAL
352 subroutine atmosphytb_update( this, model_mesh, prgvars_list, trcvars_list, auxvars_list, forcing_list, is_update )
353 implicit none
354
355 class(atmosphytb), intent(inout) :: this
356 class(modelmeshbase), intent(in) :: model_mesh
357 class(modelvarmanager), intent(inout) :: prgvars_list
358 class(modelvarmanager), intent(inout) :: trcvars_list
359 class(modelvarmanager), intent(inout) :: auxvars_list
360 class(modelvarmanager), intent(inout) :: forcing_list
361 logical, intent(in) :: is_update
362 !--------------------------------------------------
363
364 return
365 end subroutine atmosphytb_update
366
367!> Finalize a component of sub-grid scale turbulent process
368!!
369!OCL SERIAL
370 subroutine atmosphytb_finalize( this )
371 implicit none
372 class(atmosphytb), intent(inout) :: this
373
374 !--------------------------------------------------
375 if (.not. this%IsActivated()) return
376
377 call this%tb_driver%Final()
378 call this%vars%Final()
379
380 return
381 end subroutine atmosphytb_finalize
382
383!> Set boundary conditions to a turbulent model
384!!
385!! @param dyn_bnd Object to manage boundary conditions of dynamical core
386!!
387!OCL SERIAL
388 subroutine atmosphytb_setdynbc( this, dyn_bnd )
389 implicit none
390 class(atmosphytb), intent(inout) :: this
391 type(atmdynbnd), intent(in), target :: dyn_bnd
392 !--------------------------------------------------
393
394 this%dyn_bnd => dyn_bnd
395
396 return
397 end subroutine atmosphytb_setdynbc
398
399!- private ------------------------------------------------
400
401end module mod_atmos_phy_tb
module Atmosphere / Mesh
module Atmosphere / Physics / sub-grid scale turbulence
subroutine, public atmosphytbvars_getlocalmeshfields_tend(domid, mesh, tb_tends_list, tb_momx_t, tb_momy_t, tb_momz_t, tb_rhot_t, tb_rhoq_t, lcmesh3d)
module Atmosphere / Physics / sub-grid scale turbulence process
subroutine atmosphytb_setup(this, model_mesh, tm_parent_comp)
Setup a component of SGS turbulence process.
module Atmosphere / Variables
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_diag_kh_id
integer, parameter, public atmos_phy_tb_diag_nu_id
module FElib / Physics turbulence / Atmosphere / driver
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 2D
module FElib / Mesh / Base 3D
module FElib / Mesh / Base
module FElib / Data / base
FElib / model framework / physics process.
FElib / model framework / mesh manager.
FElib / model framework / variable manager.
Module common / time.
Derived type to manage a computational mesh (base class)
Derived type to manage a component of sub-grid scale turbulent process.
Derived type to manage variables with atmospheric SGS turbulent component.
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 representing a field with local mesh (base type)
Derived type to manage a computational mesh (base type for 2D domain)
Derived type to manage a computational mesh (base type for 3D domain)
Base type to manage a computational mesh.
Derived type representing a field (base type)
Derived type to represent filter operation for 3D mesh field.