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

Thawed wetlands should result in a complete removal of the snow pack #735

Open billsacks opened 5 years ago

billsacks commented 5 years ago

I'm not sure if this is actually a bug, but it at least is a source of confusion (for me anyway):

The problem

https://github.com/ESCOMP/ctsm/blob/6a7fed208cabe43a9afd34d4ec9bb44724f9508f/src/biogeophys/SnowHydrologyMod.F90#L484-L487

The problem here is that h2osno is set to 0 regardless of the number of snow layers, but h2osoi_liq and h2osoi_ice are not set to 0. From tracing the code logic, and from an experiment where I have verified this, it looks like, for snow packs with explicit snow layers, this setting of h2osno to 0 does not actually set the snow pack to 0: h2osno is reset to the sum of h2osoi_liq+h2osoi_ice in the snow pack later in the time step, and so returns to its previous value (or at least something close to it).

So the effect of this code is just to set very small (0-layer) snow packs to 0 when wetland t_grnd goes above freezing. I'll assume for the moment that the intention matches this actual behavior (though I'm not sure if that's right). But in that case, there are inconsistencies for part of the time step between h2osno/snow_depth (both 0) vs. h2osoi_liq, h2osoi_ice and other snow variables (which may indicate a non-zero, multi-layer snow pack). I can't tell if this causes any actual problems now, or if this is just a source of confusion and possible future problems.

My proposed solution

I propose adding a conditional here to make explicit that this setting to 0 only takes effect if we have a very small snow pack. i.e., adding an if (snl(c) == 0) conditional around this resetting.

(Then, connected with the changes for #733 , I would just set h2osno_unresolved to 0, rather than setting h2osno_total to 0; h2osno_total would be updated accordingly soon afterwards.)

Testing I have done

I ran a one-year, one-degree test (SMS_Ly1.f09_g17.I2000Clm50SpGs.cheyenne_intel.clm-monthly) from ctsm1.0.dev042. I generated baselines from master, and added a write statement to diagnose the number of times this resetting is triggered. This did 5422 resets to 0 when h2osno_col was not 0 to begin with. Of these, there were 487 times when snl < 0.

I then ran a second version of this test where I only did the resetting if snl(c) == 0, as proposed above. This was bit-for-bit with the original test.

Then, in case this test was missing some rare situation where this logic changes behavior, I also ran a paired set of tests where, for both, I did the resetting regardless of temperature. With that change, answers differed depending on whether I did the reset to 0 only when snl==0 vs. doing the reset to 0 regardless of snl. I'm not sure if this suggests that there are rare circumstances where my proposed logic changes answers, or if this only tells us that answers would change if we did the resetting for below-freezing t_grnd – but as long as we only do it for above-freezing t_grnd, my proposed change is bit-for-bit.

Request for feedback

@swensosc - can you please let me know if my proposed change sounds good to you?

billsacks commented 5 years ago

Incidentally, this block of code feels out of place here (in the HandleNewSnow routine). I thought about moving it to some later part of the driver loop – such as somewhere that deals with the effect of temperature on the snow pack. However, moving it would almost certainly change behavior: the code immediately following this block is:

https://github.com/ESCOMP/ctsm/blob/6a7fed208cabe43a9afd34d4ec9bb44724f9508f/src/biogeophys/SnowHydrologyMod.F90#L494-L508

which initiates an explicit snow layer if we previously had 0 snow layers but now we have accumulated enough snow to warrant a new layer. If we moved the wetland code to later, I think behavior would be changed in situations where we started the time step with 0 layers then added enough snow to have an explicit layer, with t_grnd > tfrz over wetland:

Maybe such a move is still the right thing to do, but I'd like feedback from others before doing that.

billsacks commented 5 years ago

I should mention: the main alternative I can see to my proposal is to truly set the whole snow pack to 0 in this case with a thawed wetland. That feels physically justifiable, but I'm pretty sure will change answers.

billsacks commented 5 years ago

Based on discussion with @olyson - He thinks the code in question has been around ever since LSM, where there weren't explicit snow layers. It seems that the intent of this code is to remove the full snow pack when a wetland is thawed. So the current behavior, where only a very thin, 0-layer snowpack ends up being reset, seems like a bug.

Eventually we'd like to fix this to actually remove the complete snow pack for thawed wetlands. However, in the short-term, I'll do my proposed solution of just making the current behavior more explicit in the code, since the long-term solution could take some analysis to ensure water and energy conservation.

Edit (2019-06-05): When we fix this to do the intended thing, we should probably also move this code to somewhere more appropriate, as noted in https://github.com/ESCOMP/ctsm/issues/735#issuecomment-495795718

billsacks commented 5 years ago

I noticed that there is similar code in LakeHydrologyMod, but with one important difference: There, snl(c) is also set to 0 when h2osno is set to 0:

https://github.com/ESCOMP/ctsm/blob/8e5c61b4b07c0de8cee5770aeaa5b10955edeaab/src/biogeophys/LakeHydrologyMod.F90#L550-L552

We might be able to do the same thing for wetlands. However (especially for the sake of water tracers) we probably want this to go into an explicit flux (it looks like, for lakes, the removed snow goes into qflx_snow_drain, and melting of snow ice is also treated: https://github.com/ESCOMP/ctsm/blob/8e5c61b4b07c0de8cee5770aeaa5b10955edeaab/src/biogeophys/LakeHydrologyMod.F90#L536-L548).

adamrher commented 4 years ago

Hi @billsacks, I am questioning whether this issue is contributing to this resilience of snow packs to completely melt away in some coastal, ice free regions of greenland. If I understand this thread correctly, h2osno, which is derived from the sum of snow layers (or from h2osno_unresolved if there is not enough snow to form a layer), is set to 0 when wetland t_grnd goes above freezing, but then later in the code is over-written as the sum of h2osoi_liq and h2osoi_ice, undoing the previously intended purpose of removing the snow.

A NorESM2 paper just dropped in GMD discussions (pointed out to me by @lvankampenhout) which I think may be relevant to this issue. In particular, this discussion of a modification they made to CLM5:

Screen Shot 2020-02-12 at 2 11 43 PM

The snow bias they refer to sounds very similar to the greenland problem. And their fix, if I understand it correctly, is to stop the transfer of h2osoi_liq/h2osoi_ice to h2osno in general, and instead let it runoff to the ocean when t_grnd is freezing. I think this fix might avoid the issue you describe in this thread. Presumably, they are doing something like setting h2osoi_liq = h2osoi_ice = 0 when the ground freezes, and so that h2osno would then be 0 when it is set to the sum of these two soil terms once the ground thaws. Im not sure this is the "right" thing to do -- I agree with your assessment that the more physical solution is to remove the entire snow pack when wetlands thaw.

Curious to know if what I am saying here makes any sense, or If I am misunderstanding this issue.

billsacks commented 4 years ago

@adamrher thanks for your comments, and sorry it took me a while to reply. I think that what they're describing there is separate from this issue: I think that is #573 , which we fixed on master (in ctsm1.0.dev047) but not on the CLM5.0 release branch. This indeed might be affecting your runs if you are using the release code or an older version of master; sorry that I didn't remember that when we were talking before.

This issue (#735) is just related to wetlands. Wetlands only appear in limited areas in CTSM, specifically in points that CTSM thinks are ocean but that the ocean doesn't own. I'm thinking that your issue is broader than that?

adamrher commented 4 years ago

Thx. I am using ctsm1.0.dev071, so the #573 fix is included in my runs that still exhibit a summer snow bias. Is it likely that any of the points near the coastal edges of greenland could be considered wetland here? B/c the snow also seems to be sticking at these coastal grid cells, in addition to some interior, all inland grid cells.

billsacks commented 4 years ago

You could look at PCT_LANDUNIT to see if there is any wetland. The 6th index is wetland.

However, I'd be surprised if this issue is a big part of your snow bias: If I remember correctly, this issue just arises when the water of the wetland thaws but there is still snow on top of it. Physically, I wouldn't expect this to happen very often, at least for moderately deep snow packs. And this issue doesn't actually stop the snow from melting away as normal.

adamrher commented 4 years ago

OK...I was a little confused, so thanks for clarifying. You've made clear that the bug at issue in this thread would only arise in peculiar circumstances, and probably not related to this larger scale bias in snow cover.

I'm getting a little off topic here, but I would agree part of what NorESM is trying to do is correct for #573. But could there be other bugs? I would be interested to see how sensitive the snowpack might be to doing what they did in NorESM, just as a test. That is, send the surface water pool to run-off when it freezes. I don't think this should result in vary large changes to the snowpack, and so if it does, it may be indicating something fishy going on. If not, which is probably more likely, then at least we know everything is working as it should, or at least not having a noticeable impact on the solution.

I know you r a busy bee ... but unless you have reasons to believe this is not worth your or my time ... would you be willing to help me hack this into the code at some point?

billsacks commented 4 years ago

@adamrher - I'd suggest moving this conversation back to #573 (it's fine to continue the conversation there even though the issue is closed), and specifically @ mentioning the author of that issue, who I think is involved with NorESM: Hopefully they can send you their mods rather than our needing to recreate them ourselves.