11#include "scaleFElib.h"
21 use scale_const,
only: &
22 undef8 => const_undef8
23 use scale_atmos_hydrometeor,
only: &
59 integer :: sfcflx_typeid
62 procedure,
public :: setup => atmosphysfc_setup
63 procedure,
public :: calc_tendency => atmosphysfc_calc_tendency
64 procedure,
public :: update => atmosphysfc_update
65 procedure,
public :: finalize => atmosphysfc_finalize
73 integer,
parameter :: sfcflx_typeid_simple = 2
80 private :: cal_tend_from_sfcflx
81 private :: cal_del_flux
82 private :: convert_uv2localorthvec
83 private :: convert_localorth2uvvec
99 subroutine atmosphysfc_setup( this, model_mesh, tm_parent_comp )
102 use scale_atmos_phy_sf_const,
only: &
103 atmos_phy_sf_const_setup
109 class(modelmeshbase),
target,
intent(in) :: model_mesh
112 real(dp) :: time_dt = undef8
113 character(len=H_SHORT) :: time_dt_unit =
'SEC'
115 character(len=H_MID) :: sfcflx_type =
"CONST"
116 namelist /param_atmos_phy_sfc/ &
124 if (.not. this%IsActivated())
return
127 log_info(
"ATMOS_PHY_SFC_setup",*)
'Setup'
131 read(io_fid_conf,nml=param_atmos_phy_sfc,iostat=ierr)
133 log_info(
"ATMOS_PHY_SFC_setup",*)
'Not found namelist. Default used.'
134 elseif( ierr > 0 )
then
135 log_error(
"ATMOS_PHY_SFC_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_PHY_SFC. Check!'
138 log_nml(param_atmos_phy_sfc)
142 call tm_parent_comp%Regist_process(
'ATMOS_PHY_SFC', time_dt, time_dt_unit, &
146 call this%vars%Init( model_mesh )
150 select case( sfcflx_type )
152 call atmos_phy_sf_const_setup()
156 this%SFCFLX_TYPEID = sfcflx_typeid_simple
158 log_error(
"ATMOS_PHY_SFC_setup",*)
'Not appropriate names of SFCFLX_TYPE in namelist PARAM_PHY_SFC. Check!'
163 select type(model_mesh)
165 this%mesh => model_mesh
169 end subroutine atmosphysfc_setup
181 subroutine atmosphysfc_calc_tendency( &
182 this, model_mesh, prgvars_list, trcvars_list, &
183 auxvars_list, forcing_list, is_update )
185 use scale_tracer,
only: &
199 class(modelmeshbase),
intent(in) :: model_mesh
204 logical,
intent(in) :: is_update
213 class(
localmeshfieldbase),
pointer :: dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, rhoh_p, rhoqv_tp
214 class(
localmeshfieldbase),
pointer :: sflx_mu, sflx_mv, sflx_mw, sflx_sh, sflx_lh, sflx_qv
220 if (.not. this%IsActivated())
return
222 call model_mesh%GetModelMesh( mesh )
223 do n=1, mesh%LOCAL_MESH_NUM
224 call prof_rapstart(
'ATM_PHY_SFC_get_localmesh_ptr', 2)
226 mesh, prgvars_list, auxvars_list, &
227 ddens, momx, momy, momz, drhot, &
228 dens_hyd, pres_hyd, rtot, cvtot, cptot, &
231 mesh, forcing_list, &
232 dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, &
237 mesh, auxvars_list, &
241 mesh, this%vars%SFCVARS_manager, this%vars%SFCFLX_manager, &
242 sfc_temp, sflx_mu, sflx_mv, sflx_mw, sflx_sh, sflx_lh, sflx_qv )
243 call prof_rapend(
'ATM_PHY_SFC_get_localmesh_ptr', 2)
245 call prof_rapstart(
'ATM_PHY_SFC_cal_tend', 2)
246 call cal_tend_from_sfcflx( this, is_update, &
247 dens_tp%val, momx_tp%val, momy_tp%val, momz_tp%val, rhoh_p%val, rhoqv_tp%val, &
248 sflx_mu%val, sflx_mv%val, sflx_mw%val, sflx_sh%val, sflx_lh%val, sflx_qv%val, &
249 ddens%val, momx%val, momy%val, momz%val, drhot%val, qv%val, &
250 dens_hyd%val, pres_hyd%val, &
251 pres%val, pt%val, rtot%val, sfc_temp%val, &
252 model_mesh%DOptrMat(3), model_mesh%SOptrMat(3), model_mesh%LiftOptrMat, &
253 lcmesh, lcmesh%refElem3D, lcmesh%lcmesh2D, lcmesh%lcmesh2D%refElem2D )
254 call prof_rapend(
'ATM_PHY_SFC_cal_tend', 2)
258 end subroutine atmosphysfc_calc_tendency
269 subroutine atmosphysfc_update( this, model_mesh, &
270 prgvars_list, trcvars_list, auxvars_list, forcing_list, &
275 class(modelmeshbase),
intent(in) :: model_mesh
280 logical,
intent(in) :: is_update
284 end subroutine atmosphysfc_update
289 subroutine atmosphysfc_finalize( this )
294 if (.not. this%IsActivated())
return
296 call this%vars%Final()
299 end subroutine atmosphysfc_finalize
304 subroutine cal_tend_from_sfcflx( this, is_update_sflx, &
305 DENS_tp, MOMX_tp, MOMY_tp, MOMZ_tp, RHOH_p, RHOQV_tp, &
306 SFLX_MU, SFLX_MV, SFLX_MW, SFLX_SH, SFLX_LH, SFLX_QV, &
307 DDENS, MOMX, MOMY, MOMZ, DRHOT, &
309 DENS_hyd, PRES_hyd, PRES, PT, Rtot, &
312 lcmesh, elem, lcmesh2D, elem2D )
314 use scale_const,
only: &
315 rdry => const_rdry, &
316 cpdry => const_cpdry, &
317 cvdry => const_cvdry, &
318 pres00 => const_pre00, &
319 rplanet => const_radius
320 use scale_atmos_hydrometeor,
only: &
323 use scale_tracer,
only: &
325 use scale_atmos_phy_sf_const,
only: &
326 atmos_phy_sf_const_flux
340 logical,
intent(in) :: is_update_sflx
341 real(rp),
intent(inout) :: dens_tp(elem%np,lcmesh%nea)
342 real(rp),
intent(inout) :: momx_tp(elem%np,lcmesh%nea)
343 real(rp),
intent(inout) :: momy_tp(elem%np,lcmesh%nea)
344 real(rp),
intent(inout) :: momz_tp(elem%np,lcmesh%nea)
345 real(rp),
intent(inout) :: rhoh_p (elem%np,lcmesh%nea)
346 real(rp),
intent(inout) :: rhoqv_tp(elem%np,lcmesh%nea)
347 real(rp),
intent(inout) :: sflx_mu(elem2d%np,lcmesh2d%nea)
348 real(rp),
intent(inout) :: sflx_mv(elem2d%np,lcmesh2d%nea)
349 real(rp),
intent(inout) :: sflx_mw(elem2d%np,lcmesh2d%nea)
350 real(rp),
intent(inout) :: sflx_sh(elem2d%np,lcmesh2d%nea)
351 real(rp),
intent(inout) :: sflx_lh(elem2d%np,lcmesh2d%nea)
352 real(rp),
intent(inout) :: sflx_qv(elem2d%np,lcmesh2d%nea)
353 real(rp),
intent(in) :: ddens(elem%np,lcmesh%nea)
354 real(rp),
intent(in) :: momx(elem%np,lcmesh%nea)
355 real(rp),
intent(in) :: momy(elem%np,lcmesh%nea)
356 real(rp),
intent(in) :: momz(elem%np,lcmesh%nea)
357 real(rp),
intent(in) :: drhot(elem%np,lcmesh%nea)
358 real(rp),
intent(in) :: qv(elem%np,lcmesh%nea)
359 real(rp),
intent(in) :: pres_hyd(elem%np,lcmesh%nea)
360 real(rp),
intent(in) :: dens_hyd(elem%np,lcmesh%nea)
361 real(rp),
intent(in) :: pres(elem%np,lcmesh%nea)
362 real(rp),
intent(in) :: pt(elem%np,lcmesh%nea)
363 real(rp),
intent(in) :: rtot(elem%np,lcmesh%nea)
364 real(rp),
intent(in) :: sfc_temp(elem2d%np,lcmesh2d%nea)
365 type(
sparsemat),
intent(in) :: dz, sz, lift
367 real(rp) :: atm_w (elem2d%np,lcmesh2d%ne)
368 real(rp) :: atm_u (elem2d%np,lcmesh2d%ne)
369 real(rp) :: atm_v (elem2d%np,lcmesh2d%ne)
370 real(rp) :: atm_temp(elem2d%np,lcmesh2d%ne)
371 real(rp) :: atm_pres(elem2d%np,lcmesh2d%ne)
372 real(rp) :: atm_qv (elem2d%np,lcmesh2d%ne)
373 real(rp) :: dz1 (elem2d%np,lcmesh2d%ne)
374 real(rp) :: z1 (elem2d%np,lcmesh2d%ne)
375 real(rp) :: sfc_pres(elem2d%np,lcmesh2d%ne)
376 real(rp) :: sfc_dens(elem2d%np,lcmesh2d%ne)
378 real(rp) :: sflx_qtrc(elem2d%np,lcmesh2d%ne,max(1,qa))
379 real(rp) :: sflx_engi(elem2d%np,lcmesh2d%ne)
382 real(rp) :: u10(elem2d%np,lcmesh2d%ne)
383 real(rp) :: v10(elem2d%np,lcmesh2d%ne)
387 integer :: hslicez0, hslicez1
391 real(rp) :: liftdelflx(elem%np)
392 real(rp) :: del_flux(elem%nfptot,lcmesh%ne,5)
394 real(rp) :: sflx_mu1, sflx_mv1
398 if (is_update_sflx)
then
402 do ke2d=lcmesh2d%NeS, lcmesh2d%NeE
406 hslicez0 = elem%Hslice(ij,1)
407 hslicez1 = elem%Hslice(ij,2)
409 dens = dens_hyd(hslicez1,ke) + ddens(hslicez1,ke)
410 atm_u(ij,ke2d) = momx(hslicez1,ke) / dens
411 atm_v(ij,ke2d) = momy(hslicez1,ke) / dens
412 atm_w(ij,ke2d) = 0.0_rp
413 atm_pres(ij,ke2d) = pres(hslicez1,ke)
416 atm_qv(ij,ke2d) = qv(hslicez1,ke)
418 sfc_dens(ij,ke2d) = dens_hyd(hslicez0,ke) + ddens(hslicez0,ke)
419 sfc_pres(ij,ke2d) = pres(hslicez0,ke)
421 atm_temp(ij,ke2d) = sfc_pres(ij,ke2d) / ( rtot(hslicez0,ke) * sfc_dens(ij,ke2d) )
422 atm_qv(ij,ke2d) = qv(hslicez0,ke)
424 z1(ij,ke2d) = lcmesh%zlev(hslicez1,ke)
425 dz1(ij,ke2d) = z1(ij,ke2d) - lcmesh%zlev(hslicez0,ke)
426 z1(ij,ke2d) = z1(ij,ke2d) + rplanet
430 call convert_uv2localorthvec( &
431 this%mesh%ptr_mesh, lcmesh2d%pos_en(:,:,1), lcmesh2d%pos_en(:,:,2), z1(:,:), elem2d%Np*lcmesh2d%Ne, &
435 select case ( this%SFCFLX_TYPEID )
437 call atmos_phy_sf_const_flux( &
438 elem2d%Np, 1, elem2d%Np, lcmesh2d%NeA, 1, lcmesh2d%Ne, &
439 atm_w(:,:), atm_u(:,:), atm_v(:,:), sfc_temp(:,:), &
440 dz1(:,:), sfc_dens(:,:), &
441 sflx_mw(:,:), sflx_mu(:,:), sflx_mv(:,:), &
442 sflx_sh(:,:), sflx_lh(:,:), sflx_qv(:,:), &
444 case ( sfcflx_typeid_simple )
446 elem2d%Np, 1, elem2d%Np, lcmesh2d%NeA, 1, lcmesh2d%Ne, &
447 atm_w(:,:), atm_u(:,:), atm_v(:,:), atm_temp(:,:), atm_pres(:,:), &
449 sfc_dens(:,:), sfc_temp(:,:), sfc_pres(:,:), &
451 sflx_mw(:,:), sflx_mu(:,:), sflx_mv(:,:), &
452 sflx_sh(:,:), sflx_lh(:,:), sflx_qv(:,:), &
456 call convert_localorth2uvvec( &
457 this%mesh%ptr_mesh, lcmesh2d%pos_en(:,:,1), lcmesh2d%pos_en(:,:,2), z1(:,:), elem2d%Np*lcmesh2d%Ne, &
464 call cal_del_flux( del_flux, &
465 sflx_mu, sflx_mv, sflx_mw, sflx_sh, &
468 lcmesh%normal_fn(:,:,3), &
469 lcmesh, elem, lcmesh2d, elem2d )
472 do ke2d=1, lcmesh2d%Ne
475 call sparsemat_matmul( lift, lcmesh%Fscale(:,ke)*del_flux(:,ke,1), liftdelflx )
476 momx_tp(:,ke) = momx_tp(:,ke) - liftdelflx(:)
478 call sparsemat_matmul( lift, lcmesh%Fscale(:,ke)*del_flux(:,ke,2), liftdelflx )
479 momy_tp(:,ke) = momy_tp(:,ke) - liftdelflx(:)
481 call sparsemat_matmul( lift, lcmesh%Fscale(:,ke)*del_flux(:,ke,3), liftdelflx )
482 momz_tp(:,ke) = momz_tp(:,ke) - liftdelflx(:)
484 call sparsemat_matmul( lift, lcmesh%Fscale(:,ke)*del_flux(:,ke,4), liftdelflx )
485 rhoh_p(:,ke) = rhoh_p(:,ke) - liftdelflx(:)
487 if ( .not. atmos_hydrometeor_dry )
then
488 sflx_qtrc(:,ke2d,i_qv) = sflx_qv(:,ke2d)
489 sflx_engi(:,ke2d) = sflx_qv(:,ke2d) * ( tracer_cv(i_qv) * sfc_temp(:,ke2d) + lhv )
491 call sparsemat_matmul( lift, lcmesh%Fscale(:,ke)*del_flux(:,ke,5), liftdelflx )
492 rhoqv_tp(:,ke) = rhoqv_tp(:,ke) - liftdelflx(:)
493 dens_tp(:,ke) = dens_tp(:,ke) - liftdelflx(:)
498 end subroutine cal_tend_from_sfcflx
501 subroutine cal_del_flux( del_flux, &
502 sflx_mu, sflx_mv, sflx_mw, sflx_sh, &
506 lmesh, elem, lmesh2D, elem2D )
508 use scale_atmos_hydrometeor,
only: &
511 use scale_tracer,
only: &
519 real(rp),
intent(out) :: del_flux(elem%nfptot*lmesh%ne,5)
520 real(rp),
intent(in) :: sflx_mu(elem2d%np,lmesh2d%ne)
521 real(rp),
intent(in) :: sflx_mv(elem2d%np,lmesh2d%ne)
522 real(rp),
intent(in) :: sflx_mw(elem2d%np,lmesh2d%ne)
523 real(rp),
intent(in) :: sflx_sh(elem2d%np,lmesh2d%ne)
524 real(rp),
intent(in) :: sflx_qv(elem2d%np,lmesh2d%ne)
525 real(rp),
intent(in) :: sfc_temp(elem2d%np,lmesh2d%ne)
526 real(rp),
intent(in) :: nz(elem%nfptot*lmesh%ne)
534 del_flux(:,:) = 0.0_rp
538 do ke2d=1, lmesh2d%Ne
540 i = elem%Nfaces_h*elem%Nfp_h + p + (ke2d-1)*elem%NfpTot
541 del_flux(i,1) = sflx_mu(p,ke2d) * nz(i)
542 del_flux(i,2) = sflx_mv(p,ke2d) * nz(i)
543 del_flux(i,3) = sflx_mw(p,ke2d) * nz(i)
544 del_flux(i,4) = sflx_sh(p,ke2d) * nz(i)
545 del_flux(i,5) = sflx_qv(p,ke2d) * nz(i)
550 if ( .not. atmos_hydrometeor_dry )
then
552 do ke2d=1, lmesh2d%Ne
554 i = elem%Nfaces_h*elem%Nfp_h + p + (ke2d-1)*elem%NfpTot
555 del_flux(i,4) = del_flux(i,4) &
556 + sflx_qv(p,ke2d) * ( tracer_cv(i_qv) * sfc_temp(p,ke2d) + 0.0_rp * lhv ) * nz(i)
563 end subroutine cal_del_flux
566 subroutine convert_uv2localorthvec( mesh, x1, x2, r, N, & ! (in)
573 integer,
intent(in) :: n
575 real(rp),
intent(in) :: x1(n)
576 real(rp),
intent(in) :: x2(n)
577 real(rp),
intent(in) :: r(n)
578 real(rp),
intent(inout) :: u(n)
579 real(rp),
intent(inout) :: v(n)
588 end subroutine convert_uv2localorthvec
591 subroutine convert_localorth2uvvec( mesh, x1, x2, r, N, & ! (in)
598 integer,
intent(in) :: n
600 real(rp),
intent(in) :: x1(n)
601 real(rp),
intent(in) :: x2(n)
602 real(rp),
intent(in) :: r(n)
603 real(rp),
intent(inout) :: u(n)
604 real(rp),
intent(inout) :: v(n)
613 end subroutine convert_localorth2uvvec
614end module mod_atmos_phy_sfc
module ATMOSPHERE physics / surface process
subroutine, public atmosphysfcvars_getlocalmeshfields(domid, mesh, svars_list, sflx_list, sfc_temp, sflx_mu, sflx_mv, sflx_mw, sflx_sh, sflx_lh, sflx_qv, lcmesh3d)
module ATMOSPHERE physics / surface process
integer, parameter sfcflx_typeid_const
module ATMOSPHERE / Variables
subroutine, public atmosvars_getlocalmeshqtrc_qv(domid, mesh, trcvars_list, forcing_list, var, var_tp, 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_getlocalmeshphytends(domid, mesh, phytends_list, dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, rhoh_p, rhoq_tp, lcmesh3d)
subroutine, public atmosvars_getlocalmeshqtrcphytend(domid, mesh, phytends_list, qtrcid, rhoq_tp)
subroutine, public atmosvars_getlocalmeshphyauxvars(domid, mesh, phyauxvars_list, pres, pt, lcmesh3d)
module atmosphere / physics / surface / simple
subroutine, public atmos_phy_sf_simple_setup
Setup.
subroutine, public atmos_phy_sf_simple_flux(ia, is, ie, ja, js, je, atm_w, atm_u, atm_v, atm_temp, atm_pres, atm_qv, sfc_dens, sfc_temp, sfc_pres, atm_z1, sflx_mw, sflx_mu, sflx_mv, sflx_sh, sflx_lh, sflx_qv, u10, v10)
Constant flux.
module common / Coordinate conversion with a cubed-sphere
module FElib / Element / Base
module FElib / Mesh / Local 2D
module FElib / Mesh / Local 3D
module FElib / Mesh / Local, Base
module FElib / Data / base
module FElib / Mesh / Base 2D
module FElib / Mesh / Base 3D
module FElib / Mesh / Base
module FElib / Mesh / Cubed-sphere 3D domain
module FElib / Data / base
FElib / model framework / physics process.
FElib / model framework / mesh manager.
FElib / model framework / variable manager.
module common / sparsemat
Derived type to manage a component of surface process.