ESCOMP / CTSM

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

dqgdT incorrect when there is no snow #824

Closed billsacks closed 4 years ago

billsacks commented 5 years ago

Brief summary of bug

The calculation of dqgdT, which gives the derivative, d(qg)/dT, is incorrect for soil/crop landunits when there is no snow.

General bug information

CTSM version you are using: ctsm1.0.dev072. I believe this bug has been present ever since the start of clm45.

Does this bug cause significantly incorrect results in the model's science? Yes

Configurations affected: All

Details of bug

Here is the relevant code:

https://github.com/ESCOMP/CTSM/blob/daf1459fea6c3191f4218242c98a5ebf7bebe846/src/biogeophys/SurfaceHumidityMod.F90#L196-L203

In the snl(c) >= 0 conditional, it looks like what was meant was:

               dqgdT(c) = (1._r8 - frac_h2osfc(c))*hr*qsatgdT

In the case where frac_sno(c) == 0, the original code results in a double-multiplication by (1._r8 - frac_h2osfc(c)) and a double-multiplication by hr, so dqgdT ends up closer to 0 than it should be (since both of the double-multiplied terms should be fractions less than 1). This new code does what I think is intended: If there is no explicit snow pack, then it calculates dqgdT to be what it would be if frac_sno(c) were 0.

@swensosc agreed that this is a bug, and agreed with my intended fix.

I checked the impact from one-day averages in test SMS_D_Ld1_P4x1.f10_f10_musgs.I2000Clm50BgcCropQianRsGs.bishorn_gnu.clm-default, by looking at differences in EFLX_LH_TOT. The impact is small: daily-average differences in that variable are typically 0.01 W m-2 or less; most grid cells have significantly less difference than that; only one or a few f10 grid cells have significantly greater differences, with the biggest difference being about 0.1 W m-2.

billsacks commented 5 years ago

@olyson @dlawrenncar I wanted to call your attention to this bug that impacts science. I'll fix this bug in my next tag. The good news is that the impact seems to be small, though this may warrant further investigation (I just did a one-day run at coarse resolution).

dlawrenncar commented 5 years ago

Perhaps it is close to time to do another evaluation of the science in the master branch with a few recent bugs having been fixed. Could potentially wait until after the optimized reflectance parameters branch has been brought to master.

On Fri, Oct 18, 2019 at 4:27 PM Bill Sacks notifications@github.com wrote:

@olyson https://github.com/olyson @dlawrenncar https://github.com/dlawrenncar I wanted to call your attention to this bug that impacts science. I'll fix this bug in my next tag. The good news is that the impact seems to be small, though this may warrant further investigation (I just did a one-day run at coarse resolution).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ESCOMP/CTSM/issues/824?email_source=notifications&email_token=AFABYVHU2T5ZAGJ3TFHGSHTQPHPY3A5CNFSM4JCJTWK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBVBDZY#issuecomment-543822311, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFABYVF5HMEXGHSMEYA3BPLQPHPY3ANCNFSM4JCJTWKQ .