Skip to content

Conversation

mpaiao
Copy link
Contributor

@mpaiao mpaiao commented Apr 14, 2025

Description:

This is the first step towards refactoring the phenology code. As described in #1385, in this step I create a new module that manages the cumulative/memory variables (main/FatesCumulativeMemoryMod.F90), with a main (public) sub-routine that handles all the updates (UpdateCumulativeMemoryVars) and calls sub-routines that update the date-, temperature- and moisture-related memory variables.

As described in #1385, a new module was necessary (instead of adding to the existing FatesRunningMeanMod) to avoid module circularity, as the new module uses EDTypesMod and EDTypesMod.F90 uses FatesRunningMeanMod.

Collaborators:

@XiulinGao @ckoven @rgknox @lmkueppers @rosiealice @glemieux

Expectation of Answer Changes:

At this point, the results should be bit-for-bit.

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
  • FATES-CLM6 Code Freeze: satellite phenology regression tests are b4b

If satellite phenology regressions are not b4b, please hold merge and notify the FATES development team.

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:

@mpaiao
Copy link
Contributor Author

mpaiao commented Apr 21, 2025

Probably integrate #1355 before this one.

samsrabin and others added 14 commits May 10, 2025 17:13
The goal here is to simplify things and improve my understanding before more substantive refactoring and fixing. Changes:
- Do everything within one patch loop, rather than looping through to get numerators and denominators separately, then looping again to do the division.
- Use new "weight" variable instead of repeating (e.g.) "cpatch*area * AREA_INV".
- Replace "hio_area_si_age(io_si, ipa2)*AREA" with "sites(s)%area_by_age(ipa2)"
- Replace "sites(s)%area_by_age(cpatch%age_class)" with new "age_class_area" variable.

Should be identical within roundoff precision. Affected variables:
- FATES_BURNFRAC_AP
- FATES_CANOPYAREA_AP
- FATES_FIRE_INTENSITY_BURNFRAC_AP
- FATES_FUEL_AMOUNT_AP
- FATES_GPP_AP
- FATES_LAI_AP
- FATES_LBLAYER_COND_AP
- FATES_NCL_AP
- FATES_NPP_AP
- FATES_SCORCH_HEIGHT_APPF
- FATES_SECONDAREA_ANTHRODIST_AP
- FATES_SECONDAREA_DIST_AP
- FATES_STOMATAL_COND_AP
- FATES_VEGC_AP
- FATES_ZSTAR_AP

Also renames various internal FatesHistoryInterfaceMod variables from "area" to "fracarea" for clarity (units are m2/m2, not m2).
To avoid similar mistakes in the future, adds function SumMortForHistory to fates_cohort_type.
These are useful for checking whether the per-ageclass versions are normalized correctly.
* FATES_CANOPYAREA
* FATES_NCL
* FATES_PATCHAREA
* FATES_SCORCH_HEIGHT_PF
* FATES_SECONDAREA_ANTHRODIST
* FATES_SECONDAREA_DIST
* FATES_ZSTAR
Now dividing by total site area instead of age-class area:
- FATES_GPP_AP
- FATES_NPP_AP
- FATES_LAI_AP
- FATES_NCL_AP
- FATES_SCORCH_HEIGHT_APPF

Now dividing by site-wide canopy area instead of age-class canopy area:
- FATES_LBLAYER_COND_AP
- FATES_STOMATAL_COND_AP
Tell the user how to get the value they probably want---the value on each age-class---rather than what each age-class contributes to the cross-ageclass area-weighted mean.
- Use descriptive weight names
- Remove unused variable ipa
- Organize into sections
- Add a TODO
- Use descriptive weight names
- Remove unused variable ipa
- Fix indentation
(Also add postprocessing info, where needed.)
- FATES_NPLANT_SZAP
- FATES_NPLANT_CANOPY_SZAP
- FATES_NPLANT_USTORY_SZAP
- FATES_NPLANT_SZAPPF
- FATES_NPATCH_AP
- FATES_CANOPYAREA_AP
- FATES_SECONDAREA_ANTHRODIST_AP
- FATES_SECONDAREA_DIST_AP
- FATES_PATCHAREA_AP
- Unused fire rate-of-spread output
samsrabin and others added 26 commits May 10, 2025 17:22
Used in history outputs to get biomass of each organ, plus alive and total biomass.
Co-authored-by: Gregory Lemieux <7565064+glemieux@users.noreply.github.com>
Useful for checking that FATES_PRIMARY_AREA_AP has the correct denominator.
…_AP.

For consistency with other ageclass-stratified outputs.
… counts, and updating everything else that dependons on that.
@glemieux glemieux added science: phenology type: refactor Restructures code without changing functionality labels May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
science: phenology type: refactor Restructures code without changing functionality
Projects
Status: Under Review
Development

Successfully merging this pull request may close these issues.

5 participants