Repository navigation
MPAS dycore coupling to CCPP Physics in the UWM - #300
Conversation
…Model into feature/phys2dyn
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
6 open findings
Themosaic_soilentry usesdesciption=instead ofdescription=. If the registry tooling… · New This change removesname_in_code=\"isice\"/name_in_code=\"iswater\"forisice_luand… · New Within this hunk, onlytend_ru_physicsFieldis retrieved/allocated before the UFS block, but the… · New The shim directly accesses ezXML internal struct fields (xml->next,xml->name,xml->txt),… · Newshim_attrdoes not guard againstxml == NULL, while other shim APIs do. If the Fortran layer… · New Correct spelling of 'previsous' to 'previous' in the variable description. · New
What changed in this PR
Facilitates coupling the MPAS dynamical core to CCPP physics in the UFS Weather Model under the MPAS_UFS_DYCORE macro, including registry updates and an ezXML Fortran-accessible shim.
Changes:
- Adds an ezXML C shim (and conditional build logic) to expose parsing/query helpers to Fortran when
MPAS_UFS_DYCOREis enabled. - Extends MPAS time integration preprocessor logic to treat
MPAS_UFS_DYCOREsimilarly toMPAS_CAM_DYCORE, including persistence/initialization of physics tendency fields. - Updates
Registry.xmlto gate and expand UFS-related dimensions, namelist options, and physics diagnostics/fields.
| File | Description |
|---|---|
| src/external/ezxml/ezxml_shim.h | Introduces a C API shim layer intended for Fortran interoperability. |
| src/external/ezxml/ezxml_shim.c | Implements shim wrappers around ezXML parsing/navigation routines. |
| src/external/ezxml/CMakeLists.txt | Conditionally builds the shim into the ezxml library under MPAS_UFS_DYCORE. |
| src/core_atmosphere/dynamics/mpas_atm_time_integration.F | Updates macro gating and adds UFS initialization behavior for physics tendency fields. |
| src/core_atmosphere/Registry.xml | Adjusts macro-guarded dims/options and adds/relocates UFS diagnostic and surface-related registry fields. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
clark-evans
left a comment
There was a problem hiding this comment.
Looks good pending my one comment, to which I think I know the answer.
|
@dustinswales could you make a trivial commit to help trigger the CI workflows? Github disabled them ~2 wk ago, and we just caught it and re-enabled them during today's code meeting. I can run the workflows on the top-level noaa/develop branch but apparently not on individual PRs. Thanks! |
|
I think we’re ready to merge this as v8.4.2-1.19. Dustin, Assuming you agree, I can merge if you can update the version number in your README. |
|
@clark-evans Sounds good to me. |
a064c19
into
ufs-community:noaa/develop
…anch (#16) * Update version number to 8.4.2 * Work around nvfortran issue with continuation lines in PACKAGE_LOGIC_PRINT macro Registry-generated code in setup_packages.inc (generated by the gen_pkg_debug_info registry function in gen_inc.c) may contain continuation lines in the invocation of the PACKAGE_LOGIC_PRINT macro, and this can lead to compilation failures with the nvfortran compiler. To work around this issue, this commit avoids continuation lines with the PACKAGE_LOGIC_PRINT macro only when compiling with the nvfortran or pgf90 compilers. This may result in source lines longer than 132 columns, but in practice, recent releases of the nvfortran compiler appear to have no problems with any of the source lines generated in the current version of MPAS. * Change default value of atmosphere core config_number_of_sub_steps from 2 to 4 This commit changes the default value of the atmosphere core namelist option config_number_of_sub_steps from 2 to 4 in the Registry.xml file. This change addresses an issue in convection-permitting simulations where noise can sometimes appear in the jet streams using the previous default value (config_number_of_sub_steps = 2). The noise, when present, also produces unphysical features in horizontal kinetic energy spectra at high wavenumbers. * add minimum value for Kh and Kv to allow for zero initial tke * Correct order of lbc_ni and lbc_nr in the atmosphere core's Registry.xml file This commit swaps the order of 'lbc_ni' and 'lbc_nr' in the atmosphere core's Registry.xml file so that the LBC fields for the 'ni' and 'nr' scalars are defined in the same order as the tendencies ('tend_ni' and 'tend_nr') and state ('ni' and 'nr') for these scalars. Note that unless LBCs are provided for 'ni' and 'nr', the previously incorrect order of 'lbc_ni' and 'lbc_nr' would not affect results, as both fields would be filled with zero values. * Fix for GPU-enabled restart runs This commit fixes the OpenACC data movement for the field rho_zz in routine mpas_atm_pre_compute_solve_diagnostics. Previously, an OpenACC create statement was used for this field. This is still correct for the cold initialization case , but produces incorrect results in the case of a restarted run. This has now been changed to a copyin statement. This issue was discovered as a result of restarted real simulations on GPUs crashing. The unphysical values from the dynamical core lead to a segmentation fault occuring in the SW radiation calls. Furthermore, the Jablonowski- Williamson baroclinic wave case also showed discrepancies between the cold initialization and the restarted test case. Both of these issues have been addressed by this commit. * Rename bundled ESMF time-manager library output to esmf_time The library built from src/external/esmf_time_f90 contains MPAS's bundled ESMF time-manager stubs, not the full ESMF. Naming the output file libesmf lets the dynamic loader substitute a real ESMF library found via LD_LIBRARY_PATH, which breaks every MPAS executable. Set the target's OUTPUT_NAME to esmf_time so the library is built and installed as libesmf_time.{so,a}, resolving the name conflict. The CMake target and alias names are unchanged. * Correct the order of lbc_ni and lbc_nr * Update CI test version number from 8.4.1 to 8.4.2. * Final update to version number before merge * v8.4.2-1.15: Use reduced scalars for MPAS_JEDI_IO (ufs-community#292) * Use reduced scalars for JEDI DA I/O * safeguard invalid scalar pointers * add -DMPAS_JEDI_IO=ON for cmake * add ng to the reduced scalars * Update version number --------- Co-authored-by: Clark Evans <clark.evans@noaa.gov> * v8.4.2-1.16: implementing unified MPAS/WRF driver for MYNN-SFC (ufs-community#293) * adding unified MPAS/WRF driver for MYNN-SFC * Update version number --------- Co-authored-by: Clark Evans <clark.evans@noaa.gov> * v8.4.2-1.17: Make output_timelevels more robust for first time step outputs in single-precision builds * make output_timelevels more robust for fist time step outputs in single-precision builds * revert leftover unnecessary changes * Update README.md --------- Co-authored-by: Dustin Swales <dustin.swales@noaa.gov> * updating unified MYNN-EDMF driver with packaged variables (ufs-community#280) * updating unified MYNN-EDMF driver with packaged variables * addressing copilots comments/suggestions * turn tabs to space for consistency on cqs line * Update README.md --------- Co-authored-by: Dustin Swales <dustin.swales@noaa.gov> * v8.4.2-1.19: MPAS dycore coupling to CCPP Physics in the UWM (ufs-community#300) * Add more physics diagnostics to native MPAS I/O in UFS-MPAS * Add effective radii from MP to registry for output in UFS * Some additions for surface physics * Remove package dependency for UFS-MPAS registry * Add some more fields for UFS-MPAS * More registry additons for UFS-MPAS * Add fortran interface (shim) to ezXML. Only used with UFS-MPAS * Work with MPAS_UFS_DYCORE macro * Add more physics diagnostics * Stash for snc * Add macro to stop zeroing out of scalars in UFS-MPAS * Some registry cleanup * Update comment in dycore time integration * Apply batched suggestions from code review * Update version number --------- Co-authored-by: Soren Rasmussen <s.c.rasmussen@gmail.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Clark Evans <clark.evans@noaa.gov> * v8.4.2-1.20: Update mpas init temperature extrapolation options (ufs-community#301) * update mpas init temperature extrapolation options * fix bugs and enhance code for init extrapolation updates * remove empty line * Update README.md --------- Co-authored-by: Jili Dong <Jili.Dong@gaea62.ncrc.gov> Co-authored-by: Dustin Swales <dustin.swales@noaa.gov> * v8.4.2-1.21: Bug fix for mpas_convective_diagnostics.F when running in full debug mode (ufs-community#302) * bug fix for running in full debug mode * Update README.md --------- Co-authored-by: Dustin Swales <dustin.swales@noaa.gov> * v8.4.2-1.22: Updating MYNN-EDMF in MPAS to unified driver (MPAS/WRF/CCPP) (ufs-community#303) * updating MYNN-EDMF pointer * minor updates * fixing copilot issues * changed tabs to spaces, as copilot recommends * adding conditionals for pointer allocations * adding granularity to the 2d diagnostic packages * fix spacing in Registry and fix intialization of 2d diags in pbl driver * incrementing the subversion number to 1.19 * final updating of MYNN-EDMF pointer * Update README.md --------- Co-authored-by: Dustin Swales <dustin.swales@noaa.gov> * v8.4.2-1.23: Add a namelist option "config_coordinate_smoothing_height" (ufs-community#305) * add a namelist option "config_coordinate_smoothing_height" * apply changes from review * Update README.md --------- Co-authored-by: Dustin Swales <dustin.swales@noaa.gov> * v8.4.2-2.1: Tempo v3.2.4 (ufs-community#291) * - Update Makefile to include TEMPO module configurations - Update driver to for threadsafe emissions subroutine * tempo version 3.2.0 * tempo version 3.2.1 * tempo version 3.2.2 * tempo version 3.2.3 * tempo version 3.2.4 * Update README.md --------- Co-authored-by: Dustin Swales <dustin.swales@noaa.gov> Co-authored-by: Clark Evans <clark.evans@noaa.gov> * v8.4.2-2.2: CLM Lake model for UFS-MPAS (ufs-community#307) * init_atmosphere: add 21-class MODIS land use with lakes New config_landuse_data option 'MODIFIED_IGBP_MODIS_NOAH_LAKES' reads the WPS dataset modis_landuse_20class_30s_with_lakes/ (category 21 = lakes): - Registry: nlcat = 21 for the new option; new mesh field islake_lu (default -1) in the input and output streams. - MMINLU stays 'MODIFIED_IGBP_MODIS_NOAH', so the RUC LSM selects the 21-row MODI-RUC table in VEGPARM.TBL. - interp_landuse returns islake from the dataset index file, and stops if the dataset's category count does not match nlcat. - Lake points keep lu_index = islake_lu (they are no longer converted to iswater_lu by the soil/land use consistency check) and get water soil. - derive_landmask treats lake points as water (landmask = 0). - The static step stops if the new option is used with a dataset that has no lake category. Static files without islake_lu still work: MPAS warns that the variable is not in the input file and keeps the default (-1). * init_atmosphere: nullify aerosol first-guess pointers before conditional fetch smoke_fine_fg, dust_fine_fg and dust_coarse_fg in init_atm_case_gfs and init_atm_case_lbc are only set when config_smoke_scheme / config_dust_scheme are on, but are later tested with associated(). With the schemes off the pointers are undefined, so associated() can return true and the code reads through a garbage descriptor: segfault with optimized gfortran builds, 'index below lower bound' with -fcheck=bounds (mpas_init_atm_cases.F:7357). * CI: add make_ics workflow to test init_atmosphere New workflow .github/workflows/make_ics.yml builds init_atmosphere_model from the branch under test and creates static, init, lbc and sfc_update files for four 120 km CONUS cases: conus_gfs, conus_raps, conus_rapw (20-class MODIS land use) and conus_rapw_lake (21-class MODIS with lakes). Static files are made once per land-use variant and cached on the init_atmosphere source; each case is checked with check_ics.py (nlcat, islake_lu, lake points are water, no NaN/Inf, LBC times) and uploaded as an artifact. Scripts and namelists are in testing_and_setup/ufs-community/ics/, taken from dustinswales/mpas-ic-factory; inputs come from release init-inputs-v1.0.0 of this repository (copy_inputs_release.sh copies them from the factory). The existing run_mpas* workflows are unchanged. * make_ics: run the summer RAP case with and without lakes Use only the summer RAP case (2024081518), whose ungrib inputs are 1.3 GB against 8 GB for GFS and 16 GB for winter RAP: conus_raps (20-class MODIS) and the new conus_raps_lake (21-class MODIS with lakes). The conus_gfs, conus_rapw and conus_rapw_lake case files stay for running by hand. copy_inputs_release.sh now copies only the bundles the workflow uses by default (about 6 GB); -a copies everything, -b chooses. * make_ics: add the GFS case Run conus_gfs alongside conus_raps and conus_raps_lake, so the GFS init path and the sfc_update step are tested too. conus_gfs shares the 20-class static file with conus_raps, so there are still two static jobs. copy_inputs_release.sh: default destination tag v8.4.2-1.19 (INPUTS_TAG), and the default bundles now include ungrib-gfs.2023031015 and ungrib-sst.2023031015 (about 14 GB in all). Assets already in the release are skipped, so re-running it adds only the GFS bundles. * make_ics: add a GFS lake case Add conus_gfs_lake: the GFS case (2023031015) with the 21-class MODIS land use with lakes. It shares the lakes static file with conus_raps_lake, so there are still two static jobs, and it exercises the sfc_update step over lake points. No new inputs are needed. * Add islake to core_atmosphere registry. Only used by UFS-MPAS. * Update CI script to point to new release asset * make_ics: add a Noah-MP GFS case conus_gfs_noahmp makes GFS ICs for Noah-MP: 4 soil levels, with the NCAR init/lbc/sfc_update namelists from barlage/mpas_testcase (55 levels, 30 km top), as used by the mesoscale_reference_noahmp run tests. It shares the 20-class static file with conus_gfs, which already has the Noah-MP static fields (config_noahmp_static defaults to true). - create_case.sh: optional nml_variant per case selects case_files/<step>/<source>.<date>.<nml_variant> - check_ics.py: check nSoilLevels (4 with --noahmp, 9 otherwise) and, with --noahmp, soilcomp and soilcl1-4 over land - make_ics.yml: add the case; the matrix "lakes" key is now "checks" * make_ics: add a 10-layer Noah-MP GFS case init_atmosphere: config_nsoillevels = 10 now gives a 10-layer soil set for Noah-MP (dzs = 0.05 0.10 0.10 0.10 0.30 0.35 0.50 1.00 1.00 1.50 m, 5 m deep), with soil temperature and moisture interpolated as for the 4-layer set. Layers centered below the deepest input level (3 m, the deep soil temperature) take the deepest input values instead of being left unset. The 4- and 9-level sets are unchanged. conus_gfs_noahmp10 is conus_gfs_noahmp with 10 soil layers. check_ics.py gets --soil-levels N and, for Noah-MP cases, checks that every soil level of tslb and smois is plausible over land. * physics_init_seaice: keep frozen lakes as lakes Ice-covered cells are converted to land-ice cells (lu_index = isice_lu, soil category 16, xland = 1, tmn = 271.4, soil state recomputed). That also caught lake cells (lu_index = islake_lu), so frozen lakes lost their lake category in init.nc and were never handed to the lake model. Frozen lake cells now keep their lake land use and water soil categories, landmask, xland and tmn, and only record the ice state: seaice = 1, xice set to 1 when the cell was flagged by the skin-temperature test alone, and the same snow-albedo, vegfra and snow-depth limits as sea ice. Nothing changes when the land use dataset has no lake category (islake_lu = -1). Addresses a Copilot review comment. * Update version number --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Clark Evans <clark.evans@noaa.gov> * v8.4.2-2.3: Added namelist-designation capability for 'alpha fd' UGWP TOFD coefficient (ufs-community#311) * Made UGWP alpha_fd coefficient for TOFD a namelist option * Updated Externals.cfg to current UGWP tag * Added output of 'alpha_fd' coefficient to log file in mpas_atmphys_init.F * Added 'kind=RKIND' to alpha_fd declaration in mpas_atmphys_driver_gwdo.F * Updated link to submodule 'physics_noaa/UGWP' * Update README.md --------- Co-authored-by: Dustin Swales <dustin.swales@noaa.gov> * v8.4.2-2.4: remove 5 changing fields from the invariant stream (ufs-community#316) * remove 5 changing fields from the invariant stream * Update README.md --------- Co-authored-by: Dustin Swales <dustin.swales@noaa.gov> * v8.4.2-2.5: updating MYNN-SFC pointer (ufs-community#310) * updating MYNN-SFC pointer * updating MYNN-SFC pointer with fixes suggested by Claude * Update version number --------- Co-authored-by: Dustin Swales <dustin.swales@noaa.gov> Co-authored-by: Clark Evans <clark.evans@noaa.gov> * v8.4.2-2.6: updating MYNN-EDMF pointer to v6.1.1 (ufs-community#314) * updating MYNN-EDMF pointer to v6.1.1 * Update version number --------- Co-authored-by: Dustin Swales <dustin.swales@noaa.gov> Co-authored-by: Clark Evans <clark.evans@noaa.gov> * Pass TEMPO land_input instead of xland; update TEMPO - TEMPO submodule -> AndersJensen-NOAA/TEMPO cf_tempo_v3.2.5 e0ba576: demott_nuc_ssati back to 0.25, xland folded into land_input, hpbl optional. - Microphysics driver: replace the xland_p copy with an integer landmask_p (nint(xland): 1 = land, 2 = water) passed as land_input. Only allocated when config_tempo_cldfra is on, as before, and no longer allocates/deallocates the shared xland_p array. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EHvrRrCsLQJeH8uiWKLcpQ * Update TEMPO: gate cloud fraction scheme on cldfra_flag TEMPO submodule -> AndersJensen-NOAA/TEMPO cf_tempo_v3.2.5 0beb09d. The prognostic cloud fraction scheme now only runs when config_tempo_cldfra is true; with it off TEMPO behaves as v3.2.5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EHvrRrCsLQJeH8uiWKLcpQ * Point TEMPO submodule at merged previous_commit TEMPO submodule -> AndersJensen-NOAA/TEMPO previous_commit 947d15c, the merge of the cf_tempo_v3.2.5 PR. Same tree as 0beb09d, so no code change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EHvrRrCsLQJeH8uiWKLcpQ --------- Co-authored-by: Michael Duda <duda@ucar.edu> Co-authored-by: Jimy Dudhia <dudhia@ucar.edu> Co-authored-by: Abishek Gopal <agopal@ucar.edu> Co-authored-by: jcsda-bot <jcsda-it@ucar.edu> Co-authored-by: Clark Evans <clark.evans@noaa.gov> Co-authored-by: Guoqing Ge <guoqing.ge@noaa.gov> Co-authored-by: Joseph Olson <joeolson42@users.noreply.github.com> Co-authored-by: Dustin Swales <dustin.swales@noaa.gov> Co-authored-by: Soren Rasmussen <s.c.rasmussen@gmail.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Jili Dong <jili.dong@noaa.gov> Co-authored-by: Jili Dong <Jili.Dong@gaea62.ncrc.gov> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: mdtoyNOAA <73618848+mdtoyNOAA@users.noreply.github.com>



Description
This PR introduces a few changes needed to facilitate the use of the MPAS dynamical core in the UFS Weather Model.
All changes are under the control of the MPAS_UFS_DYCORE macro, mostly following what was done for CAM-SIMAs MPAS dycore integration.
Summary of changes:
This PR will require a version tag in this repository for reference in the UWM supermodules.
Dependencies:
Mandatory Questions
No
No
Reviews
@clark-evans