Skip to content

Commit

Permalink
Merge pull request NCAR#1030 from grantfirl/ufs-dev-PR78
Browse files Browse the repository at this point in the history
UFS-dev PR#78
  • Loading branch information
grantfirl authored Oct 5, 2023
2 parents ede5b1d + fc048ca commit c83cd17
Show file tree
Hide file tree
Showing 18 changed files with 3,212 additions and 1,348 deletions.
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
18 changes: 12 additions & 6 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 @@ -172,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 @@ -294,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 @@ -469,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 @@ -742,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 @@ -789,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 @@ -928,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
7 changes: 7 additions & 0 deletions physics/GFS_phys_time_vary.fv3.meta
Original file line number Diff line number Diff line change
Expand Up @@ -1794,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
14 changes: 8 additions & 6 deletions physics/GFS_surface_generic_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ module GFS_surface_generic_post
!> \section arg_table_GFS_surface_generic_post_init Argument Table
!! \htmlinclude GFS_surface_generic_post_init.html
!!
subroutine GFS_surface_generic_post_init (vtype, stype, slope, vtype_save, stype_save, slope_save, errmsg, errflg)
subroutine GFS_surface_generic_post_init (vtype, stype,scolor, slope, vtype_save, stype_save,scolor_save, slope_save, errmsg, errflg)

integer, dimension(:), intent(in) :: vtype_save, stype_save, slope_save
integer, dimension(:), intent(out) :: vtype, stype, slope
integer, dimension(:), intent(in) :: vtype_save, stype_save,scolor_save, slope_save
integer, dimension(:), intent(out) :: vtype, stype, scolor,slope

! CCPP error handling
character(len=*), intent(out) :: errmsg
Expand All @@ -37,6 +37,7 @@ subroutine GFS_surface_generic_post_init (vtype, stype, slope, vtype_save, stype
! Restore vegetation, soil and slope type
vtype(:) = vtype_save(:)
stype(:) = stype_save(:)
scolor(:) = scolor_save(:)
slope(:) = slope_save(:)

end subroutine GFS_surface_generic_post_init
Expand All @@ -53,7 +54,7 @@ subroutine GFS_surface_generic_post_run (im, cplflx, cplaqm, cplchm, cplwav, cpl
v10mi_cpl, tsfci_cpl, psurfi_cpl, nnirbmi_cpl, nnirdfi_cpl, nvisbmi_cpl, nvisdfi_cpl, nswsfci_cpl, nswsfc_cpl, nnirbm_cpl, &
nnirdf_cpl, nvisbm_cpl, nvisdf_cpl, gflux, evbsa, evcwa, transa, sbsnoa, snowca, snohfa, paha, ep, ecan, etran, edir, waxy, &
runoff, srunoff, runof, drain, tecan, tetran, tedir, twa, lheatstrg, h0facu, h0facs, zvfun, hflx, evap, hflxq, hffac, &
isot, ivegsrc, islmsk, vtype, stype, slope, vtype_save, stype_save, slope_save, errmsg, errflg)
isot, ivegsrc, islmsk, vtype, stype,scolor, slope, vtype_save, stype_save,scolor_save, slope_save, errmsg, errflg)

implicit none

Expand Down Expand Up @@ -85,8 +86,8 @@ subroutine GFS_surface_generic_post_run (im, cplflx, cplaqm, cplchm, cplwav, cpl
real(kind=kind_phys), dimension(:), intent(out) :: hflxq
real(kind=kind_phys), dimension(:), intent(out) :: hffac

integer, intent(in) :: isot, ivegsrc, islmsk(:), vtype_save(:), stype_save(:), slope_save(:)
integer, intent(out) :: vtype(:), stype(:), slope(:)
integer, intent(in) :: isot, ivegsrc, islmsk(:), vtype_save(:), stype_save(:),scolor_save(:), slope_save(:)
integer, intent(out) :: vtype(:), stype(:),scolor(:), slope(:)

! CCPP error handling variables
character(len=*), intent(out) :: errmsg
Expand Down Expand Up @@ -274,6 +275,7 @@ subroutine GFS_surface_generic_post_run (im, cplflx, cplaqm, cplchm, cplwav, cpl
! Restore vegetation, soil and slope type
vtype(:) = vtype_save(:)
stype(:) = stype_save(:)
scolor(:) = scolor_save(:)
slope(:) = slope_save(:)

end subroutine GFS_surface_generic_post_run
Expand Down
28 changes: 28 additions & 0 deletions physics/GFS_surface_generic_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
dimensions = (horizontal_dimension)
type = integer
intent = out
[scolor]
standard_name = soil_color_classification
long_name = soil color for lsm
units = index
dimensions = (horizontal_dimension)
type = integer
intent = out
[slope]
standard_name = surface_slope_classification
long_name = sfc slope type for lsm
Expand All @@ -43,6 +50,13 @@
dimensions = (horizontal_dimension)
type = integer
intent = in
[scolor_save]
standard_name = soil_color_classification_save
long_name = soil color for lsm save
units = index
dimensions = (horizontal_dimension)
type = integer
intent = in
[slope_save]
standard_name = surface_slope_classification_save
long_name = sfc slope type for lsm save
Expand Down Expand Up @@ -988,6 +1002,13 @@
dimensions = (horizontal_loop_extent)
type = integer
intent = out
[scolor]
standard_name = soil_color_classification
long_name = soil color for lsm
units = index
dimensions = (horizontal_loop_extent)
type = integer
intent = out
[slope]
standard_name = surface_slope_classification
long_name = sfc slope type for lsm
Expand All @@ -1009,6 +1030,13 @@
dimensions = (horizontal_loop_extent)
type = integer
intent = in
[scolor_save]
standard_name = soil_color_classification_save
long_name = soil color for lsm save
units = index
dimensions = (horizontal_loop_extent)
type = integer
intent = in
[slope_save]
standard_name = surface_slope_classification_save
long_name = sfc slope type for lsm save
Expand Down
31 changes: 18 additions & 13 deletions physics/GFS_surface_generic_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ module GFS_surface_generic_pre
!> \section arg_table_GFS_surface_generic_pre_init Argument Table
!! \htmlinclude GFS_surface_generic_pre_init.html
!!
subroutine GFS_surface_generic_pre_init (nthreads, im, slmsk, isot, ivegsrc, stype, vtype, slope, &
vtype_save, stype_save, slope_save, errmsg, errflg)
subroutine GFS_surface_generic_pre_init (nthreads, im, slmsk, isot, ivegsrc, stype,scolor, vtype, slope, &
vtype_save, stype_save,scolor_save, slope_save, errmsg, errflg)

implicit none

! Interface variables
integer, intent(in) :: nthreads, im, isot, ivegsrc
real(kind_phys), dimension(:), intent(in) :: slmsk
integer, dimension(:), intent(inout) :: vtype, stype, slope
integer, dimension(:), intent(out) :: vtype_save, stype_save, slope_save
integer, dimension(:), intent(inout) :: vtype, stype, scolor,slope
integer, dimension(:), intent(out) :: vtype_save, stype_save,scolor_save, slope_save

! CCPP error handling
character(len=*), intent(out) :: errmsg
Expand All @@ -49,22 +49,23 @@ subroutine GFS_surface_generic_pre_init (nthreads, im, slmsk, isot, ivegsrc, sty
! Save current values of vegetation, soil and slope type
vtype_save(:) = vtype(:)
stype_save(:) = stype(:)
scolor_save(:) = scolor(:)
slope_save(:) = slope(:)

call update_vegetation_soil_slope_type(nthreads, im, isot, ivegsrc, islmsk, vtype, stype, slope)
call update_vegetation_soil_slope_type(nthreads, im, isot, ivegsrc, islmsk, vtype, stype,scolor, slope)

end subroutine GFS_surface_generic_pre_init

!> \section arg_table_GFS_surface_generic_pre_run Argument Table
!! \htmlinclude GFS_surface_generic_pre_run.html
!!
subroutine GFS_surface_generic_pre_run (nthreads, im, levs, vfrac, islmsk, isot, ivegsrc, stype, vtype, slope, &
subroutine GFS_surface_generic_pre_run (nthreads, im, levs, vfrac, islmsk, isot, ivegsrc, stype, scolor,vtype, slope, &
prsik_1, prslk_1, tsfc, phil, con_g, sigmaf, work3, zlvl, &
drain_cpl, dsnow_cpl, rain_cpl, snow_cpl, lndp_type, n_var_lndp, sfc_wts, &
lndp_var_list, lndp_prt_list, &
z01d, zt1d, bexp1d, xlai1d, vegf1d, lndp_vgf, &
cplflx, flag_cice, islmsk_cice, slimskin_cpl, &
wind, u1, v1, cnvwind, smcwlt2, smcref2, vtype_save, stype_save, slope_save, &
wind, u1, v1, cnvwind, smcwlt2, smcref2, vtype_save, stype_save,scolor_save, slope_save, &
errmsg, errflg)

use surface_perturbation, only: cdfnor
Expand All @@ -77,8 +78,8 @@ subroutine GFS_surface_generic_pre_run (nthreads, im, levs, vfrac, islmsk, isot,

real(kind=kind_phys), intent(in) :: con_g
real(kind=kind_phys), dimension(:), intent(in) :: vfrac, prsik_1, prslk_1
integer, dimension(:), intent(inout) :: vtype, stype, slope
integer, dimension(:), intent(out) :: vtype_save(:), stype_save(:), slope_save(:)
integer, dimension(:), intent(inout) :: vtype, stype,scolor, slope
integer, dimension(:), intent(out) :: vtype_save(:), stype_save(:),scolor_save(:), slope_save(:)

real(kind=kind_phys), dimension(:), intent(inout) :: tsfc
real(kind=kind_phys), dimension(:,:), intent(in) :: phil
Expand Down Expand Up @@ -159,9 +160,10 @@ subroutine GFS_surface_generic_pre_run (nthreads, im, levs, vfrac, islmsk, isot,
! Save current values of vegetation, soil and slope type
vtype_save(:) = vtype(:)
stype_save(:) = stype(:)
scolor_save(:) = scolor(:)
slope_save(:) = slope(:)

call update_vegetation_soil_slope_type(nthreads, im, isot, ivegsrc, islmsk, vtype, stype, slope)
call update_vegetation_soil_slope_type(nthreads, im, isot, ivegsrc, islmsk, vtype, stype,scolor, slope)

do i=1,im
sigmaf(i) = max(vfrac(i), 0.01_kind_phys)
Expand Down Expand Up @@ -191,16 +193,19 @@ subroutine GFS_surface_generic_pre_run (nthreads, im, levs, vfrac, islmsk, isot,

end subroutine GFS_surface_generic_pre_run

subroutine update_vegetation_soil_slope_type(nthreads, im, isot, ivegsrc, islmsk, vtype, stype, slope)
subroutine update_vegetation_soil_slope_type(nthreads, im, isot, ivegsrc, islmsk, vtype, stype,scolor, slope)

implicit none

integer, intent(in) :: nthreads, im, isot, ivegsrc, islmsk(:)
integer, intent(inout) :: vtype(:), stype(:), slope(:)
integer, intent(inout) :: vtype(:), stype(:),scolor(:), slope(:)
integer :: i

!$OMP parallel do num_threads(nthreads) default(none) private(i) &
!$OMP shared(im, isot, ivegsrc, islmsk, vtype, stype, slope)
!$OMP shared(im, isot, ivegsrc, islmsk, vtype, stype,scolor, slope)

! scolor is a place holder now, how to update soil color based on the mask/veg/sot src

do i=1,im
if (islmsk(i) == 2) then
if (isot == 1) then
Expand Down
30 changes: 29 additions & 1 deletion physics/GFS_surface_generic_pre.meta
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,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
[vtype]
standard_name = vegetation_type_classification
long_name = vegetation type for lsm
Expand All @@ -71,6 +78,13 @@
dimensions = (horizontal_dimension)
type = integer
intent = out
[scolor_save]
standard_name = soil_color_classification_save
long_name = soil color for lsm save
units = index
dimensions = (horizontal_dimension)
type = integer
intent = out
[vtype_save]
standard_name = vegetation_type_classification_save
long_name = vegetation type for lsm save
Expand Down Expand Up @@ -162,6 +176,13 @@
dimensions = (horizontal_loop_extent)
type = integer
intent = inout
[scolor]
standard_name = soil_color_classification
long_name = soil color for lsm
units = index
dimensions = (horizontal_loop_extent)
type = integer
intent = inout
[vtype]
standard_name = vegetation_type_classification
long_name = vegetation type for lsm
Expand Down Expand Up @@ -190,6 +211,13 @@
dimensions = (horizontal_loop_extent)
type = integer
intent = out
[scolor_save]
standard_name = soil_color_classification_save
long_name = soil color for lsm save
units = index
dimensions = (horizontal_loop_extent)
type = integer
intent = out
[slope_save]
standard_name = surface_slope_classification_save
long_name = sfc slope type for lsm save
Expand Down Expand Up @@ -470,4 +498,4 @@
units = 1
dimensions = ()
type = integer
intent = out
intent = out
Loading

0 comments on commit c83cd17

Please sign in to comment.