Skip to content

Commit

Permalink
Merge pull request NCAR#4 from bluefinweiwei/add_spp
Browse files Browse the repository at this point in the history
Implement SPP to Thompson MP
  • Loading branch information
llpcarson authored May 11, 2021
2 parents cc4cdd7 + 5c82701 commit 11f2d03
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 11 deletions.
12 changes: 6 additions & 6 deletions physics/module_mp_thompson.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1081,12 +1081,12 @@ SUBROUTINE mp_gt_driver(qv, qc, qr, qi, qs, qg, ni, nr, nc, &
! DH* 2020-06-05: The stochastic perturbations code was retrofitted
! from a newer version of the Thompson MP scheme, but it has not been
! tested yet.
if (rand_perturb_on .ne. 0) then
errmsg = 'Logic error in mp_gt_driver: the stochastic perturbations code ' // &
'has not been tested yet with this version of the Thompson scheme'
errflg = 1
return
end if
!if (rand_perturb_on .ne. 0) then
! errmsg = 'Logic error in mp_gt_driver: the stochastic perturbations code ' // &
! 'has not been tested yet with this version of the Thompson scheme'
! errflg = 1
! return
!end if
! Activate this code when removing the guard above
!if (rand_perturb_on .ne. 0 .and. .not. present(rand_pert)) then
! errmsg = 'Logic error in mp_gt_driver: random perturbations are on, ' // &
Expand Down
44 changes: 39 additions & 5 deletions physics/mp_thompson.F90
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, &
refl_10cm, reset, do_radar_ref, &
re_cloud, re_ice, re_snow, &
mpicomm, mpirank, mpiroot, &
spp_wts_mp, do_spp, &
errmsg, errflg)

implicit none
Expand Down Expand Up @@ -461,14 +462,33 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, &
integer :: has_reqs
! DH* 2020-06-05 hardcode these values for not using random perturbations,
! hasn't been tested yet with this version of module_mp_thompson.F90
integer, parameter :: rand_perturb_on = 0
!integer, parameter :: rand_perturb_on = 0
integer, parameter :: kme_stoch = 1
!real(kind_phys) :: rand_pert(1:ncol,1:kme_stoch)
! *DH 2020-06-05
logical, optional, intent(in ) :: do_spp
!+---+-----------------------------------------------------------------+
!gthompsn 21Mar2018
! Setting spp_mp to 1 gives graupel Y-intercept pertubations (2^0)
! 2 gives cloud water distribution gamma shape parameter
! perturbations (2^1)
! 4 gives CCN & IN activation perturbations (2^2)
! 3 gives both 1+2
! 5 gives both 1+4
! 6 gives both 2+4
! 7 gives all 1+2+4
! For now (22Mar2018), standard deviation should be only 0.25 and cut-off at 1.5
! in order to constrain the various perturbations from being too extreme.
!+---+-----------------------------------------------------------------+
integer, parameter :: spp_mp = 7 ! default as 7 to perturb all three fields
! spp_wts_mp only allocated if do_spp == .true.
real(kind_phys), intent(in) :: spp_wts_mp(:,:)
real(kind_phys) :: pattern_spp_mp(1:ncol,1:nlev)
! Dimensions used in mp_gt_driver
integer :: ids,ide, jds,jde, kds,kde, &
ims,ime, jms,jme, kms,kme, &
its,ite, jts,jte, kts,kte
integer :: i, k

! Initialize the CCPP error handling variables
errmsg = ''
Expand Down Expand Up @@ -580,6 +600,20 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, &
kme = nlev
kte = nlev

do k=1,nlev
do i=1,ncol
pattern_spp_mp(i,k)=0.0
enddo
enddo

if ( do_spp ) then
do k=1,nlev
do i=1,ncol
pattern_spp_mp(i,k)=spp_wts_mp(i,k)
enddo
enddo
endif

!> - Call mp_gt_driver() with or without aerosols
if (is_aerosol_aware) then
call mp_gt_driver(qv=qv_mp, qc=qc_mp, qr=qr_mp, qi=qi_mp, qs=qs_mp, qg=qg_mp, &
Expand All @@ -594,10 +628,10 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, &
diagflag=diagflag, do_radar_ref=do_radar_ref_mp, &
re_cloud=re_cloud, re_ice=re_ice, re_snow=re_snow, &
has_reqc=has_reqc, has_reqi=has_reqi, has_reqs=has_reqs, &
rand_perturb_on=rand_perturb_on, kme_stoch=kme_stoch, &
rand_perturb_on=spp_mp, kme_stoch=kme_stoch, &
! DH* 2020-06-05 not passing this optional argument, see
! comment in module_mp_thompson.F90 / mp_gt_driver
!rand_pert=rand_pert, &
rand_pert=pattern_spp_mp, &
ids=ids, ide=ide, jds=jds, jde=jde, kds=kds, kde=kde, &
ims=ims, ime=ime, jms=jms, jme=jme, kms=kms, kme=kme, &
its=its, ite=ite, jts=jts, jte=jte, kts=kts, kte=kte, &
Expand All @@ -615,10 +649,10 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, &
diagflag=diagflag, do_radar_ref=do_radar_ref_mp, &
re_cloud=re_cloud, re_ice=re_ice, re_snow=re_snow, &
has_reqc=has_reqc, has_reqi=has_reqi, has_reqs=has_reqs, &
rand_perturb_on=rand_perturb_on, kme_stoch=kme_stoch, &
rand_perturb_on=spp_mp, kme_stoch=kme_stoch, &
! DH* 2020-06-05 not passing this optional argument, see
! comment in module_mp_thompson.F90 / mp_gt_driver
!rand_pert=rand_pert, &
rand_pert=pattern_spp_mp, &
ids=ids, ide=ide, jds=jds, jde=jde, kds=kds, kde=kde, &
ims=ims, ime=ime, jms=jms, jme=jme, kms=kms, kme=kme, &
its=its, ite=ite, jts=jts, jte=jte, kts=kts, kte=kte, &
Expand Down
17 changes: 17 additions & 0 deletions physics/mp_thompson.meta
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,23 @@
type = integer
intent = in
optional = F
[spp_wts_mp]
standard_name = weights_for_stochastic_spp_mp_perturbation
long_name = weights for stochastic spp mp perturbation
units = none
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[do_spp]
standard_name = flag_for_stochastic_spp_option
long_name = flag for stochastic spp option
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down

0 comments on commit 11f2d03

Please sign in to comment.