Repository navigation
Description
Brief summary of bug
Noticed by Louisa Emmons
The hist_addfld call for GAMMAS in MEGAN averages in lake points as zero's, so it varies on history output even though it shouldn't.
General bug information
CTSM version you are using: ctsm5.3.078 (but goes way back)
Does this bug cause significantly incorrect results in the model's science? Yes, just for GAMMAS
Configurations affected: When MEGAN is on and GAMMAS is output
Details of bug
this%gammaS_out_patch(begp:endp) = spval
call hist_addfld1d (fname='GAMMAS', units='non', &
avgflag='A', long_name='gamma S for VOC calc', &
ptr_patch=this%gammaS_out_patch, set_lake=0._r8, default='inactive')This should be changed to:
this%gammaS_out_patch(begp:endp) = spval
call hist_addfld1d (fname='GAMMAS', units='non', &
avgflag='A', long_name='gamma S for VOC calc', &
ptr_patch=this%gammaS_out_patch, set_spec=spval, default='inactive')Changing set_lake=spval, or using set_spec=spval, should be equivalent for how the code is setup now. But, since it shouldn't be set over other landunits it might as well be done with set_spec.
So that zero's from lake and other special landunits won't be averaged in as zero's into history averaging. This likely applies to other fields as well.
Important output or errors that show the problem
Louisa has plots that show how GAMMAS varies even in a case where it should be constant.
Activity
lkemmons commentedon Oct 6, 2025
As I do not look at CLM output very often, I forgot about this issue.
I don't think it is a bug, but users just have to remember this is the convention.
I think we did not want 1.E36 (spval) values in the output MEGAN emissions (MEG_*), so changed to:
call hist_addfld1d ( fname='MEG_'//trim(meg_cmp%name), units='kg/m2/sec', &
avgflag='A', long_name='MEGAN flux', &
ptr_patch=meg_out(imeg)%flux_out, set_lake=0._r8, set_urb=0._r8 )
And similarly for VOCFLXT.
Maybe for the diagnostics for the parameters used in calculating MEGAN emissions it would be better to have
set_spec=spval
in the hist_addfld command.
lkemmons commentedon Oct 7, 2025
Verified that with:
GAMMAS is actually 1 everywhere.
ekluzek commentedon Jan 21, 2026
Adding next so we can decide on the milestone for this.
ekluzek commentedon Feb 12, 2026
Since this just affects diagnostic fields this would be acceptable to do post coupled model answer freeze.