Skip to content

Commit

Permalink
Merge pull request #2 from glemieux/fates_sp-deconflict-8abef14
Browse files Browse the repository at this point in the history
Deconflict PR 632 with FATES master (commit 8abef14)
  • Loading branch information
rosiealice authored May 27, 2020
2 parents 347270b + 0ffab8b commit 0f2ea16
Show file tree
Hide file tree
Showing 46 changed files with 9,250 additions and 6,455 deletions.
9 changes: 9 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"title": "The Functionally Assembled Terrestrial Ecosystem Simulator (FATES)",
"creators": [
{
"name": "FATES Development Team"
}
],
"license":"BSD-3-Clause"
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# FATES
------------------------------
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3825473.svg)](https://doi.org/10.5281/zenodo.3825473)

This repository holds the Functionally Assembled Terrestrial Ecosystem Simulator (FATES). FATES is a numerical terrestrial ecosystem model. Its development and support is primarily supported by the Department of Energy's Office of Science, through the Next Generation Ecosystem Experiment - Tropics ([NGEE-T](https://ngee-tropics.lbl.gov/)) project.

Expand Down
16 changes: 8 additions & 8 deletions biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ module EDCanopyStructureMod
use EDTypesMod , only : nlevleaf
use EDtypesMod , only : AREA
use FatesGlobals , only : endrun => fates_endrun
use FatesInterfaceMod , only : hlm_days_per_year
use FatesInterfaceMod , only : hlm_use_planthydro
use FatesInterfaceMod , only : hlm_use_cohort_age_tracking
use FatesInterfaceMod , only : numpft
use FatesInterfaceTypesMod , only : hlm_days_per_year
use FatesInterfaceTypesMod , only : hlm_use_planthydro
use FatesInterfaceTypesMod , only : hlm_use_cohort_age_tracking
use FatesInterfaceTypesMod , only : numpft
use FatesPlantHydraulicsMod, only : UpdateH2OVeg,InitHydrCohort, RecruitWaterStorage
use EDTypesMod , only : maxCohortsPerPatch

Expand Down Expand Up @@ -121,7 +121,7 @@ subroutine canopy_structure( currentSite , bc_in )

use EDParamsMod, only : ED_val_comp_excln
use EDTypesMod , only : min_patch_area
use FatesInterfaceMod, only : bc_in_type
use FatesInterfaceTypesMod, only : bc_in_type
!
! !ARGUMENTS
type(ed_site_type) , intent(inout), target :: currentSite
Expand Down Expand Up @@ -1256,8 +1256,8 @@ subroutine canopy_summarization( nsites, sites, bc_in )
! Much of this routine was once ed_clm_link minus all the IO and history stuff
! ---------------------------------------------------------------------------------

use FatesInterfaceMod , only : bc_in_type
use FatesInterfaceMod , only : hlm_use_cohort_age_tracking
use FatesInterfaceTypesMod , only : bc_in_type
use FatesInterfaceTypesMod , only : hlm_use_cohort_age_tracking
use EDPatchDynamicsMod , only : set_patchno
use FatesSizeAgeTypeIndicesMod, only : sizetype_class_index
use FatesSizeAgeTypeIndicesMod, only : coagetype_class_index
Expand Down Expand Up @@ -1874,7 +1874,7 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out)

use EDTypesMod , only : ed_patch_type, ed_cohort_type, &
ed_site_type, AREA
use FatesInterfaceMod , only : bc_out_type
use FatesInterfaceTypesMod , only : bc_out_type
use EDPftvarcon , only : EDPftvarcon_inst


Expand Down
57 changes: 28 additions & 29 deletions biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ module EDCohortDynamicsMod
! !USES:
use FatesGlobals , only : endrun => fates_endrun
use FatesGlobals , only : fates_log
use FatesInterfaceMod , only : hlm_freq_day
use FatesInterfaceMod , only : bc_in_type
use FatesInterfaceMod , only : hlm_use_planthydro
use FatesInterfaceMod , only : hlm_use_cohort_age_tracking
use FatesInterfaceTypesMod , only : hlm_freq_day
use FatesInterfaceTypesMod , only : bc_in_type
use FatesInterfaceTypesMod , only : hlm_use_planthydro
use FatesInterfaceTypesMod , only : hlm_use_cohort_age_tracking
use FatesConstantsMod , only : r8 => fates_r8
use FatesConstantsMod , only : fates_unset_int
use FatesConstantsMod , only : itrue,ifalse
use FatesConstantsMod , only : fates_unset_r8
use FatesConstantsMod , only : nearzero
use FatesConstantsMod , only : calloc_abs_error
use FatesInterfaceMod , only : hlm_days_per_year
use FatesInterfaceMod , only : nleafage
use FatesInterfaceTypesMod , only : hlm_days_per_year
use FatesInterfaceTypesMod , only : nleafage
use SFParamsMod , only : SF_val_CWD_frac
use EDPftvarcon , only : EDPftvarcon_inst
use EDPftvarcon , only : GetDecompyFrac
Expand All @@ -38,17 +38,18 @@ module EDCohortDynamicsMod
use EDTypesMod , only : site_fluxdiags_type
use EDTypesMod , only : num_elements
use EDParamsMod , only : ED_val_cohort_age_fusion_tol
use FatesInterfaceMod , only : hlm_use_planthydro
use FatesInterfaceMod , only : hlm_parteh_mode
use FatesInterfaceTypesMod , only : hlm_use_planthydro
use FatesInterfaceTypesMod , only : hlm_parteh_mode
use FatesPlantHydraulicsMod, only : FuseCohortHydraulics
use FatesPlantHydraulicsMod, only : CopyCohortHydraulics
use FatesPlantHydraulicsMod, only : updateSizeDepTreeHydProps
use FatesPlantHydraulicsMod, only : initTreeHydStates
use FatesPlantHydraulicsMod, only : UpdateSizeDepPlantHydProps
use FatesPlantHydraulicsMod, only : InitPlantHydStates
use FatesPlantHydraulicsMod, only : InitHydrCohort
use FatesPlantHydraulicsMod, only : DeallocateHydrCohort
use FatesPlantHydraulicsMod, only : AccumulateMortalityWaterStorage
use FatesPlantHydraulicsMod, only : UpdateTreeHydrNodes
use FatesPlantHydraulicsMod, only : UpdateTreeHydrLenVolCond
use FatesPlantHydraulicsMod, only : UpdatePlantHydrNodes
use FatesPlantHydraulicsMod, only : UpdatePlantHydrLenVol
use FatesPlantHydraulicsMod, only : UpdatePlantKmax
use FatesPlantHydraulicsMod, only : SavePreviousCompartmentVolumes
use FatesPlantHydraulicsMod, only : ConstrainRecruitNumber
use FatesSizeAgeTypeIndicesMod, only : sizetype_class_index
Expand Down Expand Up @@ -188,7 +189,7 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, coage, dbh, &
integer :: iage ! loop counter for leaf age classes
real(r8) :: leaf_c ! total leaf carbon
integer :: tnull,snull ! are the tallest and shortest cohorts allocate
integer :: nlevsoi_hyd ! number of hydraulically active soil layers
integer :: nlevrhiz ! number of rhizosphere layers

!----------------------------------------------------------------------

Expand Down Expand Up @@ -300,25 +301,28 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, coage, dbh, &

if( hlm_use_planthydro.eq.itrue ) then

nlevsoi_hyd = currentSite%si_hydr%nlevsoi_hyd
nlevrhiz = currentSite%si_hydr%nlevrhiz

! This allocates array spaces
call InitHydrCohort(currentSite,new_cohort)

! This calculates node heights
call UpdateTreeHydrNodes(new_cohort%co_hydr,new_cohort%pft, &
new_cohort%hite,nlevsoi_hyd,bc_in)
call UpdatePlantHydrNodes(new_cohort%co_hydr,new_cohort%pft, &
new_cohort%hite,currentSite%si_hydr)

! This calculates volumes, lengths and max conductances
call UpdateTreeHydrLenVolCond(new_cohort,nlevsoi_hyd,bc_in)
! This calculates volumes and lengths
call UpdatePlantHydrLenVol(new_cohort,currentSite%si_hydr)

! This updates the Kmax's of the plant's compartments
call UpdatePlantKmax(new_cohort%co_hydr,new_cohort,currentSite%si_hydr)

! Since this is a newly initialized plant, we set the previous compartment-size
! equal to the ones we just calculated.
call SavePreviousCompartmentVolumes(new_cohort%co_hydr)

! This comes up with starter suctions and then water contents
! based on the soil values
call initTreeHydStates(currentSite,new_cohort, bc_in)
call InitPlantHydStates(currentSite,new_cohort)

if(recruitstatus==1)then

Expand Down Expand Up @@ -949,7 +953,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
! !USES:
use EDParamsMod , only : ED_val_cohort_size_fusion_tol
use EDParamsMod , only : ED_val_cohort_age_fusion_tol
use FatesInterfaceMod , only : hlm_use_cohort_age_tracking
use FatesInterfaceTypesMod , only : hlm_use_cohort_age_tracking
use FatesConstantsMod , only : itrue
use FatesConstantsMod, only : days_per_year
use EDTypesMod , only : maxCohortsPerPatch
Expand Down Expand Up @@ -981,7 +985,6 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
real(r8) :: leaf_c_target
real(r8) :: dynamic_size_fusion_tolerance
real(r8) :: dynamic_age_fusion_tolerance
integer :: maxCohortsPerPatch_age_tracking
real(r8) :: dbh
real(r8) :: leaf_c ! leaf carbon [kg]

Expand All @@ -1000,11 +1003,6 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
! set the cohort age fusion tolerance (in fraction of years)
dynamic_age_fusion_tolerance = ED_val_cohort_age_fusion_tol

if ( hlm_use_cohort_age_tracking .eq. itrue) then
maxCohortsPerPatch_age_tracking = 300
end if



!This needs to be a function of the canopy layer, because otherwise, at canopy closure
!the number of cohorts doubles and very dissimilar cohorts are fused together
Expand Down Expand Up @@ -1386,12 +1384,13 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
currentCohort%pft, currentCohort%c_area, currentCohort%n, &
currentCohort%canopy_layer, currentPatch%canopy_layer_tlai, &
currentCohort%vcmax25top )
call updateSizeDepTreeHydProps(currentSite,currentCohort, bc_in)
call UpdateSizeDepPlantHydProps(currentSite,currentCohort, bc_in)
endif

call DeallocateCohort(nextc)
deallocate(nextc)
nullify(nextc)


endif ! if( currentCohort%isnew.eqv.nextc%isnew ) then
endif !canopy layer
Expand Down Expand Up @@ -1429,7 +1428,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)


if ( hlm_use_cohort_age_tracking .eq.itrue) then
if ( nocohorts > maxCohortsPerPatch_age_tracking ) then
if ( nocohorts > maxCohortsPerPatch ) then
iterate = 1
!---------------------------------------------------------------------!
! Making profile tolerance larger means that more fusion will happen !
Expand Down
16 changes: 8 additions & 8 deletions biogeochem/EDLoggingMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ module EDLoggingMortalityMod
use EDParamsMod , only : logging_mechanical_frac
use EDParamsMod , only : logging_coll_under_frac
use EDParamsMod , only : logging_dbhmax_infra
use FatesInterfaceMod , only : hlm_current_year
use FatesInterfaceMod , only : hlm_current_month
use FatesInterfaceMod , only : hlm_current_day
use FatesInterfaceMod , only : hlm_model_day
use FatesInterfaceMod , only : hlm_day_of_year
use FatesInterfaceMod , only : hlm_days_per_year
use FatesInterfaceMod , only : hlm_use_logging
use FatesInterfaceMod , only : hlm_use_planthydro
use FatesInterfaceTypesMod , only : hlm_current_year
use FatesInterfaceTypesMod , only : hlm_current_month
use FatesInterfaceTypesMod , only : hlm_current_day
use FatesInterfaceTypesMod , only : hlm_model_day
use FatesInterfaceTypesMod , only : hlm_day_of_year
use FatesInterfaceTypesMod , only : hlm_days_per_year
use FatesInterfaceTypesMod , only : hlm_use_logging
use FatesInterfaceTypesMod , only : hlm_use_planthydro
use FatesConstantsMod , only : itrue,ifalse
use FatesGlobals , only : endrun => fates_endrun
use FatesGlobals , only : fates_log
Expand Down
25 changes: 13 additions & 12 deletions biogeochem/EDMortalityFunctionsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ module EDMortalityFunctionsMod
use FatesConstantsMod , only : itrue,ifalse
use FatesAllometryMod , only : bleaf
use FatesAllometryMod , only : storage_fraction_of_target
use FatesInterfaceMod , only : bc_in_type
use FatesInterfaceMod , only : hlm_use_ed_prescribed_phys
use FatesInterfaceMod , only : hlm_freq_day
use FatesInterfaceMod , only : hlm_use_planthydro
use FatesInterfaceTypesMod , only : bc_in_type
use FatesInterfaceTypesMod , only : hlm_use_ed_prescribed_phys
use FatesInterfaceTypesMod , only : hlm_freq_day
use FatesInterfaceTypesMod , only : hlm_use_planthydro
use EDLoggingMortalityMod , only : LoggingMortality_frac
use EDParamsMod , only : fates_mortality_disturbance_fraction
use FatesInterfaceMod , only : bc_in_type
use FatesInterfaceTypesMod , only : bc_in_type

use PRTGenericMod, only : all_carbon_elements
use PRTGenericMod, only : store_organ
Expand Down Expand Up @@ -50,7 +50,7 @@ subroutine mortality_rates( cohort_in,bc_in,cmort,hmort,bmort,frmort,smort,asmor
! ============================================================================

use FatesConstantsMod, only : tfrz => t_water_freeze_k_1atm
use FatesInterfaceMod , only : hlm_hio_ignore_val
use FatesInterfaceTypesMod , only : hlm_hio_ignore_val
use FatesConstantsMod, only : fates_check_param_set

type (ed_cohort_type), intent(in) :: cohort_in
Expand All @@ -62,7 +62,7 @@ subroutine mortality_rates( cohort_in,bc_in,cmort,hmort,bmort,frmort,smort,asmor
real(r8),intent(out) :: smort ! size dependent senescence term
real(r8),intent(out) :: asmort ! age dependent senescence term


integer :: ifp
real(r8) :: frac ! relativised stored carbohydrate
real(r8) :: leaf_c_target ! target leaf biomass kgC
real(r8) :: store_c
Expand Down Expand Up @@ -128,9 +128,9 @@ subroutine mortality_rates( cohort_in,bc_in,cmort,hmort,bmort,frmort,smort,asmor
hf_flc_threshold = EDPftvarcon_inst%hf_flc_threshold(cohort_in%pft)
if(hlm_use_planthydro.eq.itrue)then
!note the flc is set as the fraction of max conductivity in hydro
min_fmc_ag = minval(cohort_in%co_hydr%flc_ag(:))
min_fmc_tr = minval(cohort_in%co_hydr%flc_troot(:))
min_fmc_ar = minval(cohort_in%co_hydr%flc_aroot(:))
min_fmc_ag = minval(cohort_in%co_hydr%ftc_ag(:))
min_fmc_tr = cohort_in%co_hydr%ftc_troot
min_fmc_ar = minval(cohort_in%co_hydr%ftc_aroot(:))
min_fmc = min(min_fmc_ag, min_fmc_tr)
min_fmc = min(min_fmc, min_fmc_ar)
flc = 1.0_r8-min_fmc
Expand Down Expand Up @@ -173,7 +173,8 @@ subroutine mortality_rates( cohort_in,bc_in,cmort,hmort,bmort,frmort,smort,asmor
! Eastern US carbon sink. Glob. Change Biol., 12, 2370-2390,
! doi: 10.1111/j.1365-2486.2006.01254.x

temp_in_C = bc_in%t_veg24_si - tfrz
ifp = cohort_in%patchptr%patchno
temp_in_C = bc_in%t_veg24_pa(ifp) - tfrz
temp_dep_fraction = max(0.0_r8, min(1.0_r8, 1.0_r8 - (temp_in_C - &
EDPftvarcon_inst%freezetol(cohort_in%pft))/frost_mort_buffer) )
frmort = EDPftvarcon_inst%mort_scalar_coldstress(cohort_in%pft) * temp_dep_fraction
Expand Down Expand Up @@ -217,7 +218,7 @@ subroutine Mortality_Derivative( currentSite, currentCohort, bc_in)
!
! !USES:

use FatesInterfaceMod, only : hlm_freq_day
use FatesInterfaceTypesMod, only : hlm_freq_day
!
! !ARGUMENTS
type(ed_site_type), intent(inout), target :: currentSite
Expand Down
14 changes: 7 additions & 7 deletions biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module EDPatchDynamicsMod
! Controls formation, creation, fusing and termination of patch level processes.
! ============================================================================
use FatesGlobals , only : fates_log
use FatesInterfaceMod , only : hlm_freq_day
use FatesInterfaceTypesMod , only : hlm_freq_day
use EDPftvarcon , only : EDPftvarcon_inst
use EDPftvarcon , only : GetDecompyFrac
use EDCohortDynamicsMod , only : fuse_cohorts, sort_cohorts, insert_cohort
Expand Down Expand Up @@ -37,11 +37,11 @@ module EDPatchDynamicsMod
use EDTypesMod , only : dl_sf
use EDTypesMod , only : dump_patch
use FatesConstantsMod , only : rsnbl_math_prec
use FatesInterfaceMod , only : hlm_use_planthydro
use FatesInterfaceMod , only : hlm_numSWb
use FatesInterfaceMod , only : bc_in_type
use FatesInterfaceMod , only : hlm_days_per_year
use FatesInterfaceMod , only : numpft
use FatesInterfaceTypesMod , only : hlm_use_planthydro
use FatesInterfaceTypesMod , only : hlm_numSWb
use FatesInterfaceTypesMod , only : bc_in_type
use FatesInterfaceTypesMod , only : hlm_days_per_year
use FatesInterfaceTypesMod , only : numpft
use FatesGlobals , only : endrun => fates_endrun
use FatesConstantsMod , only : r8 => fates_r8
use FatesConstantsMod , only : itrue, ifalse
Expand Down Expand Up @@ -75,7 +75,7 @@ module EDPatchDynamicsMod
use PRTGenericMod, only : repro_organ
use PRTGenericMod, only : struct_organ
use PRTLossFluxesMod, only : PRTBurnLosses
use FatesInterfaceMod, only : hlm_parteh_mode
use FatesInterfaceTypesMod, only : hlm_parteh_mode
use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : prt_cnp_flex_allom_hyp

Expand Down
Loading

0 comments on commit 0f2ea16

Please sign in to comment.