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

New allometric modes #1128

Merged
merged 21 commits into from
Apr 23, 2024
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
416f70f
Add new allometric modes for multiple quantities, plus a few minor im…
mpaiao Dec 6, 2023
d29e182
Fix swapped arguments for leaf biomass allometry.
mpaiao Dec 7, 2023
8531dda
merge resolution between allometry modes and two-stream
rgknox Feb 5, 2024
118b411
enabling cstarvation mode switch in-code
rgknox Feb 5, 2024
f450fb7
updating parameters for cstarvation and allometry crown depth modes i…
rgknox Feb 5, 2024
92d0dff
Merge pull request #9 from rgknox/mpaiao-pr-allom-modes-cstarve-merge
mpaiao Feb 5, 2024
c644186
Fix crown depth allometry for two stream.
mpaiao Feb 5, 2024
e35f44c
Add in parameter file checks and metadata that ECA phosphatase lambda…
rgknox Feb 6, 2024
37db010
Merge pull request #10 from rgknox/mpaiao-pr-allom-modes-eca
mpaiao Feb 6, 2024
e1e9b07
merging in vert resp scaler coeffs
JessicaNeedham Feb 27, 2024
dc1d029
added leaf vertical scaling parameter coefficients in read-in and xml
rgknox Mar 26, 2024
7ab9bcc
updating api update xml files
rgknox Mar 26, 2024
e218fb3
updated parameter xml names
rgknox Mar 26, 2024
4942a17
Applied batch patch script to api34 update
rgknox Mar 26, 2024
48f0a81
adding daylight factor
rgknox Mar 26, 2024
7444f26
bug fix on parameter printing
rgknox Mar 26, 2024
1aef70f
merge resolution between allom mode updates and api34
rgknox Mar 26, 2024
97dc27a
added carbon starvation mode
rgknox Mar 27, 2024
6573572
Merge pull request #11 from rgknox/mpaiao-pr-allom-modes-moreparams
mpaiao Mar 27, 2024
90350db
Merge tag 'sci.1.72.6_api.34.0.0' into mpaiao-pr-allom-modes
glemieux Apr 11, 2024
0827f05
Merge tag 'sci.1.72.7_api.34.0.0' into mpaiao-pr-allom-modes
glemieux Apr 22, 2024
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
Prev Previous commit
Next Next commit
merge resolution between allometry modes and two-stream
  • Loading branch information
rgknox committed Feb 5, 2024
commit 8531dda65557e2b317f47f4e4db77511b7ad4e5c
106 changes: 25 additions & 81 deletions biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ module EDCanopyStructureMod
use EDCohortDynamicsMod , only : InitPRTObject
use FatesAllometryMod , only : tree_lai
use FatesAllometryMod , only : tree_sai
use EDTypesMod , only : ed_site_type
use FatesAllometryMod , only : VegAreaLayer
use FatesAllometryMod , only : CrownDepth
use EDtypesMod , only : ed_site_type
use FatesPatchMod, only : fates_patch_type
use FatesCohortMod, only : fates_cohort_type
use EDParamsMod , only : nclmax
Expand Down Expand Up @@ -1529,10 +1530,10 @@ subroutine leaf_area_profile( currentSite )
real(r8) :: dh ! vertical detph of height class (m)
real(r8) :: min_cheight ! bottom of cohort canopy (m)
real(r8) :: max_cheight ! top of cohort canopy (m)
real(r8) :: lai ! leaf area per canopy area
real(r8) :: sai ! stem area per canopy area
real(r8) :: elai_layer,tlai_layer ! leaf area per canopy area
real(r8) :: esai_layer,tsai_layer ! stem area per canopy area
real(r8) :: vai_top,vai_bot ! integrated top down veg area index at boundary of layer
real(r8) :: crown_depth ! Current cohort's crown depth

real(r8) :: layer_bottom_height,layer_top_height,lai,sai ! Can be removed later
!----------------------------------------------------------------------

Expand Down Expand Up @@ -1586,78 +1587,16 @@ subroutine leaf_area_profile( currentSite )
! How much of each tree is stem area index? Assuming that there is
! This may indeed be zero if there is a sensecent grass
! ----------------------------------------------------------------
lai = currentCohort%treelai * currentCohort%c_area/currentPatch%total_canopy_area
sai = currentCohort%treesai * currentCohort%c_area/currentPatch%total_canopy_area
if( (currentCohort%treelai+currentCohort%treesai) > nearzero)then

! See issue: https://github.com/NGEET/fates/issues/899
! fleaf = currentCohort%treelai / (currentCohort%treelai + currentCohort%treesai)
fleaf = lai / (lai+sai)
else
fleaf = 0._r8
endif

currentPatch%nrad(cl,ft) = currentPatch%ncan(cl,ft)

if (currentPatch%nrad(cl,ft) > nlevleaf ) then
write(fates_log(), *) 'Number of radiative leaf layers is larger'
write(fates_log(), *) ' than the maximum allowed.'
write(fates_log(), *) ' cl: ',cl
write(fates_log(), *) ' ft: ',ft
write(fates_log(), *) ' nlevleaf: ',nlevleaf
write(fates_log(), *) ' currentPatch%nrad(cl,ft): ', currentPatch%nrad(cl,ft)
call endrun(msg=errMsg(sourcefile, __LINE__))
end if


!---~---
! Find current crown depth using the allometric function.
!---~---
call CrownDepth(currentCohort%height,currentCohort%pft,crown_depth)
!---~---


! --------------------------------------------------------------------------
! Whole layers. Make a weighted average of the leaf area in each layer
! before dividing it by the total area. Fill up layer for whole layers.
! --------------------------------------------------------------------------

do iv = 1,currentCohort%NV

! This loop builds the arrays that define the effective (not snow covered)
! and total (includes snow covered) area indices for leaves and stems
! We calculate the absolute elevation of each layer to help determine if the layer
! is obscured by snow.

layer_top_height = currentCohort%height - &
( real(iv-1,r8)/currentCohort%NV * crown_depth )

layer_bottom_height = currentCohort%height - &
( real(iv,r8)/currentCohort%NV * crown_depth )

fraction_exposed = 1.0_r8
if(currentSite%snow_depth > layer_top_height)then
fraction_exposed = 0._r8
endif
if(currentSite%snow_depth < layer_bottom_height)then
fraction_exposed = 1._r8
endif
if(currentSite%snow_depth >= layer_bottom_height .and. &
currentSite%snow_depth <= layer_top_height) then !only partly hidden...
fraction_exposed = 1._r8 - max(0._r8,(min(1.0_r8,(currentSite%snow_depth -layer_bottom_height)/ &
(layer_top_height-layer_bottom_height ))))
endif

if(iv==currentCohort%NV) then
remainder = (currentCohort%treelai + currentCohort%treesai) - &
(dlower_vai(iv) - dinc_vai(iv))
if(remainder > dinc_vai(iv) )then
write(fates_log(), *)'ED: issue with remainder', &
currentCohort%treelai,currentCohort%treesai,dinc_vai(iv), &
currentCohort%NV,remainder

call endrun(msg=errMsg(sourcefile, __LINE__))
endif
! preserve_b4b will be removed soon. This is kept here to prevent
! round off errors in the baseline tests for the two-stream code (RGK 12-27-23)
if_preserve_b4b: if(preserve_b4b) then
lai = currentCohort%treelai * currentCohort%c_area/currentPatch%total_canopy_area
sai = currentCohort%treesai * currentCohort%c_area/currentPatch%total_canopy_area
if( (currentCohort%treelai+currentCohort%treesai) > nearzero)then

! See issue: https://github.com/NGEET/fates/issues/899
! fleaf = currentCohort%treelai / (currentCohort%treelai + currentCohort%treesai)
fleaf = lai / (lai+sai)
else
fleaf = 0._r8
endif
Expand All @@ -1673,7 +1612,14 @@ subroutine leaf_area_profile( currentSite )
write(fates_log(), *) ' currentPatch%nrad(cl,ft): ', currentPatch%nrad(cl,ft)
call endrun(msg=errMsg(sourcefile, __LINE__))
end if

!---~---
! Find current crown depth using the allometric function.
!---~---
call CrownDepth(currentCohort%height,currentCohort%pft,crown_depth)
!---~---


! --------------------------------------------------------------------------
! Whole layers. Make a weighted average of the leaf area in each layer
! before dividing it by the total area. Fill up layer for whole layers.
Expand All @@ -1687,12 +1633,10 @@ subroutine leaf_area_profile( currentSite )
! is obscured by snow.

layer_top_height = currentCohort%height - &
( real(iv-1,r8)/currentCohort%NV * currentCohort%height * &
prt_params%crown_depth_frac(currentCohort%pft) )

( real(iv-1,r8)/currentCohort%NV * crown_depth )

layer_bottom_height = currentCohort%height - &
( real(iv,r8)/currentCohort%NV * currentCohort%height * &
prt_params%crown_depth_frac(currentCohort%pft) )
( real(iv,r8)/currentCohort%NV * crown_depth )

fraction_exposed = 1.0_r8
if(currentSite%snow_depth > layer_top_height)then
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.