I'm working to add an annually-output variable that gives the total "grain C to food" accumulated during each growing season. This will be faster and less error-prone than the usual method, which is to sum daily GRAINC_TO_FOOD across a growing season (after multiplying by 3600*24, or 3600*24*n_days_in_month if using monthly output).
Because that's the usual way of doing things, I was surprised to see that I'm only getting one positive GRAINC_TO_FOOD value per year, even when looking at daily outputs. I looked into it, and the variable that GRAINC_TO_FOOD tracks—
where
Then I realized that the alternative method of calculating this value—taking the maximum GRAINC_TO_FOOD seen across the entire year, instead of summing, as suggested here—conflicts with the summing method. Also, it would only make sense if GRAINC_TO_FOOD were cumulative, which it appears not to be.
What am I not understanding? @dll@ucar_edu, could you clarify?
My test simulation is 1x1_smallvilleIA, which has (I think) every crop. I branched off of ctsm5.1.dev092 and have made no changes beyond adding my new output variable and a lot of print messages.
Because that's the usual way of doing things, I was surprised to see that I'm only getting one positive GRAINC_TO_FOOD value per year, even when looking at daily outputs. I looked into it, and the variable that GRAINC_TO_FOOD tracks—
repr_grainc_to_food_patch
—is only ever updated immediately after harvest, in CNOffsetLitterfall():
Code:
repr_grainc_to_food(p,k) = t1 * reproductivec(p,k) &
+ cpool_to_reproductivec(p,k) - repr_grainc_to_seed(p,k)
t1 = 1.0_r8 / dt
. As I said, this was surprising but perhaps not a problem. Perhaps its constituent parts are doing the accumulating? But it looks like no, that's not the case. I don't see reproductivec
get a positive value anywhere; cpool_to_reproductivec
is often positive but is reset after every timestep, so it's not accumulating anything; repr_grainc_to_seed
is assigned a new value (not accumulated) just before the above lines.Then I realized that the alternative method of calculating this value—taking the maximum GRAINC_TO_FOOD seen across the entire year, instead of summing, as suggested here—conflicts with the summing method. Also, it would only make sense if GRAINC_TO_FOOD were cumulative, which it appears not to be.
What am I not understanding? @dll@ucar_edu, could you clarify?
My test simulation is 1x1_smallvilleIA, which has (I think) every crop. I branched off of ctsm5.1.dev092 and have made no changes beyond adding my new output variable and a lot of print messages.