Skip to content

Commit

Permalink
Updates to FATES API 18. Passes canopy snow coverage into FATES.
Browse files Browse the repository at this point in the history
  • Loading branch information
rgknox committed Jan 1, 2022
1 parent 9d213f5 commit 4a195ee
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
10 changes: 9 additions & 1 deletion cime_config/machines/cmake_macros/gnu_eddi.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set(SUPPORTS_CXX "TRUE")
if (COMP_NAME STREQUAL gptl)
string(APPEND CPPDEFS " -DHAVE_VPRINTF -DHAVE_GETTIMEOFDAY -DHAVE_BACKTRACE")
endif()
Expand All @@ -6,6 +7,13 @@ if (NOT DEBUG)
string(APPEND FFLAGS " -fno-unsafe-math-optimizations")
endif()
if (DEBUG)
string(APPEND FFLAGS " -fbounds-check -ffpe-trap=invalid,zero,overflow")
string(APPEND FFLAGS " -g -fbacktrace -fbounds-check -ffpe-trap=invalid,zero,overflow")
endif()
string(APPEND SLIBS " -L$ENV{NETCDF_HOME}/lib/ -lnetcdff -lnetcdf -lcurl -llapack -lblas")
if (MPILIB STREQUAL mpi-serial)
set(SCC "gcc")
endif()
if (MPILIB STREQUAL mpi-serial)
set(SFC "gfortran")
endif()
string(APPEND CXX_LIBS " -lstdc++")
12 changes: 10 additions & 2 deletions components/elm/src/biogeophys/SurfaceAlbedoMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -923,15 +923,17 @@ subroutine SurfaceAlbedo(bounds, &
end do

! Calculate surface albedos and fluxes
! Only perform on vegetated patches where coszen > 0
! Only perform on vegetated patches where coszen > 0

! Calculate surface albedos and fluxes
! Only perform on vegetated pfts where coszen > 0
if(use_fates)then
#ifndef _OPENACC

call alm_fates%wrap_canopy_radiation(bounds, &
num_vegsol, filter_vegsol, &
coszen_patch(bounds%begp:bounds%endp), surfalb_vars)
coszen_patch(bounds%begp:bounds%endp), &
surfalb_vars)
#endif
else

Expand Down Expand Up @@ -1277,6 +1279,12 @@ subroutine TwoStream(bounds, &

! Adjust omega, betad, and betai for intercepted snow

! NOTE: If improvements to the canopy snow module emerge,
! Please notify the FATES team (RGK,GL,RAF,CDK,etc) to help us adapt
! changes into the FATES albedo and canopy radiation calculations.
! At present (01-2022), we are using a similar calculation here,
! where fwet = fsnow if t_veg <= tfrz, and 0 otherwise.

if (t_veg(p) > tfrz) then !no snow
tmp0 = omegal
tmp1 = betadl
Expand Down
2 changes: 1 addition & 1 deletion components/elm/src/data_types/ColumnDataType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ module ColumnDataType
real(r8), pointer :: h2osoi_vol (:,:) => null() ! volumetric soil water (0<=h2osoi_vol<=watsat) (1:nlevgrnd) (m3/m3)
real(r8), pointer :: h2osfc (:) => null() ! surface water (kg/m2)
real(r8), pointer :: h2ocan (:) => null() ! canopy water integrated to column (kg/m2)
real(r8), pointer :: total_plant_stored_h2o(:)=> null() ! total water in plants (used??)
real(r8), pointer :: total_plant_stored_h2o(:)=> null() ! total water in plants (kg/m2)
real(r8), pointer :: wslake_col (:) => null() ! col lake water storage (mm H2O)
! Derived water and ice state variables for soil/snow column, depth varying
real(r8), pointer :: h2osoi_liqvol (:,:) => null() ! volumetric liquid water content (-nlevsno+1:nlevgrnd) (m3/m3)
Expand Down
8 changes: 7 additions & 1 deletion components/elm/src/main/elmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module ELMFatesInterfaceMod
use ColumnType , only : col_pp
use ColumnDataType , only : col_es, col_ws, col_wf, col_cs, col_cf
use ColumnDataType , only : col_nf, col_pf
use VegetationDataType, only : veg_es, veg_wf
use VegetationDataType, only : veg_es, veg_wf, veg_ws
use LandunitType , only : lun_pp

use landunit_varcon , only : istsoil
Expand Down Expand Up @@ -2212,6 +2212,12 @@ subroutine wrap_canopy_radiation(this, bounds_clump, &
this%fates(nc)%bc_in(s)%albgr_dir_rb(:) = albgrd_col(c,:)
this%fates(nc)%bc_in(s)%albgr_dif_rb(:) = albgri_col(c,:)

if (veg_es%t_veg(p) <= tfrz) then
this%fates(nc)%bc_in(s)%fcansno_pa(ifp) = veg_ws%fwet(p)
else
this%fates(nc)%bc_in(s)%fcansno_pa(ifp) = 0._r8
end if

else

this%fates(nc)%bc_in(s)%filter_vegzen_pa(ifp) = .false.
Expand Down

0 comments on commit 4a195ee

Please sign in to comment.