-
Notifications
You must be signed in to change notification settings - Fork 92
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
Numerical Overflows in carbon accounting #168
Comments
does it work to just zero the root_litter_out at the new patch creation step here:? |
That seems like a good idea, I will look into that too. At the end of EDCohortDynamicsMod.F90:terminate_cohorts(), I added a nan catcher for root_litter:
And it does catch a NaN, but the output is not unusual:
UPDATE: This was a red herring, I tracked the NaN back to earlier in the code to subroutine mortality_litter_fluxes(), variable currentpatch%canopy_mortality_root_litter(p) |
The problem was traced all the way back to cohort%npp_acc. This value was not being copied correctly during cohort copying, which is used in various places including spawning newly disturbed patches. |
Merge branch 'rgknox-leafnpp-diag-fix' This pull request mostly deals with some bug fixes to carbon accounting. @jenniferholm noticed that the diagnostics for leaf_npp were periodically showing negative values. Through #164 we identified that this occurred because daily carbon balances during the allocation sequences were sometimes negative to to high respiration and low gpp. The model was correctly using storage carbon to "pay" the negative daily carbon balance and allow maintenance respiration to occur, it was not however correctly diagnosing this flow. The accounting of this process is a little complicated because storage can be used to pay for maintenance respiration as well as maintenance turnover demand. During the process of verifying that carbon accounting errors were low, I triggered spurious values of output variables that triggered netcdf write errors, this lead to the identification that cohort%npp_accum was not being properly copied during copying of cohorts during patch fission. A fix was needed to lawrencium machine files for its lr2 partition for serial runs. While these changes are unrelated to carbon accounting, they are trivial and simple, so I bundled them here. Fixes: #164, #169, #168 and possibly #154 User interface changes?: no Code review: requesting @jenniferholm and @serbinsh for evaluation in their science algorithms. Testing: rgknox: Test suite: lawrencium lr3 (baseline) and lawrencium-lr2 (non-baseline) edTest, Rapid Science Check tool (single site multi-decadal analysis) Test baseline: 5c5928f Test namelist changes: none Test answer changes: Test summary: all PASS andre: Test suite: ed - yellowstone gnu, intel, pgi hobart nag Test baseline: 30f84d7 Test namelist changes: none Test answer changes: bit for bit Test summary: all tests pass Test suite: clm_short - yellowstone gnu, intel, pgi Test baseline: clm4_5_12_r195 Test namelist changes: none Test answer changes: bit for bit Test summary: all tests pass
Merge branch 'rgknox-leafnpp-diag-fix' This pull request mostly deals with some bug fixes to carbon accounting. @jenniferholm noticed that the diagnostics for leaf_npp were periodically showing negative values. Through #164 we identified that this occurred because daily carbon balances during the allocation sequences were sometimes negative to to high respiration and low gpp. The model was correctly using storage carbon to "pay" the negative daily carbon balance and allow maintenance respiration to occur, it was not however correctly diagnosing this flow. The accounting of this process is a little complicated because storage can be used to pay for maintenance respiration as well as maintenance turnover demand. During the process of verifying that carbon accounting errors were low, I triggered spurious values of output variables that triggered netcdf write errors, this lead to the identification that cohort%npp_accum was not being properly copied during copying of cohorts during patch fission. A fix was needed to lawrencium machine files for its lr2 partition for serial runs. While these changes are unrelated to carbon accounting, they are trivial and simple, so I bundled them here. Fixes: #164, #169, #168 and possibly #154 User interface changes?: no Code review: requesting @jenniferholm and @serbinsh for evaluation in their science algorithms. Testing: rgknox: Test suite: lawrencium lr3 (baseline) and lawrencium-lr2 (non-baseline) edTest, Rapid Science Check tool (single site multi-decadal analysis) Test baseline: 5c5928f Test namelist changes: none Test answer changes: Test summary: all PASS andre: Test suite: ed - yellowstone gnu, intel, pgi hobart nag Test baseline: 30f84d7 Test namelist changes: none Test answer changes: bit for bit Test summary: all tests pass Test suite: clm_short - yellowstone gnu, intel, pgi Test baseline: clm4_5_12_r195 Test namelist changes: none Test answer changes: bit for bit Test summary: all tests pass
Merge branch 'rgknox-leafnpp-diag-fix' This pull request mostly deals with some bug fixes to carbon accounting. @jenniferholm noticed that the diagnostics for leaf_npp were periodically showing negative values. Through #164 we identified that this occurred because daily carbon balances during the allocation sequences were sometimes negative to to high respiration and low gpp. The model was correctly using storage carbon to "pay" the negative daily carbon balance and allow maintenance respiration to occur, it was not however correctly diagnosing this flow. The accounting of this process is a little complicated because storage can be used to pay for maintenance respiration as well as maintenance turnover demand. During the process of verifying that carbon accounting errors were low, I triggered spurious values of output variables that triggered netcdf write errors, this lead to the identification that cohort%npp_accum was not being properly copied during copying of cohorts during patch fission. A fix was needed to lawrencium machine files for its lr2 partition for serial runs. While these changes are unrelated to carbon accounting, they are trivial and simple, so I bundled them here. Fixes: #164, #169, #168 and possibly #154 User interface changes?: no Code review: requesting @jenniferholm and @serbinsh for evaluation in their science algorithms. Testing: rgknox: Test suite: lawrencium lr3 (baseline) and lawrencium-lr2 (non-baseline) edTest, Rapid Science Check tool (single site multi-decadal analysis) Test baseline: 5c5928f Test namelist changes: none Test answer changes: Test summary: all PASS andre: Test suite: ed - yellowstone gnu, intel, pgi hobart nag Test baseline: 30f84d7 Test namelist changes: none Test answer changes: bit for bit Test summary: all tests pass Test suite: clm_short - yellowstone gnu, intel, pgi Test baseline: clm4_5_12_r195 Test namelist changes: none Test answer changes: bit for bit Test summary: all tests pass
Summary of Issue:
There is a check on total fates carbon balance that occurs once each day when vegetation dynamics is called. This happens in ChecksBalancesMod.F90: FATES_BGC_Carbon_Balancecheck().
This is the routine that updates the variable: sites(s)%cbal_err_fates, this is the variable that blows up. It is blowing up from the variable: sites(s)%fates_to_bgc_this_ts, which is blowing up from: currentPatch%root_litter_out(ft). By blowing up, it suddenly has a value of E+248.
This only occurs on the first time a new patch has been created.
currentPatch%root_litter_out() is zero'd and set in cwd_out(), via:
The order of operations seems fine. cwd_out is called from vegetation_dynamics, and the balance checks are called from EDBGCDynSummary() which is immediately after vegetation_dynamics in clm_drv().
ed_ecosystem_dynamics -> ed_integrate_state_variables -> non_canopy_derivs() -> cwd_out()
EDBGCDynSummary() -> wrap_bgc_summary() -> SummarizeNetFluxes()
EDBGCDynSummary() -> wrap_bgc_summary() ->FATES_BGC_Carbon_BalanceCheck()
Expected behavior and actual behavior:
Steps to reproduce the problem (should include create_newcase or create_test command along with any user_nl or xml changes):
What is the changeset ID of the code, and the machine you are using:
have you modified the code? If so, it must be committed and available for testing:
Screen output or output files showing the error message and context:
The text was updated successfully, but these errors were encountered: