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

leaf biophysics refactor and functional unit tests #1262

Open
wants to merge 50 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9c87f9e
Functional Unit Testing for photosynthesis, leaf respiration and stom…
rgknox Oct 14, 2024
20d9791
update to leaf biophys funit test
rgknox Oct 14, 2024
11b92bf
removed leaf unit test script that is for another thing
rgknox Oct 14, 2024
379e4f1
Making some notes on leaf func utests
rgknox Oct 14, 2024
5c245ff
leaf functional unit tests
rgknox Oct 15, 2024
f7ad159
Updates to leaf unit tests
rgknox Oct 15, 2024
6e5e183
updates to leaf unit tests
rgknox Oct 16, 2024
36678f8
Started work on secant solver for photosynthesis
rgknox Oct 16, 2024
a827fe8
work towards leaf solver
rgknox Oct 17, 2024
9c45896
Added bisection to photo solver, testing non-convergences
rgknox Oct 18, 2024
77657ab
Added argument control to leaf func unit test
rgknox Oct 19, 2024
bd89109
added readme placeholder
rgknox Oct 19, 2024
c7af3ef
debugged bisection, leaf unit tests generating stable results
rgknox Oct 22, 2024
929df1d
Added updated bounding to leaf photo bisection solver
rgknox Oct 26, 2024
91ee74d
Merge branch 'main' into leaf_funcunit_tests_merged
rgknox Oct 26, 2024
6610b3f
adding ability to revert to older methods for testing during leaf bio…
rgknox Oct 28, 2024
dc4f85e
adding in reversion testing to leaf photo updates
rgknox Oct 28, 2024
a7d9851
adding more ways to revert code to match old results with photo refactor
rgknox Oct 30, 2024
af7dd30
adding in options to btran effects on stomatal intercept and jmax
rgknox Oct 31, 2024
f61a3e1
updates to options in leaf photo
rgknox Oct 31, 2024
3b3872f
minor updates to comments in photo refactor
rgknox Nov 1, 2024
ea852d7
text updates and parameter reporting for leaf biophysics
rgknox Nov 4, 2024
5ec4cca
Adding some test print statements
rgknox Nov 4, 2024
6f4a030
diagnostics
rgknox Nov 4, 2024
b57cbfe
diagnostics
rgknox Nov 4, 2024
5c17877
removed diagnostic print statements, fixed zeroing bug for psn arrays
rgknox Nov 4, 2024
707704f
Updates to photosynthesis refactor related to preserving b4b
rgknox Nov 4, 2024
8c6319d
merge resolution
rgknox Nov 4, 2024
1ff3f13
reverting base compare code in leafbiophys
rgknox Nov 5, 2024
e985043
added ci_tol as argument to leaf level photosynthesis
rgknox Nov 5, 2024
4a7c550
expanding func unit tests for leaf biophys
rgknox Nov 5, 2024
254fbf8
adding in btran controls on conductance and agross
rgknox Nov 7, 2024
a261993
updating btran control tests
rgknox Nov 8, 2024
8a96e99
updated arguments to allow btran scaling of gs0 gs1 etc
rgknox Nov 8, 2024
d0fa00a
added protections in medlyn conductance when g1 approaches zero (triv…
rgknox Nov 9, 2024
efc8458
fixes to build for leaf biogeophys, addes smoothing back to c4 agross
rgknox Nov 9, 2024
cf09bce
Merge branch 'leaf_funcunit_tests' of github.com:rgknox/fates into le…
rgknox Nov 9, 2024
7358255
Added failure flags for quadratic solves (will remove)
rgknox Nov 9, 2024
3fbd7df
Added another conductance scaling term
rgknox Nov 12, 2024
dcddf2e
Cleaned up alternative scaling of the gs2 term
rgknox Nov 12, 2024
78145a2
Added gs2 arguments
rgknox Nov 12, 2024
7f9c088
fixed math on the bisection minmax for c4, subtle improvement on bise…
rgknox Nov 12, 2024
75e8684
cleaning and text updates to the photosynthesis module. Also added a …
rgknox Nov 13, 2024
6458190
converted bisection end-point solutions to use quadratic
rgknox Nov 13, 2024
a27ddba
added arguments to bisection starting point error report
rgknox Nov 19, 2024
40fa80b
Added lower floor on vcmax and jmax
rgknox Nov 19, 2024
52883e6
included smoothing into the c4 bisection endpoints, added a return to…
rgknox Nov 20, 2024
adec08d
Added lower cap on gs0 for photosynthesis, created smoke test unit test
rgknox Nov 21, 2024
c44ddcf
Added in extremely high bisection starting range as a fall back.
rgknox Nov 25, 2024
527673e
minor fixes to radiation unit testing to allow coupling with photosyn…
rgknox Dec 6, 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
4 changes: 2 additions & 2 deletions biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module EDPhysiologyMod
use FatesAllometryMod , only : tree_lai
use FatesAllometryMod , only : tree_sai
use FatesAllometryMod , only : leafc_from_treelai
use FatesAllometryMod , only : decay_coeff_vcmax
use LeafBiophysicsMod , only : DecayCoeffVcmax
use FatesLitterMod , only : litter_type
use EDTypesMod , only : site_massbal_type
use EDTypesMod , only : numlevsoil_max
Expand Down Expand Up @@ -781,7 +781,7 @@ subroutine trim_canopy( currentSite )

! Calculate sla_levleaf following the sla profile with overlying leaf area
! Scale for leaf nitrogen profile
kn = decay_coeff_vcmax(currentCohort%vcmax25top, &
kn = DecayCoeffVcmax(currentCohort%vcmax25top, &
prt_params%leafn_vert_scaler_coeff1(ipft), &
prt_params%leafn_vert_scaler_coeff2(ipft))

Expand Down
52 changes: 8 additions & 44 deletions biogeochem/FatesAllometryMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ module FatesAllometryMod
use FatesGlobals , only : FatesWarn,N2S,A2S,I2S
use EDParamsMod , only : nlevleaf,dinc_vai,dlower_vai
use DamageMainMod , only : GetCrownReduction

use LeafBiophysicsMod, only : DecayCoeffVcmax

implicit none

private
Expand All @@ -117,7 +118,6 @@ module FatesAllometryMod
public :: bdead_allom ! Generic bdead wrapper
public :: carea_allom ! Generic crown area wrapper
public :: bstore_allom ! Generic maximum storage carbon wrapper
public :: decay_coeff_vcmax ! vertical canopy decay rate, scaled on vcmax
public :: ForceDBH ! Method to set DBH to sync with structure
! or fineroot biomass
public :: CheckIntegratedAllometries
Expand Down Expand Up @@ -715,9 +715,9 @@ real(r8) function tree_lai( leaf_c, pft, c_area, nplant, cl, canopy_lai, vcmax25
end if

! Coefficient for exponential decay of 1/sla with canopy depth:
kn = decay_coeff_vcmax(vcmax25top, &
prt_params%leafn_vert_scaler_coeff1(pft), &
prt_params%leafn_vert_scaler_coeff2(pft))
kn = DecayCoeffVcmax(vcmax25top, &
prt_params%leafn_vert_scaler_coeff1(pft), &
prt_params%leafn_vert_scaler_coeff2(pft))

! take PFT-level maximum SLA value, even if under a thick canopy (which has units of m2/gC),
! and put into units of m2/kgC
Expand Down Expand Up @@ -913,9 +913,9 @@ real(r8) function leafc_from_treelai( treelai, pft, c_area, nplant, cl, vcmax25t
sla_max = g_per_kg * prt_params%slamax(pft)

! Coefficient for exponential decay of 1/sla with canopy depth:
kn = decay_coeff_vcmax(vcmax25top, &
prt_params%leafn_vert_scaler_coeff1(pft), &
prt_params%leafn_vert_scaler_coeff2(pft))
kn = DecayCoeffVcmax(vcmax25top, &
prt_params%leafn_vert_scaler_coeff1(pft), &
prt_params%leafn_vert_scaler_coeff2(pft))

if(treelai > 0.0_r8)then
! Leafc_per_unitarea at which sla_max is reached due to exponential sla profile in canopy:
Expand Down Expand Up @@ -2911,42 +2911,6 @@ end subroutine jackson_beta_root_profile
! =====================================================================================


real(r8) function decay_coeff_vcmax(vcmax25top,slope_param,intercept_param)

! ---------------------------------------------------------------------------------
! This function estimates the decay coefficient used to estimate vertical
! attenuation of properties in the canopy.
!
! Decay coefficient (kn) is a function of vcmax25top for each pft.
!
! Currently, this decay is applied to vcmax attenuation, SLA (optionally)
! and leaf respiration (optionally w/ Atkin)
!
! ---------------------------------------------------------------------------------

!ARGUMENTS

real(r8),intent(in) :: vcmax25top
real(r8),intent(in) :: slope_param ! multiplies vcmax25top
real(r8),intent(in) :: intercept_param ! adds to vcmax25top


!LOCAL VARIABLES
! -----------------------------------------------------------------------------------

! Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 used
! kn = 0.11. Here, we derive kn from vcmax25 as in Lloyd et al
! (2010) Biogeosciences, 7, 1833-1859
! This function is also used to vertically scale leaf maintenance
! respiration.

decay_coeff_vcmax = exp(slope_param * vcmax25top - intercept_param)

return
end function decay_coeff_vcmax

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

subroutine ForceDBH( ipft, crowndamage, canopy_trim, elongf_leaf, elongf_stem, d, h, bdead, bl )

! =========================================================================
Expand Down
Loading