Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Land surface upgrades for HR2 #7

Merged
merged 10 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/datm_noahmp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
matrix:
os: [ubuntu-22.04]
test: [test_datm_lnd]
esmf: [8.4.2]

env:
# set token to access gh command
Expand All @@ -34,7 +35,7 @@ jobs:
steps:
# test component
- name: Test Component
uses: esmf-org/nuopc-comp-testing@v1.0.0
uses: esmf-org/nuopc-comp-testing@feature/v1.2
with:
app_install_dir: ${{ env.APP_INSTALL_DIR }}
artifacts_files: |
Expand All @@ -61,9 +62,8 @@ jobs:
component_module_name: lnd_comp_nuopc
data_component_name: datm
dependencies: |
zlib@1.2.12
fms@2022.04
esmf@8.4.0b15+parallelio
parallelio@2.5.8+pnetcdf
fms@2022.04 precision=32,64
esmf@${{ matrix.esmf }}+external-parallelio
dependencies_install_dir: ${{ env.DEP_INSTALL_DIR }}
mpirun_args: --oversubscribe -np 6 --mca btl_tcp_if_include eth0
test_definition: ${{ env.APP_INSTALL_DIR }}/noahmp/.github/workflows/tests/${{ matrix.test }}.yaml
6 changes: 6 additions & 0 deletions .github/workflows/tests/test_datm_lnd/lnd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ input:
- input-data-20221101/FV3_fix_tiled/C96/C96.soil_type.tile4.nc
- input-data-20221101/FV3_fix_tiled/C96/C96.soil_type.tile5.nc
- input-data-20221101/FV3_fix_tiled/C96/C96.soil_type.tile6.nc
- input-data-20221101/FV3_fix_tiled/C96/C96.soil_color.tile1.nc
- input-data-20221101/FV3_fix_tiled/C96/C96.soil_color.tile2.nc
- input-data-20221101/FV3_fix_tiled/C96/C96.soil_color.tile3.nc
- input-data-20221101/FV3_fix_tiled/C96/C96.soil_color.tile4.nc
- input-data-20221101/FV3_fix_tiled/C96/C96.soil_color.tile5.nc
- input-data-20221101/FV3_fix_tiled/C96/C96.soil_color.tile6.nc
- input-data-20221101/FV3_fix_tiled/C96/C96.substrate_temperature.tile1.nc
- input-data-20221101/FV3_fix_tiled/C96/C96.substrate_temperature.tile2.nc
- input-data-20221101/FV3_fix_tiled/C96/C96.substrate_temperature.tile3.nc
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ list(APPEND _noahmp_ccpp_files drivers/ccpp/noahmpdrv.F90
drivers/ccpp/physcons.F90)

# NoahMP
list(APPEND _noahmp_files src/module_sf_noahmplsm.f90
src/module_sf_noahmp_glacier.f90)
list(APPEND _noahmp_files src/module_sf_noahmplsm.F90
src/module_sf_noahmp_glacier.F90)

#------------------------------------------------------------------------------
# Build options
Expand Down
2,282 changes: 1,285 additions & 997 deletions drivers/ccpp/noahmp_tables.f90

Large diffs are not rendered by default.

188 changes: 160 additions & 28 deletions drivers/ccpp/noahmpdrv.F90

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions drivers/ccpp/physcons.F90
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ module physcons
real(kind=kind_phys),parameter:: con_omega =7.2921e-5_kind_phys !< ang vel of earth (\f$s^{-1}\f$)
real(kind=kind_phys),parameter:: con_p0 =1.01325e5_kind_phys !< standard atmospheric pressure (\f$Pa\f$)
! real(kind=kind_phys),parameter:: con_solr =1.36822e+3_kind_phys ! solar constant (W/m2)-aer(2001)
real(kind=kind_phys),parameter:: con_solr_old =1.3660e+3_kind_phys !< solar constant (\f$W/m^{2}\f$)-Liu(2002)
real(kind=kind_phys),parameter:: con_solr =1.3608e+3_kind_phys !< solar constant (\f$W/m^{2}\f$)-nasa-sorce Tim(2008)
real(kind=kind_phys),parameter:: con_solr_2002 =1.3660e+3_kind_phys !< solar constant (\f$W/m^{2}\f$)-Liu(2002)
real(kind=kind_phys),parameter:: con_solr_2008 =1.3608e+3_kind_phys !< solar constant (\f$W/m^{2}\f$)-nasa-sorce Tim(2008)
! real(kind=kind_phys),parameter:: con_solr =1.36742732e+3_kind_phys ! solar constant (W/m2)-gfdl(1989) - OPR as of Jan 2006
! Selected geophysics/astronomy constants with kind=kind_dyn
real(kind=kind_dyn), parameter:: con_g_dyn =9.80665e+0_kind_dyn !< gravity (\f$m/s^{2}\f$)
Expand Down Expand Up @@ -139,6 +139,7 @@ module physcons
real(kind=kind_phys),parameter:: rhowater = 1000._kind_phys !< density of water (kg/m^3)
real(kind=kind_phys),parameter:: rhosnow = 100._kind_phys !< density of snow (kg/m^3)
real(kind=kind_phys),parameter:: rhoair = 1.28_kind_phys !< density of air near surface (kg/m^3)
real(kind=kind_phys),parameter:: rholakeice = 0.917e3_kind_phys !< density of ice on lake (kg/m^3)

! Decorrelation length constant (km) for iovr = 4 or 5 and idcor = 0
real(kind=kind_phys),parameter:: decorr_con = 2.50_kind_phys
Expand Down
22 changes: 15 additions & 7 deletions drivers/ccpp/set_soilveg.f
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ module set_soilveg_mod

!> \ingroup Noah_LSM
!! This subroutine initializes soil and vegetation.
subroutine set_soilveg(me,isot,ivet,nlunit)
subroutine set_soilveg(me,isot,ivet,nlunit,errmsg,errflg)
use namelist_soilveg
implicit none

integer, intent(in) :: me,isot,ivet,nlunit
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg
!my begin locals
!for 20 igbp veg type and 19 stasgo soil type
integer i
Expand Down Expand Up @@ -385,16 +387,22 @@ subroutine set_soilveg(me,isot,ivet,nlunit)
! CLOSE(59)

IF (DEFINED_SOIL .GT. MAX_SOILTYP) THEN
WRITE(0,*) 'Warning: DEFINED_SOIL too large in namelist'
STOP 222
errflg = 222
errmsg = 'ERROR(set_soilveg): DEFINED_SOIL too large in '// &
& 'namelist'
return
ENDIF
IF (DEFINED_VEG .GT. MAX_VEGTYP) THEN
WRITE(0,*) 'Warning: DEFINED_VEG too large in namelist'
STOP 222
errflg = 222
errmsg = 'ERROR(set_soilveg): DEFINED_VEG too large in '// &
& 'namelist'
return
ENDIF
IF (DEFINED_SLOPE .GT. MAX_SLOPETYP) THEN
WRITE(0,*) 'Warning: DEFINED_SLOPE too large in namelist'
STOP 222
errflg = 222
errmsg = 'ERROR(set_soilveg): DEFINED_SLOPE too large in '//&
& 'namelist'
return
ENDIF

SMLOW = SMLOW_DATA
Expand Down
8 changes: 5 additions & 3 deletions drivers/ccpp/sfc_diff.f
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ subroutine sfc_diff_run (im,rvrdm1,eps,epsm1,grav, & !intent(in)
integer, dimension(:), intent(in) :: vegtype

logical, intent(in) :: redrag ! reduced drag coeff. flag for high wind over sea (j.han)
logical, dimension(:), intent(in) :: flag_iter, wet, dry, icy
logical, dimension(:), intent(in) :: flag_iter, dry, icy
logical, dimension(:), intent(inout) :: wet

logical, intent(in) :: thsfc_loc ! Flag for reference pressure in theta calculation

Expand Down Expand Up @@ -164,7 +165,6 @@ subroutine sfc_diff_run (im,rvrdm1,eps,epsm1,grav, & !intent(in)
! ps is in pascals, wind is wind speed,
! surface roughness length is converted to m from cm
!

! write(0,*)'in sfc_diff, sfc_z0_type=',sfc_z0_type

do i=1,im
Expand Down Expand Up @@ -376,7 +376,9 @@ subroutine sfc_diff_run (im,rvrdm1,eps,epsm1,grav, & !intent(in)
call znot_t_v7(wind10m, ztmax_wat(i)) ! 10-m wind,m/s, ztmax(m)
else if (sfc_z0_type > 0) then
write(0,*)'no option for sfc_z0_type=',sfc_z0_type
stop
errflg = 1
errmsg = 'ERROR(sfc_diff_run): no option for sfc_z0_type'
return
endif
!
call stability
Expand Down
8 changes: 4 additions & 4 deletions drivers/ccpp/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ do
md5sum ../../../../FV3/ccpp/physics/physics/$i $i
done

cp -f ../../../../FV3/ccpp/physics/physics/module_sf_noahmp_glacier.f90 ../../src/.
md5sum ../../../../FV3/ccpp/physics/physics/module_sf_noahmp_glacier.f90 ../../src/module_sf_noahmp_glacier.f90
cp -f ../../../../FV3/ccpp/physics/physics/module_sf_noahmplsm.f90 ../../src/.
md5sum ../../../../FV3/ccpp/physics/physics/module_sf_noahmplsm.f90 ../../src/module_sf_noahmplsm.f90
cp -f ../../../../FV3/ccpp/physics/physics/module_sf_noahmp_glacier.F90 ../../src/.
md5sum ../../../../FV3/ccpp/physics/physics/module_sf_noahmp_glacier.F90 ../../src/module_sf_noahmp_glacier.F90
cp -f ../../../../FV3/ccpp/physics/physics/module_sf_noahmplsm.F90 ../../src/.
md5sum ../../../../FV3/ccpp/physics/physics/module_sf_noahmplsm.F90 ../../src/module_sf_noahmplsm.F90
3 changes: 2 additions & 1 deletion drivers/nuopc/lnd_comp_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ subroutine drv_run(gcomp, noahmp, rc)
noahmp%static%itime , &
noahmp%forc%ps , noahmp%model%u1 , noahmp%model%v1 , &
noahmp%forc%t1 , noahmp%forc%q1 , noahmp%model%soiltyp , &
noahmp%model%soilcol , &
noahmp%model%vegtype , noahmp%model%sigmaf , noahmp%forc%dlwflx , &
noahmp%forc%dswsfc , noahmp%model%snet , noahmp%static%delt , &
noahmp%model%tg3 , noahmp%model%cm , noahmp%model%ch , &
Expand All @@ -569,7 +570,7 @@ subroutine drv_run(gcomp, noahmp, rc)
noahmp%static%iopt_run, noahmp%static%iopt_sfc , noahmp%static%iopt_frz , &
noahmp%static%iopt_inf, noahmp%static%iopt_rad , noahmp%static%iopt_alb , &
noahmp%static%iopt_snf, noahmp%static%iopt_tbot, noahmp%static%iopt_stc , &
noahmp%static%iopt_trs, &
noahmp%static%iopt_trs, noahmp%static%iopt_diag, &
noahmp%model%xlatin , noahmp%model%xcoszin , noahmp%model%iyrlen , &
noahmp%model%julian , noahmp%domain%garea , &
noahmp%model%rainn_mp , noahmp%model%rainc_mp , &
Expand Down
15 changes: 15 additions & 0 deletions drivers/nuopc/lnd_comp_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,20 @@ subroutine read_static(noahmp, rc)
call ESMF_FieldDestroy(field, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

!----------------------
! Soil color
!----------------------

write(filename, fmt="(A,I0,A)") trim(noahmp%nmlist%input_dir)//'C', maxval(noahmp%domain%nit), '.soil_color.tile'
call read_tiled_file(filename, 'soil_color', noahmp, field, numrec=1, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_FieldGet(field, localDe=0, farrayPtr=ptr, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
noahmp%model%soilcol(:) = int(ptr(:,1,1))
nullify(ptr)
call ESMF_FieldDestroy(field, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

!----------------------
! Set land-sea mask (dry)
!----------------------
Expand Down Expand Up @@ -2128,6 +2142,7 @@ subroutine write_mosaic_output(filename, noahmp, now_time, rc)
call fld_add("t1" ,"forcing air temperature" ,"K" ,ptr2d=ptr2d, v1r8=noahmp%forc%t1)
call fld_add("q1" ,"forcing specific humidity" ,"kg/kg" ,ptr2d=ptr2d, v1r8=noahmp%forc%q1)
call fld_add("soiltyp" ,"soil type" ,"1" ,ptr2d=ptr2d, v1i4=noahmp%model%soiltyp)
call fld_add("soilcol" ,"soil color" ,"1" ,ptr2d=ptr2d, v1i4=noahmp%model%soilcol)
call fld_add("vegtype" ,"vegetation type" ,"1" ,ptr2d=ptr2d, v1i4=noahmp%model%vegtype)
call fld_add("sigmaf" ,"green vegetation fraction" ,"1" ,ptr2d=ptr2d, v1r8=noahmp%model%sigmaf)
call fld_add("dlwflx" ,"forcing longwave downward flux" ,"W/m2" ,ptr2d=ptr2d, v1r8=noahmp%forc%dlwflx)
Expand Down
11 changes: 11 additions & 0 deletions drivers/nuopc/lnd_comp_shr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,17 @@ subroutine read_namelist(gcomp, noahmp, rc)
call ESMF_LogWrite(trim(subname)//' : surface_thermal_roughness_option = '//trim(cvalue), ESMF_LOGMSG_INFO)
noahmp%static%iopt_trs = noahmp%nmlist%surface_thermal_roughness_option

! get surface_diagnose_approach_option
call NUOPC_CompAttributeGet(gcomp, name='surface_diagnose_approach_option', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
read(cvalue,*) noahmp%nmlist%surface_diagnose_approach_option
else
noahmp%nmlist%surface_diagnose_approach_option = 2
end if
call ESMF_LogWrite(trim(subname)//' : surface_diagnose_approach_option = '//trim(cvalue), ESMF_LOGMSG_INFO)
noahmp%static%iopt_diag = noahmp%nmlist%surface_diagnose_approach_option

! output frequency
call NUOPC_CompAttributeGet(gcomp, name='output_freq', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
Expand Down
5 changes: 5 additions & 0 deletions drivers/nuopc/lnd_comp_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ module lnd_comp_types
integer :: iopt_rsf ! option for surface resistent to evaporation/sublimation
integer :: iopt_gla ! option for glacier treatment
integer :: iopt_trs ! option for surface thermal roughness option
integer :: iopt_diag ! option for surface diagnose approach
logical :: do_mynnedmf ! option for MYNN-EDMF
logical :: do_mynnsfclay ! option for MYNN surface layer scheme
character(len=128) :: errmsg ! error message
Expand All @@ -89,6 +90,7 @@ module lnd_comp_types
real(kind=kp), allocatable :: u1 (:) ! u-component of wind (m/s)
real(kind=kp), allocatable :: v1 (:) ! v-component of wind (m/s)
integer , allocatable :: soiltyp (:) ! soil type (integer index)
integer , allocatable :: soilcol (:) ! soil color (integer index)
integer , allocatable :: vegtype (:) ! vegetation type (integer index)
real(kind=kp), allocatable :: sigmaf (:) ! areal fractional cover of green vegetation
real(kind=kp), allocatable :: emiss (:) ! sfc lw emissivity (fraction)
Expand Down Expand Up @@ -278,6 +280,7 @@ module lnd_comp_types
integer :: surface_evap_resistance_option
integer :: glacier_option
integer :: surface_thermal_roughness_option
integer :: surface_diagnose_approach_option ! option for surface diagnose approach
integer :: output_freq ! model output interval
logical :: has_export ! enable/disable export fields
logical :: calc_snet ! enable/disable calculating net shortwave rad. internally
Expand Down Expand Up @@ -370,6 +373,7 @@ subroutine InitializeAllocate(this, begl, endl, km, lsnowl)
allocate(this%model%u1 (begl:endl))
allocate(this%model%v1 (begl:endl))
allocate(this%model%soiltyp (begl:endl))
allocate(this%model%soilcol (begl:endl))
allocate(this%model%vegtype (begl:endl))
allocate(this%model%sigmaf (begl:endl))
allocate(this%model%emiss (begl:endl))
Expand Down Expand Up @@ -536,6 +540,7 @@ subroutine InitializeDefault(this)
this%model%u1 = 0.0_kp
this%model%v1 = 0.0_kp
this%model%soiltyp = 0
this%model%soilcol = 0
this%model%vegtype = 0
this%model%sigmaf = 0.0_kp
this%model%emiss = 0.0_kp
Expand Down
Loading