FE-Project
Loading...
Searching...
No Matches
mod_atmos_phy_bl.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Atmosphere / Physics / Planetary Boundary Layer
3!!
4!! @par Description
5!! Module for planetary boundary layer (PBL) turbulence parameterization
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
25 use scale_mesh_base, only: meshbase
28
34
35 use scale_meshfield_base, only: &
37 use scale_localmeshfield_base, only: &
39
40 use scale_model_mesh_manager, only: modelmeshbase
43
45
47 use mod_atmos_vars_container, only: &
49
50
51 !-----------------------------------------------------------------------------
52 implicit none
53 private
54 !-----------------------------------------------------------------------------
55 !
56 !++ Public type & procedure
57 !
58
59 !> Derived type to manage a component of planetary boundary layer (PBL) turbulence parameterization in atmospheric model
60 !!
61 type, extends(modelcomponentproc), public :: atmosphybl
62 integer :: bl_typeid !< Type id of PBL turbulence parameterization scheme
63 type(atmosphyblvars) :: vars !< Object to manage variables with PBL turbulence parameterization
64
65 integer :: atm_var_container_typeid !< Type ID of variable container for PBL turbulence parameterization
66
67 real(rp) :: dtsec !< Timestep for PBL turbulence parameterization
68
69 type(lineelement) :: v_elem1d
70 type(atmdynbnd), pointer :: dyn_bnd !< Pointer to object for treating boundary conditions with atmospheric dynamics
71 real(rp) :: c_ip !< Parameter for symmetric interior penalty method in DGM
72 logical :: use_delta_form !< Flag to use delta form in the vertical implicit time integration of PBL scheme
73 contains
74 procedure :: setup => atmosphybl_setup
75 procedure :: calc_tendency => atmosphybl_calc_tendency
76 procedure :: update => atmosphybl_update
77 procedure :: finalize => atmosphybl_finalize
78 procedure, public :: setdynbc => atmosphybl_setdynbc
79 end type atmosphybl
80
81 !-----------------------------------------------------------------------------
82 !++ Public parameters & variables
83 !
84 !-----------------------------------------------------------------------------
85 !
86 !++ Private procedure
87 !
88 !-----------------------------------------------------------------------------
89 !
90 !++ Private parameters & variables
91 !
92
93 integer, parameter :: bl_typeid_mynn_level2 = 1 !< Type ID of MYNN Level 2 PBL scheme
94contains
95
96!> Setup a component of planetary boundary layer (PBL) turbulence parameterization in atmospheric model
97!!
98!! @param model_mesh Object to manage computational mesh of atmospheric model
99!! @param tm_parent_comp Object to mange a temporal scheme in a parent component
100!!
101 subroutine atmosphybl_setup( this, model_mesh, tm_parent_comp )
102 use scale_tracer, only: qa
103 use mod_atmos_mesh, only: atmosmesh
105
109 implicit none
110 class(atmosphybl), 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 PBL turbulence parameterization
115 character(len=H_SHORT) :: time_dt_unit = 'SEC' !< Unit of timestep
116
117 character(len=H_MID) :: bl_type = 'NONE' !< Type of a PBL turbulence parameterization scheme
118 integer :: atm_var_container_typeid
119 real(rp) :: c_ip = 1.0_rp !< Parameter for symmetric interior penalty method in DGM
120 logical :: use_delta_form = .false. !< Flag to use delta form in the vertical implicit time integration of PBL scheme
121
122 namelist /param_atmos_phy_bl/ &
123 time_dt, &
124 time_dt_unit, &
125 bl_type, &
126 atm_var_container_typeid, &
127 c_ip, &
128 use_delta_form
129
130 class(atmosmesh), pointer :: atm_mesh
131 class(meshbase), pointer :: ptr_mesh
132 class(localmesh3d), pointer :: lcmesh3d
133 class(elementbase3d), pointer :: elem3d
134
135 integer :: ierr
136
137 integer :: qs_bl, qe_bl, qa_bl
138 !-----------------------------------------------------
139
140 if (.not. this%IsActivated()) return
141
142 log_newline
143 log_info("ATMOS_PHY_BL_setup",*) 'Setup'
144
145 atm_var_container_typeid = atm_vars_container_primary_id
146
147 !--- read namelist
148 rewind(io_fid_conf)
149 read(io_fid_conf,nml=param_atmos_phy_bl,iostat=ierr)
150 if( ierr < 0 ) then !--- missing
151 log_info("ATMOS_PHY_BL_setup",*) 'Not found namelist. Default used.'
152 elseif( ierr > 0 ) then !--- fatal error
153 log_error("ATMOS_PHY_BL_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_PHY_BL. Check!'
154 call prc_abort
155 endif
156 log_nml(param_atmos_phy_bl)
157
158 this%atm_var_container_typeid = atm_var_container_typeid
159 this%C_IP = c_ip
160 this%use_delta_form = use_delta_form
161
162 !- Get atmospheric mesh --------------------------------------------------
163
164 call model_mesh%GetModelMesh( ptr_mesh )
165 select type(model_mesh)
166 class is (atmosmesh)
167 atm_mesh => model_mesh
168 end select
169
170 !--- Register this component in the time manager
171
172 call tm_parent_comp%Regist_process( 'ATMOS_PHY_BL', time_dt, time_dt_unit, & ! (in)
173 this%tm_process_id ) ! (out)
174
175 this%dtsec = tm_parent_comp%process_list(this%tm_process_id)%dtsec
176
177 !--- Set the type of PBL turbulence parameterization
178
179 select case( bl_type )
180 case( 'MYNN_LEVEL2' )
181 this%BL_TYPEID = bl_typeid_mynn_level2
182 qs_bl = qa
183 qa_bl = 0
184
185 call atm_phy_bl_dgm_mynn_lv2_init( atm_mesh%ptr_mesh )
186 case default
187 log_error("ATMOS_PHY_BL_setup",*) 'Not appropriate PBL turbulence parameterization type. Check!'
188 call prc_abort
189 end select
190
191 qe_bl = qs_bl + qa_bl - 1
192
193 !- Initialize the variables
194 call this%vars%Init( model_mesh, qs_bl, qe_bl, qa_bl )
195
196 !-
197 call this%v_elem1D%Init( atm_mesh%ptr_mesh%refElem3D%PolyOrder_v, .false. )
198
199 return
200 end subroutine atmosphybl_setup
201
202!> Calculate tendencies associated with PBL turbulence parameterization in atmospheric model
203!!
204!!
205!! @param model_mesh Object to manage computational mesh of atmospheric model
206!! @param prgvars_list Object to manage prognostic variables with atmospheric dynamical core
207!! @param trcvars_list Object to manage auxiliary variables
208!! @param forcing_list Object to manage forcing terms
209!! @param is_update Flag to speicfy whether the tendencies are updated in this call
210!!
211!OCL SERIAL
212 subroutine atmosphybl_calc_tendency( &
213 this, model_mesh, prgvars_list, trcvars_list, &
214 auxvars_list, forcing_list, is_update )
215 use scale_tracer, only: &
216 tracer_advc, qa
219 use scale_atm_phy_bl_dgm_common, only: &
221
222 use mod_atmos_vars, only: &
227 use mod_atmos_phy_bl_vars, only: &
229 rhou_tp_id => atmos_phy_bl_rhou_t_id, &
230 rhov_tp_id => atmos_phy_bl_rhov_t_id, &
231 rhot_tp_id => atmos_phy_bl_rhot_t_id, &
232 tke_id => atmos_phy_bl_diag_tke_id, &
233 nu_id => atmos_phy_bl_diag_nu_id, &
235
236 implicit none
237 class(atmosphybl), intent(inout) :: this
238 class(modelmeshbase), intent(in) :: model_mesh
239 class(modelvarmanager), intent(inout) :: prgvars_list
240 class(modelvarmanager), intent(inout) :: trcvars_list
241 class(modelvarmanager), intent(inout) :: auxvars_list
242 class(modelvarmanager), intent(inout) :: forcing_list
243 logical, intent(in) :: is_update
244
245 class(meshbase), pointer :: mesh
246 class(meshbase3d), pointer :: mesh3d
247 class(localmesh3d), pointer :: lcmesh
248
249 integer :: n
250 integer :: ke
251 integer :: iq
252
253 class(localmeshfieldbase), pointer :: ddens, momx, momy, momz, drhot
254 class(localmeshfieldbase), pointer :: dens_hyd, pres_hyd, rtot, cvtot, cptot
255 class(localmeshfieldbase), pointer :: pres, pt
256 type(localmeshfieldbaselist) :: qtrc_list(qa)
257
258 class(localmeshfieldbase), pointer :: dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, rhoh_p
259 type(localmeshfieldbaselist) :: rhoq_tp(qa)
260 class(localmeshfieldbase), pointer :: bl_rhou_t, bl_rhov_t, bl_rhot_t
261 class(localmeshfieldbase), pointer :: bl_rhoq_t
262 type(localmeshfieldbaselist) :: bl_rhoq_t_list(qa)
263
264 type dyn_bndinfo
265 logical, allocatable :: is_bound(:,:)
266 end type
267 type(dyn_bndinfo), allocatable :: bnd_info(:)
268 !------------------------------------------------------------------------
269
270 if (.not. this%IsActivated()) return
271
272 log_progress(*) 'atmosphere / physics / planetary boundary layer'
273
274 call model_mesh%GetModelMesh( mesh )
275 select type(mesh)
276 class is (meshbase3d)
277 mesh3d => mesh
278 end select
279
280 !-
281 if ( is_update ) then
282 call prof_rapstart( 'ATM_BL_tendency', 2)
283
284 allocate( bnd_info(mesh3d%LOCAL_MESH_NUM) )
285
286 do n=1, mesh3d%LOCAL_MESH_NUM
288 mesh, prgvars_list, auxvars_list, &
289 ddens, momx, momy, momz, drhot, &
290 dens_hyd, pres_hyd, rtot, cvtot, cptot, &
291 lcmesh )
292
294 mesh, auxvars_list, &
295 pres, pt )
296
298 mesh, trcvars_list, &
299 1, qtrc_list )
300
302 mesh, this%vars%tends_manager, &
303 bl_rhou_t, bl_rhov_t, bl_rhot_t, bl_rhoq_t_list )
304
305 !-
306 allocate( bnd_info(n)%is_bound(lcmesh%refElem3D%NfpTot,lcmesh%Ne) )
307 call this%dyn_bnd%Inquire_bound_flag( bnd_info(n)%is_bound, & ! (out)
308 n, lcmesh%VMapM, lcmesh%VMapP, lcmesh%VMapB, & ! (in)
309 lcmesh, lcmesh%refElem3D ) ! (in)
310
311 select case( this%BL_TYPEID )
314 this%vars%diagvars(nu_id)%local(n)%val, & ! (out)
315 this%vars%diagvars(kh_id)%local(n)%val, & ! (out)
316 this%vars%diagvars(tke_id)%local(n)%val, & ! (out)
317 ddens%val, momx%val, momy%val, momz%val, drhot%val, & ! (in)
318 dens_hyd%val, pres_hyd%val, rtot%val, pres%val, pt%val, & ! (in)
319 model_mesh%DOptrMat(3), model_mesh%LiftOptrMat, & ! (in)
320 lcmesh, lcmesh%refElem3D, bnd_info(n)%is_bound ) ! (in)
321 end select
322
324 bl_rhou_t%val, bl_rhov_t%val, bl_rhot_t%val, & ! (out)
325 bl_rhoq_t_list, & ! (out)
326 ddens%val, momx%val, momy%val, drhot%val, & ! (in)
327 qtrc_list, & ! (in)
328 pt%val, dens_hyd%val, pres_hyd%val, & ! (in)
329 this%vars%diagvars(nu_id)%local(n)%val, & ! (in)
330 this%vars%diagvars(kh_id)%local(n)%val, & ! (in)
331 model_mesh%element3D_operation, & ! (in)
332 this%C_IP, this%dtsec, & ! (in)
333 lcmesh, lcmesh%refElem3D, this%v_elem1D, & ! (in)
334 bnd_info(n)%is_bound, this%use_delta_form ) ! (in)
335
336 end do
337
338 do n=1, mesh3d%LOCAL_MESH_NUM
339 deallocate( bnd_info(n)%is_bound )
340 end do
341 call prof_rapend( 'ATM_BL_tendency', 2)
342 end if
343
344 call prof_rapstart('ATM_PHY_BL_add_tend', 2)
345 do n=1, mesh%LOCAL_MESH_NUM
347 mesh, forcing_list, &
348 dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, &
349 rhoh_p, rhoq_tp )
350
352 mesh, this%vars%tends_manager, &
353 bl_rhou_t, bl_rhov_t, bl_rhot_t, bl_rhoq_t_list, &
354 lcmesh )
355
356 !$omp parallel private(ke, iq)
357 !$omp do
358 do ke=lcmesh%NeS, lcmesh%NeE
359 momx_tp%val(:,ke) = momx_tp%val(:,ke) + bl_rhou_t%val(:,ke)
360 momy_tp%val(:,ke) = momy_tp%val(:,ke) + bl_rhov_t%val(:,ke)
361 rhot_tp%val(:,ke) = rhot_tp%val(:,ke) + bl_rhot_t%val(:,ke)
362 end do
363 !$omp end do
364 do iq=1, qa
365 if ( .not. tracer_advc(iq) ) cycle
366 !$omp do
367 do ke=lcmesh%NeS, lcmesh%NeE
368 rhoq_tp(iq)%ptr%val(:,ke) = rhoq_tp(iq)%ptr%val(:,ke) &
369 + bl_rhoq_t_list(iq)%ptr%val(:,ke)
370 end do
371 !$omp end do
372 end do
373 !$omp end parallel
374 end do
375 call prof_rapend('ATM_PHY_BL_add_tend', 2)
376
377 return
378 end subroutine atmosphybl_calc_tendency
379
380!> Update variables in a component of PBL turbulence parameterization in atmospheric model
381!!
382!! @param model_mesh Object to manage computational mesh of atmospheric model
383!! @param prgvars_list Object to manage prognostic variables with atmospheric dynamical core
384!! @param trcvars_list Object to manage auxiliary variables
385!! @param forcing_list Object to manage forcing terms
386!! @param is_update Flag to speicfy whether the tendencies are updated in this call
387!!
388!OCL SERIAL
389 subroutine atmosphybl_update( this, model_mesh, &
390 prgvars_list, trcvars_list, &
391 auxvars_list, forcing_list, is_update )
392
393 implicit none
394 class(atmosphybl), intent(inout) :: this
395 class(modelmeshbase), intent(in) :: model_mesh
396 class(modelvarmanager), intent(inout) :: prgvars_list
397 class(modelvarmanager), intent(inout) :: trcvars_list
398 class(modelvarmanager), intent(inout) :: auxvars_list
399 class(modelvarmanager), intent(inout) :: forcing_list
400 logical, intent(in) :: is_update
401 !--------------------------------------------------
402 return
403 end subroutine atmosphybl_update
404
405!> Finalize a component of PBL turbulence parameterization in atmospheric model
406!!
407!OCL SERIAL
408 subroutine atmosphybl_finalize( this )
411 implicit none
412 class(atmosphybl), intent(inout) :: this
413
414 !--------------------------------------------------
415 if (.not. this%IsActivated()) return
416
417 select case ( this%BL_TYPEID )
420 end select
421
422 call this%vars%Final()
423 call this%v_elem1D%Final()
424 return
425 end subroutine atmosphybl_finalize
426
427!> Set boundary conditions to PBL component in atmospheric model
428!!
429!! @param dyn_bnd Object to manage boundary conditions of dynamical core
430!!
431!OCL SERIAL
432 subroutine atmosphybl_setdynbc( this, dyn_bnd )
433 implicit none
434 class(atmosphybl), intent(inout) :: this
435 type(atmdynbnd), intent(in), target :: dyn_bnd
436 !--------------------------------------------------
437
438 this%dyn_bnd => dyn_bnd
439
440 return
441 end subroutine atmosphybl_setdynbc
442!- private ------------------------------------------------
443
444end module mod_atmos_phy_bl
module Atmosphere / Mesh
module Atmosphere / Physics / Planetary Boundary Layer Turbulence
integer, parameter, public atmos_phy_bl_rhot_t_id
integer, parameter, public atmos_phy_bl_rhov_t_id
integer, parameter, public atmos_phy_bl_rhou_t_id
integer, parameter, public atmos_phy_bl_diag_kh_id
subroutine, public atmosphyblvars_getlocalmeshfields_tend(domid, mesh, bl_tends_list, bl_rhou_t, bl_rhov_t, bl_rhot_t, bl_rhoq_t, lcmesh3d)
integer, parameter, public atmos_phy_bl_diag_tke_id
integer, parameter, public atmos_phy_bl_diag_nu_id
module Atmosphere / Physics / Planetary Boundary Layer
integer, parameter bl_typeid_mynn_level2
Type ID of MYNN Level 2 PBL scheme.
module Atmosphere / Variables
subroutine, public atmosvars_getlocalmeshphytends(domid, mesh, phytends_list, dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, rhoh_p, rhoq_tp, lcmesh3d)
integer, parameter, public atm_vars_container_primary_id
subroutine, public atmosvars_getlocalmeshphyauxvars(domid, mesh, phyauxvars_list, pres, pt, lcmesh3d)
subroutine, public atmosvars_getlocalmeshprgvars(domid, mesh, prgvars_list, auxvars_list, ddens, momx, momy, momz, therm, dens_hyd, pres_hyd, rtot, cvtot, cptot, lcmesh3d)
subroutine, public atmosvars_getlocalmeshqtrcvarlist(domid, mesh, trcvars_list, varid_s, var_list, lcmesh3d)
module Atmosphere / Variables
module FElib / Fluid dyn solver / Atmosphere / Boundary
module FElib / Atmosphere / Physics / boundary layer turbulence
subroutine, public atm_phy_bl_dgm_common_calc_tendency(rhou_tp, rhov_tp, drhot_tp, rhoq_tp_list, ddens_, momx_, momy_, drhot_, qtrc_list, pt_, dens_hyd, pres_hyd, nu, kh, element3d_operation, c_ip, dtsec, lmesh, elem, elem1d, is_bound, use_delta_form)
Calculate tendency with PBL turbulence models.
module FElib / Atmosphere / Physics / boundary layer turbulence
subroutine, public atm_phy_bl_dgm_mynn_lv2_init(mesh)
Initialize a module of MYNN Level 2 PBL turbulence parameterization.
subroutine, public atm_phy_bl_dgm_mynn_lv2_cal_vviscdiffcoef(nu, kh, tke, ddens_, momx_, momy_, momz_, drhot_, dens_hyd, pres_hyd, rtot, pres, pt, dz, lift, lmesh, elem, is_bound)
subroutine, public atm_phy_bl_dgm_mynn_lv2_final()
Finalize a module of MYNN Level 2 PBL turbulence parameterization.
module FElib / Element / Base
module FElib / Element / line
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 planetary boundary layer (PBL) turbulence parameterization in a...
Derived type to manage variables with planetary boundary layer (PBL) turbulence parameterization comp...
Derived type to manage a set of variables (prognostic variables, tracer variables,...
A derived type useful for apply boundary conditions.
Derived type representing a 1D reference element.
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 line element.
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 with 3D mesh.
Derived type representing a field (base type)