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

duplicate variables: cohort%gpp and cohort%gpp_acc #134

Closed
rgknox opened this issue Oct 10, 2016 · 10 comments · Fixed by #147
Closed

duplicate variables: cohort%gpp and cohort%gpp_acc #134

rgknox opened this issue Oct 10, 2016 · 10 comments · Fixed by #147

Comments

@rgknox
Copy link
Contributor

rgknox commented Oct 10, 2016

Summary of Issue:

We have a variable that essentially a constant scale of the other.

gpp_tstep, npp_tstep and resp_tstep are calculated as rates in Photosynthesis. Photosynthesis is a rapidly updated process at every model time-step. Following photosynthesis, we call an accumulator function that temporally increments these three variables, and zeros these values following the call to dynamics (once daily).

gpp_acc = gpp_acc + gpp_tstep

The accumulation of the instantaneous variable is all well and good, and I don't see any issues with that. I just don't like how we have a separate variable that is just a scaled version of the accumulated variable. I think it is much clearer to have one variable instead of two that do the same thing.

in EDPHysiologyMod.F90, line 792:794:

 currentCohort%npp  = currentCohort%npp_acc  * udata%n_sub   !Link to CLM. convert from kgC/indiv/day into kgC/indiv/year
    currentCohort%gpp  = currentCohort%gpp_acc  * udata%n_sub   !Link to CLM. convert from kgC/indiv/day into kgC/indiv/year
    currentCohort%resp = currentCohort%resp_acc * udata%n_sub   !Link to CLM. convert from kgC/indiv/day into kgC/indiv/year

I just want to get rid of %npp, %gpp and %resp. Does this make sense? Or am I missing something?

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:

@rosiealice
Copy link
Contributor

So, each timestep we get a different GPP/NPP/resp (*_timestep) and those
are accumulated through the course of the day to give *_acc, so the
ultimate purpose is really to account for the discrepancy between the CLM
and ED model timesteps. Then the multiplication by n_sub just converts
from daily to annual (gC/cohort/day to gC/cohort/year) which is the
convention for fluxes in FATES (for historical reasons. There is no good
defensible reason for this).

So, I think we need something like npp_acc to remember what happened over
the course of the day. Is there a clever way to combine these, or does it
just need renaming so that it's e.g. 'npp_daily' to make that more obvious?

Apologies if I missed something obvious etc...

On 10 October 2016 at 17:10, Ryan Knox [email protected] wrote:

Summary of Issue:

We have a variable that essentially a constant scale of the other.

gpp_tstep, npp_tstep and resp_tstep are calculated as rates in
Photosynthesis. Photosynthesis is a rapidly updated process at every model
time-step. Following photosynthesis, we call an accumulator function that
adds up these three variables, and zeros these values following the call to
dynamics (once daily).

gpp_acc = gpp_acc + gpp_tstep

The accumulation of the instantaneous variable is all well and good, and I
don't see any issues with that. I just don't like how we have a separate
variable that is just a scaled version of the accumulated variable. I think
it is much clearer to have one variable instead of two that do the same
thing.

in EDPHysiologyMod.F90, line 792:794:

currentCohort%npp = currentCohort%npp_acc * udata%n_sub !Link to CLM. convert from kgC/indiv/day into kgC/indiv/year
currentCohort%gpp = currentCohort%gpp_acc * udata%n_sub !Link to CLM. convert from kgC/indiv/day into kgC/indiv/year
currentCohort%resp = currentCohort%resp_acc * udata%n_sub !Link to CLM. convert from kgC/indiv/day into kgC/indiv/year

I just want to get rid of %npp, %gpp and %resp. Does this make sense? Or
am I missing something?
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:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#134, or mute the thread
https://github.com/notifications/unsubscribe-auth/AMWsQ6218fbKc0a3BA5NBB1aJID7z3C6ks5qysXUgaJpZM4KTFL0
.


Dr Rosie A. Fisher

Terrestrial Sciences Section
Climate and Global Dynamics
National Center for Atmospheric Research
1850 Table Mesa Drive
Boulder, Colorado, 80305
USA.
+1 303-497-1706

http://www.cgd.ucar.edu/staff/rfisher/

@rgknox
Copy link
Contributor Author

rgknox commented Oct 11, 2016

It sounds like we are in agreement as to the need and value of the _acc variables, they are important. As are the _tstep variables. But it seems that we both have not been able to identify a purpose for cohort%npp, cohort%gpp and cohort%resp. They don't really do anything right? Do we need to keep them?

@ckoven
Copy link
Contributor

ckoven commented Oct 11, 2016

aren't they needed if you want to output the data at sub-daily frequency?

@rgknox
Copy link
Contributor Author

rgknox commented Oct 12, 2016

As far as I can tell*, %npp %gpp and %resp all do nothing that can't be accomplished by %npp_acc, %gpp_acc and %resp_acc

The %npp variable is used in growth_derivatives to calculate the npp partions, but in this case we could easily use %npp_acc times the scalar. It is then used again in history IO to write diagnostics, and again npp_acc would suffice.

%gpp is only used for history IO, and also %gpp_acc could be used instead

%resp is also only used for history IO, and %resp_acc could be used instead

*I've looked through this several times, I'm pretty sure we don't need these variables

@ckoven
Copy link
Contributor

ckoven commented Oct 12, 2016

right. looked through the code and see your point. at history writes, the sub-daily variables are being given %npp_tstep, %gpp_tstep, and %resp_tstep; whereas %npp and %gpp are being used for the daily, disaggregated fluxes on the scpf dimension. I don't see %resp going into the history at all (on master), only %resp_tstep and its growth and maintenance components.

anyway, agreed that they are redundant so we ought to get rid of them.

@rosiealice
Copy link
Contributor

I'm cool with getting rid of the gpp, npp, & resp variables too...

On 12 October 2016 at 10:25, Charlie Koven [email protected] wrote:

right. looked through the code and see your point. at history writes, the
sub-daily variables are being given %npp_tstep, %gpp_tstep, and
%resp_tstep; whereas %npp and %gpp are being used for the daily,
disaggregated fluxes on the scpf dimension. I don't see %resp going into
the history at all (on master), only %resp_tstep and its growth and
maintenance components.

anyway, agreed that they are redundant so we ought to get rid of them.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#134 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AMWsQzHBDM9XCE2dw-vVqiK_C3BVeowmks5qzQn-gaJpZM4KTFL0
.


Dr Rosie A. Fisher

Terrestrial Sciences Section
Climate and Global Dynamics
National Center for Atmospheric Research
1850 Table Mesa Drive
Boulder, Colorado, 80305
USA.
+1 303-497-1706

http://www.cgd.ucar.edu/staff/rfisher/

@rgknox
Copy link
Contributor Author

rgknox commented Oct 18, 2016

Removing these variables is a little trickier than I first thought, and I'm starting to think that they are actually quite necessary. :|

Our history diagnostics that occur after the call to dynamics wants integrated npp, gpp. In the new proposed system, instead of using %npp and %gpp, we use the %npp_acc and %gpp_acc variables and just scale the values (having removed the variables npp, gpp which were scaled copies of npp_acc and gpp_acc).

The problem is, that we call an update on history diagnostics on the initialization of restarts. But npp_acc and gpp_acc had been zero'd prior to being written out to the restart file. In the old system, we don't zero %npp, %gpp and %resp (as they are not integrated), so we don't have this problem. And this call to update the dynamics history buffers are necessary, because they won't be set with new information again until the end of the day, and those buffers must match what they looked like before restart data was written out.

@rgknox
Copy link
Contributor Author

rgknox commented Oct 18, 2016

I intend to close this up and make no changes per this thread unless anyone else feels otherwise. I will give it a few days.

@ckoven
Copy link
Contributor

ckoven commented Oct 18, 2016

ok. maybe it would be worthwhile to at least (a) add documentation in the code about what these variables are needed for so that future people don't have to re-learn what you've discovered? and (b) change the variable names of npp, gpp, and resp to be a little more descriptive of how they are used in the code? like npp_daily or something like that?

@rgknox
Copy link
Contributor Author

rgknox commented Oct 18, 2016

excellent idea
I'm doing a group of maintenance changes right now that include adding a test and turning off a warning. I will include improved documentation and descriptions for these variables with that PR.

bandre-ucar added a commit that referenced this issue Dec 2, 2016
Merge branch 'rgknox-warns-threadtests'

The first change is the renaming of cohort level carbon flux
accounting variables %npp to %npp_acc_hold, with documentation
explaining the change, see #134.

The second change is the fix on a warning message when cohorts are
created during restarts. The restart was passing arguments to cohort
creation that were triggering a warning because the values were
un-expected. Remove the evaluation of those variables from the logic
that triggered the warning, and changed the warning to a fail. Added
debug logic around two other print statements that were generating a
lot of log output. See #133.

Fixes: #134, #133

User interface changes?: no

Code review:

rgknox:
    Test suite: lawrencium-lr3 intel: edTest, clm_short45, clm_short50
    Test baseline: 53bbb9d
    Test namelist changes: none
    Test answer changes: b4b
    Test summary: all PASS

andre:
    Test suite: ed - yellowstone gnu, intel, pgi
                ed - hobart nag
    Test baseline: 1d7f88a
    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
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 a pull request may close this issue.

3 participants