Repository navigation
Major refactor of NutrientCompetition / CNAllocation to provide hooks for AgSys crop model - #1705
Merged
Merged
Conversation
The two NutrientCompetition methods did exactly the same thing for the start of calc_plant_nitrogen_demand, for the calculation of gpp, some MR terms and availc. I have consolidated this duplicated code into a new subroutine, calc_gpp_mr_availc.
This will support the incorporation of AgSys
I this this will become more useful as I do some further refactoring
This will facilitate splitting out different pieces into their own subroutines.
Resolved Conflicts: src/biogeochem/CropType.F90 src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 src/biogeochem/NutrientCompetitionFlexibleCNMod.F90
This way we can share this code between the different nutrient competition methods rather than having it duplicated. It also gives us a path towards skipping these calculations when running with AgSys. One change I made in doing this refactor was changing allocation fractions to always sum to 1, even in pre-emergence and when not croplive... this shouldn't make any difference outside of the allocation fractions themselves (and note that those aren't output to history files, so I don't think this should lead to any answer changes).
This allows the duplicate code for the calculation of allometry (in both nutrient competition methods) to be consolidated into a single subroutine.
AgSys will specify time-varying C:N ratios for each plant component. This commit provides placeholders for these, and changes the allocation and nutrient competition code to use these potentially time-varying C:N ratios rather than the constant parameters. I will probably change some other uses of the C:N parameters as well, but plan to do that in a follow-up commit.
This reverts commit 51241e8. After further discussion, it isn't clear if we really want to get time-varying C:N ratios from AgSys, and if we do, it isn't clear what those should be and in which places we should use the time-varying vs. time-constant C:N ratios. So for now we're sticking with the use of pft-constant C:N ratios; we may revisit this later.
This lets us skip this call when running with AgSys - since the relevant output variables will be calculated differently by AgSys.
This will make the code clearer when I introduce a similar subroutine for use with AgSys.
Member
Author
|
I think this is close to ready. The main thing still needed is introducing a place-holder AgSys version of |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
This PR separates the NutrientCompetition modules into pieces based on (1) consolidating duplicate code between the Clm45 and FlexibleCN versions, and (2) separating pieces that will vs. won't be used for crop patches when running with the upcoming AgSys crop model.
Specific notes
Contributors other than yourself, if any: Substantial consultation with @pengbinpeluo , as well as some with @danicalombardozzi and earlier conversations with @samsrabin
CTSM Issues Fixed (include github issue #):
Are answers expected to change (and if so in what way)? No
Any User Interface Changes (namelist or namelist defaults changes)? No
Testing performed, if any: Just a couple of tests so far