Skip to content

Change history averaging of GAMMAS for MEGAN #3525

Description

@ekluzek

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

  1. added
    scienceEnhancement to or bug impacting science
    non-b4bChanges answers (incl. adding tests)
    on Oct 6, 2025
  2. added theissue type on Oct 6, 2025
  3. lkemmons commented on Oct 6, 2025

    @lkemmons
    Contributor

    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.

    Image
  4. lkemmons commented on Oct 7, 2025

    @lkemmons
    Contributor

    Verified that with:

     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')
    

    GAMMAS is actually 1 everywhere.

    Image
  5. added
    nextthis should get some attention in the next week or two. Normally each Thursday SE meeting.
    on Jan 21, 2026
  6. ekluzek commented on Jan 21, 2026

    @ekluzek
    ContributorAuthor

    Adding next so we can decide on the milestone for this.

  7. removed
    nextthis should get some attention in the next week or two. Normally each Thursday SE meeting.
    on Feb 12, 2026
  8. ekluzek commented on Feb 12, 2026

    @ekluzek
    ContributorAuthor

    Since this just affects diagnostic fields this would be acceptable to do post coupled model answer freeze.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    non-b4bChanges answers (incl. adding tests)priority: lowBackground task that doesn't need to be done right away.scienceEnhancement to or bug impacting sciencesize: small

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions