FE-Project
Loading...
Searching...
No Matches
mod_atmos_phy_cp.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Atmosphere / Physics / Cumulus Parameterization
3!!
4!! @par Description
5!! Module for cumulus 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
26 use scale_mesh_base, only: meshbase
29
35
36 use scale_meshfield_base, only: &
38 use scale_localmeshfield_base, only: &
40
41 use scale_model_mesh_manager, only: modelmeshbase
44
46
47 use mod_atmos_vars_container, only: &
49
50 !-----------------------------------------------------------------------------
51 implicit none
52 private
53 !-----------------------------------------------------------------------------
54 !
55 !++ Public type & procedure
56 !
57
58 !> Derived type to manage a component of cumulus parameterization in atmospheric model
59 !!
60 type, extends(modelcomponentproc), public :: atmosphycp
61 integer :: cp_typeid !< Type id of cumulus parameterization scheme
62 type(atmosphycpvars) :: vars !< Object to manage variables with cumulus parameterization
63
64 integer :: atm_var_container_typeid !< Type ID of variable container for cumulus parameterization
65
66 real(rp) :: dtsec !< Timestep for cumulus parameterization
67
68 type(lineelement) :: v_elem1d
69 contains
70 procedure :: setup => atmosphycp_setup
71 procedure :: calc_tendency => atmosphycp_calc_tendency
72 procedure :: update => atmosphycp_update
73 procedure :: finalize => atmosphycp_finalize
74 end type atmosphycp
75
76 !-----------------------------------------------------------------------------
77 !++ Public parameters & variables
78 !
79 !-----------------------------------------------------------------------------
80 !
81 !++ Private procedure
82 !
83 !-----------------------------------------------------------------------------
84 !
85 !++ Private parameters & variables
86 !
87 integer, parameter :: cp_typeid_mconv_adjustment = 1 !< Type ID of a moist convective adjustment scheme
88
89contains
90
91 !> Setup a component of cumulus parameterization in atmospheric model
92 !!
93 !! @param model_mesh Object to manage computational mesh of atmospheric model
94 !! @param tm_parent_comp Object to mange a temporal scheme in a parent component
95 !!
96 subroutine atmosphycp_setup( this, model_mesh, tm_parent_comp )
97 use scale_atmos_hydrometeor, only: &
98 n_hyd
99 use mod_atmos_mesh, only: atmosmesh
102
105 implicit none
106 class(atmosphycp), intent(inout) :: this
107 class(modelmeshbase), target, intent(in) :: model_mesh
108 class(time_manager_component), intent(inout) :: tm_parent_comp
109
110 real(dp) :: time_dt = undef8 !< Timestep for cumulus parameterization
111 character(len=H_SHORT) :: time_dt_unit = 'SEC' !< Unit of timestep
112
113 character(len=H_MID) :: cp_type = 'NONE' !< Type of a cumulus parameterization scheme
114 integer :: atm_var_container_typeid !< Type ID of variable container for cumulus parameterization
115
116 namelist /param_atmos_phy_cp/ &
117 time_dt, &
118 time_dt_unit, &
119 cp_type, &
120 atm_var_container_typeid
121
122 class(atmosmesh), pointer :: atm_mesh
123 class(meshbase), pointer :: ptr_mesh
124 class(localmesh3d), pointer :: lcmesh3d
125 class(elementbase3d), pointer :: elem3d
126
127 integer :: ierr
128 !-----------------------------------------------------
129
130 if (.not. this%IsActivated()) return
131
132 log_newline
133 log_info("ATMOS_PHY_CP_setup",*) 'Setup'
134
135 atm_var_container_typeid = atm_vars_container_primary_id
136
137 !--- read namelist
138 rewind(io_fid_conf)
139 read(io_fid_conf,nml=param_atmos_phy_cp,iostat=ierr)
140 if( ierr < 0 ) then !--- missing
141 log_info("ATMOS_PHY_CP_setup",*) 'Not found namelist. Default used.'
142 elseif( ierr > 0 ) then !--- fatal error
143 log_error("ATMOS_PHY_CP_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_PHY_CP. Check!'
144 call prc_abort
145 endif
146 log_nml(param_atmos_phy_cp)
147
148 this%atm_var_container_typeid = atm_var_container_typeid
149
150 !- Get atmospheric mesh --------------------------------------------------
151
152 call model_mesh%GetModelMesh( ptr_mesh )
153 select type(model_mesh)
154 class is (atmosmesh)
155 atm_mesh => model_mesh
156 end select
157
158 !--- Register this component in the time manager
159
160 call tm_parent_comp%Regist_process( 'ATMOS_PHY_CP', time_dt, time_dt_unit, & ! (in)
161 this%tm_process_id ) ! (out)
162
163 this%dtsec = tm_parent_comp%process_list(this%tm_process_id)%dtsec
164
165 !--- Set the type of cumulus parameterization
166
167 select case( cp_type )
168 case( 'MOIST_CONV_ADJUSTMENT' )
169 this%CP_TYPEID = cp_typeid_mconv_adjustment
171 case default
172 log_error("ATMOS_PHY_CP_setup",*) 'Not appropriate cumulus parameterization type. Check!'
173 call prc_abort
174 end select
175
176 !- Initialize the variables
177 call this%vars%Init( model_mesh )
178
179 !-
180 call this%v_elem1D%Init( atm_mesh%ptr_mesh%refElem3D%PolyOrder_v, .false. )
181
182 return
183 end subroutine atmosphycp_setup
184
185 !> Calculate tendencies associated with cumulus parameterization in atmospheric model
186 !!
187 !!
188 !! @param model_mesh Object to manage computational mesh of atmospheric model
189 !! @param prgvars_list Object to manage prognostic variables with atmospheric dynamical core
190 !! @param trcvars_list Object to manage auxiliary variables
191 !! @param forcing_list Object to manage forcing terms
192 !! @param is_update Flag to speicfy whether the tendencies are updated in this call
193 !!
194!OCL SERIAL
195 subroutine atmosphycp_calc_tendency( &
196 this, model_mesh, prgvars_list, trcvars_list, &
197 auxvars_list, forcing_list, is_update )
198 use scale_tracer, only: &
199 qa
202
203 use mod_atmos_vars, only: &
209 use mod_atmos_phy_cp_vars, only: &
211 sflx_rain_id => atmos_phy_cp_aux2d_sflx_rain_id, &
212 sflx_engi_id => atmos_phy_cp_aux2d_sflx_engi_id
213 implicit none
214 class(atmosphycp), intent(inout) :: this
215 class(modelmeshbase), intent(in) :: model_mesh
216 class(modelvarmanager), intent(inout) :: prgvars_list
217 class(modelvarmanager), intent(inout) :: trcvars_list
218 class(modelvarmanager), intent(inout) :: auxvars_list
219 class(modelvarmanager), intent(inout) :: forcing_list
220 logical, intent(in) :: is_update
221
222 class(meshbase), pointer :: mesh
223 class(meshbase3d), pointer :: mesh3d
224 class(localmesh3d), pointer :: lcmesh
225
226 integer :: n
227 integer :: ke
228 integer :: iq
229
230 class(localmeshfieldbase), pointer :: ddens, momx, momy, momz, drhot, qv
231 class(localmeshfieldbase), pointer :: dens_hyd, pres_hyd, rtot, cvtot, cptot
232 class(localmeshfieldbase), pointer :: pres, pt
233
234 class(localmeshfieldbase), pointer :: dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, rhoh_p
235 class(localmeshfieldbase), pointer :: rhoq_tp
236 class(localmeshfieldbase), pointer :: cp_dens_t, cp_rhot_t, cp_rhoqv_t
237 !------------------------------------------------------------------------
238
239 if (.not. this%IsActivated()) return
240
241 log_progress(*) 'atmosphere / physics / cumulus parameterization'
242
243 call model_mesh%GetModelMesh( mesh )
244 select type(mesh)
245 class is (meshbase3d)
246 mesh3d => mesh
247 end select
248
249 !-
250 if ( is_update ) then
251 call prof_rapstart( 'ATM_CP_tendency', 2)
252 do n=1, mesh3d%LOCAL_MESH_NUM
254 mesh, prgvars_list, auxvars_list, &
255 ddens, momx, momy, momz, drhot, &
256 dens_hyd, pres_hyd, rtot, cvtot, cptot, &
257 lcmesh )
258
260 mesh, auxvars_list, &
261 pres, pt )
262
264 mesh, trcvars_list, forcing_list, &
265 qv )
266
268 mesh, this%vars%tends_manager, &
269 cp_dens_t, cp_rhot_t, cp_rhoqv_t )
270
271 select case( this%CP_TYPEID )
274 cp_dens_t%val, cp_rhot_t%val, cp_rhoqv_t%val, & ! (out)
275 this%vars%auxvars2D(sflx_rain_id)%local(n)%val, & ! (out)
276 this%vars%auxvars2D(sflx_engi_id)%local(n)%val, & ! (out)
277 ddens%val, drhot%val, qv%val, pt%val, pres%val, & ! (in)
278 dens_hyd%val, rtot%val, cptot%val, this%dtsec, & ! (in)
279 lcmesh, lcmesh%refElem3D, this%v_elem1D ) ! (in)
280 end select
281 end do
282
283 call prof_rapend( 'ATM_CP_tendency', 2)
284 end if
285
286 call prof_rapstart('ATM_PHY_CP_add_tend', 2)
287 do n=1, mesh%LOCAL_MESH_NUM
289 mesh, forcing_list, &
290 dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, &
291 rhoh_p )
292
294 mesh, trcvars_list, forcing_list, &
295 qv, rhoq_tp )
296
298 mesh, this%vars%tends_manager, &
299 cp_dens_t, cp_rhot_t, cp_rhoqv_t, &
300 lcmesh )
301
302 !$omp parallel private(ke)
303 !$omp do
304 do ke=lcmesh%NeS, lcmesh%NeE
305 dens_tp%val(:,ke) = dens_tp%val(:,ke) + cp_dens_t%val(:,ke)
306 rhot_tp%val(:,ke) = rhot_tp%val(:,ke) + cp_rhot_t%val(:,ke)
307 rhoq_tp%val(:,ke) = rhoq_tp%val(:,ke) + cp_rhoqv_t%val(:,ke)
308 end do
309 !$omp end parallel
310 end do
311 call prof_rapend('ATM_PHY_CP_add_tend', 2)
312
313 return
314 end subroutine atmosphycp_calc_tendency
315
316!> Update variables in a component of cumulus parameterization in atmospheric model
317!!
318!! @param model_mesh Object to manage computational mesh of atmospheric model
319!! @param prgvars_list Object to manage prognostic variables with atmospheric dynamical core
320!! @param trcvars_list Object to manage auxiliary variables
321!! @param forcing_list Object to manage forcing terms
322!! @param is_update Flag to speicfy whether the tendencies are updated in this call
323!!
324!OCL SERIAL
325 subroutine atmosphycp_update( this, model_mesh, &
326 prgvars_list, trcvars_list, &
327 auxvars_list, forcing_list, is_update )
328
329 implicit none
330 class(atmosphycp), intent(inout) :: this
331 class(modelmeshbase), intent(in) :: model_mesh
332 class(modelvarmanager), intent(inout) :: prgvars_list
333 class(modelvarmanager), intent(inout) :: trcvars_list
334 class(modelvarmanager), intent(inout) :: auxvars_list
335 class(modelvarmanager), intent(inout) :: forcing_list
336 logical, intent(in) :: is_update
337 !--------------------------------------------------
338 return
339 end subroutine atmosphycp_update
340
341!> Finalize a component of cumulus parameterization in atmospheric model
342!!
343!OCL SERIAL
344 subroutine atmosphycp_finalize( this )
347 implicit none
348 class(atmosphycp), intent(inout) :: this
349
350 !--------------------------------------------------
351 if (.not. this%IsActivated()) return
352
353 select case ( this%CP_TYPEID )
356 end select
357
358 call this%vars%Final()
359 call this%v_elem1D%Final()
360 return
361 end subroutine atmosphycp_finalize
362
363!- private ------------------------------------------------
364
365end module mod_atmos_phy_cp
module Atmosphere / Mesh
module Atmosphere / Physics / Cumulus Parameterization
integer, parameter, public atmos_phy_cp_aux2d_sflx_engi_id
subroutine, public atmosphycpvars_getlocalmeshfields_tend(domid, mesh, bl_tends_list, cp_dens_t, cp_rhot_t, cp_rhoqv_t, lcmesh3d)
integer, parameter, public atmos_phy_cp_aux2d_sflx_rain_id
module Atmosphere / Physics / Cumulus Parameterization
integer, parameter cp_typeid_mconv_adjustment
Type ID of a moist convective adjustment 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)
subroutine, public atmosvars_getlocalmeshqtrc_qv(domid, mesh, trcvars_list, forcing_list, var, var_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 / Atmosphere / Physics cumulus parameterization
subroutine, public atm_phy_cp_dgm_mconv_adjustment_calc_tendency(dens_t, rhot_t, rhoqv_t, sflx_rain, sflx_engi, ddens, drhot, qv, pt, pres, dens_hyd, rtot, cptot, dtsec, lmesh, elem, elem1d)
Calculate tendencies with moist convective adjustment scheme.
subroutine, public atm_phy_cp_dgm_mconv_adjustment_setup()
Setup a module for moist convective adjustment scheme.
subroutine, public atm_phy_cp_dgm_mconv_adjustment_finalize()
Finalize a module for moist convective adjustment scheme.
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 cumulus parameterization in atmospheric model.
Derived type to manage variables with cumulus parameterization component in atmospheric model.
Derived type to manage a set of variables (prognostic variables, tracer variables,...
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)