Skip to content

Commit

Permalink
Some changes to work w/ optional args in UFS
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinswales committed Aug 28, 2024
1 parent 41d2030 commit 576da96
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 40 deletions.
9 changes: 5 additions & 4 deletions physics/MP/TEMPO/module_mp_tempo.F90
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,10 @@ subroutine mp_gt_driver(qv, qc, qr, qi, qs, qg, qb, ni, nr, nc, ng, &
re_cloud, re_ice, re_snow
real(wp), dimension(ims:ime, kms:kme, jms:jme), intent(inout):: pfils, pflls
integer, intent(in) :: rand_perturb_on, kme_stoch, n_var_spp
real(wp), dimension(:,:), intent(in) :: rand_pert
real(wp), dimension(:), intent(in) :: spp_prt_list, spp_stddev_cutoff
character(len=10), dimension(:), intent(in) :: spp_var_list
real(wp), dimension(:,:), optional, intent(in) :: rand_pert
real(wp), dimension(:), optional, intent(in) :: spp_prt_list
real(wp), dimension(:), intent(in) :: spp_stddev_cutoff
character(len=10), optional, dimension(:), intent(in) :: spp_var_list
integer, intent(in):: has_reqc, has_reqi, has_reqs

real(wp), dimension(ims:ime, kms:kme, jms:jme), intent(in):: &
Expand All @@ -642,7 +643,7 @@ subroutine mp_gt_driver(qv, qc, qr, qi, qs, qg, qb, ni, nr, nc, ng, &
! Extended diagnostics, array pointers only associated if ext_diag flag is .true.
logical, intent (in) :: ext_diag
logical, optional, intent(in):: aero_ind_fdb
real(wp), dimension(:,:,:), intent(inout):: &
real(wp), optional, dimension(:,:,:), intent(inout):: &
!vts1, txri, txrc, &
prw_vcdc, &
prw_vcde, tpri_inu, tpri_ide_d, &
Expand Down
73 changes: 39 additions & 34 deletions physics/MP/TEMPO/mp_tempo.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ module mp_tempo
use module_mp_thompson_utils
use module_mp_thompson_main
use module_mp_tempo

! use module_mp_thompson, only : thompson_init, mp_gt_driver, thompson_finalize, calc_effectRad
! use module_mp_thompson, only : naIN0, naIN1, naCCN0, naCCN1, eps, Nt_c_l, Nt_c_o
! use module_mp_thompson, only : re_qc_min, re_qc_max, re_qi_min, re_qi_max, re_qs_min, re_qs_max
! use module_mp_thompson_make_number_concentrations, only: make_IceNumber, make_DropletNumber, make_RainNumber

implicit none

Expand Down Expand Up @@ -67,18 +62,18 @@ subroutine mp_tempo_init(ncol, nlev, con_g, con_rd, con_eps, &
real(kind_phys), intent(inout) :: qg(:,:)
real(kind_phys), intent(inout) :: ni(:,:)
real(kind_phys), intent(inout) :: nr(:,:)
real(kind_phys), intent(inout) :: chw(:,:)
real(kind_phys), intent(inout) :: vh(:,:)
real(kind_phys), intent(inout), optional :: chw(:,:)
real(kind_phys), intent(inout), optional :: vh(:,:)

! Aerosols
logical, intent(in ) :: is_aerosol_aware
logical, intent(in ) :: merra2_aerosol_aware
logical, intent(in ) :: is_hail_aware
real(kind_phys), intent(inout) :: nc(:,:)
real(kind_phys), intent(inout) :: nwfa(:,:)
real(kind_phys), intent(inout) :: nifa(:,:)
real(kind_phys), intent(inout) :: nwfa2d(:)
real(kind_phys), intent(inout) :: nifa2d(:)
real(kind_phys), intent(inout), optional :: nc(:,:)
real(kind_phys), intent(inout), optional :: nwfa(:,:)
real(kind_phys), intent(inout), optional :: nifa(:,:)
real(kind_phys), intent(inout), optional :: nwfa2d(:)
real(kind_phys), intent(inout), optional :: nifa2d(:)
real(kind_phys), intent(in) :: aerfld(:,:,:)
! State variables
real(kind_phys), intent(in ) :: tgrs(:,:)
Expand Down Expand Up @@ -178,8 +173,10 @@ subroutine mp_tempo_init(ncol, nlev, con_g, con_rd, con_eps, &

ni = ni/(1.0_kind_phys-spechum)
nr = nr/(1.0_kind_phys-spechum)
chw = chw/(1.0_kind_phys-spechum)
vh = vh/(1.0_kind_phys-spechum)
if (is_hail_aware) then
chw = chw/(1.0_kind_phys-spechum)
vh = vh/(1.0_kind_phys-spechum)
endif
if (is_aerosol_aware .or. merra2_aerosol_aware) then
nc = nc/(1.0_kind_phys-spechum)
nwfa = nwfa/(1.0_kind_phys-spechum)
Expand All @@ -201,8 +198,10 @@ subroutine mp_tempo_init(ncol, nlev, con_g, con_rd, con_eps, &
where(qr .GT. 0 .and. nr .LE. 0.0) nr = make_RainNumber(qr*rho, tgrs) * orho
where(qr .EQ. 0.0 .and. nr .GT. 0.0) nr=0.0

where(qg .LE. 0.0) chw=0.0
where(qg .LE. 0.0) vh=0.0
if (is_hail_aware) then
where(qg .LE. 0.0) chw=0.0
where(qg .LE. 0.0) vh=0.0
endif

!..Check for existing aerosol data, both CCN and IN aerosols. If missing
!.. fill in just a basic vertical profile, somewhat boundary-layer following.
Expand Down Expand Up @@ -314,8 +313,10 @@ subroutine mp_tempo_init(ncol, nlev, con_g, con_rd, con_eps, &

ni = ni/(1.0_kind_phys+qv)
nr = nr/(1.0_kind_phys+qv)
chw = chw/(1.0_kind_phys+qv)
vh = vh/(1.0_kind_phys+qv)
if (is_hail_aware) then
chw = chw/(1.0_kind_phys+qv)
vh = vh/(1.0_kind_phys+qv)
endif
if (is_aerosol_aware .or. merra2_aerosol_aware) then
nc = nc/(1.0_kind_phys+qv)
nwfa = nwfa/(1.0_kind_phys+qv)
Expand Down Expand Up @@ -377,8 +378,8 @@ subroutine mp_tempo_run(ncol, nlev, con_g, con_rd, &
real(kind_phys), intent(inout) :: qg(:,:)
real(kind_phys), intent(inout) :: ni(:,:)
real(kind_phys), intent(inout) :: nr(:,:)
real(kind_phys), intent(inout) :: chw(:,:)
real(kind_phys), intent(inout) :: vh(:,:)
real(kind_phys), optional, intent(inout) :: chw(:,:)
real(kind_phys), optional, intent(inout) :: vh(:,:)
! Aerosols
logical, intent(in) :: is_aerosol_aware, fullradar_diag
logical, intent(in) :: merra2_aerosol_aware, is_hail_aware
Expand All @@ -401,10 +402,10 @@ subroutine mp_tempo_run(ncol, nlev, con_g, con_rd, &
real, intent(in ) :: dt_inner
! Precip/rain/snow/graupel fall amounts and fraction of frozen precip
real(kind_phys), intent(inout) :: prcp(:)
real(kind_phys), intent(inout) :: rain(:)
real(kind_phys), intent(inout) :: graupel(:)
real(kind_phys), intent(inout) :: ice(:)
real(kind_phys), intent(inout) :: snow(:)
real(kind_phys), optional, intent(inout) :: rain(:)
real(kind_phys), optional, intent(inout) :: graupel(:)
real(kind_phys), optional, intent(inout) :: ice(:)
real(kind_phys), optional, intent(inout) :: snow(:)
real(kind_phys), intent( out) :: sr(:)
! Radar reflectivity
real(kind_phys), intent(inout) :: refl_10cm(:,:)
Expand All @@ -428,15 +429,15 @@ subroutine mp_tempo_run(ncol, nlev, con_g, con_rd, &
! SPP
integer, intent(in) :: spp_mp
integer, intent(in) :: n_var_spp
real(kind_phys), intent(in) :: spp_wts_mp(:,:)
real(kind_phys), intent(in) :: spp_prt_list(:)
character(len=10), intent(in) :: spp_var_list(:)
real(kind_phys), intent(in) :: spp_stddev_cutoff(:)
real(kind_phys), optional,intent(in) :: spp_wts_mp(:,:)
real(kind_phys), optional,intent(in) :: spp_prt_list(:)
character(len=10),optional,intent(in) :: spp_var_list(:)
real(kind_phys), optional,intent(in) :: spp_stddev_cutoff(:)

logical, intent (in) :: cplchm
! ice and liquid water 3d precipitation fluxes - only allocated if cplchm is .true.
real(kind=kind_phys), intent(inout), dimension(:,:) :: pfi_lsan
real(kind=kind_phys), intent(inout), dimension(:,:) :: pfl_lsan
real(kind=kind_phys), optional, intent(inout), dimension(:,:) :: pfi_lsan
real(kind=kind_phys), optional, intent(inout), dimension(:,:) :: pfl_lsan

! Local variables

Expand Down Expand Up @@ -601,8 +602,10 @@ subroutine mp_tempo_run(ncol, nlev, con_g, con_rd, &

ni = ni/(1.0_kind_phys-spechum)
nr = nr/(1.0_kind_phys-spechum)
chw = chw/(1.0_kind_phys-spechum)
vh = vh/(1.0_kind_phys-spechum)
if (is_hail_aware) then
chw = chw/(1.0_kind_phys-spechum)
vh = vh/(1.0_kind_phys-spechum)
endif
if (is_aerosol_aware .or. merra2_aerosol_aware) then
nc = nc/(1.0_kind_phys-spechum)
nwfa = nwfa/(1.0_kind_phys-spechum)
Expand Down Expand Up @@ -856,8 +859,10 @@ subroutine mp_tempo_run(ncol, nlev, con_g, con_rd, &

ni = ni/(1.0_kind_phys+qv)
nr = nr/(1.0_kind_phys+qv)
chw = chw/(1.0_kind_phys+qv)
vh = vh/(1.0_kind_phys+qv)
if (is_hail_aware) then
chw = chw/(1.0_kind_phys+qv)
vh = vh/(1.0_kind_phys+qv)
endif
if (is_aerosol_aware .or. merra2_aerosol_aware) then
nc = nc/(1.0_kind_phys+qv)
nwfa = nwfa/(1.0_kind_phys+qv)
Expand Down
3 changes: 2 additions & 1 deletion physics/MP/TEMPO/mp_tempo.meta
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[vh]
standard_name = graupel_volume
long_name = graupel particle volume
Expand Down Expand Up @@ -423,6 +424,7 @@
type = real
kind = kind_phys
intent = inout
optional = True
[vh]
standard_name = graupel_volume_of_new_state
long_name = graupel particle volume
Expand Down Expand Up @@ -521,7 +523,6 @@
dimensions = ()
type = logical
intent = in
optional = True
[tgrs]
standard_name = air_temperature_of_new_state
long_name = model layer mean temperature
Expand Down
2 changes: 1 addition & 1 deletion physics/MP/TEMPO/tempo

0 comments on commit 576da96

Please sign in to comment.