ESCOMP / CTSM

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

Rework CNPhenology onset and offset triggers to be more robust to changes in dt #1167

Closed billsacks closed 3 years ago

billsacks commented 3 years ago

1165 improves the robustness of the CNPhenology onset and offset triggers when there are changes in time step length (dt) between the restart file and the current run. However, I don't think it goes far enough to ensure that all of the phenology code will work correctly under this condition.

I haven't come to completely understand the relevant code, but my understanding is that, for both onset and offset, we have:

  1. Many time steps during the onset / offset period when we are making gradual transfers from some pools to other pools.

  2. A second-to-last time step when there is some special code to ensure that all of the final transfers happen.

  3. A last time step that finalizes the period.

The key point, from what I can tell from my brief read of the code, is that it seems like (2) is designed to happen exactly once. However, I think that neither the code before or after #1165 ensures that (2) actually happens exactly once if we allow for changes in the time step length between the restart file and the current run.

Specific scenarios I can think of where this is violated are:

The solution I can see is to treat this more explicitly like a state machine, and add another state here. Currently, we have two values for the onset and offset flags: 0.0 or 1.0. We could add a third value (2.0) that indicates that we are in the final time step. Then we would change the logic as follows:

billsacks commented 3 years ago

Although I think this will do the wrong thing in some scenarios when changing the time step, my sense is that we have bigger fish to fry, so I'm closing this as a wontfix; we can reopen it if it seems to actually be causing problems in practice.