11#include "scaleFElib.h"
21 use scale_const,
only: &
22 undef8 => const_undef8
61 integer :: rd_solarins_typeid
67 integer :: atm_var_container_typeid
75 procedure,
public :: setup => atmosphyrd_setup
76 procedure,
public :: calc_tendency => atmosphyrd_calc_tendency
77 procedure,
public :: update => atmosphyrd_update
78 procedure,
public :: finalize => atmosphyrd_finalize
79 procedure,
public :: setsfcvars => atmosphyrd_set_sfcvars
80 procedure,
private :: calc_tendency_core => atmosphyrd_calc_tendency_core
96 integer,
parameter :: rd_insolation_typeid_none = 0
97 integer,
parameter :: rd_insolation_typeid_simple = 1
105 subroutine atmosphyrd_setup( this, model_mesh, tm_parent_comp )
113 class(modelmeshbase),
target,
intent(in) :: model_mesh
116 real(dp) :: time_dt = undef8
117 character(len=H_SHORT) :: time_dt_unit =
'SEC'
119 character(len=H_MID) :: rd_type =
'NONE'
120 character(len=H_MID) :: rd_solarins_type =
'SIMPLE'
121 integer :: atm_var_container_typeid
123 namelist /param_atmos_phy_rd/ &
128 atm_var_container_typeid
131 class(
meshbase),
pointer :: ptr_mesh
140 if (.not. this%IsActivated())
return
143 log_info(
"ATMOS_PHY_RD_setup",*)
'Setup'
149 read(io_fid_conf,nml=param_atmos_phy_rd,iostat=ierr)
151 log_info(
"ATMOS_PHY_RD_setup",*)
'Not found namelist. Default used.'
152 elseif( ierr > 0 )
then
153 log_error(
"ATMOS_PHY_RD_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_PHY_RD. Check!'
156 log_nml(param_atmos_phy_rd)
158 this%atm_var_container_typeid = atm_var_container_typeid
162 call tm_parent_comp%Regist_process(
'ATMOS_PHY_RD', time_dt, time_dt_unit, &
167 select case ( rd_type )
170 call this%simple_rad%Init()
172 log_error(
"ATMOS_PHY_RD_setup",*)
'Not appropriate RD_TYPE. Check!'
176 select case ( rd_solarins_type )
178 this%RD_SOLARINS_TYPEID = rd_insolation_typeid_simple
181 this%RD_SOLARINS_TYPEID = rd_insolation_typeid_none
183 log_error(
"ATMOS_PHY_RD_setup",*)
'Not appropriate RD_SOLARINS_TYPE. Check!'
189 call this%vars%Init( model_mesh )
191 select type(model_mesh)
193 atm_mesh => model_mesh
195 mesh3d => atm_mesh%ptr_mesh
200 end subroutine atmosphyrd_setup
203 subroutine atmosphyrd_set_sfcvars( this, sfc_temp, sfc_alb )
209 this%SFC_TEMP_ptr => sfc_temp
210 this%SFC_ALB_ptr => sfc_alb
212 end subroutine atmosphyrd_set_sfcvars
224 subroutine atmosphyrd_calc_tendency( &
225 this, model_mesh, prgvars_list, trcvars_list, &
226 auxvars_list, forcing_list, is_update )
245 class(modelmeshbase),
intent(in) :: model_mesh
250 logical,
intent(in) :: is_update
262 class(
localmeshfieldbase),
pointer :: dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, rhoh_p
268 if (.not. this%IsActivated())
return
270 log_progress(*)
'atmosphere / physics / radiation'
272 call model_mesh%GetModelMesh( mesh )
276 do n=1, mesh%LOCAL_MESH_NUM
277 call prof_rapstart(
'ATM_PHY_RD_get_localmesh_ptr', 2)
281 mesh, prgvars_list, auxvars_list, &
282 ddens, momx, momy, momz, drhot, &
283 dens_hyd, pres_hyd, rtot, cvtot, cptot, &
287 mesh, auxvars_list, &
291 mesh, trcvars_list, forcing_list, &
293 call prof_rapend(
'ATM_PHY_RD_get_localmesh_ptr', 2)
297 call prof_rapstart(
'ATM_PHY_RD_cal_tend', 2)
299 lcmesh2d => lcmesh%lcmesh2D
301 select case ( this%RD_SOLARINS_TYPEID )
302 case ( rd_insolation_typeid_simple )
304 this%vars%auxvars2D(solins_id)%local(n)%val(:,lcmesh2d%NeS:lcmesh2d%NeE), &
305 this%vars%auxvars2D(cos_sza_id)%local(n)%val(:,lcmesh2d%NeS:lcmesh2d%NeE), &
306 lcmesh2d%lat, lcmesh2d%Ne * lcmesh2d%refElem2D%Np )
309 call this%vars%tends(rd_rhoh_id)%GetLocalMeshField( n, rd_rhoh )
310 call this%calc_tendency_core( rd_rhoh%val, &
311 this%vars%auxvars2D(sflx_sw_up_id)%local(n)%val, &
312 this%vars%auxvars2D(sflx_sw_dn_id)%local(n)%val, &
313 this%vars%auxvars2D(sflx_lw_up_id)%local(n)%val, &
314 this%vars%auxvars2D(sflx_lw_dn_id)%local(n)%val, &
315 this%vars%auxvars2D(tomflx_lw_up_id)%local(n)%val, &
316 this%vars%auxvars2D(solins_id)%local(n)%val, &
317 this%vars%auxvars2D(cos_sza_id)%local(n)%val, &
318 ddens%val, pres%val, qv%val, &
319 this%SFC_TEMP_ptr%local(n)%val, &
320 this%SFC_ALB_ptr%local(n)%val, &
321 dens_hyd%val, rtot%val, cvtot%val, &
322 lcmesh, lcmesh%refElem3D, lcmesh2d, lcmesh2d%refElem2D, &
323 model_mesh%element3D_operation )
324 call prof_rapend(
'ATM_PHY_RD_cal_tend', 2)
331 do n=1, mesh%LOCAL_MESH_NUM
333 mesh, forcing_list, &
334 dens_tp, momx_tp, momy_tp, momz_tp, rhot_tp, &
335 rhoh_p, lcmesh3d=lcmesh )
337 call this%vars%tends(rd_rhoh_id)%GetLocalMeshField( n, rd_rhoh )
340 do ke=lcmesh%NeS, lcmesh%NeE
341 rhoh_p %val(:,ke) = rhoh_p %val(:,ke) + rd_rhoh%val(:,ke)
347 end subroutine atmosphyrd_calc_tendency
358 subroutine atmosphyrd_update( this, model_mesh, &
359 prgvars_list, trcvars_list, &
360 auxvars_list, forcing_list, is_update )
364 class(modelmeshbase),
intent(in) :: model_mesh
369 logical,
intent(in) :: is_update
372 end subroutine atmosphyrd_update
377 subroutine atmosphyrd_finalize( this )
382 if (.not. this%IsActivated())
return
384 select case ( this%RD_TYPEID )
386 call this%simple_rad%Final()
389 call this%vars%Final()
391 end subroutine atmosphyrd_finalize
395 subroutine atmosphyrd_calc_tendency_core( this, &
397 sflx_sw_up, sflx_sw_dn, sflx_lw_up, sflx_lw_dn, &
400 ddens, pres, qv, sfc_temp, sfc_alb, &
401 dens_hyd, rtot, cvtot, &
402 lcmesh, elem3d, lcmesh2d, elem2d, &
404 use scale_atmos_phy_rd_common,
only: &
405 i_up, i_dn, i_lw, i_sw
417 real(rp),
intent(out) :: rhoh(elem3d%np,lcmesh%nea)
418 real(rp),
intent(out) :: sflx_sw_up(elem2d%np,lcmesh2d%nea)
419 real(rp),
intent(out) :: sflx_sw_dn(elem2d%np,lcmesh2d%nea)
420 real(rp),
intent(out) :: sflx_lw_up(elem2d%np,lcmesh2d%nea)
421 real(rp),
intent(out) :: sflx_lw_dn(elem2d%np,lcmesh2d%nea)
422 real(rp),
intent(out) :: tomflx_lw_up(elem2d%np,lcmesh2d%nea)
423 real(rp),
intent(in) :: solins(elem2d%np,lcmesh2d%nea)
424 real(rp),
intent(in) :: cos_sza(elem2d%np,lcmesh2d%nea)
425 real(rp),
intent(in) :: ddens(elem3d%np,lcmesh%nea)
426 real(rp),
intent(in) :: pres(elem3d%np,lcmesh%nea)
427 real(rp),
intent(in) :: qv(elem3d%np,lcmesh%nea)
428 real(rp),
intent(in) :: sfc_temp(elem2d%np,lcmesh2d%nea)
429 real(rp),
intent(in) :: sfc_alb(elem2d%np,lcmesh2d%nea)
430 real(rp),
intent(in) :: dens_hyd(elem3d%np,lcmesh%nea)
431 real(rp),
intent(in) :: rtot(elem3d%np,lcmesh%nea)
432 real(rp),
intent(in) :: cvtot(elem3d%np,lcmesh%nea)
435 real(rp) :: flux_rad(elem3d%np,lcmesh%ne,2,2,2)
436 real(rp) :: flux_rad_top(elem3d%nnode_h1d**2,lcmesh%ne2d,2,2,2)
437 real(rp) :: sflux_rad_up(elem3d%nnode_h1d**2,lcmesh%ne2d,2,2)
438 real(rp) :: sflux_rad_dn(elem3d%nnode_h1d**2,lcmesh%ne2d,2,2)
439 real(rp) :: temp_(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
440 real(rp) :: dens_(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
441 real(rp) :: pres_(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
442 real(rp) :: qv_(elem3d%nnode_v,lcmesh%nez,elem3d%nnode_h1d**2,lcmesh%ne2d)
451 integer :: ke, ke_h, ke_z
458 do ke_z=1, lcmesh%NeZ
459 do ke_h=1, lcmesh%Ne2D
460 ke = ke_h + (ke_z-1)*lcmesh%Ne2D
461 do pz=1, elem3d%Nnode_v
462 do ph=1, elem3d%Nnode_h1D**2
463 p = ph + (pz-1)*elem3d%Nnode_h1D**2
464 dens_tmp = dens_hyd(p,ke) + ddens(p,ke)
466 pres_(pz,ke_z,ph,ke_h) = pres(p,ke)
467 temp_(pz,ke_z,ph,ke_h) = pres(p,ke) / ( rtot(p,ke) * dens_tmp )
468 dens_(pz,ke_z,ph,ke_h) = dens_tmp
469 qv_(pz,ke_z,ph,ke_h) = qv(p,ke)
475 select case( this%RD_TYPEID )
477 call this%simple_rad%calculate_rad_flux( flux_rad(:,:,:,:,1), &
478 flux_rad_top(:,:,:,:,1), sflux_rad_up(:,:,:,1), sflux_rad_dn(:,:,:,1), &
479 solins, pres_, temp_, dens_, qv_, sfc_temp, sfc_alb, &
480 lcmesh, elem3d, lcmesh2d, elem2d )
483 do ke=lcmesh2d%NeS, lcmesh2d%NeE
484 sflx_sw_dn(:,ke) = sflux_rad_dn(:,ke,i_sw,1)
485 sflx_lw_dn(:,ke) = sflux_rad_dn(:,ke,i_lw,1)
486 sflx_sw_up(:,ke) = sflux_rad_up(:,ke,i_sw,1)
487 sflx_lw_up(:,ke) = sflux_rad_up(:,ke,i_lw,1)
489 tomflx_lw_up(:,ke) = flux_rad_top(:,ke,i_lw,1,1)
500 flux_rad(:,:,:,:,1), ddens, dens_hyd, cvtot, &
501 lcmesh, elem3d, elem2d, &
507 end subroutine atmosphyrd_calc_tendency_core
module Atmosphere / Physics / Radiation
integer, parameter, public atmos_phy_rd_aux2d_solins_id
ID of solar insolation flux at the top of the model.
integer, parameter, public atmos_phy_rd_aux2d_tomflx_lw_up_id
ID of upward longwave flux at the top of the model.
integer, parameter, public atmos_phy_rd_aux2d_cossza_id
ID of cosine of solar zenith angle.
integer, parameter, public atmos_phy_rd_aux2d_sflx_sw_dn_id
ID of downward shortwave surface flux.
integer, parameter, public atmos_phy_rd_rhoh_id
ID of diabatic heating rate in RD process.
integer, parameter, public atmos_phy_rd_aux2d_sflx_lw_dn_id
ID of downward longwave surface flux.
integer, parameter, public atmos_phy_rd_aux2d_sflx_sw_up_id
ID of upward shortwave surface flux.
integer, parameter, public atmos_phy_rd_aux2d_sflx_lw_up_id
ID of upward longwave surface flux.
module Atmosphere / Physics / Radiation
integer, parameter rd_typeid_simple
Type ID of a simple radiation 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)
module Atmosphere / Variables
module FElib / Atmosphere / Physics radiation
subroutine, public atm_phy_rd_dgm_calc_heating(rhoh, flux_rad, ddens, dens_hyd, cvtot, lcmesh, elem3d, elem2d, element3d_operation, temp_t)
module FElib / Atmosphere / Physics radiation
module FElib / Atmosphere / Physics radiation / Solar insolation / Simple gray-radiation scheme
subroutine, public atm_phy_rd_solarins_simple_get(solins, cossza, lat, np)
Get solar insolation and cosine of the solar zenith angle for the given latitude array.
subroutine, public atm_phy_rd_solarins_simple_setup()
Setup the simplified solar insolation module.
module FElib / Element / Base
module FElib / Element / Operation / Base
module FElib / File / History
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 / Data / base
FElib / model framework / physics process.
FElib / model framework / mesh manager.
FElib / model framework / variable manager.
Derived type to manage a computational mesh (base class)
Derived type to manage a component of radiation in atmospheric model.
Derived type to manage variables with radiation component in atmospheric model.
Derived type to manage a set of variables (prognostic variables, tracer variables,...
Derived type to represent a simplified radiation scheme based on Vallis et al. (2018)
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.
Base type for elementwise operations.
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 2D mesh.
Derived type representing a field with 3D mesh.
Derived type representing a field (base type)