FE-Project
Loading...
Searching...
No Matches
mod_atmos_phy_mp.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Atmosphere / Physics / cloud microphysics
3!!
4!! @par Description
5!! Module for cloud microphysics
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 use scale_tracer, only: qa
24
25 use scale_sparsemat, only: sparsemat
27
28 use scale_mesh_base, only: meshbase
31
37
38 use scale_meshfield_base, only: &
40 use scale_localmeshfield_base, only: &
42
43 use scale_model_mesh_manager, only: modelmeshbase
46
48
49
50 !-----------------------------------------------------------------------------
51 implicit none
52 private
53 !-----------------------------------------------------------------------------
54 !
55 !++ Public type & procedure
56 !
57
58 !> Derived type to manage a component of cloud microphysics
59 !!
60 type, extends(modelcomponentproc), public :: atmosphymp
61 integer :: mp_typeid !< Type id of cloud microphysics scheme
62 type(atmosphympvars) :: vars !< Object to manage variables with cloud microphysics
63
64 logical, private :: do_precipitation !< Apply sedimentation (precipitation)?
65 logical, private :: do_negative_fixer !< Apply negative fixer?
66 real(rp), private :: limit_negative !< Abort if abs(fixed negative value) > abs(MP_limit_negative)
67 integer, private :: ntmax_sedimentation !< Number of time step for sedimentation
68 real(rp), private :: max_term_vel !< Terminal velocity for calculate dt of sedimentation
69 real(rp), private :: cldfrac_thleshold !< Threshold for cloud fraction
70
71 real(dp), private :: dtsec !< Timestep with cloud microphysics component
72 integer, private :: nstep_sedmientation
73 real(rp), private :: rnstep_sedmientation
74 real(dp), private :: dtsec_sedmientation
75
76 type(sparsemat) :: dz, lift
77 type(hexahedralelement) :: elem
78 contains
79 procedure, public :: setup => atmosphymp_setup
80 procedure, public :: calc_tendency => atmosphymp_calc_tendency
81 procedure, public :: update => atmosphymp_update
82 procedure, public :: finalize => atmosphymp_finalize
83 procedure, private :: calc_tendency_core => atmosphymp_calc_tendency_core
84 end type atmosphymp
85
86 !-----------------------------------------------------------------------------
87 !++ Public parameters & variables
88 !-----------------------------------------------------------------------------
89
90 integer, parameter :: mp_typeid_kessler = 1
91 integer, parameter :: mp_typeid_tomita08 = 2
92 integer, parameter :: mp_typeid_sn14 = 3
93
94 !-----------------------------------------------------------------------------
95 !
96 !++ Private procedure
97 !
98 !-----------------------------------------------------------------------------
99 !
100 !++ Private parameters & variables
101 !
102 !-----------------------------------------------------------------------------
103
104 logical :: flag_lt = .false. ! Tentative
105
106contains
107
108!> Setup a component of cloud microphysics
109!!
110!! @param model_mesh Object to manage computational mesh of atmospheric model
111!! @param tm_parent_comp Object to mange a temporal scheme in a parent component
112!!
113 subroutine atmosphymp_setup( this, model_mesh, tm_parent_comp )
114 use scale_const, only: &
115 eps => const_eps
116 use scale_tracer, only: &
117 tracer_regist
118 use scale_atmos_hydrometeor, only: &
119 atmos_hydrometeor_regist
120 use scale_atmos_phy_mp_kessler, only: &
121 atmos_phy_mp_kessler_setup, &
122 atmos_phy_mp_kessler_ntracers, &
123 atmos_phy_mp_kessler_nwaters, &
124 atmos_phy_mp_kessler_nices, &
125 atmos_phy_mp_kessler_tracer_names, &
126 atmos_phy_mp_kessler_tracer_descriptions, &
127 atmos_phy_mp_kessler_tracer_units
128 use scale_atmos_phy_mp_tomita08, only: &
129 atmos_phy_mp_tomita08_setup, &
130 atmos_phy_mp_tomita08_ntracers, &
131 atmos_phy_mp_tomita08_nwaters, &
132 atmos_phy_mp_tomita08_nices, &
133 atmos_phy_mp_tomita08_tracer_names, &
134 atmos_phy_mp_tomita08_tracer_descriptions, &
135 atmos_phy_mp_tomita08_tracer_units
136 use scale_atmos_phy_mp_sn14, only: &
137 atmos_phy_mp_sn14_setup, &
138 atmos_phy_mp_sn14_ntracers, &
139 atmos_phy_mp_sn14_nwaters, &
140 atmos_phy_mp_sn14_nices, &
141 atmos_phy_mp_sn14_tracer_names, &
142 atmos_phy_mp_sn14_tracer_descriptions, &
143 atmos_phy_mp_sn14_tracer_units
144 !------------------------------
146 use mod_atmos_mesh, only: atmosmesh
147
148 implicit none
149 class(atmosphymp), intent(inout) :: this
150 class(modelmeshbase), target, intent(in) :: model_mesh
151 class(time_manager_component), intent(inout) :: tm_parent_comp
152
153 real(dp) :: time_dt = undef8 !< Timestep for cloud microcloud physics
154 character(len=H_SHORT) :: time_dt_unit = 'SEC' !< Unit of timestep
155
156 character(len=H_MID) :: mp_type = 'KESSLER' !< Type of cloud microcloud physics scheme
157
158 logical :: do_precipitation !< Flag whether sedimentation (precipitation) is applied
159 logical :: do_negative_fixer !< Flag whether negative fixer is applied
160 real(rp) :: limit_negative
161 integer :: ntmax_sedimentation
162 real(rp) :: max_term_vel
163 real(rp) :: cldfrac_thleshold
164
165 namelist /param_atmos_phy_mp/ &
166 time_dt, &
167 time_dt_unit, &
168 mp_type, &
169 do_precipitation, &
170 do_negative_fixer, &
171 limit_negative, &
172 ntmax_sedimentation, &
173 max_term_vel, &
174 cldfrac_thleshold
175
176 class(atmosmesh), pointer :: atm_mesh
177 class(meshbase), pointer :: ptr_mesh
178 class(localmesh3d), pointer :: lcmesh3d
179 class(elementbase3d), pointer :: elem3d
180
181 integer :: ierr
182
183 integer :: qs_mp, qe_mp, qa_mp
184 integer :: qs2
185
186 integer :: nstep_max
187 !--------------------------------------------------
188
189 if (.not. this%IsActivated()) return
190
191 log_newline
192 log_info("ATMOS_PHY_MP_setup",*) 'Setup'
193
194 cldfrac_thleshold = eps
195
196 do_precipitation = .true.
197 do_negative_fixer = .true.
198 limit_negative = 0.1_rp
199 ntmax_sedimentation = 1
200 max_term_vel = 10.0_rp
201
202 !--- read namelist
203 rewind(io_fid_conf)
204 read(io_fid_conf,nml=param_atmos_phy_mp,iostat=ierr)
205 if( ierr < 0 ) then !--- missing
206 log_info("ATMOS_PHY_MP_setup",*) 'Not found namelist. Default used.'
207 elseif( ierr > 0 ) then !--- fatal error
208 log_error("ATMOS_PHY_MP_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_PHY_MP. Check!'
209 call prc_abort
210 endif
211 log_nml(param_atmos_phy_mp)
212
213 this%cldfrac_thleshold = cldfrac_thleshold
214 this%do_precipitation = do_precipitation
215 this%do_negative_fixer = do_negative_fixer
216 this%ntmax_sedimentation = ntmax_sedimentation
217 this%max_term_vel = max_term_vel
218
219 log_newline
220 log_info("ATMOS_PHY_MP_setup",*) 'Enable negative fixer? : ', this%do_negative_fixer
221 log_info("ATMOS_PHY_MP_setup",*) 'Value limit of negative fixer (abs) : ', abs(this%limit_negative)
222 log_info("ATMOS_PHY_MP_setup",*) 'Enable sedimentation (precipitation)? : ', this%do_precipitation
223
224 !- get mesh --------------------------------------------------
225
226 call model_mesh%GetModelMesh( ptr_mesh )
227 select type(model_mesh)
228 class is (atmosmesh)
229 atm_mesh => model_mesh
230 end select
231
232 !--- Register this component in the time manager
233
234 call tm_parent_comp%Regist_process( 'ATMOS_PHY_MP', time_dt, time_dt_unit, & ! (in)
235 this%tm_process_id ) ! (out)
236
237 this%dtsec = tm_parent_comp%process_list(this%tm_process_id)%dtsec
238 nstep_max = 0 ! ceiling( this%dtsec * this%max_term_vel / maxval( CDZ) )
239 this%ntmax_sedimentation = max( ntmax_sedimentation, nstep_max )
240
241 this%nstep_sedmientation = ntmax_sedimentation
242 this%rnstep_sedmientation = 1.0_rp / real(ntmax_sedimentation,kind=rp)
243 this%dtsec_sedmientation = this%dtsec * this%rnstep_sedmientation
244
245 log_newline
246 log_info("ATMOS_PHY_MP_setup",*) 'Enable negative fixer? : ', this%do_negative_fixer
247 !LOG_INFO("ATMOS_PHY_MP_setup",*) 'Value limit of negative fixer (abs) : ', abs(MP_limit_negative)
248 log_info("ATMOS_PHY_MP_setup",*) 'Enable sedimentation (precipitation)? : ', this%do_precipitation
249 log_info("ATMOS_PHY_MP_setup",*) 'Timestep of sedimentation is divided into : ', this%ntmax_sedimentation, 'step'
250 log_info("ATMOS_PHY_MP_setup",*) 'DT of sedimentation : ', this%dtsec_sedmientation, '[s]'
251
252 !--- Set the type of microphysics scheme
253
254 select case( mp_type )
255 case ('KESSLER')
256 this%MP_TYPEID = mp_typeid_kessler
257 call atmos_hydrometeor_regist( &
258 atmos_phy_mp_kessler_nwaters, & ! (in)
259 atmos_phy_mp_kessler_nices, & ! (in)
260 atmos_phy_mp_kessler_tracer_names(:), & ! (in)
261 atmos_phy_mp_kessler_tracer_descriptions(:), & ! (in)
262 atmos_phy_mp_kessler_tracer_units(:), & ! (in)
263 qs_mp ) ! (out)
264 qa_mp = atmos_phy_mp_kessler_ntracers
265 case ( 'TOMITA08' )
266 this%MP_TYPEID = mp_typeid_tomita08
267 call atmos_hydrometeor_regist( &
268 atmos_phy_mp_tomita08_nwaters, & ! (in)
269 atmos_phy_mp_tomita08_nices, & ! (in)
270 atmos_phy_mp_tomita08_tracer_names(:), & ! (in)
271 atmos_phy_mp_tomita08_tracer_descriptions(:), & ! (in)
272 atmos_phy_mp_tomita08_tracer_units(:), & ! (in)
273 qs_mp ) ! (out)
274 qa_mp = atmos_phy_mp_tomita08_ntracers
275 ! case( 'SN14' )
276 ! this%MP_TYPEID = MP_TYPEID_SN14
277 ! call ATMOS_HYDROMETEOR_regist( &
278 ! ATMOS_PHY_MP_SN14_nwaters, & ! (in)
279 ! ATMOS_PHY_MP_SN14_nices, & ! (in)
280 ! ATMOS_PHY_MP_SN14_tracer_names(1:6), & ! (in)
281 ! ATMOS_PHY_MP_SN14_tracer_descriptions(1:6), & ! (in)
282 ! ATMOS_PHY_MP_SN14_tracer_units(1:6), & ! (in)
283 ! QS_MP ) ! (out)
284
285 ! call TRACER_regist( QS2, & ! (out)
286 ! 5, & ! (in)
287 ! ATMOS_PHY_MP_SN14_tracer_names(7:11), & ! (in)
288 ! ATMOS_PHY_MP_SN14_tracer_descriptions(7:11), & ! (in)
289 ! ATMOS_PHY_MP_SN14_tracer_units(7:11) ) ! (in)
290 ! QA_MP = ATMOS_PHY_MP_SN14_ntracers
291 case default
292 log_error("ATMOS_PHY_MP_setup",*) 'Not appropriate names of MP_TYPE in namelist PARAM_ATMOS_PHY_MP. Check!'
293 call prc_abort
294 end select
295
296 qe_mp = qs_mp + qa_mp - 1
297
298 !- initialize the variables
299 call this%vars%Init( model_mesh, qs_mp, qe_mp, qa_mp )
300
301 !- Setup a module for microcloud physics
302
303 select case( this%MP_TYPEID )
304 case( mp_typeid_kessler )
305 call atmos_phy_mp_kessler_setup()
306 case( mp_typeid_tomita08 )
307 lcmesh3d => atm_mesh%ptr_mesh%lcmesh_list(1)
308 elem3d => lcmesh3d%refElem3D
309 call atmos_phy_mp_tomita08_setup( &
310 elem3d%Nnode_v*lcmesh3d%NeZ, 1, elem3d%Nnode_v*lcmesh3d%NeZ, elem3d%Nnode_h1D**2, 1, elem3d%Nnode_h1D**2, lcmesh3d%Ne2D, 1, lcmesh3d%Ne2D, &
311 flag_lt )
312 case( mp_typeid_sn14 )
313 end select
314
315 !
316 call this%elem%Init( atm_mesh%ptr_mesh%refElem3D%PolyOrder_h, atm_mesh%ptr_mesh%refElem3D%PolyOrder_v, .true. )
317 call this%Dz%Init( this%elem%Dx3, storage_format='ELL' )
318 call this%Lift%Init( this%elem%Lift, storage_format='ELL' )
319
320 return
321 end subroutine atmosphymp_setup
322
323!> Calculate tendencies associated with cloud microphysics
324!!
325!!
326!! @param model_mesh a object to manage computational mesh of atmospheric model
327!! @param prgvars_list a object to mange prognostic variables with atmospheric dynamical core
328!! @param trcvars_list a object to mange auxiliary variables
329!! @param forcing_list a object to mange forcing terms
330!! @param is_update Flag to speicfy whether the tendencies are updated in this call
331!!
332!OCL SERIAL
333 subroutine atmosphymp_calc_tendency( &
334 this, model_mesh, prgvars_list, trcvars_list, &
335 auxvars_list, forcing_list, is_update )
336
337 use mod_atmos_vars, only: &
342 use mod_atmos_phy_mp_vars, only: &
345
346 implicit none
347
348 class(atmosphymp), intent(inout) :: this
349 class(modelmeshbase), intent(in) :: model_mesh
350 class(modelvarmanager), intent(inout) :: prgvars_list
351 class(modelvarmanager), intent(inout) :: trcvars_list
352 class(modelvarmanager), intent(inout) :: auxvars_list
353 class(modelvarmanager), intent(inout) :: forcing_list
354 logical, intent(in) :: is_update
355
356 class(meshbase), pointer :: mesh
357 class(localmesh3d), pointer :: lcmesh
358
359 class(localmeshfieldbase), pointer :: ddens, momx, momy, momz, drhot
360 class(localmeshfieldbase), pointer :: rtot, cvtot, cptot
361 type(localmeshfieldbaselist) :: qtrc(this%vars%qs:this%vars%qe)
362 class(localmeshfieldbase), pointer :: dens_hyd, pres_hyd
363 class(localmeshfieldbase), pointer :: pres, pt
364 class(localmeshfieldbase), pointer :: dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, rhoh_p
365 type(localmeshfieldbaselist) :: rhoq_tp(qa)
366 class(localmeshfieldbase), pointer :: mp_dens_t, mp_momx_t, mp_momy_t, mp_momz_t, mp_rhot_t, mp_rhoh, mp_evap
367 type(localmeshfieldbaselist) :: mp_rhoq_t(this%vars%qs:this%vars%qe)
368 class(localmeshfieldbase), pointer :: sflx_rain, sflx_snow, sflx_engi
369
370 integer :: n
371 integer :: ke
372 integer :: iq
373 !--------------------------------------------------
374
375 if (.not. this%IsActivated()) return
376
377 log_progress(*) 'atmosphere / physics / cloud microphysics'
378
379 call model_mesh%GetModelMesh( mesh )
380
381 do n=1, mesh%LOCAL_MESH_NUM
382 call prof_rapstart('ATM_PHY_MP_get_localmesh_ptr', 2)
384 mesh, prgvars_list, auxvars_list, &
385 ddens, momx, momy, momz, drhot, &
386 dens_hyd, pres_hyd, rtot, cvtot, cptot, &
387 lcmesh )
388
390 mesh, trcvars_list, this%vars%QS, qtrc(:) )
391
393 mesh, auxvars_list, &
394 pres, pt )
395
397 mesh, forcing_list, &
398 dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, &
399 rhoh_p, rhoq_tp )
400
402 mesh, this%vars%tends_manager, &
403 mp_dens_t, mp_momx_t, mp_momy_t, mp_momz_t, mp_rhot_t, mp_rhoh, mp_evap, &
404 mp_rhoq_t )
405
407 mesh, this%vars%auxvars2D_manager, &
408 sflx_rain, sflx_snow, sflx_engi )
409
410 call prof_rapend('ATM_PHY_MP_get_localmesh_ptr', 2)
411
412 call prof_rapstart('ATM_PHY_MP_cal_tend', 2)
413 if (is_update) then
414 call this%calc_tendency_core( &
415 mp_dens_t%val, mp_momx_t%val, mp_momy_t%val, mp_momz_t%val, mp_rhoq_t, & ! (out)
416 mp_rhoh%val, mp_evap%val, sflx_rain%val, sflx_snow%val, sflx_engi%val, & ! (out)
417 ddens%val, momx%val, momy%val, momz%val, pt%val, qtrc, & ! (in)
418 pres%val, pres_hyd%val, dens_hyd%val, rtot%val, cvtot%val, cptot%val, & ! (in)
419 model_mesh%DOptrMat(3), model_mesh%LiftOptrMat, & ! (in)
420 lcmesh, lcmesh%refElem3D, lcmesh%lcmesh2D, lcmesh%lcmesh2D%refElem2D ) ! (in)
421 end if
422
423 !$omp parallel private(ke, iq)
424 !$omp do
425 do ke = lcmesh%NeS, lcmesh%NeE
426 dens_tp%val(:,ke) = dens_tp%val(:,ke) + mp_dens_t%val(:,ke)
427 momx_tp%val(:,ke) = momx_tp%val(:,ke) + mp_momx_t%val(:,ke)
428 momy_tp%val(:,ke) = momy_tp%val(:,ke) + mp_momy_t%val(:,ke)
429 momz_tp%val(:,ke) = momz_tp%val(:,ke) + mp_momz_t%val(:,ke)
430 rhoh_p %val(:,ke) = rhoh_p %val(:,ke) + mp_rhoh %val(:,ke)
431 end do
432 !$omp end do
433 !$omp do collapse(2)
434 do iq = this%vars%QS, this%vars%QE
435 do ke = lcmesh%NeS, lcmesh%NeE
436 rhoq_tp(iq)%ptr%val(:,ke) = rhoq_tp(iq)%ptr%val(:,ke) &
437 + mp_rhoq_t(iq)%ptr%val(:,ke)
438 end do
439 end do
440 !$omp end do
441 !$omp end parallel
442
443 call prof_rapend('ATM_PHY_MP_cal_tend', 2)
444 end do
445
446 return
447 end subroutine atmosphymp_calc_tendency
448
449!> Update variables in a component of cloud microphysics
450!!
451!! @param model_mesh a object to manage computational mesh of atmospheric model
452!! @param prgvars_list a object to mange prognostic variables with atmospheric dynamical core
453!! @param trcvars_list a object to mange auxiliary variables
454!! @param forcing_list a object to mange forcing terms
455!! @param is_update Flag to speicfy whether the tendencies are updated in this call
456!!
457!OCL SERIAL
458 subroutine atmosphymp_update( this, model_mesh, &
459 prgvars_list, trcvars_list, &
460 auxvars_list, forcing_list, is_update )
461
462 implicit none
463 class(atmosphymp), intent(inout) :: this
464 class(modelmeshbase), intent(in) :: model_mesh
465 class(modelvarmanager), intent(inout) :: prgvars_list
466 class(modelvarmanager), intent(inout) :: trcvars_list
467 class(modelvarmanager), intent(inout) :: auxvars_list
468 class(modelvarmanager), intent(inout) :: forcing_list
469 logical, intent(in) :: is_update
470 !--------------------------------------------------
471
472 return
473 end subroutine atmosphymp_update
474
475!> Finalize a component of cloud microphysics
476!!
477!OCL SERIAL
478 subroutine atmosphymp_finalize( this )
479 implicit none
480 class(atmosphymp), intent(inout) :: this
481
482 !--------------------------------------------------
483 if (.not. this%IsActivated()) return
484
485 select case ( this%MP_TYPEID )
486 case( mp_typeid_kessler )
487 end select
488
489 call this%vars%Final()
490
491 return
492 end subroutine atmosphymp_finalize
493
494!- private ------------------------------------------------
495
496!OCL SERIAL
497 subroutine atmosphymp_calc_tendency_core( this, &
498 DENS_t_MP, RHOU_t_MP, RHOV_t_MP, MOMZ_t_MP, RHOQ_t_MP, & ! (out)
499 rhoh_mp, evaporate, sflx_rain, sflx_snow, sflx_engi, & ! (out)
500 ddens, rhou, rhov, momz, pt, qtrc, & ! (in)
501 pres, pres_hyd, dens_hyd, rtot, cvtot, cptot, & ! (in)
502 dz, lift, & ! (in)
503 lcmesh, elem3d, lcmesh2d, elem2d ) ! (in)
504
505 use scale_const, only: &
506 pre00 => const_pre00
507 use scale_const, only: &
508 cvdry => const_cvdry, &
509 cpdry => const_cpdry
510 use scale_atmos_hydrometeor, only: &
511 lhf, &
512 qha, qla, qia
513 use scale_atmos_phy_mp_kessler, only: &
514 atmos_phy_mp_kessler_terminal_velocity
515 use scale_atmos_phy_mp_tomita08, only: &
516 atmos_phy_mp_tomita08_terminal_velocity
517 use scale_atmos_phy_mp_sn14, only: &
518 atmos_phy_mp_sn14_tendency, &
519 atmos_phy_mp_sn14_terminal_velocity
520 use scale_sparsemat, only: sparsemat
521 use scale_atm_phy_mp_dgm_common, only: &
525
526 implicit none
527
528 class(atmosphymp), intent(inout) :: this
529 class(localmesh3d), intent(in) :: lcmesh
530 class(elementbase3d), intent(in) :: elem3d
531 class(localmesh2d), intent(in) :: lcmesh2d
532 class(elementbase2d), intent(in) :: elem2d
533 real(rp), intent(out) :: dens_t_mp(elem3d%np,lcmesh%nea)
534 real(rp), intent(out) :: rhou_t_mp(elem3d%np,lcmesh%nea)
535 real(rp), intent(out) :: rhov_t_mp(elem3d%np,lcmesh%nea)
536 real(rp), intent(out) :: momz_t_mp(elem3d%np,lcmesh%nea)
537 type(localmeshfieldbaselist), intent(inout) :: rhoq_t_mp(this%vars%qs:this%vars%qe)
538 real(rp), intent(out) :: rhoh_mp(elem3d%np,lcmesh%nea)
539 real(rp), intent(out) :: evaporate(elem3d%np,lcmesh%nea)
540 real(rp), intent(out) :: sflx_rain(elem2d%np,lcmesh2d%nea)
541 real(rp), intent(out) :: sflx_snow(elem2d%np,lcmesh2d%nea)
542 real(rp), intent(out) :: sflx_engi(elem2d%np,lcmesh2d%nea)
543 real(rp), intent(in) :: ddens(elem3d%np,lcmesh%nea)
544 real(rp), intent(in) :: rhou(elem3d%np,lcmesh%nea)
545 real(rp), intent(in) :: rhov(elem3d%np,lcmesh%nea)
546 real(rp), intent(in) :: momz(elem3d%np,lcmesh%nea)
547 real(rp), intent(in) :: pt (elem3d%np,lcmesh%nea)
548 type(localmeshfieldbaselist), intent(in) :: qtrc(this%vars%qs:this%vars%qe)
549 real(rp), intent(in) :: pres(elem3d%np,lcmesh%nea)
550 real(rp), intent(in) :: pres_hyd(elem3d%np,lcmesh%nea)
551 real(rp), intent(in) :: dens_hyd(elem3d%np,lcmesh%nea)
552 real(rp), intent(in) :: rtot (elem3d%np,lcmesh%nea)
553 real(rp), intent(in) :: cvtot(elem3d%np,lcmesh%nea)
554 real(rp), intent(in) :: cptot(elem3d%np,lcmesh%nea)
555 class(sparsemat), intent(in) :: dz
556 class(sparsemat), intent(in) :: lift
557
558 real(rp) :: dens (elem3d%np,lcmesh%nea)
559
560 real(rp) :: rhoe_t(elem3d%np,lcmesh%nea)
561
562 real(rp) :: cptot_t(elem3d%np,lcmesh%nea)
563 real(rp) :: cvtot_t(elem3d%np,lcmesh%nea)
564
565 real(rp) :: vterm(elem3d%np,lcmesh%nez,lcmesh%ne2d,this%vars%qs+1:this%vars%qe)
566 real(rp) :: dens0(elem3d%np,lcmesh%nez,lcmesh%ne2d)
567 real(rp) :: dens2(elem3d%np,lcmesh%nez,lcmesh%ne2d)
568 real(rp) :: ref_dens(elem3d%np,lcmesh%nez,lcmesh%ne2d)
569 real(rp) :: rhou2(elem3d%np,lcmesh%nez,lcmesh%ne2d)
570 real(rp) :: rhov2(elem3d%np,lcmesh%nez,lcmesh%ne2d)
571 real(rp) :: momz2(elem3d%np,lcmesh%nez,lcmesh%ne2d)
572 real(rp) :: temp2(elem3d%np,lcmesh%nez,lcmesh%ne2d)
573 real(rp) :: pres2(elem3d%np,lcmesh%nez,lcmesh%ne2d)
574 real(rp) :: cptot2(elem3d%np,lcmesh%nez,lcmesh%ne2d)
575 real(rp) :: cvtot2(elem3d%np,lcmesh%nez,lcmesh%ne2d)
576 real(rp) :: rhoe (elem3d%np,lcmesh%nez,lcmesh%ne2d)
577 real(rp) :: rhoe2(elem3d%np,lcmesh%nez,lcmesh%ne2d)
578 real(rp) :: rhoq (elem3d%np,lcmesh%nez,lcmesh%ne2d,this%vars%qs+1:this%vars%qe)
579 real(rp) :: rhoq2(elem3d%np,lcmesh%nez,lcmesh%ne2d,this%vars%qs+1:this%vars%qe)
580 real(rp) :: rhoq2_tmp(elem3d%nnode_v,lcmesh%nez,this%vars%qs+1:this%vars%qe)
581 real(rp) :: dens2_tmp(elem3d%nnode_v,lcmesh%nez)
582 real(rp) :: temp2_tmp(elem3d%nnode_v,lcmesh%nez)
583 real(rp) :: pres2_tmp(elem3d%nnode_v,lcmesh%nez)
584 real(rp) :: ref_dens_tmp(elem3d%nnode_v,lcmesh%nez)
585 real(rp) :: vterm_tmp(elem3d%nnode_v,lcmesh%nez,this%vars%qs+1:this%vars%qe)
586 real(rp) :: flx_hydro(elem3d%np,lcmesh%nez,lcmesh%ne2d)
587 real(rp) :: cp_t(elem3d%np), cv_t(elem3d%np)
588
589 integer :: iq
590 integer :: domid
591 integer :: ke
592 integer :: ke2d, ke_z
593 integer :: p2d, pv1d, p
594 integer :: colmask(elem3d%nnode_v)
595
596 integer :: step
597 real(rp) :: rdt_mp
598
599 integer :: vmapm(elem3d%nfptot,lcmesh%nez)
600 integer :: vmapp(elem3d%nfptot,lcmesh%nez)
601 real(rp) :: intweight(elem3d%nfaces,elem3d%nfptot)
602 real(rp) :: nz(elem3d%nfptot,lcmesh%nez,lcmesh%ne2d)
603 !----------------------------------------------
604
605 rdt_mp = 1.0_rp / this%dtsec
606 domid = lcmesh%lcdomID
607
608 call lcmesh%GetVmapZ1D( vmapm, vmapp ) ! (out)
609
610 call atm_phy_mp_dgm_common_gen_intweight( intweight, & ! (out)
611 lcmesh ) ! (in)
612
613 !$omp parallel do private(ke)
614 do ke = lcmesh%NeS, lcmesh%NeE
615 dens(:,ke) = dens_hyd(:,ke) + ddens(:,ke)
616 end do
617
618 select case( this%MP_TYPEID )
619 case( mp_typeid_kessler )
620 call calc_tendency_kessler( this, &
621 rhoq_t_mp, cptot_t, cvtot_t, rhoe_t, evaporate, & ! (out)
622 dens, qtrc, pres, dens_hyd, rtot, cvtot, cptot, & ! (in)
623 rdt_mp, lcmesh, elem3d ) ! (in)
624
625 case( mp_typeid_tomita08 )
626 call calc_tendency_tomita08( this, &
627 rhoq_t_mp, cptot_t, cvtot_t, rhoe_t, evaporate, & ! (out)
628 dens, qtrc, pres, dens_hyd, rtot, cvtot, cptot, & ! (in)
629 rdt_mp, lcmesh, elem3d ) ! (in)
630
631 case( mp_typeid_sn14 )
632 call calc_tendency_sn14( this, &
633 rhoq_t_mp, cptot_t, cvtot_t, rhoe_t, evaporate, & ! (out)
634 dens, qtrc, pres, dens_hyd, rtot, cvtot, cptot, & ! (in)
635 rdt_mp, lcmesh, elem3d ) ! (in)
636
637 end select
638
639 !$omp parallel do
640 do ke = lcmesh%NeS, lcmesh%NeE
641 rhoh_mp(:,ke) = rhoe_t(:,ke) &
642 - ( cptot_t(:,ke) + log( pres(:,ke) / pre00 ) * ( cvtot(:,ke) / cptot(:,ke) * cptot_t(:,ke) - cvtot_t(:,ke) ) ) &
643 * pres(:,ke) / rtot(:,ke)
644 end do
645
646 if ( this%do_precipitation ) then
647
648 !$omp parallel private(ke,ke2D,ke_z,iq)
649 !$omp do collapse(2)
650 do ke2d = 1, lcmesh%Ne2D
651 do ke_z = 1, lcmesh%NeZ
652 ke = ke2d + (ke_z-1)*lcmesh%Ne2D
653
654 dens0(:,ke_z,ke2d) = dens(:,ke)
655 dens2(:,ke_z,ke2d) = dens(:,ke)
656 ref_dens(:,ke_z,ke2d) = dens_hyd(:,ke)
657 rhou2(:,ke_z,ke2d) = rhou(:,ke)
658 rhov2(:,ke_z,ke2d) = rhov(:,ke)
659 momz2(:,ke_z,ke2d) = momz(:,ke)
660 temp2(:,ke_z,ke2d) = pres(:,ke) / ( dens(:,ke) * rtot(:,ke) )
661 pres2(:,ke_z,ke2d) = pres(:,ke)
662 cptot2(:,ke_z,ke2d) = cptot(:,ke)
663 cvtot2(:,ke_z,ke2d) = cvtot(:,ke)
664 rhoe(:,ke_z,ke2d) = temp2(:,ke_z,ke2d) * cvtot(:,ke) * dens(:,ke)
665 rhoe2(:,ke_z,ke2d) = rhoe(:,ke_z,ke2d)
666
667 nz(:,ke_z,ke2d) = lcmesh%normal_fn(:,ke,3)
668
669 flx_hydro(:,ke_z,ke2d) = 0.0_rp
670 end do
671 end do
672 !$omp end do
673 !$omp do collapse(3)
674 do iq = this%vars%QS+1, this%vars%QE
675 do ke2d = 1, lcmesh%Ne2D
676 do ke_z = 1, lcmesh%NeZ
677 ke = ke2d + (ke_z-1)*lcmesh%Ne2D
678 rhoq(:,ke_z,ke2d,iq) = dens2(:,ke_z,ke2d) * qtrc(iq)%ptr%val(:,ke) &
679 + rhoq_t_mp(iq)%ptr%val(:,ke) * this%dtsec
680 rhoq2(:,ke_z,ke2d,iq) = rhoq(:,ke_z,ke2d,iq)
681 end do
682 end do
683 end do
684 !$omp end do
685 !$omp workshare
686 sflx_rain(:,:) = 0.0_rp
687 sflx_snow(:,:) = 0.0_rp
688 sflx_engi(:,:) = 0.0_rp
689 !$omp end workshare
690 !$omp end parallel
691
692 do iq = this%vars%QS+1, this%vars%QE
693 if ( this%vars%vterm_hist_id(iq) > 0 ) then
694 !$omp parallel do
695 do ke = lcmesh%NeS, lcmesh%NeE
696 this%vars%vterm_hist(iq)%local(domid)%val(:,ke) = 0.0_rp
697 end do
698 end if
699 end do
700
701 do step = 1, this%nstep_sedmientation
702
703 !- Calculate terminal velocity
704
705 do ke2d = 1, lcmesh%Ne2D
706 !$omp parallel do private( &
707 !$omp p2D, ke_z, iq, ColMask, &
708 !$omp DENS2_tmp, REF_DENS_tmp, RHOQ2_tmp, TEMP2_tmp, PRES2_tmp, &
709 !$omp vterm_tmp )
710 do p2d = 1, elem3d%Nnode_h1D**2
711 colmask(:) = elem3d%Colmask(:,p2d)
712 do ke_z = 1, lcmesh%NeZ
713 dens2_tmp(:,ke_z) = dens2(colmask(:),ke_z,ke2d)
714 ref_dens_tmp(:,ke_z) = ref_dens(colmask(:),ke_z,ke2d)
715 temp2_tmp(:,ke_z) = temp2(colmask(:),ke_z,ke2d)
716 pres2_tmp(:,ke_z) = pres2(colmask(:),ke_z,ke2d)
717 end do
718 do iq = this%vars%QS+1, this%vars%QE
719 do ke_z = 1, lcmesh%NeZ
720 rhoq2_tmp(:,ke_z,iq) = rhoq2(colmask(:),ke_z,ke2d,iq)
721 end do
722 end do
723
724 select case( this%MP_TYPEID )
725 case( mp_typeid_kessler )
726 call atmos_phy_mp_kessler_terminal_velocity( &
727 elem3d%Nnode_v*lcmesh%NeZ, 1, elem3d%Nnode_v*lcmesh%NeZ, & ! (in)
728 dens2_tmp(:,:), rhoq2_tmp(:,:,:), ref_dens_tmp(:,:), & ! (in)
729 vterm_tmp(:,:,:) ) ! (out)
730 case( mp_typeid_tomita08 )
731 call atmos_phy_mp_tomita08_terminal_velocity( &
732 elem3d%Nnode_v*lcmesh%NeZ, 1, elem3d%Nnode_v*lcmesh%NeZ, & ! (in)
733 dens2_tmp(:,:), temp2_tmp(:,:), rhoq2_tmp(:,:,:), & ! (in)
734 vterm_tmp(:,:,:) ) ! (out)
735 case( mp_typeid_sn14 )
736 call atmos_phy_mp_sn14_terminal_velocity( &
737 elem3d%Nnode_v*lcmesh%NeZ, 1, elem3d%Nnode_v*lcmesh%NeZ, & ! (in)
738 dens2_tmp(:,:), temp2_tmp(:,:), rhoq2_tmp(:,:,:), pres2_tmp(:,:), & ! (in)
739 vterm_tmp(:,:,:) ) ! (out)
740 end select
741
742 do iq = this%vars%QS+1, this%vars%QE
743 do ke_z = 1, lcmesh%NeZ
744 vterm(colmask(:),ke_z,ke2d,iq) = vterm_tmp(:,ke_z,iq)
745 end do
746 end do
747 end do
748 end do
749
750
751 do iq = this%vars%QS+1, this%vars%QE
752 if ( this%vars%vterm_hist_id(iq) > 0 ) then
753 !$omp parallel do collapse(2) private(ke2D, ke_z, ke)
754 do ke2d = 1, lcmesh%Ne2D
755 do ke_z = 1, lcmesh%NeZ
756 ke = ke2d + (ke_z-1)*lcmesh%Ne2D
757 this%vars%vterm_hist(iq)%local(domid)%val(:,ke) = &
758 this%vars%vterm_hist(iq)%local(domid)%val(:,ke) + vterm(:,ke_z,ke2d,iq) * this%rnstep_sedmientation
759 end do
760 end do
761 end if
762 end do
763
764 !- precipiation of hydrometers
765
767 dens2, rhoq2, cptot2, cvtot2, rhoe2, & ! (inout)
768 flx_hydro, sflx_rain, sflx_snow, sflx_engi, & ! (inout)
769 temp2, vterm, & ! (in)
770 this%dtsec_sedmientation, this%rnstep_sedmientation, & ! (in)
771! Dz, Lift, nz, vmapM, vmapP, IntWeight, & ! (in)
772 this%Dz, this%Lift, nz, vmapm, vmapp, intweight, & ! (in)
773 this%vars%QE - this%vars%QS, qla, qia, & ! (in)
774 lcmesh, elem3d )
775
776 !$omp parallel do private(ke2D, ke_z, ke) collapse(2)
777 do ke2d = 1, lcmesh%Ne2D
778 do ke_z = 1, lcmesh%NeZ
779 ke = ke2d + (ke_z-1)*lcmesh%Ne2D
780 temp2(:,ke_z,ke2d) = rhoe2(:,ke_z,ke2d) / ( dens2(:,ke_z,ke2d) * cvtot2(:,ke_z,ke2d) )
781 end do
782 end do
783
784 end do ! end loop for step
785
786 !$omp parallel private(ke2D, ke_z, iq, ke, CP_t, CV_t)
787 !$omp workshare
788 sflx_engi(:,:) = sflx_engi(:,:) - sflx_snow(:,:) * lhf ! moist internal energy
789 !$omp end workshare
790 !$omp do collapse(2)
791 do ke2d = 1, lcmesh%Ne2D
792 do ke_z = 1, lcmesh%NeZ
793 ke = ke2d + (ke_z-1)*lcmesh%Ne2D
794 dens_t_mp(:,ke) = ( dens2(:,ke_z,ke2d) - dens(:,ke) ) * rdt_mp
795
796 cp_t(:) = ( cptot2(:,ke_z,ke2d) - cptot(:,ke) ) * rdt_mp
797 cv_t(:) = ( cvtot2(:,ke_z,ke2d) - cvtot(:,ke) ) * rdt_mp
798 rhoh_mp(:,ke) = rhoh_mp(:,ke) &
799 + ( rhoe2(:,ke_z,ke2d) - rhoe(:,ke_z,ke2d) ) * rdt_mp &
800 - ( cp_t(:) &
801 + log( pres(:,ke) / pre00 ) * ( cvtot(:,ke) / cptot(:,ke) * cp_t(:) - cv_t(:) ) &
802 ) * pres(:,ke) / rtot(:,ke)
803 end do
804 end do
805 !$omp end do
806 !$omp do collapse(2)
807 do iq = this%vars%QS+1, this%vars%QE
808 do ke2d = 1, lcmesh%Ne2D
809 do ke_z = 1, lcmesh%NeZ
810 ke = ke2d + (ke_z-1)*lcmesh%Ne2D
811 rhoq_t_mp(iq)%ptr%val(:,ke) = rhoq_t_mp(iq)%ptr%val(:,ke) &
812 + ( rhoq2(:,ke_z,ke2d,iq) - rhoq(:,ke_z,ke2d,iq) ) * rdt_mp
813 end do
814 end do
815 end do
816 !$omp end do
817 !$omp end parallel
818
819 !- precipiation of momentum
820
822 rhou_t_mp, rhov_t_mp, momz_t_mp, & ! (out)
823 dens0, rhou2, rhov2, momz2, flx_hydro, & ! (in)
824! Dz, Lift, nz, vmapM, vmapP, & ! (in)
825 this%Dz, this%Lift, nz, vmapm, vmapp, & ! (in)
826 lcmesh, elem3d ) ! (in)
827
828 end if ! end if do_precipitation
829
830 return
831 end subroutine atmosphymp_calc_tendency_core
832
833!OCL SERIAL
834 subroutine calc_tendency_kessler( this, &
835 RHOQ_t_MP, CPtot_t, CVtot_t, RHOE_t, EVAPORATE, & ! (out)
836 dens, qtrc, pres, dens_hyd, rtot, cvtot, cptot, & ! (in)
837 rdt_mp, lcmesh, elem3d ) ! (in)
838
839 use scale_atmos_phy_mp_kessler, only: &
840 atmos_phy_mp_kessler_adjustment
841 implicit none
842
843 class(atmosphymp), intent(in) :: this
844 class(localmesh3d), intent(in) :: lcmesh
845 class(elementbase3d), intent(in) :: elem3d
846 type(localmeshfieldbaselist), intent(inout) :: rhoq_t_mp(this%vars%qs:this%vars%qe)
847 real(rp), intent(out) :: cptot_t(elem3d%np,lcmesh%nea)
848 real(rp), intent(out) :: cvtot_t(elem3d%np,lcmesh%nea)
849 real(rp), intent(out) :: rhoe_t(elem3d%np,lcmesh%nea)
850 real(rp), intent(out) :: evaporate(elem3d%np,lcmesh%nea)
851 real(rp), intent(in) :: dens(elem3d%np,lcmesh%nea)
852 type(localmeshfieldbaselist), intent(in) :: qtrc(this%vars%qs:this%vars%qe)
853 real(rp), intent(in) :: pres(elem3d%np,lcmesh%nea)
854 real(rp), intent(in) :: dens_hyd(elem3d%np,lcmesh%nea)
855 real(rp), intent(in) :: rtot (elem3d%np,lcmesh%nea)
856 real(rp), intent(in) :: cvtot(elem3d%np,lcmesh%nea)
857 real(rp), intent(in) :: cptot(elem3d%np,lcmesh%nea)
858 real(rp), intent(in) :: rdt_mp
859
860 real(rp) :: temp1(elem3d%np,lcmesh%nea)
861 real(rp) :: cptot1(elem3d%np,lcmesh%nea)
862 real(rp) :: cvtot1(elem3d%np,lcmesh%nea)
863 real(rp) :: qtrc1(elem3d%np,lcmesh%nea,this%vars%qs:this%vars%qe)
864
865 integer :: ke
866 integer :: iq
867 !------------------------------------------------------------
868
869 !$omp parallel private(ke, iq)
870 !$omp do
871 do ke = lcmesh%NeS, lcmesh%NeE
872 temp1(:,ke) = pres(:,ke) / ( dens(:,ke) * rtot(:,ke) )
873 cptot1(:,ke) = cptot(:,ke)
874 cvtot1(:,ke) = cvtot(:,ke)
875 end do
876 !$omp end do
877 !$omp do collapse(2)
878 do iq = this%vars%QS, this%vars%QE
879 do ke = lcmesh%NeS, lcmesh%NeE
880 qtrc1(:,ke,iq) = qtrc(iq)%ptr%val(:,ke)
881 end do
882 end do
883 !$omp end do
884 !$omp end parallel
885
886 call atmos_phy_mp_kessler_adjustment( &
887 elem3d%Np, 1, elem3d%Np, lcmesh%NeA, lcmesh%NeS, lcmesh%NeE, 1, 1, 1, & ! (in)
888 dens, pres, this%dtsec, & ! (in)
889 temp1, qtrc1, cptot1, cvtot1, & ! (inout)
890 rhoe_t, evaporate ) ! (out)
891
892 !$omp parallel private(ke, iq)
893 !$omp do collapse(2)
894 do iq = this%vars%QS, this%vars%QE
895 do ke = lcmesh%NeS, lcmesh%NeE
896 rhoq_t_mp(iq)%ptr%val(:,ke) = ( qtrc1(:,ke,iq) - qtrc(iq)%ptr%val(:,ke) ) * dens(:,ke) * rdt_mp
897 end do
898 end do
899 !$omp end do
900 !$omp do
901 do ke = lcmesh%NeS, lcmesh%NeE
902 cptot_t(:,ke) = ( cptot1(:,ke) - cptot(:,ke) ) * rdt_mp
903 cvtot_t(:,ke) = ( cvtot1(:,ke) - cvtot(:,ke) ) * rdt_mp
904 end do
905 !$omp end do
906 !$omp end parallel
907 return
908 end subroutine calc_tendency_kessler
909
910!OCL SERIAL
911 subroutine calc_tendency_tomita08( this, &
912 RHOQ_t_MP, CPtot_t, CVtot_t, RHOE_t, EVAPORATE, & ! (out)
913 dens, qtrc, pres, dens_hyd, rtot, cvtot, cptot, & ! (in)
914 rdt_mp, lcmesh, elem3d ) ! (in)
915
916 use scale_const, only: &
917 undef => const_undef
918 use scale_atmos_phy_mp_tomita08, only: &
919 atmos_phy_mp_tomita08_adjustment
920 implicit none
921
922 class(atmosphymp), intent(in) :: this
923 class(localmesh3d), intent(in) :: lcmesh
924 class(elementbase3d), intent(in) :: elem3d
925 type(localmeshfieldbaselist), intent(inout) :: rhoq_t_mp(this%vars%qs:this%vars%qe)
926 real(rp), intent(out) :: cptot_t(elem3d%np,lcmesh%nea)
927 real(rp), intent(out) :: cvtot_t(elem3d%np,lcmesh%nea)
928 real(rp), intent(out) :: rhoe_t(elem3d%np,lcmesh%nea)
929 real(rp), intent(out) :: evaporate(elem3d%np,lcmesh%nea)
930 real(rp), intent(in) :: dens(elem3d%np,lcmesh%nea)
931 type(localmeshfieldbaselist), intent(in) :: qtrc(this%vars%qs:this%vars%qe)
932 real(rp), intent(in) :: pres(elem3d%np,lcmesh%nea)
933 real(rp), intent(in) :: dens_hyd(elem3d%np,lcmesh%nea)
934 real(rp), intent(in) :: rtot (elem3d%np,lcmesh%nea)
935 real(rp), intent(in) :: cvtot(elem3d%np,lcmesh%nea)
936 real(rp), intent(in) :: cptot(elem3d%np,lcmesh%nea)
937 real(rp), intent(in) :: rdt_mp
938
939 real(rp) :: dens_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
940 real(rp) :: pres_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
941 real(rp) :: ccn_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
942 real(rp) :: temp1_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
943 real(rp) :: cptot1_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
944 real(rp) :: cvtot1_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
945 real(rp) :: qtrc1_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d,this%vars%qs:this%vars%qe)
946 real(rp) :: rhoe_t_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
947 real(rp) :: evaporate_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
948
949 integer :: ke, ke_xy, ke_z
950 integer :: p,p_xy, p_z
951 integer :: iq
952 !------------------------------------------------------------
953
954 !$omp parallel do collapse(2) private(p_z,p_xy,iq, ke,p)
955 do ke_z=1, lcmesh%NeZ
956 do ke_xy=1, lcmesh%Ne2D
957 ke = ke_xy + (ke_z-1)*lcmesh%Ne2D
958 do p_z=1, elem3d%Nnode_v
959 do p_xy=1, elem3d%Nnode_h1D**2
960 p = p_xy + (p_z-1)*elem3d%Nnode_h1D**2
961 dens_z(p_z,ke_z,p_xy,ke_xy) = dens(p,ke)
962 pres_z(p_z,ke_z,p_xy,ke_xy) = pres(p,ke)
963 temp1_z(p_z,ke_z,p_xy,ke_xy) = pres(p,ke) / ( dens(p,ke) * rtot(p,ke) )
964 cptot1_z(p_z,ke_z,p_xy,ke_xy) = cptot(p,ke)
965 cvtot1_z(p_z,ke_z,p_xy,ke_xy) = cvtot(p,ke)
966
967 ccn_z(p_z,ke_z,p_xy,ke_xy) = undef
968 end do
969 end do
970 do iq = this%vars%QS, this%vars%QE
971 do p_z=1, elem3d%Nnode_v
972 do p_xy=1, elem3d%Nnode_h1D**2
973 p = p_xy + (p_z-1)*elem3d%Nnode_h1D**2
974 qtrc1_z(p_z,ke_z,p_xy,ke_xy,iq) = qtrc(iq)%ptr%val(p,ke)
975 end do
976 end do
977 end do
978 end do
979 end do
980
981 call atmos_phy_mp_tomita08_adjustment( &
982 elem3d%Nnode_v*lcmesh%NeZ, 1, elem3d%Nnode_v*lcmesh%NeZ, elem3d%Nnode_h1D**2, 1, elem3d%Nnode_h1D**2, lcmesh%Ne2D, 1, lcmesh%Ne2D, & ! (in)
983 dens_z, pres_z, ccn_z, this%dtsec, & ! (in)
984 temp1_z, qtrc1_z, cptot1_z, cvtot1_z, & ! (inout)
985 rhoe_t_z, evaporate_z ) ! (out)
986
987 !$omp parallel do collapse(2) private(p_z,p_xy,iq, ke,p)
988 do ke_z=1, lcmesh%NeZ
989 do ke_xy=1, lcmesh%Ne2D
990 ke = ke_xy + (ke_z-1)*lcmesh%Ne2D
991 do p_z=1, elem3d%Nnode_v
992 do p_xy=1, elem3d%Nnode_h1D**2
993 p = p_xy + (p_z-1)*elem3d%Nnode_h1D**2
994 cptot_t(p,ke) = ( cptot1_z(p_z,ke_z,p_xy,ke_xy) - cptot(p,ke) ) * rdt_mp
995 cvtot_t(p,ke) = ( cvtot1_z(p_z,ke_z,p_xy,ke_xy) - cvtot(p,ke) ) * rdt_mp
996 rhoe_t(p,ke) = rhoe_t_z(p_z,ke_z,p_xy,ke_xy)
997 evaporate(p,ke) = evaporate_z(p_z,ke_z,p_xy,ke_xy)
998 end do
999 end do
1000 do iq = this%vars%QS, this%vars%QE
1001 do p_z=1, elem3d%Nnode_v
1002 do p_xy=1, elem3d%Nnode_h1D**2
1003 p = p_xy + (p_z-1)*elem3d%Nnode_h1D**2
1004 rhoq_t_mp(iq)%ptr%val(p,ke) = ( qtrc1_z(p_z,ke_z,p_xy,ke_xy,iq) - qtrc(iq)%ptr%val(p,ke) ) * dens(p,ke) * rdt_mp
1005 end do
1006 end do
1007 end do
1008 end do
1009 end do
1010
1011 return
1012 end subroutine calc_tendency_tomita08
1013
1014!OCL SERIAL
1015 subroutine calc_tendency_sn14( this, &
1016 RHOQ_t_MP, CPtot_t, CVtot_t, RHOE_t, EVAPORATE, & ! (out)
1017 dens, qtrc, pres, dens_hyd, rtot, cvtot, cptot, & ! (in)
1018 rdt_mp, lcmesh, elem3d ) ! (in)
1019
1020 use scale_const, only: &
1021 undef => const_undef
1022 use scale_atmos_phy_mp_sn14, only: &
1023 atmos_phy_mp_sn14_tendency
1024 implicit none
1025
1026 class(atmosphymp), intent(in) :: this
1027 class(localmesh3d), intent(in) :: lcmesh
1028 class(elementbase3d), intent(in) :: elem3d
1029 type(localmeshfieldbaselist), intent(inout) :: rhoq_t_mp(this%vars%qs:this%vars%qe)
1030 real(rp), intent(out) :: cptot_t(elem3d%np,lcmesh%nea)
1031 real(rp), intent(out) :: cvtot_t(elem3d%np,lcmesh%nea)
1032 real(rp), intent(out) :: rhoe_t(elem3d%np,lcmesh%nea)
1033 real(rp), intent(out) :: evaporate(elem3d%np,lcmesh%nea)
1034 real(rp), intent(in) :: dens(elem3d%np,lcmesh%nea)
1035 type(localmeshfieldbaselist), intent(in) :: qtrc(this%vars%qs:this%vars%qe)
1036 real(rp), intent(in) :: pres(elem3d%np,lcmesh%nea)
1037 real(rp), intent(in) :: dens_hyd(elem3d%np,lcmesh%nea)
1038 real(rp), intent(in) :: rtot (elem3d%np,lcmesh%nea)
1039 real(rp), intent(in) :: cvtot(elem3d%np,lcmesh%nea)
1040 real(rp), intent(in) :: cptot(elem3d%np,lcmesh%nea)
1041 real(rp), intent(in) :: rdt_mp
1042
1043 real(rp) :: dens_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
1044 real(rp) :: pres_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
1045 real(rp) :: ccn_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
1046 real(rp) :: temp1_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
1047 real(rp) :: cptot1_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
1048 real(rp) :: cvtot1_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
1049 real(rp) :: qtrc1_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d,this%vars%qs:this%vars%qe)
1050 real(rp) :: rhoq_t_mp_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d,this%vars%qs:this%vars%qe)
1051 real(rp) :: rhoe_t_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
1052 real(rp) :: evaporate_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
1053 real(rp) :: cptot_t_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
1054 real(rp) :: cvtot_t_z(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
1055
1056 integer :: ke, ke_xy, ke_z
1057 integer :: p,p_xy, p_z
1058 integer :: iq
1059 !------------------------------------------------------------
1060
1061 !$omp parallel do collapse(2) private(p_z,p_xy,iq, ke,p)
1062 do ke_z=1, lcmesh%NeZ
1063 do ke_xy=1, lcmesh%Ne2D
1064 ke = ke_xy + (ke_z-1)*lcmesh%Ne2D
1065 do p_z=1, elem3d%Nnode_v
1066 do p_xy=1, elem3d%Nnode_h1D**2
1067 p = p_xy + (p_z-1)*elem3d%Nnode_h1D**2
1068 dens_z(p_z,ke_z,p_xy,ke_xy) = dens(p,ke)
1069 pres_z(p_z,ke_z,p_xy,ke_xy) = pres(p,ke)
1070 temp1_z(p_z,ke_z,p_xy,ke_xy) = pres(p,ke) / ( dens(p,ke) * rtot(p,ke) )
1071 cptot1_z(p_z,ke_z,p_xy,ke_xy) = cptot(p,ke)
1072 cvtot1_z(p_z,ke_z,p_xy,ke_xy) = cvtot(p,ke)
1073
1074 ccn_z(p_z,ke_z,p_xy,ke_xy) = undef
1075 end do
1076 end do
1077 do iq = this%vars%QS, this%vars%QE
1078 do p_z=1, elem3d%Nnode_v
1079 do p_xy=1, elem3d%Nnode_h1D**2
1080 p = p_xy + (p_z-1)*elem3d%Nnode_h1D**2
1081 qtrc1_z(p_z,ke_z,p_xy,ke_xy,iq) = qtrc(iq)%ptr%val(p,ke)
1082 end do
1083 end do
1084 end do
1085 end do
1086 end do
1087
1088 ! call ATMOS_PHY_MP_sn14_tendency( &
1089 ! elem3D%Nnode_v*lcmesh%NeZ, 1, elem3D%Nnode_v*lcmesh%NeZ, elem3D%Nnode_h1D**2, 1, elem3D%Nnode_h1D**2, lcmesh%Ne2D, 1, lcmesh%Ne2D, & ! (in)
1090 ! DENS_z, W_z, QTRC1_z, PRES_z, TEMP_z, Qdry_z, CPtot1_z, CVtot1_z, CCN_z, this%dtsec, REAL_CZ, REAL_FZ, & ! (in)
1091 ! RHOQ_t_MP_z, RHOE_t_z, CPtot_t_z, CVtot_t_z, EVAPORATE_z ) ! (out)
1092
1093
1094 !$omp parallel do collapse(2) private(p_z,p_xy,iq, ke,p)
1095 do ke_z=1, lcmesh%NeZ
1096 do ke_xy=1, lcmesh%Ne2D
1097 ke = ke_xy + (ke_z-1)*lcmesh%Ne2D
1098 do p_z=1, elem3d%Nnode_v
1099 do p_xy=1, elem3d%Nnode_h1D**2
1100 p = p_xy + (p_z-1)*elem3d%Nnode_h1D**2
1101 cptot_t(p,ke) = cptot_t_z(p_z,ke_z,p_xy,ke_xy)
1102 cvtot_t(p,ke) = cvtot_t_z(p_z,ke_z,p_xy,ke_xy)
1103 end do
1104 end do
1105 do iq = this%vars%QS, this%vars%QE
1106 do p_z=1, elem3d%Nnode_v
1107 do p_xy=1, elem3d%Nnode_h1D**2
1108 p = p_xy + (p_z-1)*elem3d%Nnode_h1D**2
1109 rhoq_t_mp(iq)%ptr%val(p,ke) = rhoq_t_mp_z(p_z,ke_z,p_xy,ke_xy,iq)
1110 end do
1111 end do
1112 end do
1113 end do
1114 end do
1115
1116 return
1117 end subroutine calc_tendency_sn14
1118end module mod_atmos_phy_mp
module Atmosphere / Mesh
module Atmosphere / Physics / Cloud Microphysics
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)
subroutine, public atmosphympvars_getlocalmeshfields_sfcflx(domid, mesh, sfcflx_list, sflx_rain, sflx_snow, sflx_engi)
module Atmosphere / Physics / cloud microphysics
integer, parameter mp_typeid_kessler
module Atmosphere / Physics / Variables
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)
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_getlocalmeshphyauxvars(domid, mesh, phyauxvars_list, pres, pt, lcmesh3d)
module FElib / Atmosphere / Physics cloud microphysics / common
subroutine, public atm_phy_mp_dgm_common_gen_intweight(intweight, lcmesh)
subroutine, public atm_phy_mp_dgm_common_precipitation(dens, rhoq, cptot, cvtot, rhoe, flx_hydro, sflx_rain, sflx_snow, esflx, temp, vterm, dt, rnstep, dz, lift, nz, vmapm, vmapp, intweight, qha, qla, qia, lcmesh, elem)
subroutine, public atm_phy_mp_dgm_common_precipitation_momentum(momu_t, momv_t, momz_t, dens, momu, momv, momz, mflx, dz, lift, nz, vmapm, vmapp, lcmesh, elem)
module FElib / Element / Base
module FElib / Element / hexahedron
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 / sparsemat.
Module common / time.
Derived type to manage a computational mesh (base class)
Derived type to manage a component of cloud microphysics.
Derived type to manage variables with cloud microphysics component.
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 hexahedral element.
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 representing a field with 3D mesh.
Derived type representing a field (base type)
Derived type to manage a sparse matrix.