From 66b8b09daf14a61a4311f179c87d1262adc73b06 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Wed, 13 Sep 2023 15:40:54 -0400 Subject: [PATCH 1/3] update GFS_typedefs for UFS-dev PR#78 (soil color) and add soil color to SCM input --- ccpp/physics | 2 +- scm/src/GFS_typedefs.F90 | 15 ++++++++++++++- scm/src/GFS_typedefs.meta | 18 ++++++++++++++++++ scm/src/scm_input.F90 | 7 +++++++ scm/src/scm_type_defs.F90 | 17 ++++++++++++++++- 5 files changed, 56 insertions(+), 3 deletions(-) diff --git a/ccpp/physics b/ccpp/physics index 8a8f11626..934a626d4 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit 8a8f11626aa95dfa57df4db22768749cfbcbc005 +Subproject commit 934a626d49ffa6325c472616a766234ca4c2c70d diff --git a/scm/src/GFS_typedefs.F90 b/scm/src/GFS_typedefs.F90 index 6b621b9c0..1ded0e1d6 100644 --- a/scm/src/GFS_typedefs.F90 +++ b/scm/src/GFS_typedefs.F90 @@ -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 @@ -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 @@ -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)) @@ -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 @@ -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 @@ -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 @@ -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 @@ -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' @@ -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' diff --git a/scm/src/GFS_typedefs.meta b/scm/src/GFS_typedefs.meta index bc62d0ed8..5d3fcc5a6 100644 --- a/scm/src/GFS_typedefs.meta +++ b/scm/src/GFS_typedefs.meta @@ -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 @@ -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 diff --git a/scm/src/scm_input.F90 b/scm/src/scm_input.F90 index b0f2a1568..55a869078 100644 --- a/scm/src/scm_input.F90 +++ b/scm/src/scm_input.F90 @@ -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 @@ -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) @@ -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 @@ -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 @@ -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), & @@ -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) @@ -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) diff --git a/scm/src/scm_type_defs.F90 b/scm/src/scm_type_defs.F90 index ea9aa951f..df026e067 100644 --- a/scm/src/scm_type_defs.F90 +++ b/scm/src/scm_type_defs.F90 @@ -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 @@ -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 @@ -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:" From 8513e204c34a8bda8aa1b53a958b5538a648c616 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Wed, 13 Sep 2023 15:41:17 -0400 Subject: [PATCH 2/3] update .gitmodules for testing --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 7f187f694..b93233808 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,7 +7,7 @@ #url = https://github.com/NCAR/ccpp-physics #branch = main url = https://github.com/grantfirl/ccpp-physics - branch = ufs-dev-PR85 + branch = ufs-dev-PR78 [submodule "CMakeModules"] path = CMakeModules url = https://github.com/noaa-emc/CMakeModules From 06b0a2b6d1546116d84e1e0500342559c437b770 Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Thu, 5 Oct 2023 13:34:42 -0400 Subject: [PATCH 3/3] udpate ccpp/physics, revert .gitmodules, and submit a tested bugfix --- .gitmodules | 6 ++---- ccpp/physics | 2 +- scm/src/scm_input.F90 | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.gitmodules b/.gitmodules index b93233808..dc0798c32 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,10 +4,8 @@ branch = main [submodule "ccpp-physics"] path = ccpp/physics - #url = https://github.com/NCAR/ccpp-physics - #branch = main - url = https://github.com/grantfirl/ccpp-physics - branch = ufs-dev-PR78 + url = https://github.com/NCAR/ccpp-physics + branch = main [submodule "CMakeModules"] path = CMakeModules url = https://github.com/noaa-emc/CMakeModules diff --git a/ccpp/physics b/ccpp/physics index ede5b1d34..c83cd1714 160000 --- a/ccpp/physics +++ b/ccpp/physics @@ -1 +1 @@ -Subproject commit ede5b1d34f0dbbc1275617c49e18d561253b8d96 +Subproject commit c83cd1714c9674f87944a48d82c287ce1660d226 diff --git a/scm/src/scm_input.F90 b/scm/src/scm_input.F90 index 55a869078..a39404366 100644 --- a/scm/src/scm_input.F90 +++ b/scm/src/scm_input.F90 @@ -2038,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