FE-Project
Loading...
Searching...
No Matches
mod_atmos_phy_mp_vars.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Atmosphere / Physics / Cloud Microphysics
3!!
4!! @par Description
5!! Container for variables with cloud microphysics component
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 cloud microphysics component
55 type, public :: atmosphympvars
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 :: qs !< Start index of tracer variables with cloud microphysics
63 integer :: qe !< End index of tracer variables with cloud microphysics
64 integer :: qa !< Number of tracer variables with cloud microphysics
65
66 integer :: tends_num_tot !< Number of tendency variables with cloud microphysics
67 integer, allocatable :: vterm_hist_id(:)
68 type(meshfield3d), allocatable :: vterm_hist(:)
69 contains
70 procedure :: init => atmosphympvars_init
71 procedure :: final => atmosphympvars_final
72 procedure :: setup => atmosphympvars_setup
73 procedure :: history => atmosphympvars_history
74 end type atmosphympvars
75
78
79 !-----------------------------------------------------------------------------
80 !
81 !++ Public variables
82 !
83
84 integer, public, parameter :: atmos_phy_mp_dens_t_id = 1
85 integer, public, parameter :: atmos_phy_mp_momx_t_id = 2
86 integer, public, parameter :: atmos_phy_mp_momy_t_id = 3
87 integer, public, parameter :: atmos_phy_mp_momz_t_id = 4
88 integer, public, parameter :: atmos_phy_mp_rhot_t_id = 5
89 integer, public, parameter :: atmos_phy_mp_rhoh_id = 6
90 integer, public, parameter :: atmos_phy_mp_evaporate_id = 7
91 integer, public, parameter :: atmos_phy_mp_tends_num1 = 7
92
93 type(variableinfo), public :: atmos_phy_mp_tend_vinfo(atmos_phy_mp_tends_num1)
95 variableinfo( atmos_phy_mp_dens_t_id, 'MP_DENS_t', 'tendency of x-momentum in MP process', &
96 'kg/m3/s', 3, 'XYZ', '' ), &
97 variableinfo( atmos_phy_mp_momx_t_id, 'MP_MOMX_t', 'tendency of x-momentum in MP process', &
98 'kg/m2/s2', 3, 'XYZ', '' ), &
99 variableinfo( atmos_phy_mp_momy_t_id, 'MP_MOMY_t', 'tendency of y-momentum in MP process', &
100 'kg/m2/s2', 3, 'XYZ', '' ), &
101 variableinfo( atmos_phy_mp_momz_t_id, 'MP_MOMZ_t', 'tendency of z-momentum in MP process', &
102 'kg/m2/s2', 3, 'XYZ', '' ), &
103 variableinfo( atmos_phy_mp_rhot_t_id, 'MP_RHOT_t', 'tendency of rho*PT in MP process', &
104 'kg/m3.K/s', 3, 'XYZ', '' ), &
105 variableinfo( atmos_phy_mp_rhoh_id , 'MP_RHOH', 'diabatic heating rate in MP process', &
106 'J/kg/s', 3, 'XYZ', '' ), &
107 variableinfo( atmos_phy_mp_evaporate_id, 'mp_EVAPORATE', 'number concentration of evaporated cloud', &
108 'm-3' , 3, 'XYZ', '' ) /
109
110
111 integer, public, parameter :: atmos_phy_mp_aux2d_sflx_rain_id = 1
112 integer, public, parameter :: atmos_phy_mp_aux2d_sflx_snow_id = 2
113 integer, public, parameter :: atmos_phy_mp_aux2d_sflx_engi_id = 3
114 integer, public, parameter :: atmos_phy_mp_aux2d_num = 3
115
118 variableinfo( atmos_phy_mp_aux2d_sflx_rain_id, 'MP_SFLX_RAIN', 'precipitation flux (liquid) in MP process', &
119 'kg/m2/s', 2, 'XY', '' ), &
120 variableinfo( atmos_phy_mp_aux2d_sflx_snow_id, 'MP_SFLX_SNOW', 'precipitation flux (solid) in MP process', &
121 'kg/m2/s', 2, 'XY', '' ), &
122 variableinfo( atmos_phy_mp_aux2d_sflx_engi_id, 'MP_SFLX_ENGI', 'internal energy flux flux in MP process', &
123 'J/m2/s', 2, 'XY', '' ) /
124
125
126 !-----------------------------------------------------------------------------
127 !
128 !++ Private procedures
129 !
130 !-------------------
131
132contains
133
134!> Setup an object to manage variables with a cloud microphysics component
135!OCL SERIAL
136 subroutine atmosphympvars_init( this, model_mesh, &
137 QS_MP, QE_MP, QA_MP )
138 implicit none
139 class(atmosphympvars), target, intent(inout) :: this
140 class(modelmeshbase), target, intent(in) :: model_mesh
141 integer, intent(in) :: qs_mp
142 integer, intent(in) :: qe_mp
143 integer, intent(in) :: qa_mp
144 !--------------------------------------------------
145
146 log_info('AtmosPhyMpVars_Init',*)
147
148 this%QS = qs_mp
149 this%QE = qe_mp
150 this%QA = qa_mp
151 this%TENDS_NUM_TOT = atmos_phy_mp_tends_num1 + qe_mp - qs_mp + 1
152 return
153 end subroutine atmosphympvars_init
154
155 !> Setup variable objects with cloud microphysics component
156 subroutine atmosphympvars_setup( this, model_mesh )
157 use scale_tracer, only: &
158 tracer_name, tracer_desc, tracer_unit
159 use scale_file_history, only: &
160 file_history_reg
161 implicit none
162 class(atmosphympvars), target, intent(inout) :: this
163 class(modelmeshbase), target, intent(in) :: model_mesh
164
165 integer :: iv
166 integer :: iq
167 integer :: n
168 logical :: reg_file_hist
169
170 class(atmosmesh), pointer :: atm_mesh
171 class(meshbase2d), pointer :: mesh2d
172 class(meshbase3d), pointer :: mesh3d
173
174 type(variableinfo) :: qtrc_tp_vinfo_tmp
175 type(variableinfo) :: qtrc_vterm_vinfo_tmp
176 !--------------------------------------------------
177
178 !- Initialize auxiliary and diagnostic variables
179
180 nullify( atm_mesh )
181 select type(model_mesh)
182 class is (atmosmesh)
183 atm_mesh => model_mesh
184 end select
185 mesh3d => atm_mesh%ptr_mesh
186
187 call mesh3d%GetMesh2D( mesh2d )
188
189 !----
190
191 call this%tends_manager%Init()
192 allocate( this%tends(this%TENDS_NUM_TOT) )
193
194 reg_file_hist = .true.
195 do iv = 1, atmos_phy_mp_tends_num1
196 call this%tends_manager%Regist( &
197 atmos_phy_mp_tend_vinfo(iv), mesh3d, &
198 this%tends(iv), reg_file_hist )
199
200 do n = 1, mesh3d%LOCAL_MESH_NUM
201 this%tends(iv)%local(n)%val(:,:) = 0.0_rp
202 end do
203 end do
204
205 qtrc_tp_vinfo_tmp%ndims = 3
206 qtrc_tp_vinfo_tmp%dim_type = 'XYZ'
207 qtrc_tp_vinfo_tmp%STDNAME = ''
208
209 do iq = 1, this%QA
210 iv = atmos_phy_mp_tends_num1 + iq
211 qtrc_tp_vinfo_tmp%keyID = iv
212 qtrc_tp_vinfo_tmp%NAME = 'MP_'//trim(tracer_name(this%QS+iq-1))//'_t'
213 qtrc_tp_vinfo_tmp%DESC = 'tendency of rho*'//trim(tracer_name(this%QS+iq-1))//' in MP process'
214 qtrc_tp_vinfo_tmp%UNIT = 'kg/m3/s'
215
216 reg_file_hist = .true.
217 call this%tends_manager%Regist( &
218 qtrc_tp_vinfo_tmp, mesh3d, &
219 this%tends(iv), reg_file_hist )
220
221 do n = 1, mesh3d%LOCAL_MESH_NUM
222 this%tends(iv)%local(n)%val(:,:) = 0.0_rp
223 end do
224 end do
225
226 !--
227
228 allocate( this%vterm_hist_id(this%QS+1:this%QE) )
229 allocate( this%vterm_hist (this%QS+1:this%QE) )
230
231 qtrc_vterm_vinfo_tmp%ndims = 3
232 qtrc_vterm_vinfo_tmp%dim_type = 'XYZ'
233 qtrc_vterm_vinfo_tmp%STDNAME = ''
234
235 do iq = this%QS+1, this%QE
236 qtrc_vterm_vinfo_tmp%NAME = 'Vterm_'//trim(tracer_name(this%QS+iq-1))
237 qtrc_vterm_vinfo_tmp%DESC = 'terminal velocity of '//trim(tracer_name(this%QS+iq-1))
238 qtrc_vterm_vinfo_tmp%UNIT = 'm/s'
239 call file_history_reg( qtrc_vterm_vinfo_tmp%NAME, qtrc_vterm_vinfo_tmp%DESC, qtrc_vterm_vinfo_tmp%UNIT, &
240 this%vterm_hist_id(iq), dim_type='XYZ' )
241 if ( this%vterm_hist_id(iq) > 0 ) call this%vterm_hist(iq)%Init( qtrc_vterm_vinfo_tmp%NAME, qtrc_vterm_vinfo_tmp%UNIT, mesh3d )
242 end do
243
244 !--
245
246 call this%auxvars2D_manager%Init()
247 allocate( this%auxvars2D(atmos_phy_mp_aux2d_num) )
248
249 reg_file_hist = .true.
250 do iv = 1, atmos_phy_mp_aux2d_num
251 call this%auxvars2D_manager%Regist( &
252 atmos_phy_mp_aux2d_vinfo(iv), mesh2d, & ! (in)
253 this%auxvars2D(iv), reg_file_hist ) ! (out)
254
255 do n = 1, mesh3d%LOCAL_MESH_NUM
256 this%auxvars2D(iv)%local(n)%val(:,:) = 0.0_rp
257 end do
258 end do
259
260 return
261 end subroutine atmosphympvars_setup
262
263!> Finalize an object to manage variables with cloud microphysics component
264!OCL SERIAL
265 subroutine atmosphympvars_final( this )
266 implicit none
267 class(atmosphympvars), intent(inout) :: this
268
269 integer :: iq
270 !--------------------------------------------------
271
272 log_info('AtmosPhyMpVars_Final',*)
273
274 call this%tends_manager%Final()
275 deallocate( this%tends )
276
277 call this%auxvars2D_manager%Final()
278 deallocate( this%auxvars2D )
279
280 do iq = this%QS+1, this%QE
281 if ( this%vterm_hist_id(iq) > 0 ) call this%vterm_hist(iq)%Final()
282 end do
283 deallocate( this%vterm_hist_id )
284
285 return
286 end subroutine atmosphympvars_final
287
288!OCL SERIAL
289 subroutine atmosphympvars_getlocalmeshfields_tend( domID, mesh, mp_tends_list, &
290 mp_DENS_t, mp_MOMX_t, mp_MOMY_t, mp_MOMZ_t, mp_RHOT_t, mp_RHOH, mp_EVAP, &
291 mp_RHOQ_t, &
292 lcmesh3D &
293 )
294
295 use scale_mesh_base, only: meshbase
297 implicit none
298
299 integer, intent(in) :: domid
300 class(meshbase), intent(in) :: mesh
301 class(modelvarmanager), intent(inout) :: mp_tends_list
302 class(localmeshfieldbase), pointer, intent(out) :: mp_dens_t
303 class(localmeshfieldbase), pointer, intent(out) :: mp_momx_t
304 class(localmeshfieldbase), pointer, intent(out) :: mp_momy_t
305 class(localmeshfieldbase), pointer, intent(out) :: mp_momz_t
306 class(localmeshfieldbase), pointer, intent(out) :: mp_rhot_t
307 class(localmeshfieldbase), pointer, intent(out) :: mp_rhoh
308 class(localmeshfieldbase), pointer, intent(out) :: mp_evap
309 type(localmeshfieldbaselist), intent(out) :: mp_rhoq_t(:)
310 class(localmesh3d), pointer, intent(out), optional :: lcmesh3d
311
312 class(meshfieldbase), pointer :: field
313 class(localmeshbase), pointer :: lcmesh
314
315 integer :: iq
316 !-------------------------------------------------------
317
318 !--
319 call mp_tends_list%Get(atmos_phy_mp_dens_t_id, field)
320 call field%GetLocalMeshField(domid, mp_dens_t)
321
322 call mp_tends_list%Get(atmos_phy_mp_momx_t_id, field)
323 call field%GetLocalMeshField(domid, mp_momx_t)
324
325 call mp_tends_list%Get(atmos_phy_mp_momy_t_id, field)
326 call field%GetLocalMeshField(domid, mp_momy_t)
327
328 call mp_tends_list%Get(atmos_phy_mp_momz_t_id, field)
329 call field%GetLocalMeshField(domid, mp_momz_t)
330
331 call mp_tends_list%Get(atmos_phy_mp_rhot_t_id, field)
332 call field%GetLocalMeshField(domid, mp_rhot_t)
333
334 call mp_tends_list%Get(atmos_phy_mp_rhoh_id, field)
335 call field%GetLocalMeshField(domid, mp_rhoh)
336
337 call mp_tends_list%Get(atmos_phy_mp_evaporate_id, field)
338 call field%GetLocalMeshField(domid, mp_evap)
339
340 !---
341 do iq = 1, size(mp_rhoq_t)
342 call mp_tends_list%Get(atmos_phy_mp_tends_num1 + iq, field)
343 call field%GetLocalMeshField(domid, mp_rhoq_t(iq)%ptr)
344 end do
345
346
347 if (present(lcmesh3d)) then
348 call mesh%GetLocalMesh( domid, lcmesh )
349 nullify( lcmesh3d )
350
351 select type(lcmesh)
352 type is (localmesh3d)
353 if (present(lcmesh3d)) lcmesh3d => lcmesh
354 end select
355 end if
356
357 return
359
360!OCL SERIAL
361 subroutine atmosphympvars_getlocalmeshfields_sfcflx( domID, mesh, sfcflx_list, &
362 SFLX_rain, SFLX_snow, SFLX_engi )
363
364 use scale_mesh_base, only: meshbase
366 implicit none
367
368 integer, intent(in) :: domid
369 class(meshbase), intent(in) :: mesh
370 class(modelvarmanager), intent(inout) :: sfcflx_list
371 class(localmeshfieldbase), pointer, intent(out) :: sflx_rain
372 class(localmeshfieldbase), pointer, intent(out) :: sflx_snow
373 class(localmeshfieldbase), pointer, intent(out) :: sflx_engi
374
375 class(meshfieldbase), pointer :: field
376 !-------------------------------------------------------
377
378 call sfcflx_list%Get(atmos_phy_mp_aux2d_sflx_rain_id, field)
379 call field%GetLocalMeshField(domid, sflx_rain)
380
381 call sfcflx_list%Get(atmos_phy_mp_aux2d_sflx_snow_id, field)
382 call field%GetLocalMeshField(domid, sflx_snow)
383
384 call sfcflx_list%Get(atmos_phy_mp_aux2d_sflx_engi_id, field)
385 call field%GetLocalMeshField(domid, sflx_engi)
386
387 return
389
390!OCL SERIAL
391 subroutine atmosphympvars_history( this )
393 implicit none
394 class(atmosphympvars), intent(inout) :: this
395
396 integer :: v
397 integer :: iq
398 integer :: hst_id
399 type(meshfield3d) :: tmp_field
400 class(meshbase3d), pointer :: mesh3d
401 !-------------------------------------------------------------------------
402
403 mesh3d => this%tends(1)%mesh
404
405 do v = 1, this%TENDS_NUM_TOT
406 hst_id = this%tends(v)%hist_id
407 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%tends(v) )
408 end do
409
410 do v = 1, atmos_phy_mp_aux2d_num
411 hst_id = this%auxvars2D(v)%hist_id
412 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%auxvars2D(v) )
413 end do
414
415 do iq = this%QS+1, this%QE
416 hst_id = this%vterm_hist_id(iq)
417 if ( hst_id > 0 ) call file_history_meshfield_put( hst_id, this%vterm_hist(iq) )
418 end do
419
420 return
421 end subroutine atmosphympvars_history
422
423end module mod_atmos_phy_mp_vars
module Atmosphere / Mesh
module Atmosphere / Physics / Cloud Microphysics
integer, parameter, public atmos_phy_mp_tends_num1
integer, parameter, public atmos_phy_mp_momx_t_id
integer, parameter, public atmos_phy_mp_momz_t_id
integer, parameter, public atmos_phy_mp_evaporate_id
subroutine, public atmosphympvars_getlocalmeshfields_tend(domid, mesh, mp_tends_list, mp_dens_t, mp_momx_t, mp_momy_t, mp_momz_t, mp_rhot_t, mp_rhoh, mp_evap, mp_rhoq_t, lcmesh3d)
integer, parameter, public atmos_phy_mp_aux2d_sflx_snow_id
integer, parameter, public atmos_phy_mp_aux2d_sflx_engi_id
subroutine, public atmosphympvars_getlocalmeshfields_sfcflx(domid, mesh, sfcflx_list, sflx_rain, sflx_snow, sflx_engi)
type(variableinfo), dimension(atmos_phy_mp_aux2d_num), public atmos_phy_mp_aux2d_vinfo
integer, parameter, public atmos_phy_mp_aux2d_num
integer, parameter, public atmos_phy_mp_momy_t_id
integer, parameter, public atmos_phy_mp_aux2d_sflx_rain_id
type(variableinfo), dimension(atmos_phy_mp_tends_num1), public atmos_phy_mp_tend_vinfo
integer, parameter, public atmos_phy_mp_dens_t_id
integer, parameter, public atmos_phy_mp_rhot_t_id
integer, parameter, public atmos_phy_mp_rhoh_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 cloud microphysics component.
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.