Skip to content

Updates for ccpp-capgen v1 - #378

Open
dustinswales wants to merge 60 commits into
ufs-community:ufs/devfrom
dustinswales:feature/capgen-ng-djs
Open

Updates for ccpp-capgen v1#378
dustinswales wants to merge 60 commits into
ufs-community:ufs/devfrom
dustinswales:feature/capgen-ng-djs

Conversation

@dustinswales

@dustinswales dustinswales commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Description of Changes:

This PR makes the necessary changes to the CCPP metadata and Fortran files to support the transition to the new code generator ccpp-capgen v1.

The majority of the changes are addressing inconsistencies between Fortran and Metadata, the renaming of *_finalize to *_final, missing dependencies in the metadata tables, and simplified syntax for defining DDTs in the metadata.
One or more paragraphs describing the problem, solution, and required changes.

Tests Conducted:

All UFS weather model regression tests pass on Ursa.

Dependencies:

Waiting on NCAR/TEMPO#31

Documentation:

New documentation needed for CCPP framework. https://ccpp-techdoc.readthedocs.io/en/latest/

Contributors (optional):

@climbfuji

hertneky and others added 30 commits March 23, 2026 19:59
* Add ability to build with ip if it is found. sp is being replaced by ip so this is needed. Note that in spack-stack 1.9.3 the ip package builds with the OpenMP flag, so CMAKE_Fortran_FLAGS_OPENMP_OFF needs to be set by the host model. The RRTMGP files currently break if compiled with OpenMP flags.

* only have DTC/SCM people in the CODEOWNERS for the scm/dev branch

---------

Co-authored-by: Soren Rasmussen <s.c.rasmussen@gmail.com>
* update several files to work with CCPP SCM after PR 1187

* remove ccpp_bcast for aerin and aer_pres due to UFS RT hanging
… NOAA fixes) (NCAR#1209)

* Read and broadcast data from MPI root rank during init and timestep init phase in GFS time vary; add time vary interstitials for NEPTUNE (NCAR#1187)

* 1. number_of_coefficients_in_ozone_data --> number_of_coefficients_in_ozone_forcing_data
2. Add NEPTUNE interstitials in physics/Interstitials/UFS_SCM_NEPTUNE/

* Read and broadcast data in CCPP init and timestep_init phases instead of reading with every MPI rank

* In physics/Radiation/radiation_astronomy.f, replace hardcoded zero with mpiroot; move mpiutil.F90 to subdirectory tools

* physics/tools/mpiutil.F90: add temporary routine to mpi-abort the model if MPI broadcast errors occur

* Bug fixes in physics/Interstitials/UFS_SCM_NEPTUNE/GFS_time_vary_pre.*.F90 when writing to errmsg for invalid w3kindreal/w3kindint; additionally: formatting updates

* In physics/Radiation/radiation_astronomy.f, replace hardcoded zero with mpiroot; move mpiutil.F90 to subdirectory tools

* Add ability to build with ip if it is found. sp is being replaced by ip so this is needed. Note that in spack-stack 1.9.3 the ip package builds with the OpenMP flag, so CMAKE_Fortran_FLAGS_OPENMP_OFF needs to be set by the host model. The RRTMGP files currently break if compiled with OpenMP flags.

* update several files to work with CCPP SCM after PR 1187

* remove ccpp_bcast for aerin and aer_pres due to UFS RT hanging

---------

Co-authored-by: Dom Heinzeller <dom.heinzeller@icloud.com>
Co-authored-by: Soren Rasmussen <s.c.rasmussen@gmail.com>
* add doxygen action

* minor changes

* minor changes

* minor changes

* doxy only

* Create main.yml

* Create jekyll-gh-pages.yml

* change

* add doxyfile into wkfl

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update ccpp_doxyfile

* Update ccpp_doxyfile

* update ccpp doxyfile

* Update doxygen.yml

* update doxyfile

* Update doxygen.yml

* Update doxygen.yml

* update doxyfile

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* Update doxygen.yml

* change path

* add mactex

* add mactex

* minor changes

* minor fix

* try1

* try1

* try2

* updates

* update perl

* update perl

* update path

* explicitly install

* updates

* updates

* fix

* fix path

* fix

* fix path

* fixes

* fix3

* cleanup

* restore yml files

* hsd updates

* add doxygen.yml

* update branch

* update wflw

* test

* fix

* fix

* fix

* fix

* rearrange steps

* oops

* .

* debug

* chng dir

* chng dir

* chng dir

* -landing page

* -update para

* try to add a backlink, fix typo

* fix css link

* link path

* try cp stylesheet

* Add CCPP website

* fix

* add SRW build, backlink

* try mainpage

* changes for mainpage

* mainpage config

* mainpage config

* mainpage config

* mainpage debug

* mainpage debug

* mainpage debug

* mainpage debug

* mainpage debug

* fix landing page sidebar.

* fix landing page sidebar.

* fix landing page sidebar.

* fix landing page sidebar.

* style updates

* mainpage style

* mainpage style

* hide tree on mainpage

* add back tree

* try adding backlink

* add backlink to other pages

* updates migrated from mzhangw

* fix missed conflicts

* fix syntax

* run workflow on this branch

* remove branch from workflow run, update doxyfile

* mods to mainpag dxy

* updates

* try update for v7 arg table

* turn on scidoc branch for deploy

* recurse checkout

* fix directory

* try fix

* update landing page with acknowledgements

* fix path

* fix path

* debug

* add prebuild_config for building tables

* fix

* debug

* debug

* restructure workflow to work with metadata2html.py

* add remaining prebuild configs

* attempt fix srwv3 checkout

* fix main checkout for landing page, stash prebuild configs

* fix syntax

* update prebuild location

* workflow updates

* point to NCAR/main

---------

Co-authored-by: mzhangw <man.zhang@noaa.gov>
Co-authored-by: mzhangw <mzhangw@gmail.com>
Co-authored-by: Grant Firl <grant.firl@noaa.gov>
Main -> scm/dev (20260421)
… version. Updating other actions to their newest release (NCAR#1215)

Co-authored-by: Grant Firl <grant.firl@noaa.gov>
* remove Zhao-Carr cloud schemes and combine Xu-Randall cloud fraction calculations

* change Xu-Randall cloud fraction  scheme to be elemental

* use new cld_frac_XuRandall function from module_radiation_clouds in RRTMGP scheme

* modify the cld_frac_XuRandall function call in RRTMGP scheme

* add the repository update to this PR

* Revert "add the repository update to this PR"

This reverts commit 565d62c.

* remove the printing tests

* remove Zhao-Carr schemes from modules in the UFS_SCM_NEPTUNE directory

* remove Zhao-Carr microphysics scheme from physics/MP directory

* remove non-ASCII character in canopy_levs.F90 (from previous PR)

* Apply suggestion from @matusmartini

Co-authored-by: Matus Martini <matusmartini@users.noreply.github.com>

---------

Co-authored-by: Qingfu Liu <Qingfu.Liu@noaa.gov>
Co-authored-by: Grant Firl <grant.firl@noaa.gov>
Co-authored-by: Matus Martini <matusmartini@users.noreply.github.com>
* remove Zhao-Carr cloud schemes and combine Xu-Randall cloud fraction calculations

* change Xu-Randall cloud fraction  scheme to be elemental

* Fixed too-high lower bound for SMC
Deleted code associated with already removed print statements
Deleted excess comments.

* use new cld_frac_XuRandall function from module_radiation_clouds in RRTMGP scheme

* Tidy-up for PR.

* modify the cld_frac_XuRandall function call in RRTMGP scheme

* Changes to the post L-IAU checks:
* Change tfreeze to match that in NoahMP
* Only set SLC to SMC if temp newly > tfreez

* add the repository update to this PR

* Revert "add the repository update to this PR"

This reverts commit 565d62c.

* remove the printing tests

* remove Zhao-Carr schemes from modules in the UFS_SCM_NEPTUNE directory

* remove Zhao-Carr microphysics scheme from physics/MP directory

* Update for 10m wind option in fire_behavior module

* remove non-ASCII character in canopy_levs.F90 (from previous PR)

* Updates to progomega option of saSAS convection scheme

* Correction

* correction 2

* Correct parameter setting in samfshalcnv to pass debug runs

* address saturation vapor pressure out of bounds error in hafs_4_nest RT

---------

Co-authored-by: Qingfu Liu <Qingfu.Liu@noaa.gov>
Co-authored-by: Clara.Draoper-NOAA <clara.draper@noaa.gov>
Co-authored-by: Grant Firl <grant.firl@noaa.gov>
Co-authored-by: Michael Kavulich, Jr <kavulich@ucar.edu>
Co-authored-by: Lisa <lisa.bengtsson@noaa.gov>
Co-authored-by: Rhae Sung Kim <rhaesung.kim@noaa.gov>
…CAR#1222)

* Fix fortran to metadata inconsistency

* Actual fix

---------

Co-authored-by: dustinswales <dswales@ucar.edu>
* update standard names to move Xgrs to physics_timestep_initial* and remove *_of_new_state (default name refers to 'current' value)

* fix a few unchanged standard names

* change some timestep_initial variables to general variables; make satmedmfvdifq return new tendencies and new tendency application block in GFS_PBL_generic_post

* Refactor physics tendency calculations

- Added tendency variables (`ten_t`, `ten_u`, `ten_v`) for temperature and wind tendencies in SAMF deep and shallow convection schemes.
- Updated relevant `.meta` files to reflect changes in variable intent (`inout` -> `in` where appropriate) and added tendencies.
- Modified Interstitials (`GFS_DCNV_generic_post`, `GFS_DCNV_generic_pre`, `GFS_SCNV_generic_post`, `GFS_SCNV_generic_pre`) to directly use tendencies instead of saved state variables.
- Removed redundant saved variables (`save_u`, `save_v`, `save_t`).
- Added `delt` to post interstitials.

* update unified_ugwp, ugwpv1, and drag_suite to use new tendency code

* save tendency work with GFS_photochemistry

* add tracer tendency changes to convection; fix typos in GFS_photochemistry

* fix typo in samfdeepcnv.f

* save tendency work with Thompson MP

* save tendency work with radiation

* add FMS to ccpp-physics CMakeLists.txt for fv3

* add initial setting of state in GFS_time_vary_pre.fv3; fix horizontal_dimension in GFS_time_vary_pre.scm

* fix metadata in GFS_time_vary_pre.fv3

* add momentum tendency output to mp_thompson and fix intent in metadata

* fix array size bug in mp_thompson.F90; cleanup dtend code using new tendency paradigm; cleanup saving of states no longer needed

* fix improperly-merged conflict resolution in GFS_photochemistry.F90

* fix access of ntlnc/ntinc access of tracer array when missing

* convert many RAD, PBL, GWD, CONV, and MP schemes to return tendencies

* convert MG micro and Arakawa-Wu adjustment schemes

* convert MYNNEDMF PBL scheme to return tendencies

* add changes to MYNN EDMF PBL

* add back divide-by-zero bugfix in module_sf_noahmp_glacier.F90 that was removed recently

* remove obsolete interstitial schemes

* fix 2 minor compilation issues after testing with UFS RTs

* fix bug in MG MP

* fix near-surface air temperature standard name in GFS_surface_composites_pre

* apply tendency cleanup to GFDLMPv3 and TEMPO

* fix compilation error

* fix typo in TEMPO

* debug sgscloud_radpre/post

* remove tendency application code from rrtmg_lw/sw_post

* change thmpsn to thompson to fix compilation error

* fix compilation errors in GFS_radiation_post.F90

* remove Zhao-Carr cloud schemes and combine Xu-Randall cloud fraction calculations

* fix array size problem in cs_conv.F90

* refactor RAS tendencies

* fix compilation error in rascnv.F90

* change Xu-Randall cloud fraction  scheme to be elemental

* Fixed too-high lower bound for SMC
Deleted code associated with already removed print statements
Deleted excess comments.

* use new cld_frac_XuRandall function from module_radiation_clouds in RRTMGP scheme

* Tidy-up for PR.

* modify the cld_frac_XuRandall function call in RRTMGP scheme

* Changes to the post L-IAU checks:
* Change tfreeze to match that in NoahMP
* Only set SLC to SMC if temp newly > tfreez

* add the repository update to this PR

* Revert "add the repository update to this PR"

This reverts commit 565d62c.

* fix bug in GFDLMPv3 tendency implementation

* remove the printing tests

* remove Zhao-Carr schemes from modules in the UFS_SCM_NEPTUNE directory

* remove Zhao-Carr microphysics scheme from physics/MP directory

* fix hail tendency changes from reviewer suggestions

* fix indexing bug in cu_tiedtke caught in code review

* changes to RAS tendency application update code from code review

* check for flag_for_generic_tendency_due_to_gravity_wave_drag before computing diagnostic tendencies in drag_suite

* fix diagnostic tendency bug in physics/GWD/ugwpv1_gsldrag.F90

* remove unused arguments in physics/GWD/ugwpv1_gsldrag_post.F90

* fix tendency diagnostics in physics/GWD/unified_ugwp.F90

* fix merge problem in mp_thompson.meta

* add arguments to drag_suite_run called outside of ccpp entry point

* initialize dclw variables in cu_ntiedtke

* fix loop bounds for ten_q in cu_gf_driver.F90

* fix loop bounds in cu_c3_driver

* fix new_q typo in mp_fer_hires.F90

* deallocate locally-allocated variables in MP schemes

* update zeroing logic in m_micro_post after review

* Update for 10m wind option in fire_behavior module

* remove non-ASCII character in canopy_levs.F90 (from previous PR)

* Updates to progomega option of saSAS convection scheme

* Correction

* correction 2

* fix line in SHOC where a tracer was being updated directly

* remove old_ozone array since it was not being used

* deallocate local variables in satmedmfvdifq at end of run phase

* save temperature before modification to pass in to diagnostics in GFS_radiation_post

* fix diagnostic temp tendency in GFS_MP_generic.F90 for when radar is/isn't available

* Correct parameter setting in samfshalcnv to pass debug runs

* address saturation vapor pressure out of bounds error in hafs_4_nest RT

* update long names to remove 'updated by physics'; change prognostic updraft standard names

* remove additional references to Zhao-Carr microphysics

* remove Zhao-Carr references from GFS_scnv_generic_post

* fix deallocation statement in Thompson MP

* fix additional warnings

* Bug fix in physics/GWD/rayleigh_damp.f: don't mix scalars and rank-2 arrays

* remove whitespace changes in radiation_clouds.f

---------

Co-authored-by: VanderleiVargas-NOAA <vanderlei.vargas@noaa.gov>
Co-authored-by: Qingfu Liu <Qingfu.Liu@noaa.gov>
Co-authored-by: Clara.Draoper-NOAA <clara.draper@noaa.gov>
Co-authored-by: Michael Kavulich, Jr <kavulich@ucar.edu>
Co-authored-by: Lisa <lisa.bengtsson@noaa.gov>
Co-authored-by: Rhae Sung Kim <rhaesung.kim@noaa.gov>
Co-authored-by: Grant Firl <grant@Macbook-Air-M4.local>
Co-authored-by: Dom Heinzeller <dom.heinzeller@icloud.com>

@climbfuji climbfuji left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@dustinswales Is it possible to separate the capgen v1 changes from the other updates in this PR? I see documentation updates and GitHub actions updates that are not part of the capgen v1 changes.

@grantfirl

Copy link
Copy Markdown
Collaborator

Also dependent on ufs-community/c3#3

@grantfirl

Copy link
Copy Markdown
Collaborator

@dustinswales I'm assuming that this has more changes than NCAR#1221 since this started from NCAR/main and therefore contains whatever changes accumulated since the last sync between NCAR/main and ufs/dev?

C(I,K) = max((ENG0-ENG1),0.0) * hfbcpdt
IF(vidx>=1) THEN
dtend(i,k,vidx) = dtend(i,k,vidx) + A*dt
dtend(i,k,vidx) = dtend(i,k,vidx) + A(i,k)*dt

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.

Note to self: change brought over from NCAR/main unrelated to capgen-ng.

sigres = max(sigmin, sigma(J))
if (hprime(J)/sigres > dxres) sigres = hprime(J)/dxres
mtbridge = ZR * sigres*ZLEN / hprime(J)
! Scale the blocking coefficient by the inverse square root of dxres

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.

Note to self: change brought over from NCAR/main unrelated to capgen-ng.

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.

Any insights as to why this host metadata now exists here rather than GFS_typedefs (where the constants are imported)? I'm asking mainly for clarification since @scrasmussen has been working to move physcons out of the CCPP physics repo.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's mainly a step towards the cleanup from @scrasmussen, but there was also a reason related to capgen v1. I couldn't cleanly import and re-export the constant there, because the Fortran-Metadata validator would fail. It doesn's search for imported variables - only things that are locally declared.

But this move makes a lot of sense, because (a) it's clearer now where these constants live, and (b) emphasizes the need for @scrasmussen's work.


!> - Update ozone concentration.
if (ntoz > 0) then
if (rjday < ozphys%time(1)) rjday = rjday + 365.

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.

Note to self: the actual code changes were brought over from NCAR/main in this file and not part of the capgen-ng effort.

Comment thread physics/Interstitials/UFS_SCM_NEPTUNE/module_ccpp_suite_simulator.meta Outdated

@grantfirl grantfirl 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.

Nice work @dustinswales and @climbfuji . Looks good to me. A few questions for clarification only.

@dustinswales

Copy link
Copy Markdown
Collaborator Author

@dustinswales I'm assuming that this has more changes than NCAR#1221 since this started from NCAR/main and therefore contains whatever changes accumulated since the last sync between NCAR/main and ufs/dev?

@grantfirl Correct.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants