Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
87fa4d4
initial commit
Mar 19, 2025
24c0eb0
making test class
Mar 19, 2025
c3c4a6c
updates
Mar 25, 2025
642fcf2
updates to fix bug
adrifoster Apr 21, 2025
338c24a
update
May 29, 2025
4910840
Add FatesMossMod with just UVAFME moss() subroutine.
samsrabin Jun 4, 2025
1d30d2a
Break soil object into reals.
samsrabin Jun 5, 2025
2daea4c
Delete an unused line.
samsrabin Jun 5, 2025
63d9333
Delete unused variables in moss().
samsrabin Jun 5, 2025
a8da251
Remove moisture growth factor (drydays implementation).
samsrabin Jun 5, 2025
5576138
Moss: Use fates_r8 reals.
samsrabin Jun 5, 2025
eeed237
Moss: Rearrange parameters/variables.
samsrabin Jun 5, 2025
e30c9f0
Add moss unit test. Untested.
samsrabin Jun 5, 2025
6ba3f2d
Moss: Add some constants.
samsrabin Jun 10, 2025
f8a8c76
Merge branch 'testing_update' into moss
samsrabin Jun 10, 2025
57963bb
Add LeafBiophysicsMod.F90 to biogeophys/CMakeLists.txt.
samsrabin Jun 10, 2025
c663592
Merge tag 'sci.1.84.0_api.40.0.0' into testing_update_ssr
samsrabin Jun 10, 2025
157b2e9
Add LeafBiophysicsMod.F90 to biogeophys/CMakeLists.txt
samsrabin Jun 10, 2025
89320b6
Fix QuadraticRootsNSWC call in FatesTestMathUtils.F90.
samsrabin Jun 10, 2025
39e7af4
Merge branch 'testing_update_ssr' into moss
samsrabin Jun 10, 2025
09fb0dd
Moss testing: Switch actual/expected
samsrabin Jun 10, 2025
3ccec5b
Add a temporary moss test.
samsrabin Jun 11, 2025
8ea6292
Moss: Refactor out repro_eff.
samsrabin Jun 10, 2025
74944bb
Moss: Add units to variable names.
samsrabin Jun 11, 2025
a2be658
Moss: Add a TODO.
samsrabin Jun 11, 2025
db44553
Moss: Clarify that litter calculation is a flux.
samsrabin Jun 11, 2025
eb01a47
Moss: Further clarify variable names.
samsrabin Jun 11, 2025
ea80c19
Moss: Simplify an equation.
samsrabin Jun 11, 2025
ca2b543
Moss: Rearrange.
samsrabin Jun 11, 2025
abb2678
Moss: Some var names now indicate before/after timestep.
samsrabin Jun 11, 2025
26e74db
Moss: Rearrange.
samsrabin Jun 11, 2025
c5c71c8
Moss bugfix: Properly handle reproductive flux.
samsrabin Jun 11, 2025
9b48b2f
Moss: Rearrange.
samsrabin Jun 11, 2025
de247a8
Moss: Rename prod to moss_biom_change.
samsrabin Jun 11, 2025
11f454f
Moss: Rename vars/fix comments to reflect use of SPORES in UVAFME.
samsrabin Jun 11, 2025
aed0417
Moss: Rearrange.
samsrabin Jun 11, 2025
d86896b
Moss bugfix: repro_eff_kg_per_m2plot.
samsrabin Jun 11, 2025
e4fac91
Moss refactor: Get rid of reproduction.
samsrabin Jun 11, 2025
d2772e8
Test that fcgf transitions smoothly from 1 where alff effect starts.
samsrabin Jun 11, 2025
a7e05eb
Test that dlgf transitions smoothly from 1 where litter effect starts.
samsrabin Jun 11, 2025
bcf155d
Moss: Factor out fcgf function and test.
samsrabin Jun 11, 2025
96561d7
Moss: Factor out algf functions and test.
samsrabin Jun 11, 2025
7957c72
Moss: Refactor available_light_under_canopy_and_moss().
samsrabin Jun 11, 2025
d3879cb
Moss: Factor out dlgf function and test.
samsrabin Jun 11, 2025
dde84ab
Moss: Add some TODOs.
samsrabin Jun 11, 2025
d0141da
Moss: Factor out ∆ biomass/fluxes function and test.
samsrabin Jun 11, 2025
abfdb20
Moss: Move resp/mort into moss_biomass_change_kg_per_m2().
samsrabin Jun 11, 2025
4e1ce8c
Moss refactor: Flux to litter is just resp+mort.
samsrabin Jun 11, 2025
12a3d6e
Add moss test for when mort+resp-assim > biomass. Failing.
samsrabin Jun 11, 2025
19e15e4
Moss latent bugfix: Cap moss loss term at start-of-timestep biomass.
samsrabin Jun 11, 2025
024b0c5
Moss refactor: Separate resp/mort from moss_biomass_change_kg_per_m2().
samsrabin Jun 11, 2025
47c40c9
Litter flux output now kg/m2.
samsrabin Jun 11, 2025
90e0fb2
Moss change: Respiration now goes to atmosphere.
samsrabin Jun 11, 2025
a1c8ecc
Add one moss functional test.
samsrabin Jul 31, 2025
1596d7e
Simplify plot_moss_cla_x_mossbiomass().
samsrabin Aug 1, 2025
9546b53
Generalized to plot_dim0x_dim1legend().
samsrabin Aug 1, 2025
16db675
Add out_algf.
samsrabin Aug 1, 2025
73feb39
Add functional tests of moss_biomass_change_kg_per_m2().
samsrabin Aug 1, 2025
4396292
Moss functional test plots now start with moss_.
samsrabin Aug 1, 2025
f7e7518
Moss functional tests now use native plot setup.
samsrabin Aug 1, 2025
a44217e
Moss functional tests: Better biomass bins.
samsrabin Aug 1, 2025
566acfe
Moss light functions: Use LAI, not LAI*area.
samsrabin Aug 4, 2025
d90d349
Moss unit tests: Check litter_growth_multiplier getting ~0.5.
samsrabin Aug 4, 2025
fc517ec
Update moss functional tests for LAI instead of CLA.
samsrabin Aug 4, 2025
ee18ae8
Add functional test for moss decid litter multiplier.
samsrabin Aug 4, 2025
819d0b4
Rename decLit_t_per_haplot to decid_litter.
samsrabin Aug 4, 2025
20e7782
Moss decid litter function now uses kg/m2 instead of t/ha.
samsrabin Aug 4, 2025
0b8266f
moss() subroutine now uses kg/m2 biomass, not kg/plot.
samsrabin Aug 4, 2025
97f4f5b
Merge tag 'sci.1.86.3_api.40.0.0_tools.3.1.0' into moss
samsrabin Aug 4, 2025
4716b4e
Fix moss functional test plots when not called alone.
samsrabin Aug 4, 2025
b927ba7
Roll back some testing stuff that never got to main.
samsrabin Aug 4, 2025
a638867
Add fates_params_moss.cdl.
samsrabin Aug 7, 2025
7bc0eac
Add fates_moss logical parameter. Read and checked but not used.
samsrabin Sep 30, 2025
5bcf0e6
FatesPlantRespPhotosynthDrive() now partially in 'is moss' check. Fai…
samsrabin Sep 30, 2025
bf6cdae
Add moss photosynthesis & respiration.
samsrabin Oct 1, 2025
9e6a6e8
Kludge to ignore diagnostic stomatal conductance from mosses.
samsrabin Oct 1, 2025
cd60098
Refactor out moss_photosynth_resp().
samsrabin Oct 2, 2025
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
35 changes: 22 additions & 13 deletions biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module EDCanopyStructureMod
use FatesConstantsMod , only : rsnbl_math_prec
use FatesConstantsMod , only : nocomp_bareground
use FatesConstantsMod, only : i_term_mort_type_canlev
use FatesConstantsMod, only : m2_per_ha
use FatesGlobals , only : fates_log
use EDPftvarcon , only : EDPftvarcon_inst
use PRTParametersMod , only : prt_params
Expand Down Expand Up @@ -2232,7 +2233,9 @@ end subroutine UpdatePatchLAI
subroutine UpdateCohortLAI(currentCohort, canopy_layer_tlai, total_canopy_area)

! Update LAI and related variables for a given cohort


use FatesMossMod, only : SLA_M2LEAF_PER_KGMOSS

! Arguments
type(fates_cohort_type),intent(inout), target :: currentCohort
real(r8), intent(in) :: canopy_layer_tlai(nclmax) ! total leaf area index of each canopy layer
Expand All @@ -2244,20 +2247,26 @@ subroutine UpdateCohortLAI(currentCohort, canopy_layer_tlai, total_canopy_area)

! Obtain the leaf carbon
leaf_c = currentCohort%prt%GetState(leaf_organ,carbon12_element)

! Note that tree_lai has an internal check on the canopy location
call tree_lai_sai(leaf_c, currentCohort%pft, currentCohort%c_area, currentCohort%n, &
currentCohort%canopy_layer, canopy_layer_tlai, currentCohort%vcmax25top, currentCohort%dbh, currentCohort%crowndamage, &
currentCohort%canopy_trim, currentCohort%efstem_coh, 4, currentCohort%treelai, treesai )

! Do not update stem area index of SP vegetation
if (hlm_use_sp .eq. ifalse) then
currentCohort%treesai = treesai
end if

! Number of actual vegetation layers in this cohort's crown
currentCohort%nv = GetNVegLayers(currentCohort%treelai+currentCohort%treesai)
if (prt_params%moss(currentCohort%pft) == itrue) then
currentCohort%treelai = leaf_c * currentCohort%n / m2_per_ha * SLA_M2LEAF_PER_KGMOSS
currentCohort%treesai = 0._r8
currentCohort%nv = 1
else

! Note that tree_lai has an internal check on the canopy location
call tree_lai_sai(leaf_c, currentCohort%pft, currentCohort%c_area, currentCohort%n, &
currentCohort%canopy_layer, canopy_layer_tlai, currentCohort%vcmax25top, currentCohort%dbh, currentCohort%crowndamage, &
currentCohort%canopy_trim, currentCohort%efstem_coh, 4, currentCohort%treelai, treesai )

! Do not update stem area index of SP vegetation
if (hlm_use_sp .eq. ifalse) then
currentCohort%treesai = treesai
end if

! Number of actual vegetation layers in this cohort's crown
currentCohort%nv = GetNVegLayers(currentCohort%treelai+currentCohort%treesai)
end if
end subroutine UpdateCohortLAI

! ===============================================================================================
Expand Down
23 changes: 22 additions & 1 deletion biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3191,7 +3191,28 @@ subroutine fuse_2_patches(csite, dp, rp)
rp%frac_burnt = (dp%frac_burnt*dp%area + rp%frac_burnt*rp%area) * inv_sum_area
rp%btran_ft(:) = (dp%btran_ft(:)*dp%area + rp%btran_ft(:)*rp%area) * inv_sum_area
rp%zstar = (dp%zstar*dp%area + rp%zstar*rp%area) * inv_sum_area
rp%c_stomata = (dp%c_stomata*dp%area + rp%c_stomata*rp%area) * inv_sum_area
if (dp%IsAllMoss() .or. rp%IsAllMoss()) then
! We set c_stomata to the unset real value in FatesPlantRespPhotosynthDrive() because mosses
! are expected to have zero resistance. If exactly one fusing patch is all moss, take
! c_stomata from that. This is not accurate, but it's only a diagnostic and for
! one timestep at most (until the next call of FatesPlantRespPhotosynthDrive).
! TODO:
! * If keeping fates_unset_r8 kludge in FatesPlantRespPhotosynthDrive(), code up a way
! to quickly recalculate c_stomata without having to call FatesPlantRespPhotosynthDrive()
! again.
! * Otherwise, c_stomata should always have meaningful values, so remove this special
! handling and just calculate the new value as the area-weighted mean of the donor and
! recipient patches.
if (.not. dp%IsAllMoss()) then
rp%c_stomata = dp%c_stomata
else if (.not. rp%IsAllMoss()) then
rp%c_stomata = rp%c_stomata
else
rp%c_stomata = fates_unset_r8
end if
else
rp%c_stomata = (dp%c_stomata*dp%area + rp%c_stomata*rp%area) * inv_sum_area
end if
rp%c_lblayer = (dp%c_lblayer*dp%area + rp%c_lblayer*rp%area) * inv_sum_area

! Radiation
Expand Down
12 changes: 11 additions & 1 deletion biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,12 @@ subroutine trim_canopy( currentSite )
currentCohort%dbh, currentCohort%crowndamage, currentCohort%canopy_trim, &
currentCohort%efstem_coh, 0, currentCohort%treelai, currentCohort%treesai )

currentCohort%nv = GetNVegLayers(currentCohort%treelai+currentCohort%treesai)
! TODO: Would be safer to add this handling to GetNVegLayers()
if (prt_params%moss(ipft) == itrue) then
currentCohort%nv = 1
else
currentCohort%nv = GetNVegLayers(currentCohort%treelai+currentCohort%treesai)
end if

leaf_veg_frac = currentCohort%treelai/(currentCohort%treelai+currentCohort%treesai)

Expand Down Expand Up @@ -1885,6 +1890,11 @@ subroutine satellite_phenology(currentSite, bc_in)
call endrun(msg=errMsg(sourcefile, __LINE__))
end if

if (prt_params%moss(fates_pft) == itrue) then
write(fates_log(),*) 'Moss in SP mode'
call endrun(msg=errMsg(sourcefile, __LINE__))
end if

! Call routine to invert SP drivers into cohort properites.
call assign_cohort_SP_properties(currentCohort, currentSite%sp_htop(fates_pft), currentSite%sp_tlai(fates_pft) , currentSite%sp_tsai(fates_pft),currentPatch%area,ifalse,leaf_c)

Expand Down
28 changes: 28 additions & 0 deletions biogeochem/FatesPatchMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ module FatesPatchMod
procedure :: FreeMemory
procedure :: Dump
procedure :: CheckVars
procedure :: IsAllMoss

end type fates_patch_type

Expand Down Expand Up @@ -1286,6 +1287,33 @@ subroutine CheckVars(this, var_aliases, return_code)

end subroutine CheckVars

!===========================================================================

function IsAllMoss(this)
!
! DESCRIPTION:
! Checks whether all cohorts on patch are moss

! ARGUMENTS:
class(fates_patch_type), intent(inout) :: this

! LOCALS:
type(fates_cohort_type), pointer :: currentCohort ! cohort object

! RESULT:
logical :: IsAllMoss

currentCohort => this%tallest
IsAllMoss = associated(currentCohort) ! If patch has no cohorts, it's not all moss
do while(associated(currentCohort) .and. IsAllMoss)
if (prt_params%moss(currentCohort%pft) == ifalse) then
IsAllMoss = .false.
end if
currentCohort => currentCohort%shorter
end do

end function IsAllMoss

!===========================================================================

end module FatesPatchMod
1 change: 1 addition & 0 deletions biogeophys/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
list(APPEND fates_sources
FatesHydroWTFMod.F90
FatesMossMod.F90
LeafBiophysicsMod.F90
FatesPlantHydraulicsMod.F90)

Expand Down
Loading