Skip to content

Commit

Permalink
Adds a lower limit to stem allocation to avoid negative states
Browse files Browse the repository at this point in the history
The stem:leaf allocation variable can go negative without this
limiter, which can cause negative stem carbon pools.
  • Loading branch information
thorntonpe committed May 23, 2024
1 parent 0e0df9e commit 5f7fbe4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/elm/src/biogeochem/AllocationMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ subroutine Allocation1_PlantNPDemand (bounds, num_soilc, filter_soilc, num_soilp

if (stem_leaf(ivt(p)) < 0._r8) then
if (stem_leaf(ivt(p)) == -1._r8) then
f3 = (2.7/(1.0+exp(-0.004*(annsum_npp(p) - 300.0)))) - 0.4
f3 = max((2.7/(1.0+exp(-0.004*(annsum_npp(p) - 300.0)))) - 0.4_r8, 0.2_r8)
else
f3 = max((-1.0_r8*stem_leaf(ivt(p))*2.7_r8)/(1.0_r8+exp(-0.004_r8*(annsum_npp(p) - &
300.0_r8))) - 0.4_r8, 0.2_r8)
Expand Down Expand Up @@ -2118,7 +2118,7 @@ subroutine Allocation3_PlantCNPAlloc (bounds , &

if (stem_leaf(ivt(p)) < 0._r8) then
if (stem_leaf(ivt(p)) == -1._r8) then
f3 = (2.7/(1.0+exp(-0.004*(annsum_npp(p) - 300.0)))) - 0.4
f3 = max((2.7/(1.0+exp(-0.004*(annsum_npp(p) - 300.0)))) - 0.4_r8, 0.2_r8)
else
f3 = max((-1.0_r8*stem_leaf(ivt(p))*2.7_r8)/(1.0_r8+exp(-0.004_r8*(annsum_npp(p) - &
300.0_r8))) - 0.4_r8, 0.2_r8)
Expand Down

3 comments on commit 5f7fbe4

@bpbond
Copy link

@bpbond bpbond commented on 5f7fbe4 Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thorntonpe On the HES call today we wondered whether, as part of fixing this, you looked for other missing negative-value checks on pools and ratios in the land model?

@evasinha
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thorntonpe do you plan on submitting a PR for this fix?

@thorntonpe
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bpbond I have not done exhaustive checking for other issues like this. It's a very good idea, and would also be good to add as a run-time error check similar to the mass balance checking that is done now.
@evasinha the fix is being tested in a coupled run now, and then I expect to issue a PR. Those results may already be available - I've been traveling this week and just back in the office this afternoon.

Please sign in to comment.