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

HLM-side changes to allow FATES snow occlusion of LAI #1324

Merged
merged 7 commits into from
Apr 21, 2021
21 changes: 16 additions & 5 deletions src/utils/clmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ module CLMFatesInterfaceMod
use EDBtranMod , only : btran_ed, &
get_active_suction_layers
use EDCanopyStructureMod , only : canopy_summarization, update_hlm_dynamics
use EDCanopyStructureMod , only : UpdateFatesAvgSnowDepth
use FatesPlantRespPhotosynthMod, only : FatesPlantRespPhotosynthDrive
use EDAccumulateFluxesMod , only : AccumulateFluxes_ED
use FatesSoilBGCFluxMod , only : FluxIntoLitterPools
Expand Down Expand Up @@ -919,7 +920,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, &
call this%wrap_update_hlmfates_dyn(nc, &
bounds_clump, &
waterdiagnosticbulk_inst, &
canopystate_inst)
canopystate_inst, .false.)

! ---------------------------------------------------------------------------------
! Part IV:
Expand All @@ -942,7 +943,7 @@ end subroutine dynamics_driv
! ------------------------------------------------------------------------------------

subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, &
waterdiagnosticbulk_inst, canopystate_inst)
waterdiagnosticbulk_inst, canopystate_inst, is_initing_from_restart)

! ---------------------------------------------------------------------------------
! This routine handles the updating of vegetation canopy diagnostics, (such as lai)
Expand All @@ -956,7 +957,11 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, &
integer , intent(in) :: nc
type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst
type(canopystate_type) , intent(inout) :: canopystate_inst


! is this being called during a read from restart sequence (if so then use the restarted fates
! snow depth variable rather than the CLM variable).
logical , intent(in) :: is_initing_from_restart

integer :: npatch ! number of patches in each site
integer :: ifp ! index FATES patch
integer :: p ! HLM patch index
Expand Down Expand Up @@ -988,6 +993,11 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, &
this%fates(nc)%bc_in(s)%frac_sno_eff_si = frac_sno_eff(c)
end do

! Only update the fates internal snow burial if this is not a restart
if (.not. is_initing_from_restart) then
call UpdateFatesAvgSnowDepth(this%fates(nc)%sites,this%fates(nc)%bc_in)
end if

! Canopy diagnostics for FATES
call canopy_summarization(this%fates(nc)%nsites, &
this%fates(nc)%sites, &
Expand Down Expand Up @@ -1390,7 +1400,7 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, &
! Update diagnostics of FATES ecosystem structure used in HLM.
! ------------------------------------------------------------------------
call this%wrap_update_hlmfates_dyn(nc,bounds_clump, &
waterdiagnosticbulk_inst,canopystate_inst)
waterdiagnosticbulk_inst,canopystate_inst, .true.)

! ------------------------------------------------------------------------
! Update the 3D patch level radiation absorption fractions
Expand Down Expand Up @@ -1527,7 +1537,7 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, &
! Update diagnostics of FATES ecosystem structure used in HLM.
! ------------------------------------------------------------------------
call this%wrap_update_hlmfates_dyn(nc,bounds_clump, &
waterdiagnosticbulk_inst,canopystate_inst)
waterdiagnosticbulk_inst,canopystate_inst, .false.)

! ------------------------------------------------------------------------
! Update history IO fields that depend on ecosystem dynamics
Expand Down Expand Up @@ -1610,6 +1620,7 @@ subroutine wrap_sunfrac(this,nc,atm2lnd_inst,canopystate_inst)
end do
end do


! -------------------------------------------------------------------------------
! Call FATES public function to calculate internal sun/shade structures
! as well as total patch sun/shade fraction output boundary condition
Expand Down