Skip to content

Commit

Permalink
Merge branch 'ufs/dev' into feature/rad-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LarissaReames-NOAA committed Feb 6, 2025
2 parents 8a96ec2 + db19a6d commit 4f2a977
Show file tree
Hide file tree
Showing 12 changed files with 388 additions and 93 deletions.
6 changes: 3 additions & 3 deletions physics/CONV/Grell_Freitas/cu_gf_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ end subroutine cu_gf_driver_init
!! \htmlinclude cu_gf_driver_run.html
!!
!>\section gen_gf_driver Grell-Freitas Cumulus Scheme Driver General Algorithm
subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart, gf_coldstart, &
cactiv,cactiv_m,g,cp,xlv,r_v,forcet,forceqv_spechum,phil,raincv, &
qv_spechum,t,cld1d,us,vs,t2di,w,qv2di_spechum,p2di,psuri, &
hbot,htop,kcnv,xland,hfx2,qfx2,aod_gf,cliw,clcw, &
Expand Down Expand Up @@ -97,7 +97,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
integer :: its,ite, jts,jte, kts,kte
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_init, flag_restart, do_mynnedmf, gf_coldstart
logical, intent(in ) :: flag_for_scnv_generic_tend,flag_for_dcnv_generic_tend
real (kind=kind_phys), intent(in) :: g,cp,xlv,r_v
logical, intent(in ) :: ldiag3d
Expand Down Expand Up @@ -431,7 +431,7 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart,&
ccn_m(i) = 0.

! set aod and ccn
if (flag_init .and. .not.flag_restart) then
if ((flag_init .and. .not.flag_restart) .or. gf_coldstart) then
aod_gf(i)=aodc0
else
if((cactiv(i).eq.0) .and. (cactiv_m(i).eq.0))then
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 @@ -588,6 +588,13 @@
dimensions = ()
type = logical
intent = in
[gf_coldstart]
standard_name = flag_for_cold_start_gf
long_name = flag to cold start G-F
units = flag
dimensions = ()
type = logical
intent = in
[ichoice_in]
standard_name = identifier_for_c3_or_gf_deep_convection_closure
long_name = flag for C3 or GF deep convection closure
Expand Down
5 changes: 3 additions & 2 deletions physics/CONV/Grell_Freitas/cu_gf_driver_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module cu_gf_driver_pre
!> \section arg_table_cu_gf_driver_pre_run Argument Table
!! \htmlinclude cu_gf_driver_pre_run.html
!!
subroutine cu_gf_driver_pre_run (flag_init, flag_restart, kdt, fhour, dtp, t, q, prevst, prevsq, &
subroutine cu_gf_driver_pre_run (flag_init, flag_restart, gf_coldstart, kdt, fhour, dtp, t, q, prevst, prevsq, &
forcet, forceq, cactiv, cactiv_m, conv_act, conv_act_m, &
rrfs_sd, ntsmoke, ntdust, ntcoarsepm, chem3d, gq0, &
errmsg, errflg)
Expand All @@ -26,6 +26,7 @@ subroutine cu_gf_driver_pre_run (flag_init, flag_restart, kdt, fhour, dtp, t, q,

logical, intent(in) :: flag_init
logical, intent(in) :: flag_restart
logical, intent(in) :: gf_coldstart
logical, intent(in) :: rrfs_sd
integer, intent(in) :: kdt
real(kind_phys), intent(in) :: fhour
Expand Down Expand Up @@ -59,7 +60,7 @@ subroutine cu_gf_driver_pre_run (flag_init, flag_restart, kdt, fhour, dtp, t, q,
! For restart runs, can assume that prevst and prevsq
! are read from the restart files beforehand, same
! for conv_act.
if(flag_init .and. .not.flag_restart) then
if((flag_init .and. .not.flag_restart) .or. gf_coldstart) then
!$acc kernels
forcet(:,:)=0.0
forceq(:,:)=0.0
Expand Down
7 changes: 7 additions & 0 deletions physics/CONV/Grell_Freitas/cu_gf_driver_pre.meta
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@
kind = kind_phys
intent = in
optional = True
[gf_coldstart]
standard_name = flag_for_cold_start_gf
long_name = flag to cold start G-F
units = flag
dimensions = ()
type = logical
intent = in
[rrfs_sd]
standard_name = do_smoke_coupling
long_name = flag controlling rrfs_sd collection
Expand Down
39 changes: 11 additions & 28 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ module GFS_phys_time_vary

private

public GFS_phys_time_vary_init, GFS_phys_time_vary_timestep_init, GFS_phys_time_vary_timestep_finalize, GFS_phys_time_vary_finalize

logical :: is_initialized = .false.
public GFS_phys_time_vary_init, GFS_phys_time_vary_timestep_init, GFS_phys_time_vary_finalize

real(kind=kind_phys), parameter :: con_hr = 3600.0_kind_phys
real(kind=kind_phys), parameter :: con_99 = 99.0_kind_phys
Expand Down Expand Up @@ -95,7 +93,8 @@ subroutine GFS_phys_time_vary_init (
smcwtdxy, deeprechxy, rechxy, snowxy, snicexy, snliqxy, tsnoxy , smoiseq, zsnsoxy, &
slc, smc, stc, tsfcl, snowd, canopy, tg3, stype, con_t0c, lsm_cold_start, nthrds, &
lkm, use_lake_model, lakefrac, lakedepth, iopt_lake, iopt_lake_clm, iopt_lake_flake, &
lakefrac_threshold, lakedepth_threshold, ozphys, h2ophys, errmsg, errflg)
lakefrac_threshold, lakedepth_threshold, ozphys, h2ophys, is_initialized, errmsg, &
errflg)

implicit none

Expand Down Expand Up @@ -193,6 +192,7 @@ subroutine GFS_phys_time_vary_init (
real(kind_phys), intent(in) :: con_t0c

integer, intent(in) :: nthrds
logical, intent(inout) :: is_initialized
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

Expand Down Expand Up @@ -713,7 +713,8 @@ subroutine GFS_phys_time_vary_timestep_init (
tsfc, tsfco, tisfc, hice, fice, facsf, facwf, alvsf, alvwf, alnsf, alnwf, zorli, zorll, &
zorlo, weasd, slope, snoalb, canopy, vfrac, vtype, stype,scolor, shdmin, shdmax, snowd, &
cv, cvb, cvt, oro, oro_uf, xlat_d, xlon_d, slmsk, landfrac, ozphys, h2ophys, &
do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau, tau_amf, errmsg, errflg)
do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau, tau_amf, is_initialized, &
errmsg, errflg)

implicit none

Expand Down Expand Up @@ -762,6 +763,7 @@ subroutine GFS_phys_time_vary_timestep_init (
real(kind_phys), intent(inout), optional :: smois(:,:), sh2o(:,:), tslb(:,:), tref(:)
integer, intent(inout) :: vtype(:), stype(:),scolor(:), slope(:)

logical, intent(in) :: is_initialized
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

Expand Down Expand Up @@ -931,36 +933,17 @@ subroutine GFS_phys_time_vary_timestep_init (
end subroutine GFS_phys_time_vary_timestep_init
!> @}

!> \section arg_table_GFS_phys_time_vary_timestep_finalize Argument Table
!! \htmlinclude GFS_phys_time_vary_timestep_finalize.html
!!
!>\section gen_GFS_phys_time_vary_timestep_finalize GFS_phys_time_vary_timestep_finalize General Algorithm
!> @{
subroutine GFS_phys_time_vary_timestep_finalize (errmsg, errflg)

implicit none

! Interface variables
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

end subroutine GFS_phys_time_vary_timestep_finalize
!> @}

!> \section arg_table_GFS_phys_time_vary_finalize Argument Table
!! \htmlinclude GFS_phys_time_vary_finalize.html
!!
subroutine GFS_phys_time_vary_finalize(errmsg, errflg)
subroutine GFS_phys_time_vary_finalize(is_initialized, errmsg, errflg)

implicit none

! Interface variables
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
logical, intent(inout) :: is_initialized
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

! Initialize CCPP error handling variables
errmsg = ''
Expand Down
39 changes: 20 additions & 19 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.meta
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,13 @@
dimensions = ()
type = ty_h2ophys
intent = in
[is_initialized]
standard_name = flag_for_gfs_phys_time_vary_interstitial_initialization
long_name = flag carrying interstitial initialization status
units = flag
dimensions = ()
type = logical
intent = inout
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand All @@ -1062,6 +1069,13 @@
[ccpp-arg-table]
name = GFS_phys_time_vary_finalize
type = scheme
[is_initialized]
standard_name = flag_for_gfs_phys_time_vary_interstitial_initialization
long_name = flag carrying interstitial initialization status
units = flag
dimensions = ()
type = logical
intent = inout
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down Expand Up @@ -2055,26 +2069,13 @@
dimensions = ()
type = ty_h2ophys
intent = in
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
units = none
dimensions = ()
type = character
kind = len=*
intent = out
[errflg]
standard_name = ccpp_error_code
long_name = error code for error handling in CCPP
units = 1
[is_initialized]
standard_name = flag_for_gfs_phys_time_vary_interstitial_initialization
long_name = flag carrying interstitial initialization status
units = flag
dimensions = ()
type = integer
intent = out

########################################################################
[ccpp-arg-table]
name = GFS_phys_time_vary_timestep_finalize
type = scheme
type = logical
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/MP/Thompson/module_mp_thompson.F90
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module module_mp_thompson
!.. droplet number concentration.
!real(wp), parameter :: Nt_c = 100.e6
real(wp), parameter :: Nt_c_o = 50.e6
real(wp), parameter :: Nt_c_l = 100.e6
real(wp), parameter :: Nt_c_l = 150.e6
real(wp), parameter, private :: Nt_c_max = 1999.e6

!..Declaration of constants for assumed CCN/IN aerosols when none in
Expand Down
10 changes: 8 additions & 2 deletions physics/Radiation/radiation_clouds.f
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ module module_radiation_clouds
real (kind=kind_phys), parameter :: reice_def = 50.0 !< default ice radius to 50 micron
real (kind=kind_phys), parameter :: rrain_def = 1000.0 !< default rain radius to 1000 micron
real (kind=kind_phys), parameter :: rsnow_def = 250.0 !< default snow radius to 250 micron
real (kind=kind_phys), parameter :: creice_def = 25.0 !< default convective ice radius to 25 micron overland

real (kind=kind_phys), parameter :: cldssa_def = 0.99 !< default cld single scat albedo
real (kind=kind_phys), parameter :: cldasy_def = 0.84 !< default cld asymmetry factor
Expand Down Expand Up @@ -2164,8 +2165,13 @@ subroutine progcld_thompson_wsm6 &
cip(i,k) = max(0.0, (clw(i,k,ntiw) +
& snow2ice*clw(i,k,ntsw) + tem2) *
& gfac * delp(i,k))
if(tem2 > 1.e-12 .and. clw(i,k,ntiw) < 1.e-12)
& rei(i,k)=reice_def
if(tem2 > 1.e-12 .and. clw(i,k,ntiw) < 1.e-12) then
if(nint(slmsk(i))==1) then
rei(i,k)=creice_def
else
rei(i,k)=reice_def
endif
endif
crp(i,k) = max(0.0, clw(i,k,ntrw) * gfac * delp(i,k))
csp(i,k) = max(0.0, (1.-snow2ice)*clw(i,k,ntsw) *
& gfac * delp(i,k))
Expand Down
2 changes: 2 additions & 0 deletions physics/SFC_Models/Land/Noahmp/module_sf_noahmp_glacier.F90
Original file line number Diff line number Diff line change
Expand Up @@ -842,12 +842,14 @@ subroutine radiation_glacier (dt ,tg ,sneqvo ,sneqv ,cosz , & !in

! snow albedos: age even when sun is not present

if(cosz > 0) then
if(opt_alb == 1) &
call snowalb_bats_glacier (nband,cosz,fage,albsnd,albsni)
if(opt_alb == 2) then
call snowalb_class_glacier(nband,qsnow,dt,alb,albold,albsnd,albsni)
albold = alb
end if
end if

! zero summed solar fluxes

Expand Down
34 changes: 24 additions & 10 deletions physics/SFC_Models/Land/Noahmp/module_sf_noahmplsm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2511,7 +2511,19 @@ subroutine thermoprop (parameters,nsoil ,nsnow ,isnow ,ist ,dzsnso ,
real (kind=kind_phys), dimension(-nsnow+1: 0) :: tksno !snow thermal conductivity (j/m3/k)
real (kind=kind_phys), dimension( 1:nsoil) :: sice !soil ice content
real (kind=kind_phys), parameter :: sbeta = -2.0
real (kind=kind_phys), dimension(4,20) :: soil_carbon ! soil carbon content [kg/m3]
real (kind=kind_phys), parameter :: soil_carbon_df = 0.25 ! soil carbon therm cond (Lawrence and Slater)
real (kind=kind_phys), parameter :: soil_carbon_hcpct = 2.5e6 ! soil carbon heat capacity (Lawrence and Slater)
! --------------------------------------------------------------------------------------------------
! soil carbon [kg/m3] by vegetation type estimated from global PNNL soil carbon dataset
! and VIIRS surface type

soil_carbon(1,:) = (/90,65,90,65,90,40,50,50,40,50,90,60,60,60,0,20,0,90,90,60/)
soil_carbon(2,:) = (/40,30,40,30,40,25,30,30,25,30,40,30,30,30,0,15,0,60,60,40/)
soil_carbon(3,:) = (/20,15,20,15,20,15,20,15,15,15,25,20,20,20,0,10,0,40,40,30/)
soil_carbon(4,:) = (/15,10,15,10,15,10,15,10,10,10,20,10,10,10,0,10,0,40,30,20/)

soil_carbon = soil_carbon / 130.0 ! convert to soil carbon relative to peat

! compute snow thermal conductivity and heat capacity

Expand All @@ -2530,6 +2542,11 @@ subroutine thermoprop (parameters,nsoil ,nsnow ,isnow ,ist ,dzsnso ,
hcpct(iz) = sh2o(iz)*cwat + (1.0-parameters%smcmax(iz))*parameters%csoil &
+ (parameters%smcmax(iz)-smc(iz))*cpair + sice(iz)*cice
call tdfcnd (parameters,iz,df(iz), smc(iz), sh2o(iz))

! adjust for soil carbon organic content

! hcpct(iz) = (1.0 - soil_carbon(iz,vegtyp)) * hcpct(iz) + soil_carbon(iz,vegtyp) * soil_carbon_hcpct
df(iz) = (1.0 - soil_carbon(iz,vegtyp)) * df(iz) + soil_carbon(iz,vegtyp) * soil_carbon_df
end do

if ( parameters%urban_flag ) then
Expand Down Expand Up @@ -3003,7 +3020,11 @@ subroutine albedo (parameters,vegtyp ,ist ,ice ,nsoil , & !in
if (ib.eq.1) fsun = 0.
end do

if(cosz <= 0) goto 100
! snow age

call snow_age (parameters,dt,tg,sneqvo,sneqv,tauss,fage)

if(cosz > 0) then

! weight reflectance/transmittance by lai and sai

Expand All @@ -3015,10 +3036,6 @@ subroutine albedo (parameters,vegtyp ,ist ,ice ,nsoil , & !in
tau(ib) = max(parameters%taul(ib)*wl+parameters%taus(ib)*ws, mpe)
end do

! snow age

call snow_age (parameters,dt,tg,sneqvo,sneqv,tauss,fage)

! snow albedos: only if cosz > 0 and fsno > 0

if(opt_alb == 1) &
Expand Down Expand Up @@ -3067,8 +3084,7 @@ subroutine albedo (parameters,vegtyp ,ist ,ice ,nsoil , & !in
wl = ext
end if
fsun = wl

100 continue
end if

end subroutine albedo

Expand Down Expand Up @@ -9126,9 +9142,7 @@ subroutine groundwater(parameters,nsnow ,nsoil ,dt ,sice ,zsoil , & !in

! recharge rate qin to groundwater

! ka = hk(iwt)
! harmonic average, c.he changed based on gy niu's update
ka = 2.0*(hk(iwt)*parameters%dksat(iwt)*1.0e3) / (hk(iwt)+parameters%dksat(iwt)*1.0e3)
ka = 0.5*(hk(iwt)+parameters%dksat(iwt)*1.0e3)

wh_zwt = - zwt * 1.e3 !(mm)
wh = smpfz - znode(iwt)*1.e3 !(mm)
Expand Down
Loading

0 comments on commit 4f2a977

Please sign in to comment.