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

bugfix on understory demotion #271

Merged
merged 9 commits into from
Sep 19, 2017
Merged

Conversation

rgknox
Copy link
Contributor

@rgknox rgknox commented Sep 8, 2017

When the understory needed demotions (a situation that we had not been encountering until only recently), the accounting for the lost area had not been accounted for correctly. In short, when a cohort is demoted, its crown area has to be added to the layer below. But in the case of understory demotion, the cohorts should not be donating area to the layer below, because their is none, and they are generating litter instead.

Code review: pending

Test suite: cheyenne (ed, clm_short_45, clm_short_50), 300 year f45_f45 smoke test (by @jkshuman, see #267 PASS)

Test namelist changes: none
Test answer changes: none expected (should only expect answer changes if understory experiences demotion, nigh impossible within the first year)

Test summary (updated 9/13/2017):
cheyenne(intel): all PASS

@jenniferholm
Copy link
Contributor

Hi @rgknox - I will get started on testing this issue and understory demotion.

I was having difficulty with successfully building this branch in ALM-FATES (https://github.com/rgknox/fates/tree/rgknox-test-layering), but this was on Thursday of last week. You might have made some changes since then, so should I checkout this branch again? Just double checking on the latest version.

Also - should I test in strict PPA?

@jenniferholm
Copy link
Contributor

Hi @rgknox -- Here was my build error using your branch "rgknox-test-layering". This might be something ALM-FATES specific......

ERROR: Command: '/global/scratch/jaholm/ACME-fates-rgknox/components/clm/cime_config/buildnml /global/scratch/jaholm/Models/FATES_runs/ICLM45ED_ACME-FATES_f45_13pfts_layering' failed with error 'No handlers could be found for logger "CIME.utils"
No handlers could be found for logger "CIME.utils"
......
......
No handlers could be found for logger "CIME.utils"
** source directory does not exist: /global/scratch/jaholm/ACME-fates-rgknox/components/clm/src/external_models/mpp/src/mpp/dtypes
ERROR clm.buildnml: /global/scratch/jaholm/ACME-fates-rgknox/components/clm/bld/configure -comp_intf MCT -phys clm4_5 -usr_src /global/scratch/jaholm/Models/FATES_runs/ICLM45ED_ACME-FATES_f45_13pfts_layering/SourceMods/src.clm failed: 512'

@rgknox
Copy link
Contributor Author

rgknox commented Sep 11, 2017

@jenniferholm : I'l bet that error can be fixed by "git submodule update --init --recursive"

@rgknox
Copy link
Contributor Author

rgknox commented Sep 13, 2017

Merged in the fixes that resolved #267. Re-testing on Cheyenne.

if ( abs(error) > 10e-6 ) then
! We are not closing this error within 10e-6 very often
! but this is filling up the logs too much
! Encapsulating print statements and making new issue (RGK 09-11-2017)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you make a new issue? I should have made this an end run while it still passed the balance checks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the reminder. I didn't

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is #182

@@ -61,10 +61,12 @@ module FatesConstantsMod
! Conversion: days per second
real(fates_r8), parameter :: days_per_sec = 1.0_fates_r8/86400.0_fates_r8

! Conversion: days per year. assume HLM uses 365 day calendar. If we need to link to 365.25-day-calendared HLM, rewire to pass through interface
! Conversion: days per year. assume HLM uses 365 day calendar.
! If we need to link to 365.25-day-calendared HLM, rewire to pass through interface
Copy link
Contributor

Choose a reason for hiding this comment

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

We had a discussion about usig Gregorian calendars in the CLM code meeting last week, pertaining to the inability to do so in CISM (I think!), so just wanted to flag that @billsacks has been giving this sort of thing a lot of thought and might have an opinion on what to do and not do.

Copy link
Member

Choose a reason for hiding this comment

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

@rosiealice is right about this discussion, though is giving me too much credit for how much thought I've given this: Basically, I decided to punt on this for CISM for now so I don't need to think about it 😄 That said, the idea proposed in this comment of passing the current year length through the interface seems reasonable. That's one of the approaches being considered for CISM. One complication here (at least for CISM) is that you can no longer treat this as a constant set in initialization or at compile-time, since year length will vary from year to year.

call fates_params%RetreiveParameter(name=ED_name_grass_spread, &
data=ED_val_grass_spread)

call fates_params%RetreiveParameter(name=ED_name_comp_excln, &
Copy link
Contributor

Choose a reason for hiding this comment

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

Have these gone somewhere else? ED_val_comp_exlcn seems to still be used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They were actually redundant. We defined each twice, and read each twice. I just removed the extra calls.

do while (associated(currentPatch)) ! Patch loop


! Perform a numerical check on input data structures
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe make this section on nan checking it's own function. Seems like it might be useful elsewhere also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, ok, maybe a patch level function call that checks through all variables listed as arguments...

do while(area_not_balanced)

! ---------------------------------------------------------------------------------------
! Demotion Phase: Identify upper layers that are too full, and demote them to
Copy link
Contributor

Choose a reason for hiding this comment

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

This is so much more zen than before.

! Not quite sure why we have this block of code, seems like a small subset of cases
! Essentially promote all cohorts from layer below if that whole layer has area smaller
! than the tolerance on the gains needed into current layer
! -------------------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's so we don't break the carbon balance by losing this little set of cohorts. Suspect it's to do with 'trickling' in of recruits each day. I should know, obviously...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It just seems like the code below that block will serve the same function. Perhaps not as quickly, but that small lower layer will get completely promoted even without that first block of code right?
I don't think we need to remove it, as it does the task of promoting that specific case more efficiently.

Copy link
Contributor

Choose a reason for hiding this comment

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

Might the default promoting code end up with loads of tiny cohorts in the 'layer below'? This block could act as a 'terminate cohorts' type of thing, but for canopy layering?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should keep the block and I will remove the comment.

endif

sumdiff = 0.0_r8
rankordered_area_so
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this a namelist variable? I think the PFT file switches are pretty confusing for most people.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wasn't sure exactly what you were pointing at, but it looks like you want the non-probabalistic exclusion switch as a NL variable right?

A switch instead of ED_val_comp_excln right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we make this an issue so we can bat back and forth the pros and cons?

Copy link
Contributor

Choose a reason for hiding this comment

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

sure...

endif

sumdiff = 0.0_r8
rankordered_area_so
Copy link
Contributor

@rosiealice rosiealice Sep 15, 2017

Choose a reason for hiding this comment

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

while i'm here, should we separate canopy_structure and the canopy_summarization&leaf_area_profile code into different files. I feel like they are awkward bedfellows, since they are trying to achieve quite orthogonal things...

Copy link
Contributor

@rosiealice rosiealice left a comment

Choose a reason for hiding this comment

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

I think this all looks great. It's much clearer to read overall than it was before.

! Not quite sure why we have this block of code, seems like a small subset of cases
! Essentially promote all cohorts from layer below if that whole layer has area smaller
! than the tolerance on the gains needed into current layer
! -------------------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

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

Might the default promoting code end up with loads of tiny cohorts in the 'layer below'? This block could act as a 'terminate cohorts' type of thing, but for canopy layering?

@rgknox
Copy link
Contributor Author

rgknox commented Sep 16, 2017

Added numerical checks (nan, overflow and underflow) as generic subroutines. These subroutines, if detecting numerical problems will dump site, patch and cohort information when possible, and exit.

Didn't remove the DEBUG bypass on the error check, but I see that is issue #182, and I will prioritize that issue (along with logging) next.

Removed that language where I was questioning if the block of code should had been kept.

Will re-test.

Any remaining items @rosiealice ?

@rgknox
Copy link
Contributor Author

rgknox commented Sep 18, 2017

all tests re-run, all pass

@rgknox
Copy link
Contributor Author

rgknox commented Sep 18, 2017

If no comments or concerns crop up by the end of the day I will merge this in.

@rgknox rgknox merged commit c8e6da5 into NGEET:master Sep 19, 2017
@rgknox rgknox deleted the rgknox-test-layering branch July 31, 2018 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants