Skip to content

Commit

Permalink
Merge pull request #400 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 2c706af + 06b0a2b commit 73cdb1e
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 4 deletions.
15 changes: 14 additions & 1 deletion scm/src/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,10 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: vfrac (:) => null() !< vegetation fraction
integer, pointer :: vtype (:) => null() !< vegetation type
integer, pointer :: stype (:) => null() !< soil type
integer, pointer :: scolor (:) => null() !< soil color
integer, pointer :: vtype_save (:) => null()!< vegetation type save
integer, pointer :: stype_save (:) => null()!< soil type save
integer, pointer :: scolor_save (:) => null()!< soil color save
real (kind=kind_phys), pointer :: uustar (:) => null() !< boundary layer parameter
real (kind=kind_phys), pointer :: oro (:) => null() !< orography
real (kind=kind_phys), pointer :: oro_uf (:) => null() !< unfiltered orography
Expand Down Expand Up @@ -1038,6 +1040,8 @@ module GFS_typedefs
integer :: iopt_tbot !lower boundary of soil temperature (1->zero-flux; 2->noah)
integer :: iopt_stc !snow/soil temperature time scheme (only layer 1)
integer :: iopt_trs !thermal roughness scheme (1-z0h=z0m; 2-czil; 3-ec;4-kb inversed)
integer :: iopt_diag !2m t/q diagnostic approach (1->external GFS sfc_diag 2->original NoahMP 2-title 3->NoahMP
!2-title + internal GFS sfc_diag )

! -- RUC LSM options
integer :: mosaic_lu=0 !< control for use of fractional landuse in RUC land surface model
Expand Down Expand Up @@ -2368,6 +2372,8 @@ subroutine sfcprop_create (Sfcprop, IM, Model)
allocate (Sfcprop%vtype_save (IM))
allocate (Sfcprop%stype (IM))
allocate (Sfcprop%stype_save (IM))
allocate (Sfcprop%scolor (IM))
allocate (Sfcprop%scolor_save(IM))
allocate (Sfcprop%uustar (IM))
allocate (Sfcprop%oro (IM))
allocate (Sfcprop%oro_uf (IM))
Expand All @@ -2386,6 +2392,8 @@ subroutine sfcprop_create (Sfcprop, IM, Model)
Sfcprop%vtype_save = zero
Sfcprop%stype = zero
Sfcprop%stype_save = zero
Sfcprop%scolor = zero
Sfcprop%scolor_save = zero
Sfcprop%uustar = clear_val
Sfcprop%oro = clear_val
Sfcprop%oro_uf = clear_val
Expand Down Expand Up @@ -3484,6 +3492,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
integer :: iopt_tbot = 2 !lower boundary of soil temperature (1->zero-flux; 2->noah)
integer :: iopt_stc = 1 !snow/soil temperature time scheme (only layer 1)
integer :: iopt_trs = 2 !thermal roughness scheme (1-z0h=z0m; 2-czil; 3-ec;4-kb reversed)
integer :: iopt_diag = 2 !2m t/q diagnostic approach (1->external GFS sfc_diag 2->original NoahMP 2-title
!3->NoahMP 2-title + internal GFS sfc_diag )

integer :: mosaic_lu = 0 ! 1 - used of fractional landuse in RUC lsm
integer :: mosaic_soil = 0 ! 1 - used of fractional soil in RUC lsm
Expand Down Expand Up @@ -3902,7 +3912,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
! Noah MP options
iopt_dveg,iopt_crs,iopt_btr,iopt_run,iopt_sfc, iopt_frz, &
iopt_inf, iopt_rad,iopt_alb,iopt_snf,iopt_tbot,iopt_stc, &
iopt_trs, &
iopt_trs, iopt_diag, &
! RUC lsm options
mosaic_lu, mosaic_soil, isncond_opt, isncovr_opt, &
! GFDL surface layer options
Expand Down Expand Up @@ -4713,6 +4723,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%iopt_tbot = iopt_tbot
Model%iopt_stc = iopt_stc
Model%iopt_trs = iopt_trs
Model%iopt_diag = iopt_diag

! RUC lsm options
Model%mosaic_lu = mosaic_lu
Expand Down Expand Up @@ -5651,6 +5662,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
print *,'iopt_tbot = ',Model%iopt_tbot
print *,'iopt_stc = ', Model%iopt_stc
print *,'iopt_trs = ', Model%iopt_trs
print *,'iopt_diag = ', Model%iopt_diag
elseif (Model%lsm == Model%lsm_ruc) then
print *,' RUC Land Surface Model used'
print *, 'The Physics options are'
Expand Down Expand Up @@ -6567,6 +6579,7 @@ subroutine control_print(Model)
print *, ' iopt_tbot : ', Model%iopt_tbot
print *, ' iopt_stc : ', Model%iopt_stc
print *, ' iopt_trs : ', Model%iopt_trs
print *, ' iopt_diag : ', Model%iopt_diag
elseif (Model%lsm == Model%lsm_ruc) then
print *,' RUC Land Surface Model used'
print *, 'The Physics options are'
Expand Down
18 changes: 18 additions & 0 deletions scm/src/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,18 @@
units = index
dimensions = (horizontal_loop_extent)
type = integer
[scolor]
standard_name = soil_color_classification
long_name = soil color for lsm
units = index
dimensions = (horizontal_loop_extent)
type = integer
[scolor_save]
standard_name = soil_color_classification_save
long_name = soil color for lsm save
units = index
dimensions = (horizontal_loop_extent)
type = integer
[uustar]
standard_name = surface_friction_velocity
long_name = boundary layer parameter
Expand Down Expand Up @@ -4919,6 +4931,12 @@
units = index
dimensions = ()
type = integer
[iopt_diag]
standard_name = control_for_land_surface_scheme_surface_diagnose_approach
long_name = choice for surface diagnose approach option (see noahmp module for definition)
units = index
dimensions = ()
type = integer
[use_ufo]
standard_name = flag_for_gcycle_surface_option
long_name = flag for gcycle surface option
Expand Down
9 changes: 8 additions & 1 deletion scm/src/scm_input.F90
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ subroutine get_case_init(scm_state, scm_input)
real(kind=dp) :: input_q2m !< 2-meter specific humidity (kg kg-1)
integer :: input_vegtyp !< vegetation type
integer :: input_soiltyp!< soil type
integer :: input_scolor !< soil color
real(kind=dp) :: input_uustar !< surface friction velocity (m s-1)
real(kind=dp) :: input_ffmm !< Monin-Obukhov similarity function for momentum
real(kind=dp) :: input_ffhh !< Monin-Obukhov similarity function for heat
Expand Down Expand Up @@ -552,6 +553,7 @@ subroutine get_case_init(scm_state, scm_input)
call NetCDF_read_var(grp_ncid, "q2m", .False., input_q2m)
call NetCDF_read_var(grp_ncid, "vegtyp", .False., input_vegtyp )
call NetCDF_read_var(grp_ncid, "soiltyp", .False., input_soiltyp )
call NetCDF_read_var(grp_ncid, "scolor", .False., input_scolor)
call NetCDF_read_var(grp_ncid, "uustar", .False., input_uustar)
call NetCDF_read_var(grp_ncid, "ffmm", .False., input_ffmm)
call NetCDF_read_var(grp_ncid, "ffhh", .False., input_ffhh)
Expand Down Expand Up @@ -797,6 +799,7 @@ subroutine get_case_init(scm_state, scm_input)
scm_input%input_q2m = input_q2m
scm_input%input_vegtyp = input_vegtyp
scm_input%input_soiltyp = input_soiltyp
scm_input%input_scolor = input_scolor
scm_input%input_uustar = input_uustar
scm_input%input_ffmm = input_ffmm
scm_input%input_ffhh = input_ffhh
Expand Down Expand Up @@ -994,6 +997,7 @@ subroutine get_case_init_DEPHY(scm_state, scm_input)
integer , allocatable :: input_vegsrc(:) !< vegetation source
integer , allocatable :: input_vegtyp(:) !< vegetation type
integer , allocatable :: input_soiltyp(:)!< soil type
integer , allocatable :: input_scolor(:) !< soil color
integer , allocatable :: input_slopetype(:) !< slope type
real(kind=dp), allocatable :: input_vegfrac(:) !< vegetation fraction
real(kind=dp), allocatable :: input_shdmin(:) !< minimun vegetation fraction
Expand Down Expand Up @@ -1329,6 +1333,7 @@ subroutine get_case_init_DEPHY(scm_state, scm_input)
input_vegsrc ( input_n_init_times), &
input_vegtyp ( input_n_init_times), &
input_soiltyp ( input_n_init_times), &
input_scolor ( input_n_init_times), &
input_slopetype ( input_n_init_times), &
input_vegfrac ( input_n_init_times), &
input_shdmin ( input_n_init_times), &
Expand Down Expand Up @@ -1659,6 +1664,7 @@ subroutine get_case_init_DEPHY(scm_state, scm_input)
call NetCDF_read_var(ncid, "vegsrc", .True., input_vegsrc )
call NetCDF_read_var(ncid, "vegtyp", .True., input_vegtyp )
call NetCDF_read_var(ncid, "soiltyp", .True., input_soiltyp )
call NetCDF_read_var(ncid, "scolor", .True., input_scolor)
call NetCDF_read_var(ncid, "slopetyp", .True., input_slopetype)
call NetCDF_read_var(ncid, "tsfco", .True., input_tsfco)
call NetCDF_read_var(ncid, "vegfrac", .True., input_vegfrac)
Expand Down Expand Up @@ -2032,7 +2038,7 @@ subroutine get_case_init_DEPHY(scm_state, scm_input)
scm_input%input_T_surf = input_force_ts(:)
scm_state%surface_thermo_control = 2
end if
else if (input_surfaceForcingTemp == 'surface_flux') then
else if (input_surfaceForcingTemp == 'kinematic') then
!overwrite sfc_flux_spec
scm_state%sfc_flux_spec = .true.
scm_state%surface_thermo_control = 0
Expand Down Expand Up @@ -2155,6 +2161,7 @@ subroutine get_case_init_DEPHY(scm_state, scm_input)
scm_input%input_vegtyp = REAL(input_vegtyp(active_init_time), kind=dp)
scm_input%input_soiltyp = REAL(input_soiltyp(active_init_time), kind=dp)
scm_input%input_slopetype = REAL(input_slopetype(active_init_time), kind=dp)
scm_input%input_scolor = REAL(input_scolor(active_init_time), kind=dp)
scm_input%input_tsfco = input_tsfco(active_init_time)
scm_input%input_vegfrac = input_vegfrac(active_init_time)
scm_input%input_shdmin = input_shdmin(active_init_time)
Expand Down
17 changes: 16 additions & 1 deletion scm/src/scm_type_defs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ module scm_type_defs
real(kind=dp) :: input_q2m !< 2-meter specific humidity (kg kg-1)
integer :: input_vegtyp !< vegetation type classification
integer :: input_soiltyp !<
integer :: input_scolor
real(kind=dp) :: input_uustar !< surface friction velocity (m s-1)
real(kind=dp) :: input_ffmm !< Monin-Obukhov similarity function for momentum
real(kind=dp) :: input_ffhh !< Monin-Obukhov similarity function for heat
Expand Down Expand Up @@ -693,6 +694,7 @@ subroutine scm_input_create(scm_input, ntimes, nlev, nsoil, nsnow, nice)
scm_input%input_q2m = real_zero
scm_input%input_vegtyp = int_zero
scm_input%input_soiltyp = int_zero
scm_input%input_scolor = int_zero
scm_input%input_uustar = real_zero
scm_input%input_ffmm = real_zero
scm_input%input_ffhh = real_zero
Expand Down Expand Up @@ -1165,12 +1167,25 @@ subroutine physics_set(physics, scm_input, scm_state)
else
physics%Sfcprop%zorlwav(i) = physics%Sfcprop%zorlw(i)
end if
call conditionally_set_var(scm_input%input_scolor, physics%Sfcprop%scolor(i), "scolor", .false., missing_var(50))

if (missing_var(50)) then
if (.not. missing_var(1)) then
if ( nint (physics%Sfcprop%slmsk(i)) == 1 ) then !including glacier
physics%Sfcprop%scolor(i) = 4
else
physics%Sfcprop%scolor(i) = int_zero
endif
else
physics%Sfcprop%scolor(i) = int_zero
end if
end if

!GJF: Is this still needed?
if (missing_var(32)) physics%Sfcprop%sncovr(i) = real_zero

!write out warning if missing data for non-required variables
n = 49
n = 50
if ( i==1 .and. ANY( missing_var(1:n) ) ) then
write(0,'(a)') "INPUT CHECK: Some missing input data was found related to (potentially non-required) surface variables. This may lead to crashes or other strange behavior."
write(0,'(a)') "Check scm_type_defs.F90/physics_set to see the names of variables that are missing, corresponding to the following indices:"
Expand Down

0 comments on commit 73cdb1e

Please sign in to comment.