ESCOMP / CTSM

Community Terrestrial Systems Model (includes the Community Land Model of CESM)
http://www.cesm.ucar.edu/models/cesm2.0/land/
Other
305 stars 307 forks source link

Resetting causes runaccum accumulators to miss an update #2586

Open samsrabin opened 3 months ago

samsrabin commented 3 months ago

Brief summary of bug

When runaccum accumulators (accumulMod) are reset, their updates for that timestep are skipped. This results in a value of 0 when the accumulated values are extracted.

To me, it would make more sense if the reset took place, then the update. This is how it works for timeavg accumulators.

General bug information

CTSM version you are using: ctsm5.2.007

Does this bug cause significantly incorrect results in the model's science? Incorrect, yes, but probably not "significantly" so.

Configurations affected: All

Details of bug

Replacing this if/else/endif with if/endif, if/endif would solve the issue. https://github.com/ESCOMP/CTSM/blob/a9433779f0ae499d60ad118d2ec331628f0eaaa8/src/main/accumulMod.F90#L683-L690

As an example, here's where the reset, (non-)update and extract take place for AGDD: https://github.com/ESCOMP/CTSM/blob/a9433779f0ae499d60ad118d2ec331628f0eaaa8/src/biogeochem/CNDVType.F90#L509-L512