FE-Project
Loading...
Searching...
No Matches
mod_atmos_phy_cp_vars.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Atmosphere / Physics / Cumulus Parameterization
3!!
4!! @par Description
5!! Container for variables with cumulus parameterization component 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
22 use scale_mesh_base, only: meshbase
24 use scale_mesh_base3d, only: &
25 meshbase3d, &
26 dimtype_xyz => meshbase3d_dimtypeid_xyz
29 use scale_localmeshfield_base, only: &
31 use scale_meshfield_base, only: &
33
36
38
39 use scale_model_var_manager, only: &
40 modelvarmanager, variableinfo
41 use scale_model_mesh_manager, only: modelmeshbase
42
43 use mod_atmos_mesh, only: atmosmesh
44
45 !-----------------------------------------------------------------------------
46 implicit none
47 private
48
49 !-----------------------------------------------------------------------------
50 !
51 !++ Public type & procedures
52 !
53
54 !> Derived type to manage variables with cumulus parameterization component in atmospheric model
55 type, public :: atmosphycpvars
56 type(meshfield3d), allocatable :: tends(:) !< Array of tendency variables
57 type(modelvarmanager) :: tends_manager !< Object to manage tendencies
58
59 type(meshfield2d), allocatable :: auxvars2d(:) !< Array of 2D auxiliary variables
60 type(modelvarmanager) :: auxvars2d_manager !< Object to manage 2D auxiliary variables
61
62 integer :: tends_num_tot !< Number of tendency variables with cumulus parameterization
63 contains
64 procedure :: init => atmosphycpvars_init
65 procedure :: final => atmosphycpvars_final
66 procedure :: setup => atmosphycpvars_setup
67 procedure :: history => atmosphycpvars_history
68 end type atmosphycpvars
69
72
73 !-----------------------------------------------------------------------------
74 !
75 !++ Public variables
76 !
77 integer, public, parameter :: atmos_phy_cp_dens_t_id = 1
78 integer, public, parameter :: atmos_phy_cp_rhow_t_id = 2
79 integer, public, parameter :: atmos_phy_cp_rhot_t_id = 3
80 integer, public, parameter :: atmos_phy_cp_rhoqv_t_id = 4
81 integer, public, parameter :: atmos_phy_cp_tends_num1 = 4
82
83 type(variableinfo), public :: atmos_phy_cp_tend_vinfo(atmos_phy_cp_tends_num1)
85 variableinfo( atmos_phy_cp_dens_t_id, 'CP_DENS_t', 'tendency of density in CP process', &
86 'kg/m3/s', 3, 'XYZ', '' ), &
87 variableinfo( atmos_phy_cp_rhow_t_id, 'CP_RHOW_t', 'tendency of water vapor in CP process', &
88 'kg/m3/s', 3, 'XYZ', '' ), &
89 variableinfo( atmos_phy_cp_rhot_t_id, 'CP_RHOT_t', 'tendency of rho*PT in CP process', &
90 'kg/m3.K/s', 3, 'XYZ', '' ), &
91 variableinfo( atmos_phy_cp_rhoqv_t_id, 'CP_RHOQV_t', 'tendency of rho*QV in CP process', &
92 'kg/m3/s', 3, 'XYZ', '' ) /
93
94 integer, public, parameter :: atmos_phy_cp_aux2d_sflx_rain_id = 1
95 integer, public, parameter :: atmos_phy_cp_aux2d_sflx_snow_id = 2
96 integer, public, parameter :: atmos_phy_cp_aux2d_sflx_engi_id = 3
97 integer, public, parameter :: atmos_phy_cp_aux2d_num = 3
98
99 type(variableinfo), public :: atmos_phy_cp_aux2d_vinfo(atmos_phy_cp_aux2d_num)
101 variableinfo( atmos_phy_cp_aux2d_sflx_rain_id, 'CP_SFLX_RAIN', 'precipitation flux (liquid) in CP process', &
102 'kg/m2/s', 2, 'XY', '' ), &
103 variableinfo( atmos_phy_cp_aux2d_sflx_snow_id, 'CP_SFLX_SNOW', 'precipitation flux (solid) in CP process', &
104 'kg/m2/s', 2, 'XY', '' ), &
105 variableinfo( atmos_phy_cp_aux2d_sflx_engi_id, 'CP_SFLX_ENGI', 'internal energy flux flux in CP process', &
106 'J/m2/s', 2, 'XY', '' ) /
107
108 !-----------------------------------------------------------------------------
109 !
110 !++ Private procedures
111 !
112contains
113 !> Setup an object to manage variables with a cumulus parameterization component
114!OCL SERIAL
115 subroutine atmosphycpvars_init( this, model_mesh )
116 implicit none
117 class(atmosphycpvars), target, intent(inout) :: this
118 class(modelmeshbase), target, intent(in) :: model_mesh
119 !----------------------------------------------------
120
121 log_info('AtmosPhyCpVars_Init',*)
122 return
123 end subroutine atmosphycpvars_init
124
125 !> Setup variable objects with cumulus parameterization component
126 subroutine atmosphycpvars_setup( this, model_mesh )
127 use scale_atmos_hydrometeor, only: &
128 n_hyd, &
129 hyd_name
130 use scale_tracer, only: &
131 tracer_name, tracer_desc, tracer_unit
132 use scale_file_history, only: &
133 file_history_reg
134 implicit none
135 class(atmosphycpvars), target, intent(inout) :: this
136 class(modelmeshbase), target, intent(in) :: model_mesh
137
138 integer :: iv
139 integer :: iq
140 integer :: n
141 logical :: reg_file_hist
142
143 class(atmosmesh), pointer :: atm_mesh
144 class(meshbase2d), pointer :: mesh2d
145 class(meshbase3d), pointer :: mesh3d
146
147 type(variableinfo) :: qtrc_tp_vinfo_tmp
148 type(variableinfo) :: qtrc_vterm_vinfo_tmp
149 !----------------------------------------------------
150
151
152 this%TENDS_NUM_TOT = atmos_phy_cp_tends_num1 + n_hyd
153
154 !- Initialize auxiliary and diagnostic variables
155
156 nullify( atm_mesh )
157 select type(model_mesh)
158 class is (atmosmesh)
159 atm_mesh => model_mesh
160 end select
161 mesh3d => atm_mesh%ptr_mesh
162
163 call mesh3d%GetMesh2D( mesh2d )
164
165 !----
166
167 call this%tends_manager%Init()
168 allocate( this%tends(this%TENDS_NUM_TOT) )
169
170 reg_file_hist = .true.
171 do iv = 1, atmos_phy_cp_tends_num1
172 call this%tends_manager%Regist( &
173 atmos_phy_cp_tend_vinfo(iv), mesh3d, &
174 this%tends(iv), reg_file_hist )
175
176 do n = 1, mesh3d%LOCAL_MESH_NUM
177 this%tends(iv)%local(n)%val(:,:) = 0.0_rp
178 end do
179 end do
180
181 qtrc_tp_vinfo_tmp%ndims = 3
182 qtrc_tp_vinfo_tmp%dim_type = 'XYZ'
183 qtrc_tp_vinfo_tmp%STDNAME = ''
184
185 do iq = 1, n_hyd
186 iv = atmos_phy_cp_tends_num1 + iq
187 qtrc_tp_vinfo_tmp%keyID = iv
188 qtrc_tp_vinfo_tmp%NAME = 'CP_'//trim(hyd_name(iq))//'_t'
189 qtrc_tp_vinfo_tmp%DESC = 'tendency of rho*'//trim(hyd_name(iq))//' in CP process'
190 qtrc_tp_vinfo_tmp%UNIT = 'kg/m3/s'
191
192 reg_file_hist = .true.
193 call this%tends_manager%Regist( &
194 qtrc_tp_vinfo_tmp, mesh3d, &
195 this%tends(iv), reg_file_hist )
196
197 do n = 1, mesh3d%LOCAL_MESH_NUM
198 this%tends(iv)%local(n)%val(:,:) = 0.0_rp
199 end do
200 end do
201
202 !--
203
204 call this%auxvars2D_manager%Init()
205 allocate( this%auxvars2D(atmos_phy_cp_aux2d_num) )
206
207 reg_file_hist = .true.
208 do iv = 1, atmos_phy_cp_aux2d_num
209 call this%auxvars2D_manager%Regist( &
210 atmos_phy_cp_aux2d_vinfo(iv), mesh2d, & ! (in)
211 this%auxvars2D(iv), reg_file_hist ) ! (out)
212
213 do n = 1, mesh3d%LOCAL_MESH_NUM
214 this%auxvars2D(iv)%local(n)%val(:,:) = 0.0_rp
215 end do
216 end do
217
218 return
219 end subroutine atmosphycpvars_setup
220
221 !> Finalize an object to manage variables with cumulus parameterization component
222!OCL SERIAL
223 subroutine atmosphycpvars_final( this )
224 implicit none
225 class(atmosphycpvars), intent(inout) :: this
226 !----------------------------------------------------
227
228 log_info('AtmosPhyCpVars_Final',*)
229
230 call this%tends_manager%Final()
231 deallocate( this%tends )
232
233 call this%auxvars2D_manager%Final()
234 deallocate( this%auxvars2D )
235
236 return
237 end subroutine atmosphycpvars_final
238
239!OCL SERIAL
240 subroutine atmosphycpvars_getlocalmeshfields_tend( domID, mesh, bl_tends_list, &
241 cp_DENS_t, cp_RHOT_t, cp_RHOQv_t, &
242 lcmesh3D &
243 )
244
245 use scale_mesh_base, only: meshbase
247 implicit none
248
249 integer, intent(in) :: domid
250 class(meshbase), intent(in) :: mesh
251 class(modelvarmanager), intent(inout) :: bl_tends_list
252 class(localmeshfieldbase), pointer, intent(out) :: cp_dens_t
253 class(localmeshfieldbase), pointer, intent(out) :: cp_rhot_t
254 class(localmeshfieldbase), pointer, intent(out) :: cp_rhoqv_t
255 class(localmesh3d), pointer, intent(out), optional :: lcmesh3d
256
257 class(meshfieldbase), pointer :: field
258 class(localmeshbase), pointer :: lcmesh
259
260 integer :: iq
261 !-------------------------------------------------------
262
263 !--
264 call bl_tends_list%Get(atmos_phy_cp_dens_t_id, field)
265 call field%GetLocalMeshField(domid, cp_dens_t)
266
267 call bl_tends_list%Get(atmos_phy_cp_rhot_t_id, field)
268 call field%GetLocalMeshField(domid, cp_rhot_t)
269
270 call bl_tends_list%Get(atmos_phy_cp_rhoqv_t_id, field)
271 call field%GetLocalMeshField(domid, cp_rhoqv_t)
272
273 if (present(lcmesh3d)) then
274 call mesh%GetLocalMesh( domid, lcmesh )
275 nullify( lcmesh3d )
276
277 select type(lcmesh)
278 type is (localmesh3d)
279 if (present(lcmesh3d)) lcmesh3d => lcmesh
280 end select
281 end if
282
283 return
285
286!OCL SERIAL
287 subroutine atmosphycpvars_getlocalmeshfields_sfcflx( domID, mesh, sfcflx_list, &
288 SFLX_rain, SFLX_snow, SFLX_engi )
289
290 use scale_mesh_base, only: meshbase
292 implicit none
293
294 integer, intent(in) :: domid
295 class(meshbase), intent(in) :: mesh
296 class(modelvarmanager), intent(inout) :: sfcflx_list
297 class(localmeshfieldbase), pointer, intent(out) :: sflx_rain
298 class(localmeshfieldbase), pointer, intent(out) :: sflx_snow
299 class(localmeshfieldbase), pointer, intent(out) :: sflx_engi
300
301 class(meshfieldbase), pointer :: field
302 !-------------------------------------------------------
303
304 call sfcflx_list%Get(atmos_phy_cp_aux2d_sflx_rain_id, field)
305 call field%GetLocalMeshField(domid, sflx_rain)
306
307 call sfcflx_list%Get(atmos_phy_cp_aux2d_sflx_snow_id, field)
308 call field%GetLocalMeshField(domid, sflx_snow)
309
310 call sfcflx_list%Get(atmos_phy_cp_aux2d_sflx_engi_id, field)
311 call field%GetLocalMeshField(domid, sflx_engi)
312
313 return
315
316!OCL SERIAL
317 subroutine atmosphycpvars_history( this )
319 implicit none
320 class(atmosphycpvars), intent(inout) :: this
321
322 integer :: v
323 integer :: hst_id
324 !----------------------------------------------------
325
326 do v=1, this%TENDS_NUM_TOT
327 hst_id = this%tends(v)%hist_id
328 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%tends(v) )
329 end do
330
332 hst_id = this%auxvars2D(v)%hist_id
333 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%auxvars2D(v) )
334 end do
335 return
336 end subroutine atmosphycpvars_history
337
338end module mod_atmos_phy_cp_vars
module Atmosphere / Mesh
module Atmosphere / Physics / Cumulus Parameterization
type(variableinfo), dimension(atmos_phy_cp_tends_num1), public atmos_phy_cp_tend_vinfo
integer, parameter, public atmos_phy_cp_dens_t_id
integer, parameter, public atmos_phy_cp_aux2d_sflx_engi_id
subroutine, public atmosphycpvars_getlocalmeshfields_sfcflx(domid, mesh, sfcflx_list, sflx_rain, sflx_snow, sflx_engi)
integer, parameter, public atmos_phy_cp_tends_num1
subroutine, public atmosphycpvars_getlocalmeshfields_tend(domid, mesh, bl_tends_list, cp_dens_t, cp_rhot_t, cp_rhoqv_t, lcmesh3d)
type(variableinfo), dimension(atmos_phy_cp_aux2d_num), public atmos_phy_cp_aux2d_vinfo
integer, parameter, public atmos_phy_cp_rhoqv_t_id
integer, parameter, public atmos_phy_cp_rhot_t_id
integer, parameter, public atmos_phy_cp_aux2d_num
integer, parameter, public atmos_phy_cp_aux2d_sflx_rain_id
integer, parameter, public atmos_phy_cp_aux2d_sflx_snow_id
integer, parameter, public atmos_phy_cp_rhow_t_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 cumulus parameterization component in atmospheric model.
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.