Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/ufs/dev' into feature/ha…
Browse files Browse the repository at this point in the history
…fsv2_gfdlmpv3
  • Loading branch information
BinLiu-NOAA committed Feb 5, 2024
2 parents 26ac3dd + 51452b8 commit e42ac90
Show file tree
Hide file tree
Showing 35 changed files with 1,194 additions and 361 deletions.
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ physics/ysuvdif.* @Qingfu-Liu @WeiguoWang-NOAA
physics/zhaocarr_gscond.* @RuiyuSun @grantfirl @Qingfu-Liu @dustinswales
physics/zhaocarr_precpd.* @RuiyuSun @grantfirl @Qingfu-Liu @dustinswales

physics/sfc_land.* @uturuncoglu @barlage

########################################################################

# Lines starting with '#' are comments.
Expand Down
5 changes: 3 additions & 2 deletions physics/CONV/Grell_Freitas/cu_gf_deep.F90
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ subroutine cu_gf_deep_run( &
!! betwee -1 and +1
,do_capsuppress,cap_suppress_j & !
,k22 & !
,jmin,tropics) !
,jmin,kdt,tropics) !

implicit none

integer &
,intent (in ) :: &
nranflag,itf,ktf,its,ite, kts,kte,ipr,imid
nranflag,itf,ktf,its,ite, kts,kte,ipr,imid,kdt
integer, intent (in ) :: &
ichoice,nchem
real(kind=kind_phys), dimension (its:ite,4) &
Expand Down Expand Up @@ -591,6 +591,7 @@ subroutine cu_gf_deep_run( &
sig(i)=(1.-frh)**2
!frh_out(i) = frh
if(forcing(i,7).eq.0.)sig(i)=1.
if(kdt.le.(3600./dtime))sig(i)=1.
frh_out(i) = frh*sig(i)
enddo
!$acc end kernels
Expand Down
8 changes: 4 additions & 4 deletions physics/CONV/Grell_Freitas/cu_gf_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
dfi_radar_max_intervals,ldiag3d,qci_conv,do_cap_suppress, &
maxupmf,maxMF,do_mynnedmf,ichoice_in,ichoicem_in,ichoice_s_in, &
spp_cu_deep,spp_wts_cu_deep,nchem,chem3d,fscav,wetdpc_deep, &
do_smoke_transport,errmsg,errflg)
do_smoke_transport,kdt,errmsg,errflg)
!-------------------------------------------------------------
implicit none
integer, parameter :: maxiens=1
Expand All @@ -95,7 +95,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
integer :: ishallow_g3 ! depend on imfshalcnv
!-------------------------------------------------------------
integer :: its,ite, jts,jte, kts,kte
integer, intent(in ) :: im,km,ntracer, nchem
integer, intent(in ) :: im,km,ntracer,nchem,kdt
integer, intent(in ) :: ichoice_in,ichoicem_in,ichoice_s_in
logical, intent(in ) :: flag_init, flag_restart, do_mynnedmf
logical, intent(in ) :: flag_for_scnv_generic_tend,flag_for_dcnv_generic_tend
Expand Down Expand Up @@ -766,7 +766,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
! betwee -1 and +1
,do_cap_suppress_here,cap_suppress_j &
,k22m &
,jminm,tropics)
,jminm,kdt,tropics)
!$acc kernels
do i=its,itf
do k=kts,ktf
Expand Down Expand Up @@ -853,7 +853,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
! betwee -1 and +1
,do_cap_suppress_here,cap_suppress_j &
,k22 &
,jmin,tropics)
,jmin,kdt,tropics)
jpr=0
ipr=0
!$acc kernels
Expand Down
7 changes: 7 additions & 0 deletions physics/CONV/Grell_Freitas/cu_gf_driver.meta
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,13 @@
type = real
kind = kind_phys
intent = inout
[kdt]
standard_name = index_of_timestep
long_name = current forecast iteration
units = index
dimensions = ()
type = integer
intent = in
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down
2 changes: 1 addition & 1 deletion physics/CONV/SAMF/samfshalcnv.f
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ subroutine samfshalcnv_run(im,km,itc,ntc,cliq,cp,cvap, &
parameter(cinacrmx=-120.,shevf=2.0)
parameter(dtmax=10800.,dtmin=600.)
parameter(bb1=4.0,bb2=0.8,csmf=0.2)
parameter(tkcrt=2.,cmxfac=15.)
parameter(tkcrt=2.,cmxfac=10.)
! parameter(bet1=1.875,cd1=.506,f1=2.0,gam1=.5)
parameter(betaw=.03,dxcrtc0=9.e3)
parameter(h1=0.33333333)
Expand Down
48 changes: 42 additions & 6 deletions physics/MP/NSSL/mp_nssl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module mp_nssl

private
logical :: is_initialized = .False.
logical :: missing_vars_global = .False.
real :: nssl_qccn

contains
Expand All @@ -26,7 +27,9 @@ module mp_nssl
!! \htmlinclude mp_nssl_init.html
!!
subroutine mp_nssl_init(ncol, nlev, errflg, errmsg, threads, restart, &
mpirank, mpiroot, &
mpirank, mpiroot,mpicomm, &
qc, qr, qi, qs, qh, &
ccw, crw, cci, csw, chw, vh, &
con_g, con_rd, con_cp, con_rv, &
con_t0c, con_cliq, con_csol, con_eps, &
imp_physics, imp_physics_nssl, &
Expand All @@ -36,6 +39,9 @@ subroutine mp_nssl_init(ncol, nlev, errflg, errmsg, threads, restart, &


use module_mp_nssl_2mom, only: nssl_2mom_init, nssl_2mom_init_const
#ifdef MPI
use mpi
#endif

implicit none

Expand All @@ -50,16 +56,32 @@ subroutine mp_nssl_init(ncol, nlev, errflg, errmsg, threads, restart, &

integer, intent(in) :: mpirank
integer, intent(in) :: mpiroot
integer, intent(in) :: mpicomm
integer, intent(in) :: imp_physics
integer, intent(in) :: imp_physics_nssl
real(kind_phys), intent(in) :: nssl_cccn, nssl_alphah, nssl_alphahl
real(kind_phys), intent(in) :: nssl_alphar, nssl_ehw0, nssl_ehlw0
logical, intent(in) :: nssl_ccn_on, nssl_hail_on, nssl_invertccn, nssl_3moment

real(kind_phys), intent(inout) :: qc (:,:) !(1:ncol,1:nlev)
real(kind_phys), intent(inout) :: qr (:,:) !(1:ncol,1:nlev)
real(kind_phys), intent(inout) :: qi (:,:) !(1:ncol,1:nlev)
real(kind_phys), intent(inout) :: qs (:,:) !(1:ncol,1:nlev)
real(kind_phys), intent(inout) :: qh (:,:) !(1:ncol,1:nlev) graupel
real(kind_phys), intent(inout) :: ccw(:,:) !(1:ncol,1:nlev)
real(kind_phys), intent(inout) :: crw(:,:) !(1:ncol,1:nlev)
real(kind_phys), intent(inout) :: cci(:,:) !(1:ncol,1:nlev)
real(kind_phys), intent(inout) :: csw(:,:) !(1:ncol,1:nlev)
real(kind_phys), intent(inout) :: chw(:,:) !(1:ncol,1:nlev) graupel number
real(kind_phys), intent(inout) :: vh (:,:) !(1:ncol,1:nlev) graupel volume

! Local variables: dimensions used in nssl_init
integer :: ims,ime, jms,jme, kms,kme, nx, nz, i,k
real :: nssl_params(20)
real(kind_phys) :: nssl_params(20)
integer :: ihailv,ipc
real(kind_phys), parameter :: qmin = 1.e-12
integer :: ierr
logical :: missing_vars = .False.


! Initialize the CCPP error handling variables
Expand Down Expand Up @@ -143,6 +165,19 @@ subroutine mp_nssl_init(ncol, nlev, errflg, errmsg, threads, restart, &

! For restart runs, the init is done here
if (restart) then

! For restart, check if the IC is from a different scheme that does not have all the needed variables
missing_vars = .False.
IF ( Any( qc > qmin .and. ccw == 0.0 ) ) missing_vars = .true.
IF ( .not. missing_vars .and. Any( qi > qmin .and. cci == 0.0 ) ) missing_vars = .true.
IF ( .not. missing_vars .and. Any( qs > qmin .and. csw == 0.0 ) ) missing_vars = .true.
IF ( .not. missing_vars .and. Any( qr > qmin .and. crw == 0.0 ) ) missing_vars = .true.
IF ( .not. missing_vars .and. Any( qh > qmin .and. (chw == 0.0 .or. vh == 0.0) ) ) missing_vars = .true.

#ifdef MPI
call MPI_Allreduce(missing_vars, missing_vars_global, 1, MPI_LOGICAL, MPI_LOR, mpicomm, ierr)
#endif

is_initialized = .true.
return
end if
Expand Down Expand Up @@ -312,13 +347,14 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
its,ite, jts,jte, kts,kte, i,j,k
integer :: itimestep ! timestep counter
integer :: ntmul, n
real, parameter :: dtpmax = 60. ! allow up to dt=75 (1.25*60)
real(kind_phys), parameter :: dtpmax = 60. ! allow up to dt=75 (1.25*60)
real(kind_phys) :: dtptmp
integer, parameter :: ndebug = 0
logical :: invertccn
real :: cwmas
real(kind_phys) :: cwmas

real(kind_phys), allocatable :: an(:,:,:,:) ! temporary scalar array



errflg = 0
Expand Down Expand Up @@ -529,8 +565,8 @@ subroutine mp_nssl_run(ncol, nlev, con_g, con_rd, mpirank, &
dtptmp = dtp
ntmul = 1
ENDIF
IF ( first_time_step .and. .not. restart ) THEN

IF ( first_time_step .and. ( .not. restart .or. missing_vars_global ) ) THEN
itimestep = 0 ! gets incremented to 1 in call loop
IF ( nssl_ccn_on ) THEN
IF ( invertccn ) THEN
Expand Down
95 changes: 95 additions & 0 deletions physics/MP/NSSL/mp_nssl.meta
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,101 @@
dimensions = ()
type = integer
intent = in
[mpicomm]
standard_name = mpi_communicator
long_name = MPI communicator
units = index
dimensions = ()
type = integer
intent = in
[qc]
standard_name = cloud_liquid_water_mixing_ratio
long_name = cloud water mixing ratio wrt dry+vapor (no condensates)
units = kg kg-1
dimensions = (horizontal_dimension ,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[qr]
standard_name = rain_mixing_ratio
long_name = rain water mixing ratio wrt dry+vapor (no condensates)
units = kg kg-1
dimensions = (horizontal_dimension,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[qi]
standard_name = cloud_ice_mixing_ratio
long_name = ice water mixing ratio wrt dry+vapor (no condensates)
units = kg kg-1
dimensions = (horizontal_dimension,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[qs]
standard_name = snow_mixing_ratio
long_name = snow water mixing ratio wrt dry+vapor (no condensates)
units = kg kg-1
dimensions = (horizontal_dimension,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[qh]
standard_name = graupel_mixing_ratio
long_name = graupel mixing ratio wrt dry+vapor (no condensates)
units = kg kg-1
dimensions = (horizontal_dimension,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[ccw]
standard_name = mass_number_concentration_of_cloud_liquid_water_particles_in_air
long_name = cloud droplet number concentration
units = kg-1
dimensions = (horizontal_dimension,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[crw]
standard_name = mass_number_concentration_of_rain_water_in_air
long_name = rain number concentration
units = kg-1
dimensions = (horizontal_dimension,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[cci]
standard_name = mass_number_concentration_of_cloud_ice_water_crystals_in_air
long_name = ice number concentration
units = kg-1
dimensions = (horizontal_dimension,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[csw]
standard_name = mass_number_concentration_of_snow_in_air
long_name = snow number concentration
units = kg-1
dimensions = (horizontal_dimension,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[chw]
standard_name = mass_number_concentration_of_graupel_in_air
long_name = graupel number concentration
units = kg-1
dimensions = (horizontal_dimension,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[vh]
standard_name = graupel_volume
long_name = graupel particle volume
units = m3 kg-1
dimensions = (horizontal_dimension,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[con_g]
standard_name = gravitational_acceleration
long_name = gravitational acceleration
Expand Down
Loading

0 comments on commit e42ac90

Please sign in to comment.