Skip to content
Draft
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ https://github.com/E3SM-Project/E3SM

https://github.com/ESCOMP/cesm

The FATES, E3SM and CTSM teams maintain compatability of the NGEET/FATES master branch with the E3SM master and CTSM master branches respectively. There may be some modest lag time in which the latest commit on the FATES master branch is available to these host land models (HLM) by default. This is typically correlated with FATES development updates forcing necessary changes to the FATES API. See the table of [FATES API/HLM compatibility](https://fates-users-guide.readthedocs.io/en/latest/user/release-tags-compat-table.html) for information on which fates tag corresponds to which HLM tag or commit.
The FATES, E3SM and CTSM teams maintain compatability of the NGEET/FATES master branch with the E3SM master and CTSM master branches respectively. There may be some modest lag time in which the latest commit on the FATES master branch is available to these host land models (HLM) by default. This is typically correlated with FATES development updates forcing necessary changes to the FATES API. See the table of [FATES API/HLM compatibility](https://fates-users-guide.readthedocs.io/en/latest/user/release-tags-compat-table.html) for information on which fates tag corresponds to which HLM tag or commit.

## TODO take out this section, INFO from 8/7-2026
This branch represents a rejuvenation of a branch that had been merged but needed to be reverted because regression tests and runs from old finidats were failing. This needs to be reinvestigated and solved later / after the summer

20 changes: 4 additions & 16 deletions biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,6 @@ module EDCanopyStructureMod

real(r8), parameter :: co_area_target_precision = 1.0E-9_r8

! Relative precision target used alongside the absolute targets above.
! Area conservation checks compare differences of two large, similarly
! sized areas (e.g. cohort crown areas, layer areas, patch areas). For
! such differences a fixed absolute threshold becomes meaningless once
! the operands are large, because a single rounding of an operand of
! magnitude x already produces a residual of order ulp(x) ~ 2.2e-16*x.
! To avoid spuriously tripping error checks on rounding noise, the
! comparisons below use max(absolute_target, rel_area_precision*|operand|).
! rel_area_precision is set to relative machine precision for r8 so that
! a difference below machine precision is never treated as a real error.
real(r8), parameter :: rel_area_precision = 1.0E-15_r8

integer, parameter :: demotion_phase = 1
integer, parameter :: promotion_phase = 2

Expand Down Expand Up @@ -577,7 +565,7 @@ subroutine PromoteOrDemote(site,patch,target_layer,phase,target_area)
sumpd_area = 0._r8
ic = 1
do while( ic<=n_layer .and. (promdem_area-sumpd_area) > &
max(co_area_target_precision, rel_area_precision*promdem_area))
max(co_area_target_precision, rsnbl_math_prec*promdem_area))

cohort => layer_co(ic)%p

Expand Down Expand Up @@ -625,7 +613,7 @@ subroutine PromoteOrDemote(site,patch,target_layer,phase,target_area)


whole_or_part: if( ((layer_co(ic)%pd_area - cohort%c_area) > &
max(co_area_target_precision, rel_area_precision*cohort%c_area) ) .or. &
max(co_area_target_precision, rsnbl_math_prec*cohort%c_area) ) .or. &
(layer_co(ic)%pd_area < 0._r8) ) then
write(fates_log(),*) 'negative,or more area than the cohort has is being promoted/demoted'
write(fates_log(),*) 'change: ',layer_co(ic)%pd_area
Expand All @@ -635,7 +623,7 @@ subroutine PromoteOrDemote(site,patch,target_layer,phase,target_area)


elseif ( abs(layer_co(ic)%pd_area - cohort%c_area) < &
max(co_area_target_precision, rel_area_precision*cohort%c_area) ) then
max(co_area_target_precision, rsnbl_math_prec*cohort%c_area) ) then

! Whole cohort promotion/demotion
cohort%canopy_layer = cohort%canopy_layer + ilyr_change
Expand Down Expand Up @@ -894,7 +882,7 @@ subroutine canopy_summarization( nsites, sites, bc_in )
end if

if (currentPatch%total_canopy_area - (1._r8-imperfect_fraction)*currentPatch%area > &
max(area_error_1, rel_area_precision*currentPatch%area)) then
max(area_error_1, rsnbl_math_prec*currentPatch%area)) then
write(fates_log(),*) 'too much canopy in summary', s, &
currentPatch%nocomp_pft_label, currentPatch%total_canopy_area - (1._r8-imperfect_fraction)*currentPatch%area
call endrun(msg=errMsg(sourcefile, __LINE__))
Expand Down
34 changes: 32 additions & 2 deletions biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Module EDCohortDynamicsMod
use EDParamsMod , only : max_cohort_per_patch
use EDTypesMod , only : min_npm2, min_nppatch
use EDTypesMod , only : min_n_safemath
use EDTypesMod , only : min_patch_area
use EDParamsMod , only : nlevleaf
use FatesConstantsMod , only : ican_upper
use EDTypesMod , only : elem_diag_type
Expand Down Expand Up @@ -86,6 +87,7 @@ Module EDCohortDynamicsMod
use DamageMainMod, only : undamaged_class
use FatesConstantsMod, only : i_term_mort_type_cstarv
use FatesConstantsMod, only : i_term_mort_type_canlev
use FatesConstantsMod, only : i_term_mort_type_nocomp
use FatesConstantsMod, only : i_term_mort_type_numdens

use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=)
Expand Down Expand Up @@ -287,7 +289,7 @@ subroutine terminate_cohorts( currentSite, currentPatch, level , call_index, bc_
! terminates all cohorts when they get too small
!
! !USES:

use FatesInterfaceTypesMod , only : hlm_use_nocomp
!
! !ARGUMENTS
type (ed_site_type) , intent(inout) :: currentSite
Expand Down Expand Up @@ -336,7 +338,27 @@ subroutine terminate_cohorts( currentSite, currentPatch, level , call_index, bc_
struct_c = currentCohort%prt%GetState(struct_organ, carbon12_element)
repro_c = currentCohort%prt%GetState(repro_organ, carbon12_element)

! Check if number density is so low is breaks math (level 1)
! ----------------------------------------------------------------------
! Numerically dangerous states. These are checked at all levels and for
! recruits as well, so that degenerate cohorts are removed before cohort
! fusion (which runs between the level-1 and level-2 termination calls)
! can smear their pathology into otherwise healthy cohorts.
! ----------------------------------------------------------------------

! Number density is so low it breaks math
if (currentCohort%n < min_n_safemath .and. level == 1) then
terminate = itrue
termination_type = i_term_mort_type_numdens
if ( debug ) then
write(fates_log(),*) 'terminating cohorts 0',currentCohort%n/currentPatch%area, &
currentCohort%dbh,currentCohort%pft,call_index
endif
endif



! The rest of these are biological starvation checks, only allowed if we
! are not dealing with a recruit (level 2)
if (currentcohort%n < min_n_safemath .and. level == 1) then
terminate = itrue
termination_type = i_term_mort_type_numdens
Expand Down Expand Up @@ -410,6 +432,14 @@ subroutine terminate_cohorts( currentSite, currentPatch, level , call_index, bc_
write(fates_log(),*) 'terminating cohorts 2', currentCohort%canopy_layer,currentCohort%pft,call_index
endif
endif
if (hlm_use_nocomp == itrue .and. level == 4 .and. &
currentPatch%nocomp_pft_label .ne. currentCohort%pft) then
terminate = itrue
termination_type = i_term_mort_type_nocomp
if ( debug ) then
write(fates_log(),*) 'terminating cohorts 7', currentPatch%nocomp_pft_label,currentCohort%pft,call_index
endif
endif

if (terminate == itrue) then
call terminate_cohort(currentSite, currentPatch, currentCohort, bc_in, termination_type)
Expand Down
Loading