Skip to content

Commit

Permalink
Merge pull request #914 from glemieux/tveg-ers-fixes
Browse files Browse the repository at this point in the history
Fix mean vegetation temperature output for exact restarts
  • Loading branch information
glemieux authored Oct 12, 2022
2 parents e216ca0 + 5fa6ca3 commit d63b8d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions main/FatesInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1926,6 +1926,7 @@ subroutine UpdateFatesRMeansTStep(sites,bc_in)
ifp=0
cpatch => sites(s)%oldest_patch
do while(associated(cpatch))
if (cpatch%patchno .ne. 0) then
ifp=ifp+1
call cpatch%tveg24%UpdateRMean(bc_in(s)%t_veg_pa(ifp))
call cpatch%tveg_lpa%UpdateRMean(bc_in(s)%t_veg_pa(ifp))
Expand All @@ -1936,6 +1937,7 @@ subroutine UpdateFatesRMeansTStep(sites,bc_in)
! call ccohort%tveg_lpa%UpdateRMean(bc_in(s)%t_veg_pa(ifp))
! ccohort => ccohort%shorter
!end do
end if

cpatch => cpatch%younger
enddo
Expand Down
15 changes: 13 additions & 2 deletions main/FatesRestartInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module FatesRestartInterfaceMod
use FatesConstantsMod, only : ifalse
use FatesConstantsMod, only : fates_unset_r8, fates_unset_int
use FatesConstantsMod, only : primaryforest
use FatesConstantsMod, only : nearzero
use FatesGlobals, only : fates_log
use FatesGlobals, only : endrun => fates_endrun
use FatesIODimensionsMod, only : fates_io_dimension_type
Expand All @@ -19,6 +20,7 @@ module FatesRestartInterfaceMod
use FatesInterfaceTypesMod, only : bc_out_type
use FatesInterfaceTypesMod, only : hlm_use_planthydro
use FatesInterfaceTypesMod, only : hlm_use_sp
use FatesInterfaceTypesMod, only : hlm_use_nocomp, hlm_use_fixed_biogeog
use FatesInterfaceTypesMod, only : fates_maxElementsPerSite
use EDCohortDynamicsMod, only : UpdateCohortBioPhysRates
use FatesHydraulicsMemMod, only : nshell
Expand All @@ -36,7 +38,7 @@ module FatesRestartInterfaceMod
use FatesLitterMod, only : litter_type
use FatesLitterMod, only : ncwd
use FatesLitterMod, only : ndcmpy
use EDTypesMod, only : nfsc
use EDTypesMod, only : nfsc, nlevleaf, area
use PRTGenericMod, only : prt_global
use PRTGenericMod, only : num_elements
use FatesRunningMeanMod, only : rmean_type
Expand Down Expand Up @@ -2685,12 +2687,21 @@ subroutine get_restart_vectors(this, nc, nsites, sites)
sites(s)%recruitment_rate(i_pft) = rio_recrate_sift(io_idx_co_1st+i_pft-1)
enddo

!variables for fixed biogeography mode. These are currently used in restart even when this is off.
! variables for fixed biogeography mode. These are currently used in restart even when this is off.
do i_pft = 1,numpft
sites(s)%use_this_pft(i_pft) = rio_use_this_pft_sift(io_idx_co_1st+i_pft-1)
sites(s)%area_pft(i_pft) = rio_area_pft_sift(io_idx_co_1st+i_pft-1)
enddo

! calculate the bareground area for the pft in no competition + fixed biogeo modes
if (hlm_use_nocomp .eq. itrue .and. hlm_use_fixed_biogeog .eq. itrue) then
if (area-sum(sites(s)%area_pft(1:numpft)) .gt. nearzero) then
sites(s)%area_pft(0) = area - sum(sites(s)%area_pft(1:numpft))
else
sites(s)%area_pft(0) = 0.0_r8
endif
endif

! Mass balance and diagnostics across elements at the site level
do el = 1, num_elements

Expand Down

0 comments on commit d63b8d2

Please sign in to comment.