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

cleaning up nocomp patch indexing #1226

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

rgknox
Copy link
Contributor

@rgknox rgknox commented Jul 18, 2024

Description:

This set of changes removes the need for all these checks that determine if a patch is nocomp+fixedbiogeog. We currently do this check because when in this mode, we construct a bareground patch in the zero-th patch index position. When we traverse patch loops, sometimes we increment the patch index, and this logic check makes sure that we don't increment.

However, we don't need to put this special bare-ground patch in the zeroth position. We can just put it in the first position, and allow it to be in-line index-wise with the what ELM/CLM identifies as the 1st vegetated patch. This is fine, FATES has patches in the full dynamics mode that have no cohorts, it's used to having patches with no vegetation lined-up with patches in CLM/ELM that are "vegetated". What happens is we set the weighting to zero, and many of the fluxes are some nominal value.

We also don't need to touch the ELM/ELM side of the code, because the way we create out weightings actaully works for both the indexing schemes described. Why? because we assign the CLM/ELM bare-ground patch fraction based on 1 minus the sum of all patches total canopy area, which doesn't care about index position.

Here are some slides that give a sense of what is going on and what is proposed: https://docs.google.com/presentation/d/1ZwErNVF3B-_jJwpCDud3d-MtR59Idax8YTWe_ErEc8Q/edit?usp=sharing

Further, if someone want's to bypass some subset of physics, or some algorithm, because there is no vegetation, it would be more appropriate anyway to compare against total canopy area, and not if it is a nocomp+bareground patch.

I still need to make sure that we don't exceed our patch counts on the fates-side when in nocomp+fixedbiogeog, in this mode we were using 1 less space as we matched with ELM/CLM arrays.

Collaborators:

Discussions with @glemieux

Expectation of Answer Changes:

Checklist

If this is your first time contributing, please read the CONTRIBUTING document.

All checklist items must be checked to enable merging this pull request:

Contributor

  • The in-code documentation has been updated with descriptive comments
  • The documentation has been assessed to determine if updates are necessary

Integrator

  • FATES PASS/FAIL regression tests were run
  • Evaluation of test results for answer changes was performed and results provided

Documentation

Test Results:

CTSM (or) E3SM (specify which) test hash-tag:

CTSM (or) E3SM (specify which) baseline hash-tag:

FATES baseline hash-tag:

Test Output:

@rgknox rgknox added the draft label Jul 18, 2024
@mpaiao mpaiao self-requested a review October 28, 2024 19:13
@glemieux
Copy link
Contributor

glemieux commented Nov 1, 2024

We also don't need to touch the ELM/ELM side of the code, because the way we create out weightings actaully works for both the indexing schemes described.

For the hlm-fates interface mod, we skip the hlm bareground patch, col%patchi(c), by mapping fates patch index ifp onto hlm patch index p via p = ifp+col%patchi(c). If we make ifp=1 the bareground patch for fates, wouldn't we want to remove this mapping on the hlm side API?

@glemieux
Copy link
Contributor

@rgknox and @glemieux to talk about this this coming Thursday.

@rgknox rgknox removed the draft label Dec 2, 2024
@rgknox rgknox closed this Dec 2, 2024
@rgknox rgknox reopened this Dec 2, 2024
maxpatches_by_landuse(primaryland) = max(maxpatches_by_landuse(primaryland),fates_numpft)
maxpatch_total = sum(maxpatches_by_landuse(:))
!! REVIEWERS: NEED THIS NEXT LINE?
!maxpatches_by_landuse(secondaryland) = max(maxpatches_by_landuse(secondaryland),fates_numpft)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ckoven and others.. Don't we need to allocate at least numpft patches for the secondary lu category (and others if nocomp is on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and actually, this shouldn't be a maximum here, it should not be more than fates_numpft, it should be equal to

Copy link
Contributor

Choose a reason for hiding this comment

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

@rgknox there is logic in the nocomp x land use initialization that limits the number of PFTs allowed on secondary (or other LU) patches to be the number of secondary patches allowed, see here: https://github.com/NGEET/fates/blob/main/main/EDInitMod.F90#L554-L578

Copy link
Contributor Author

@rgknox rgknox Dec 4, 2024

Choose a reason for hiding this comment

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

I see, thanks for pointing that out @ckoven . Can you confirm that you do want to make sure maxpatches_by_landuse(primary) is greater than or equal to numpft, at this location in the code? The logic in the above mentioned line did not seem to ignore primary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Under Review
Development

Successfully merging this pull request may close these issues.

3 participants