FE-Project
Loading...
Searching...
No Matches
mod_atmos_phy_bl_vars.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Atmosphere / Physics / Planetary Boundary Layer Turbulence
3!!
4!! @par Description
5!! Container for variables with planetary boundary layer (PBL) turbulence parameterization in atmospheric model
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_io
19 use scale_prc
20 use scale_tracer, only: qa
21
23 use scale_mesh_base, only: meshbase
25 use scale_mesh_base3d, only: &
26 meshbase3d, &
27 dimtype_xyz => meshbase3d_dimtypeid_xyz
30 use scale_localmeshfield_base, only: &
32 use scale_meshfield_base, only: &
34
37
39
40 use scale_model_var_manager, only: &
41 modelvarmanager, variableinfo
42 use scale_model_mesh_manager, only: modelmeshbase
43
44 use mod_atmos_mesh, only: atmosmesh
45
46 !-----------------------------------------------------------------------------
47 implicit none
48 private
49
50 !-----------------------------------------------------------------------------
51 !
52 !++ Public type & procedures
53 !
54
55 !> Derived type to manage variables with planetary boundary layer (PBL) turbulence parameterization component in atmospheric model
56 type, public :: atmosphyblvars
57 type(meshfield3d), allocatable :: tends(:) !< Array of tendency variables
58 type(modelvarmanager) :: tends_manager !< Object to manage tendencies
59
60 type(meshfield3d), allocatable :: diagvars(:)
61 type(modelvarmanager) :: diagvars_manager
62
63 integer :: qs !< Start index of tracer variables with PBL turbulence parameterization
64 integer :: qe !< End index of tracer variables with PBL turbulence parameterization
65 integer :: qa !< Number of tracer variables with PBL turbulence parameterization
66
67 integer :: tends_num_tot !< Number of tendency variables with PBL turbulence parameterization
68 contains
69 procedure :: init => atmosphyblvars_init
70 procedure :: final => atmosphyblvars_final
71 procedure :: setup => atmosphyblvars_setup
72 procedure :: history => atmosphyblvars_history
73 end type atmosphyblvars
74
76
77 !-----------------------------------------------------------------------------
78 !
79 !++ Public variables
80 !
81 integer, public, parameter :: atmos_phy_bl_rhou_t_id = 1
82 integer, public, parameter :: atmos_phy_bl_rhov_t_id = 2
83 integer, public, parameter :: atmos_phy_bl_rhot_t_id = 3
84 integer, public, parameter :: atmos_phy_bl_tends_num1 = 3
85
86 type(variableinfo), public :: atmos_phy_bl_tend_vinfo(atmos_phy_bl_tends_num1)
88 variableinfo( atmos_phy_bl_rhou_t_id, 'BL_RHOU_t', 'tendency of x-momentum in BL process', &
89 'kg/m2/s2', 3, 'XYZ', '' ), &
90 variableinfo( atmos_phy_bl_rhov_t_id, 'BL_RHOV_t', 'tendency of y-momentum in BL process', &
91 'kg/m2/s2', 3, 'XYZ', '' ), &
92 variableinfo( atmos_phy_bl_rhot_t_id, 'BL_RHOT_t', 'tendency of rho*PT in BL process', &
93 'kg/m3.K/s', 3, 'XYZ', '' ) /
94
95 integer, public, parameter :: atmos_phy_bl_diag_tke_id = 1
96 integer, public, parameter :: atmos_phy_bl_diag_nu_id = 2
97 integer, public, parameter :: atmos_phy_bl_diag_kh_id = 3
98 integer, public, parameter :: atmos_phy_bl_diag_num = 3
99
100 type(variableinfo) :: atmos_phy_bl_diag_vinfo(atmos_phy_bl_diag_num)
101 DATA atmos_phy_bl_diag_vinfo / &
102 variableinfo( atmos_phy_bl_diag_tke_id, 'TKE', 'SGS turbulence kinetic energy', &
103 'm2/s2', 3, 'XYZ', '' ), &
104 variableinfo( atmos_phy_bl_diag_nu_id, 'NU', 'eddy viscosity', &
105 'm2/s', 3, 'XYZ', '' ), &
106 variableinfo( atmos_phy_bl_diag_kh_id, 'KH', 'eddy diffusion', &
107 'm2/s', 3, 'XYZ', '' ) /
108
109 !-----------------------------------------------------------------------------
110 !
111 !++ Private procedures
112 !
113contains
114 !> Setup an object to manage variables with a planetary boundary layer (PBL) turbulence parameterization component
115!OCL SERIAL
116 subroutine atmosphyblvars_init( this, model_mesh, &
117 QS_BL, QE_BL, QA_BL )
118 implicit none
119 class(atmosphyblvars), target, intent(inout) :: this
120 class(modelmeshbase), target, intent(in) :: model_mesh
121 integer, intent(in) :: qs_bl
122 integer, intent(in) :: qe_bl
123 integer, intent(in) :: qa_bl
124 !----------------------------------------------------
125
126 log_info('AtmosPhyBlVars_Init',*)
127
128 this%QS = qs_bl
129 this%QE = qe_bl
130 this%QA = qa_bl
131 return
132 end subroutine atmosphyblvars_init
133
134 !> Setup variable objects
135!OCL SERIAL
136 subroutine atmosphyblvars_setup( this, model_mesh )
137 use scale_tracer, only: &
138 tracer_name, tracer_desc, tracer_unit, &
139 qa
140 use scale_file_history, only: &
141 file_history_reg
142 implicit none
143 class(atmosphyblvars), target, intent(inout) :: this
144 class(modelmeshbase), target, intent(in) :: model_mesh
145
146 integer :: iv
147 integer :: iq
148 integer :: n
149 logical :: reg_file_hist
150
151 class(atmosmesh), pointer :: atm_mesh
152 class(meshbase2d), pointer :: mesh2d
153 class(meshbase3d), pointer :: mesh3d
154
155 type(variableinfo) :: qtrc_tp_vinfo_tmp
156 type(variableinfo) :: qtrc_vterm_vinfo_tmp
157 !----------------------------------------------------
158
159 this%TENDS_NUM_TOT = atmos_phy_bl_tends_num1 + qa
160
161 !- Initialize auxiliary and diagnostic variables
162
163 nullify( atm_mesh )
164 select type(model_mesh)
165 class is (atmosmesh)
166 atm_mesh => model_mesh
167 end select
168 mesh3d => atm_mesh%ptr_mesh
169
170 call mesh3d%GetMesh2D( mesh2d )
171
172 !- Initialize tendency variables
173
174 call this%tends_manager%Init()
175 allocate( this%tends(this%TENDS_NUM_TOT) )
176
177 reg_file_hist = .true.
179 call this%tends_manager%Regist( &
180 atmos_phy_bl_tend_vinfo(iv), mesh3d, &
181 this%tends(iv), reg_file_hist, fill_zero=.true. )
182 end do
183
184 qtrc_tp_vinfo_tmp%ndims = 3
185 qtrc_tp_vinfo_tmp%dim_type = 'XYZ'
186 qtrc_tp_vinfo_tmp%STDNAME = ''
187
188 do iq = 1, qa
189 iv = atmos_phy_bl_tends_num1 + iq
190 qtrc_tp_vinfo_tmp%keyID = iv
191 qtrc_tp_vinfo_tmp%NAME = 'BL_'//trim(tracer_name(iq))//'_t'
192 qtrc_tp_vinfo_tmp%DESC = 'tendency of rho*'//trim(tracer_name(iq))//' in BL process'
193 qtrc_tp_vinfo_tmp%UNIT = 'kg/m3/s'
194
195 reg_file_hist = .true.
196 call this%tends_manager%Regist( &
197 qtrc_tp_vinfo_tmp, mesh3d, &
198 this%tends(iv), reg_file_hist, fill_zero=.true. )
199 end do
200
201 !- Initialize diagnostic variables
202
203 call this%diagvars_manager%Init()
204 allocate( this%diagvars(atmos_phy_bl_diag_num) )
205
206 reg_file_hist = .true.
207 do iv=1, atmos_phy_bl_diag_num
208 call this%diagvars_manager%Regist( &
209 atmos_phy_bl_diag_vinfo(iv), mesh3d, &
210 this%diagvars(iv), reg_file_hist, fill_zero=.true. )
211 end do
212
213 return
214 end subroutine atmosphyblvars_setup
215
216 !> Finalize an object to manage variables with planetary boundary layer (PBL) turbulence parameterization component
217!OCL SERIAL
218 subroutine atmosphyblvars_final( this )
219 implicit none
220 class(atmosphyblvars), intent(inout) :: this
221 !----------------------------------------------------
222
223 log_info('AtmosPhyBlVars_Final',*)
224
225 call this%tends_manager%Final()
226 deallocate( this%tends )
227
228 call this%diagvars_manager%Final()
229 deallocate( this%diagvars )
230 return
231 end subroutine atmosphyblvars_final
232
233!OCL SERIAL
234 subroutine atmosphyblvars_getlocalmeshfields_tend( domID, mesh, bl_tends_list, &
235 bl_RHOU_t, bl_RHOV_t, bl_RHOT_t, bl_RHOQ_t, &
236 lcmesh3D &
237 )
238
239 use scale_mesh_base, only: meshbase
241 implicit none
242
243 integer, intent(in) :: domid
244 class(meshbase), intent(in) :: mesh
245 class(modelvarmanager), intent(inout) :: bl_tends_list
246 class(localmeshfieldbase), pointer, intent(out) :: bl_rhou_t
247 class(localmeshfieldbase), pointer, intent(out) :: bl_rhov_t
248 class(localmeshfieldbase), pointer, intent(out) :: bl_rhot_t
249 type(localmeshfieldbaselist), intent(out), optional :: bl_rhoq_t(:)
250 class(localmesh3d), pointer, intent(out), optional :: lcmesh3d
251
252 class(meshfieldbase), pointer :: field
253 class(localmeshbase), pointer :: lcmesh
254
255 integer :: iq
256 !-------------------------------------------------------
257
258 !--
259 call bl_tends_list%Get(atmos_phy_bl_rhou_t_id, field)
260 call field%GetLocalMeshField(domid, bl_rhou_t)
261
262 call bl_tends_list%Get(atmos_phy_bl_rhov_t_id, field)
263 call field%GetLocalMeshField(domid, bl_rhov_t)
264
265 call bl_tends_list%Get(atmos_phy_bl_rhot_t_id, field)
266 call field%GetLocalMeshField(domid, bl_rhot_t)
267
268 !---
269 if ( present(bl_rhoq_t) ) then
270 do iq = 1, size(bl_rhoq_t)
271 call bl_tends_list%Get(atmos_phy_bl_tends_num1 + iq, field)
272 call field%GetLocalMeshField(domid, bl_rhoq_t(iq)%ptr)
273 end do
274 end if
275
276 if (present(lcmesh3d)) then
277 call mesh%GetLocalMesh( domid, lcmesh )
278 nullify( lcmesh3d )
279
280 select type(lcmesh)
281 type is (localmesh3d)
282 if (present(lcmesh3d)) lcmesh3d => lcmesh
283 end select
284 end if
285
286 return
288
289 !> Put data with BL variables to history file
290!OCL SERIAL
291 subroutine atmosphyblvars_history( this )
293 implicit none
294 class(atmosphyblvars), intent(inout) :: this
295
296 integer :: v
297 integer :: hst_id
298 !----------------------------------------------------
299
300 do v=1, this%TENDS_NUM_TOT
301 hst_id = this%tends(v)%hist_id
302 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%tends(v) )
303 end do
304
306 hst_id = this%diagvars(v)%hist_id
307 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%diagvars(v) )
308 end do
309
310 return
311 end subroutine atmosphyblvars_history
312
313end module mod_atmos_phy_bl_vars
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_tends_num1
integer, parameter, public atmos_phy_bl_diag_num
integer, parameter, public atmos_phy_bl_diag_kh_id
type(variableinfo), dimension(atmos_phy_bl_tends_num1), public atmos_phy_bl_tend_vinfo
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 FElib / Element / Base
module FElib / Mesh / Local 3D
module FElib / Mesh / Local, Base
module FElib / Mesh / Base 2D
module FElib / Mesh / Base 3D
integer, public meshbase3d_dimtypeid_xyz
module FElib / Mesh / Base
module FElib / Data / base
module FElib / Data / Communication base
FElib / model framework / mesh manager.
FElib / model framework / variable manager.
Derived type to manage a computational mesh (base class)
Derived type to manage variables with planetary boundary layer (PBL) turbulence parameterization comp...
Derived type representing a 3D reference element.
Derived type to manage restart file with each component.
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 2D mesh.
Derived type representing a field with 3D mesh.
Derived type representing a field (base type)
Container to save a pointer of MeshField(1D, 2D, 3D) object.