Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/ufs/dev' into feature/noahmp
Browse files Browse the repository at this point in the history
  • Loading branch information
uturuncoglu committed Jul 25, 2023
2 parents 87bd714 + 9b69974 commit 1afb8fc
Show file tree
Hide file tree
Showing 96 changed files with 12,351 additions and 3,171 deletions.
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release" AND ${CMAKE_Fortran_COMPILER_ID} STREQUAL
endforeach()
endif()

# Reduce optimization for mo_gas_optics_kernels.F90 (to avoid an apparent compiler bug with Intel 19+)
if(${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/kernels/mo_gas_optics_kernels.F90 IN_LIST SCHEMES_OPENMP_OFF AND
CMAKE_BUILD_TYPE STREQUAL "Release" AND ${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
SET_SOURCE_FILES_PROPERTIES(${LOCAL_CURRENT_SOURCE_DIR}/physics/rte-rrtmgp/rrtmgp/kernels/mo_gas_optics_kernels.F90
APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_Fortran_FLAGS_PHYSICS} -O1")
endif()

#------------------------------------------------------------------------------

add_library(ccpp_physics STATIC ${SCHEMES} ${SCHEMES_OPENMP_OFF} ${SCHEMES_DYNAMICS} ${CAPS})
Expand Down
371 changes: 185 additions & 186 deletions CODEOWNERS

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions physics/GFS_MP_generic_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ subroutine GFS_MP_generic_post_run(
graupelprv, draincprv, drainncprv, diceprv, dsnowprv, dgraupelprv, dtp, dfi_radar_max_intervals, &
dtend, dtidx, index_of_temperature, index_of_process_mp,ldiag3d, qdiag3d,dqdt_qmicro, lssav, num_dfi_radar, &
fh_dfi_radar,index_of_process_dfi_radar, ix_dfi_radar, dfi_radar_tten, radar_tten_limits, fhour, prevsq, &
errmsg, errflg)
iopt_lake, iopt_lake_clm, lkm, use_lake_model, errmsg, errflg)
!
use machine, only: kind_phys
use calpreciptype_mod, only: calpreciptype
implicit none

integer, intent(in) :: im, levs, kdt, nrcm, nncl, ntcw, ntrac, num_dfi_radar, index_of_process_dfi_radar
integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_mg, imp_physics_fer_hires
integer, intent(in) :: imp_physics_nssl
integer, intent(in) :: imp_physics_nssl, iopt_lake_clm, iopt_lake, lkm
logical, intent(in) :: cal_pre, lssav, ldiag3d, qdiag3d, cplflx, cplchm, cpllnd, progsigma, exticeden
integer, intent(in) :: index_of_temperature,index_of_process_mp
integer, intent(in) :: index_of_temperature,index_of_process_mp,use_lake_model(:)

integer :: dfi_radar_max_intervals
real(kind=kind_phys), intent(in) :: fh_dfi_radar(:), fhour
Expand Down Expand Up @@ -228,6 +228,13 @@ subroutine GFS_MP_generic_post_run(
dgraupelprv(:) = tem * graupelprv(:)
diceprv(:) = tem * iceprv(:)
end if
else if(lkm>0 .and. iopt_lake==iopt_lake_clm) then
do i=1,im
if(use_lake_model(i)>0) then
raincprv(i) = rainc(i)
rainncprv(i) = frain * rain1(i)
end if
end do
end if

if (cal_pre) then ! hchuang: add dominant precipitation type algorithm
Expand Down
28 changes: 28 additions & 0 deletions physics/GFS_MP_generic_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,34 @@
dimensions = ()
type = logical
intent = in
[lkm]
standard_name = control_for_lake_model_execution_method
long_name = control for lake model execution: 0=no lake, 1=lake, 2=lake+nsst
units = flag
dimensions = ()
type = integer
intent = in
[iopt_lake]
standard_name = control_for_lake_model_selection
long_name = control for lake model selection
units = 1
dimensions = ()
type = integer
intent = in
[iopt_lake_clm]
standard_name = clm_lake_model_control_selection_value
long_name = value that indicates clm lake model in the control for lake model selection
units = 1
dimensions = ()
type = integer
intent = in
[use_lake_model]
standard_name = flag_for_using_lake_model
long_name = flag indicating lake points using a lake model
units = flag
dimensions = (horizontal_loop_extent)
type = integer
intent = in
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down
10 changes: 9 additions & 1 deletion physics/GFS_debug.F90
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,10 @@ subroutine GFS_diagtoscreen_run (Model, Statein, Stateout, Sfcprop, Coupling,
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Sfcprop%vtype_save', Sfcprop%vtype_save)
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Sfcprop%stype' , Sfcprop%stype)
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Sfcprop%stype_save', Sfcprop%stype_save)

call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Sfcprop%scolor' , Sfcprop%scolor)
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Sfcprop%scolore_save', Sfcprop%scolor_save)

call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Sfcprop%uustar' , Sfcprop%uustar)
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Sfcprop%oro' , Sfcprop%oro)
call print_var(mpirank, omprank, blkno, Grid%xlat_d, Grid%xlon_d, 'Sfcprop%oro_uf' , Sfcprop%oro_uf)
Expand Down Expand Up @@ -1531,7 +1535,7 @@ module GFS_checkland
!! \htmlinclude GFS_checkland_run.html
!!
subroutine GFS_checkland_run (me, master, blkno, im, kdt, iter, flag_iter, flag_guess, &
flag_init, flag_restart, frac_grid, isot, ivegsrc, stype, vtype, slope, &
flag_init, flag_restart, frac_grid, isot, ivegsrc, stype,scolor, vtype, slope, &
dry, icy, wet, lake, ocean, oceanfrac, landfrac, lakefrac, slmsk, islmsk, &
zorl, zorlw, zorll, zorli, fice, errmsg, errflg )

Expand All @@ -1554,6 +1558,8 @@ subroutine GFS_checkland_run (me, master, blkno, im, kdt, iter, flag_iter, flag_
integer, intent(in ) :: isot
integer, intent(in ) :: ivegsrc
integer, intent(in ) :: stype(:)
integer, intent(in ) :: scolor(:)

integer, intent(in ) :: vtype(:)
integer, intent(in ) :: slope(:)
logical, intent(in ) :: dry(:)
Expand Down Expand Up @@ -1598,6 +1604,8 @@ subroutine GFS_checkland_run (me, master, blkno, im, kdt, iter, flag_iter, flag_
write(0,'(a,2i5,1x,1x,l)') 'YYY: i, blk, flag_iter(i) :', i, blkno, flag_iter(i)
write(0,'(a,2i5,1x,1x,l)') 'YYY: i, blk, flag_guess(i) :', i, blkno, flag_guess(i)
write(0,'(a,2i5,1x,e16.7)')'YYY: i, blk, stype(i) :', i, blkno, stype(i)

write(0,'(a,2i5,1x,e16.7)')'YYY: i, blk, scolor(i) :', i, blkno, scolor(i)
write(0,'(a,2i5,1x,e16.7)')'YYY: i, blk, vtype(i) :', i, blkno, vtype(i)
write(0,'(a,2i5,1x,e16.7)')'YYY: i, blk, slope(i) :', i, blkno, slope(i)
write(0,'(a,2i5,1x,1x,l)') 'YYY: i, blk, dry(i) :', i, blkno, dry(i)
Expand Down
7 changes: 7 additions & 0 deletions physics/GFS_debug.meta
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,13 @@
dimensions = (horizontal_loop_extent)
type = integer
intent = in
[scolor]
standard_name = soil_color_classification
long_name = soil color for lsm
units = index
dimensions = (horizontal_loop_extent)
type = integer
intent = in
[vtype]
standard_name = vegetation_type_classification
long_name = vegetation type for lsm
Expand Down
55 changes: 45 additions & 10 deletions physics/GFS_phys_time_vary.fv3.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ module GFS_phys_time_vary
use set_soilveg_mod, only: set_soilveg

! --- needed for Noah MP init
use noahmp_tables, only: laim_table,saim_table,sla_table, &
use noahmp_tables, only: read_mp_table_parameters, &
laim_table,saim_table,sla_table, &
bexp_table,smcmax_table,smcwlt_table, &
dwsat_table,dksat_table,psisat_table, &
isurban_table,isbarren_table, &
Expand Down Expand Up @@ -80,17 +81,22 @@ subroutine GFS_phys_time_vary_init (
zwtxy, xlaixy, xsaixy, lfmassxy, stmassxy, rtmassxy, woodxy, stblcpxy, fastcpxy, &
smcwtdxy, deeprechxy, rechxy, snowxy, snicexy, snliqxy, tsnoxy , smoiseq, zsnsoxy, &
slc, smc, stc, tsfcl, snowd, canopy, tg3, stype, con_t0c, lsm_cold_start, nthrds, &
errmsg, errflg)
lkm, use_lake_model, lakefrac, lakedepth, iopt_lake, iopt_lake_clm, iopt_lake_flake, &
lakefrac_threshold, lakedepth_threshold, errmsg, errflg)

implicit none

! Interface variables
integer, intent(in) :: me, master, ntoz, iccn, iflip, im, nx, ny, levs, iaermdl
logical, intent(in) :: h2o_phys, iaerclm, lsm_cold_start
integer, intent(in) :: idate(:)
real(kind_phys), intent(in) :: fhour
integer, intent(in) :: idate(:), iopt_lake, iopt_lake_clm, iopt_lake_flake
real(kind_phys), intent(in) :: fhour, lakefrac_threshold, lakedepth_threshold
real(kind_phys), intent(in) :: xlat_d(:), xlon_d(:)

integer, intent(in) :: lkm
integer, intent(inout) :: use_lake_model(:)
real(kind=kind_phys), intent(in ) :: lakefrac(:), lakedepth(:)

integer, intent(inout) :: jindx1_o3(:), jindx2_o3(:), jindx1_h(:), jindx2_h(:)
real(kind_phys), intent(inout) :: ddy_o3(:), ddy_h(:)
real(kind_phys), intent(in) :: ozpl(:,:,:), h2opl(:,:,:)
Expand Down Expand Up @@ -167,6 +173,7 @@ subroutine GFS_phys_time_vary_init (
real(kind_phys), intent(in) :: canopy(:)
real(kind_phys), intent(in) :: tg3(:)
integer, intent(in) :: stype(:)

real(kind_phys), intent(in) :: con_t0c

integer, intent(in) :: nthrds
Expand Down Expand Up @@ -289,6 +296,10 @@ subroutine GFS_phys_time_vary_init (
!> - Initialize soil vegetation (needed for sncovr calculation further down)
call set_soilveg(me, isot, ivegsrc, nlunit, errmsg, errflg)

!$OMP section
!> - read in NoahMP table (needed for NoahMP init)
call read_mp_table_parameters(errmsg, errflg)

!$OMP end sections

! Need an OpenMP barrier here (implicit in "end sections")
Expand Down Expand Up @@ -464,8 +475,8 @@ subroutine GFS_phys_time_vary_init (
!$OMP shared(isbarren_table,isice_table,isurban_table) &
!$omp shared(iswater_table,laim_table,sla_table,bexp_table) &
!$omp shared(stc,smc,slc,tg3,snowxy,tsnoxy,snicexy,snliqxy) &
!$omp shared(zsnsoxy,STYPE,SMCMAX_TABLE,SMCWLT_TABLE,zs,dzs) &
!$omp shared(DWSAT_TABLE,DKSAT_TABLE,PSISAT_TABLE,smoiseq) &
!$omp shared(zsnsoxy,stype,smcmax_table,smcwlt_table,zs,dzs) &
!$omp shared(dwsat_table,dksat_table,psisat_table,smoiseq) &
!$OMP shared(smcwtdxy,deeprechxy,rechxy,errmsg,errflg) &
!$OMP private(vegtyp,masslai,masssai,snd,dzsno,dzsnso,isnow) &
!$OMP private(soiltyp,bexp,smcmax,smcwlt,dwsat,dksat,psisat,ddz)
Expand Down Expand Up @@ -670,6 +681,27 @@ subroutine GFS_phys_time_vary_init (
endif noahmp_init
endif lsm_init

!Lake model
if(lkm>0 .and. iopt_lake>0) then
! A lake model is enabled.
do i = 1, im
!if (lakefrac(i) > 0.0 .and. lakedepth(i) > 1.0 ) then

! The lake data must say there's a lake here (lakefrac) with a depth (lakedepth)
if (lakefrac(i) > lakefrac_threshold .and. lakedepth(i) > lakedepth_threshold ) then
! This is a lake point. Inform the other schemes to use a lake model, and possibly nsst (lkm)
use_lake_model(i) = lkm
cycle
else
! Not a valid lake point.
use_lake_model(i) = 0
endif
enddo
else
! Lake model is disabled or settings are invalid.
use_lake_model = 0
endif

is_initialized = .true.

contains
Expand Down Expand Up @@ -716,7 +748,7 @@ subroutine GFS_phys_time_vary_timestep_init (
kice, ialb, isot, ivegsrc, input_nml_file, use_ufo, nst_anl, frac_grid, fhcyc, phour, &
lakefrac, min_seaice, min_lakeice, smc, slc, stc, smois, sh2o, tslb, tiice, tg3, tref, &
tsfc, tsfco, tisfc, hice, fice, facsf, facwf, alvsf, alvwf, alnsf, alnwf, zorli, zorll, &
zorlo, weasd, slope, snoalb, canopy, vfrac, vtype, stype, shdmin, shdmax, snowd, &
zorlo, weasd, slope, snoalb, canopy, vfrac, vtype, stype,scolor, shdmin, shdmax, snowd, &
cv, cvb, cvt, oro, oro_uf, xlat_d, xlon_d, slmsk, landfrac, &
do_ugwp_v1, jindx1_tau, jindx2_tau, ddy_j1tau, ddy_j2tau, tau_amf, errmsg, errflg)

Expand Down Expand Up @@ -763,7 +795,7 @@ subroutine GFS_phys_time_vary_timestep_init (
zorli(:), zorll(:), zorlo(:), weasd(:), snoalb(:), &
canopy(:), vfrac(:), shdmin(:), shdmax(:), &
snowd(:), cv(:), cvb(:), cvt(:), oro(:), oro_uf(:), slmsk(:)
integer, intent(inout) :: vtype(:), stype(:), slope(:)
integer, intent(inout) :: vtype(:), stype(:),scolor(:), slope(:)

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
Expand Down Expand Up @@ -887,7 +919,10 @@ subroutine GFS_phys_time_vary_timestep_init (
fhour, iflip, jindx1_aer, jindx2_aer, &
ddy_aer, iindx1_aer, &
iindx2_aer, ddx_aer, &
levs, prsl, aer_nm)
levs, prsl, aer_nm, errmsg, errflg)
if(errflg /= 0) then
return
endif
endif

!> - Call gcycle() to repopulate specific time-varying surface properties for AMIP/forecast runs
Expand All @@ -899,7 +934,7 @@ subroutine GFS_phys_time_vary_timestep_init (
frac_grid, smc, slc, stc, smois, sh2o, tslb, tiice, tg3, tref, tsfc, &
tsfco, tisfc, hice, fice, facsf, facwf, alvsf, alvwf, alnsf, alnwf, &
zorli, zorll, zorlo, weasd, slope, snoalb, canopy, vfrac, vtype, &
stype, shdmin, shdmax, snowd, cv, cvb, cvt, oro, oro_uf, &
stype, scolor, shdmin, shdmax, snowd, cv, cvb, cvt, oro, oro_uf, &
xlat_d, xlon_d, slmsk, imap, jmap, errmsg, errflg)
endif
endif
Expand Down
74 changes: 74 additions & 0 deletions physics/GFS_phys_time_vary.fv3.meta
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,73 @@
dimensions = ()
type = integer
intent = in
[lkm]
standard_name = control_for_lake_model_execution_method
long_name = control for lake model execution: 0=no lake, 1=lake, 2=lake+nsst
units = flag
dimensions = ()
type = integer
intent = in
[use_lake_model]
standard_name = flag_for_using_lake_model
long_name = flag indicating lake points using a lake model
units = flag
dimensions = (horizontal_dimension)
type = integer
intent = inout
[lakefrac]
standard_name = lake_area_fraction
long_name = fraction of horizontal grid area occupied by lake
units = frac
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = in
[lakedepth]
standard_name = lake_depth
long_name = lake depth
units = m
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = in
[iopt_lake]
standard_name = control_for_lake_model_selection
long_name = control for lake model selection
units = 1
dimensions = ()
type = integer
intent = in
[iopt_lake_clm]
standard_name = clm_lake_model_control_selection_value
long_name = value that indicates clm lake model in the control for lake model selection
units = 1
dimensions = ()
type = integer
intent = in
[iopt_lake_flake]
standard_name = flake_model_control_selection_value
long_name = value that indicates flake model in the control for lake model selection
units = 1
dimensions = ()
type = integer
intent = in
[lakefrac_threshold]
standard_name = lakefrac_threshold_for_enabling_lake_model
long_name = fraction of horizontal grid area occupied by lake must be greater than this value to enable a lake model
units = frac
dimensions = ()
type = real
kind = kind_phys
intent = in
[lakedepth_threshold]
standard_name = lake_depth_threshold_for_enabling_lake_model
long_name = lake depth must be greater than this value to enable a lake model
units = m
dimensions = ()
type = real
kind = kind_phys
intent = in
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
Expand Down Expand Up @@ -1727,6 +1794,13 @@
dimensions = (horizontal_dimension)
type = integer
intent = inout
[scolor]
standard_name = soil_color_classification
long_name = soil color for lsm
units = index
dimensions = (horizontal_dimension)
type = integer
intent = inout
[shdmin]
standard_name = min_vegetation_area_fraction
long_name = min fractional coverage of green vegetation
Expand Down
6 changes: 3 additions & 3 deletions physics/GFS_radiation_surface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ subroutine GFS_radiation_surface_run ( &
lsm_ruc, xlat, xlon, slmsk, lndp_type, n_var_lndp, sfc_alb_pert,&
lndp_var_list, lndp_prt_list, landfrac, snodl, snodi, sncovr, &
sncovr_ice, fice, zorl, hprime, tsfg, tsfa, tisfc, coszen, &
cplice, min_seaice, min_lakeice, lakefrac, use_flake, &
cplice, min_seaice, min_lakeice, lakefrac, use_lake_model, &
alvsf, alnsf, alvwf, alnwf, facsf, facwf, &
semis_lnd, semis_ice, semis_wat, snoalb, use_cice_alb, con_ttp, &
albdvis_lnd, albdnir_lnd, albivis_lnd, albinir_lnd, &
Expand All @@ -69,7 +69,7 @@ subroutine GFS_radiation_surface_run ( &
logical, intent(in) :: frac_grid, lslwr, lsswr, use_cice_alb, cplice
integer, intent(in) :: lsm, lsm_noahmp, lsm_ruc, lndp_type, n_var_lndp
real(kind=kind_phys), intent(in) :: min_seaice, min_lakeice, con_ttp
logical, dimension(:), intent(in) :: use_flake
integer, dimension(:), intent(in) :: use_lake_model

real(kind=kind_phys), dimension(:), intent(in) :: xlat, xlon, slmsk, &
sfc_alb_pert, lndp_prt_list, &
Expand Down Expand Up @@ -154,7 +154,7 @@ subroutine GFS_radiation_surface_run ( &
!> - Call module_radiation_surface::setemis(),to set up surface
!! emissivity for LW radiation.
call setemis (lsm, lsm_noahmp, lsm_ruc, frac_grid, cplice, &
use_flake, lakefrac, xlon, xlat, slmsk, &
use_lake_model, lakefrac, xlon, xlat, slmsk, &
! frac_grid, min_seaice, xlon, xlat, slmsk, &
snodl, snodi, sncovr, sncovr_ice, zorl, tsfg, &
tsfa, hprime, semis_lnd, semis_ice, semis_wat,&
Expand Down
Loading

0 comments on commit 1afb8fc

Please sign in to comment.