Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAM history erroneously overrides averaging flags for nhtfrq=1 #1150

Open
peverwhee opened this issue Sep 13, 2024 · 6 comments
Open

CAM history erroneously overrides averaging flags for nhtfrq=1 #1150

peverwhee opened this issue Sep 13, 2024 · 6 comments
Assignees
Labels
bug Something isn't working correctly CoupledEval3

Comments

@peverwhee
Copy link
Collaborator

What happened?

If nhtfrq=1, CAM history currently overrides (since cam6_3_140) the averaging flag to 'I'

    !
    ! Initialize history variables
    !
    do t=1,ptapes
      do fld=1,nflds(t)
        if (nhtfrq(t) == 1) then
           ! Override any non-I flags if nhtfrq equals 1
           tape(t)%hlist(fld)%avgflag = 'I'
        end if
        if (tape(t)%hlist(fld)%avgflag .ne. 'I') then
           hfile_accum(t) = .true.
        end if

BUT:
as @adamrher pointed out, this neglects subcycling averages.

What are the steps to reproduce the bug?

Run CAM, outputting a variable that exists in a subcycle (like a CLUBB variable in the macmic loop) with the 'A' flag and observe that the results are the same as for the 'I' flag.

What CAM tag were you using?

cam6_4_032

What machine were you running CAM on?

CGD machine (e.g. izumi)

What compiler were you using?

GNU

Path to a case directory, if applicable

No response

Will you be addressing this bug yourself?

Any CAM SE can do this

Extra info

No response

@gold2718
Copy link
Collaborator

This happened in #903, see this comment.

@adamrher
Copy link

Is there a way to query how many times an outfld call for a particular variable is called in a time-step? If we could get this number N than we could make logic that, for this special case of nhtfrq=1 and avgflag_pertape='A', forces all N=1 variables into the 'I' tapes and the N>1 variables into the 'A' tapes (and adjust their metadata accordingly).

@gold2718
Copy link
Collaborator

I would vote for a new, optional input to addfld to indicate this type of field. Something like sampled_on_subcycle or allow_single_timestep_average.

@adamrher
Copy link

One complication with that approach is I could set up the namelists to do no subcycling -- e.g, for ne240pg3, we don't subcycle in the macmic loop at all.

@gold2718
Copy link
Collaborator

One complication with that approach is I could set up the namelists to do no subcycling -- e.g, for ne240pg3, we don't subcycle in the macmic loop at all.

Of course but is that a bad thing? What is the impact of allowing averaging (or other collection methods) for this case? Is there an impact beyond the timestamp being in the middle of the time step instead of the current time (lines 5816 - 5822) in cam_history.F90)?

@adamrher
Copy link

I don't know if there's an adverse impact other than creating inconsistent time metadata relative to the non-subcycled variables in this case, but I agree this is preferable to the current method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly CoupledEval3
Projects
Status: To Do
Development

No branches or pull requests

4 participants