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

Incorrect freqsh definition in shallow convection diagnostics #1254

Open
jimmielin opened this issue Feb 10, 2025 · 0 comments
Open

Incorrect freqsh definition in shallow convection diagnostics #1254

jimmielin opened this issue Feb 10, 2025 · 0 comments
Assignees
Labels
bug Something isn't working correctly

Comments

@jimmielin
Copy link
Member

What happened?

The freqsh diagnostic in CAM4 shallow convection code is incorrectly defined.

   ! --------------------------------------------------------!
   ! Calculate fractional occurance of shallow convection    !
   ! --------------------------------------------------------!

 ! Modification : I should check whether below computation of freqsh is correct.

   freqsh(:) = 0._r8
   do i = 1, ncol
      if( maxval(cmfmc2(i,:pver)) <= 0._r8 ) then
          freqsh(i) = 1._r8
      end if
   end do

From @adamrher:

That is indeed strange -- a value of 1 should be assigned to the column when there is shallow convection. The comment above it "! Modification : I should check whether below computation of freqsh is correct." suggests we aren't the only one who thinks so (can you git blame this comment?).

I looked through hk_conv.F90 and verified that the array (cmfmc2, which I presume is cmfmc_sh in your code) cannot be negative. There are explicit limiters on the components that are summed and multiplied to give cmfmc2: beta and eta:

if (eta(i) > tmass*rtdt .or. eta(i) <= 0.0_r8) eta(i) = 0.0_r8
.

And beta is limited using beta(i) = max(0.0_r8,beta(i)) statements anytime it's modified. So I believe this is a bug in this particular diagnostic, and that the logic should be:
if (maxval(cmfmc_sh(i,:)) > 0._kind_phys) then

What are the steps to reproduce the bug?

Observe definition of freqsh in a CAM4 model run

What CAM tag were you using?

cam6_4_055

What machine were you running CAM on?

CISL machine (e.g. cheyenne)

What compiler were you using?

Intel

Path to a case directory, if applicable

No response

Will you be addressing this bug yourself?

Yes

Extra info

Found this during CCPPization work of Hack shallow convection.

Will likely address this in a separate PR after the CCPPization, in order to maintain bit-for-bit of the eventual CCPP PR.

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
Projects
Status: To Do
Development

No branches or pull requests

1 participant