Skip to content

converting the CLUBB portable layer - #1718

Open
bstephens82 wants to merge 70 commits into
ESCOMP:cam_developmentfrom
bstephens82:clubb_mf_ccpp
Open

bstephens82 wants to merge 70 commits into
ESCOMP:cam_developmentfrom
bstephens82:clubb_mf_ccpp

Conversation

@bstephens82

Copy link
Copy Markdown
Collaborator

This PR converts the portable layer for CLUBB, by gathering sections of code from clubb_intr.F90 and incorporating them into new subroutines in the atmospheric_physics repo. It also removes clubb_mf.F90 from CAM/src/physics/cam and into the atmospheric_physics repo, and changes the way that CLUBB is checked out so that it gets checked out into atmos_phys/schemes/clubb.

We also decided to remove the flags clubb_do_icesuper and clubb_do_liqsupersat, so those have been removed from namelist files along with their associated blocks of code that were previously in clubb_intr.F90.

… stored in

src/atmos_phys/schemes/clubb/clubb
and namelist entries and adding clubb3_run subroutine to clubb_tend_cam
and updating atmos_phys path
Comment thread .gitmodules Outdated
Comment on lines +30 to +32
path = src/atmos_phys
url = https://github.com/bstephens82/atmospheric_physics
fxtag = 1dc98193cbdd90d3e8bcfbe6ca416f6560e17d4c

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder for me - this needs to be updated before tag assignment

@jtruesdal jtruesdal left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good cam keeps namelist, pbuf and outfld and clubb and clubb mf goes to atmos_phys. Just a few simple change requests. I hope in phase 2 we can get rid of the many many many pbuf arrays passed through the interface just for outfld. Was Adam able to cut the number of these down . If he hasn't looked at that yet it might help to do it at this stage to help with generating and maintaining the meta data for the atmos_phys side. Just fyi, I checked out your code and noticed that the src/atmos_phys pointer hasn't been updated.

modified:   src/atmos_phys (new commits)

gitfleximod will work around that but anyone using submodule updates (me sometimes) will get the old link. You should just run git add src/atmos_phys to allow it to also checkout with the git method.

Comment thread src/physics/cam/clubb_intr.F90 Outdated
Comment thread src/physics/cam/clubb_intr.F90 Outdated
Comment thread src/physics/cam/clubb_intr.F90 Outdated
Comment thread src/physics/cam/clubb_intr.F90 Outdated
@bstephens82

Copy link
Copy Markdown
Collaborator Author

This looks good cam keeps namelist, pbuf and outfld and clubb and clubb mf goes to atmos_phys. Just a few simple change requests. I hope in phase 2 we can get rid of the many many many pbuf arrays passed through the interface just for outfld. Was Adam able to cut the number of these down . If he hasn't looked at that yet it might help to do it at this stage to help with generating and maintaining the meta data for the atmos_phys side. Just fyi, I checked out your code and noticed that the src/atmos_phys pointer hasn't been updated.

modified:   src/atmos_phys (new commits)

gitfleximod will work around that but anyone using submodule updates (me sometimes) will get the old link. You should just run git add src/atmos_phys to allow it to also checkout with the git method.

Ok thanks, I think I've handled all of these now including the src/atmos_phys pointer.

bstephens82 and others added 16 commits October 21, 2026 17:29
… for tag prep

Resolve the atmos_phys conflict by pointing src/atmos_phys at a local merge
of atmos_phys0_31_000 (856127273a) into clubb_mf_ccpp (e8aef8366):
c257e1c0a3c9f71953192886cc1a165ed7cf3732. That commit exists only locally; an
ESCOMP atmos_phys tag is needed before the CAM tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c257e1c0a3c9 is the local merge of atmos_phys0_31_000 into clubb_mf_ccpp,
now pushed to jtruesdal/atmospheric_physics branch pr1718-tagprep. An ESCOMP
atmos_phys tag is still needed before the CAM tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The BAS calday/tropp_days declarations and the do n = 1,12 loop were outside
#ifdef CLUBB_SGS, but n is declared inside it, so non-CLUBB builds (e.g. PC4)
failed with "This name does not have a type [N]". calday and tropp_days are
only used in the CLUBB call, so move both blocks inside the CLUBB_SGS ifdefs.
No change to the compiled code for CLUBB builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clubb_ini_cam sets the wp2/up2/vp2/rtp2/thlp2 pbuf fields from these
tolerances but no longer imported them (cam6_4_215 did), so nvfortran
stopped with S-0038 "has not been explicitly declared".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cam6_4_207 (e976e11) dropped the latvap/cpair scaling on these diagnostics
and changed their units to kg/kg m/s and K m/s. The refactor brought the
scaling back, so the history fields no longer matched their units or the
baselines. Diagnostic output only; model state is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/th_zt)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The read of clubb_stats_nl opens the hard-coded "atm_in". In cam6_4_215 that
happened only inside stats_init_clubb, under stats_metadata%l_stats; the
refactor made it unconditional, so multi-instance runs (atm_in_NNNN)
aborted with "file not found ... atm_in". The values read are only used
when l_stats is true, so restore the guard. No answer change.

Reviewed by an independent reviewer subagent against cam6_4_215: APPROVE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pass errmsg/errflg to clubb2_run and abort on error with the same endrun
block used after clubb1_run and clubb3_run. Update atmos_phys to
182bd17a, which adds those outputs to clubb2_run. No answer change.

Reviewed by an independent reviewer subagent: APPROVE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the never-used calday/tropp_days calculation and its declarations,
stop passing calday, tropp_days, lat, phis and pint to clubb3_run, and
remove the now-unused get_curr_calday/get_calday imports. Update
atmos_phys to 2b845b8e, which removes those clubb3_run arguments
(atmos_phys PR ESCOMP#452 review). No answer change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clubb_tend_cam fetches the CLUBB-MF pbuf pointers only when do_clubb_mf is
true, but passes all of them to clubb1_run. With do_clubb_mf false they were
undefined pointer actual arguments, which NAG's runtime checking rejects.

When do_clubb_mf is false, associate the 34 MF-only pointers (MF memory,
macmic accumulators, and the deep-convection hookup fields including the
integer jt/maxg/ideep) with zero-size local targets of matching type and
rank, and fetch tpert unconditionally since it is always registered.
clubb1_run only touches these arrays under do_clubb_mf, so this is
bit-for-bit.

Reviewed by an independent reviewer subagent: APPROVE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gprep

b3b90a6 and f700525 make the same clubb2_run/clubb3_run call changes as
5349684 and cb6c30c; clubb_intr.F90 merged with no change to ours.
Resolve .gitmodules to keep url = jtruesdal/atmospheric_physics with
fxtag = 1cb28d99, and point the atmos_phys gitlink at 1cb28d99, the
merge of d8df985 into 2b845b8 (tree identical to 2b845b8). No source
changes relative to the tested a7db32b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jtruesdal

Copy link
Copy Markdown
Collaborator

@bstephens82 I merged in the changes from my (Claude's really) regression test updates. There were some unexpected problems that needed to be updated and were all fixed. The issue for cleaning up clubb_intr when mf is not active will be updated with some findings from these changes. I don't think you will need to commit anything more before this is tagged but if you do please pull first to merge my (Claude's) fixes into your update. I also will note on the ChangeLog that the Silhs test is the only baseline difference due to the removal of the ice supersat flag. I assume that was taken into account when you got rid of it but just checking now (@nusbaume maybe you know). I'm not sure of the science effect on the SILHS users.

…term)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants