Add MPAS Atmosphere NUOPC build#1417
Conversation
|
@mgduda @scrasmussen @uturuncoglu @anntsay I've drafted a PR for the NUOPC cap infrastructure. I'd like for you to take a look before I mark this "ready" for review, in case you have any major revisions. I've rebased the work so that it builds on the MPAS_ESMF="external" work recently merged. I've also split the work into two commits, one for the NUOPC build infrastructure and stub cap, and a second one for the regression testing infrastructure. Please let me know if this work is on the right track. The quicker we move forward the faster we can get to executing the running standalone (uncoupled) MPAS-Atmosphere cap, followed by coupled MPAS-Atmosphere caps. All follow on NUOPC work should include appropriate tests in |
|
This PR worked for me for Dan's testcase. The mpas-hydro-develop branch I've been working on builds and I'm debugging things so it produces identical results at runtime with an MPAS idealized testcase. Once that is fixed, I'll rebase off this branch and use this testing framework to make sure it builds and runs. This looks good to me right now! And I'll be able to give better feedback once I've used it to add a testcase. |
|
@mgduda @scrasmussen @uturuncoglu |
* add installation locations for MPAS_PREFIX, MPAS_LIBDIR, MPAS_MODDIR * enabled NUOPC library with on, ON, 1, TRUE, true * disabled CORE_model build for NUOPC=true * disabled internal ESMF initialize and finalize for NUOPC=true * add nuopc folder to core_atmosphere with stub cap * add core, driver, framework, and external *.o to libmpas_nuopc.a
|
@mgduda @scrasmussen @scrasmussen @anntsay The testing infrastructure can be cherry-picked from this branch We'll rebase our following iterations once this work is merged. |
* update variables to MPAS_NUOPC_ prefix * create fullpath to MPAS_NUOPC_LIBDIR and MPAS_NUOPC_MODDIR * only create and delete installation if NUOPC=true * only clean nuopc files from MPAS_NUOPC_LIBDIR, MPAS_NUOPC_MODDIR
| ( cd operators; $(MAKE) clean ) | ||
| ( cd driver; $(MAKE) clean ) | ||
|
|
||
| clean_nuopc: |
There was a problem hiding this comment.
@mgduda
What are your thoughts on cleaning the MPAS_NUOPC_LIBDIR and MPAS_NUOPC_MODDIR? I wanted the ability to install it in user defined directories but cleaning it from user defined directories can be unsafe. Say the MPAS_NUOPC_PREFIX is /usr, MPAS_NUOPC_LIBDIR is /lib, and MPAS_NUOPC_MODDIR is /include. Should I remove the clean functionality or do something different? Do we want to be able to delete the <MPAS_DIR>/lib and <MPAS_DIR>/mod directories when cleaning?
There was a problem hiding this comment.
Installing files outside of the main MPAS-Model directory isn't something that we've had to think much about until now, so I'm still not sure what the best approach would be. Perhaps if we could determine that the installation mod and lib directories resided within the MPAS-Model directory, we could clean them, and otherwise, running make clean could print a message informing the user that they should manually remove the installation directories (which we could list in the message)?
| @echo "NUOPC build does not exist for the init_atmosphere core. Quitting." | ||
| @echo "************ ERROR ************" | ||
| @echo "" | ||
| exit 1 |
There was a problem hiding this comment.
Rather than modifying the Makefile files under each core directory (besides core_atmosphere) to indicate that a NUOPC build is not supported, we could simplify matters by making a NUOPC build an "opt-in" feature. Here's an example of an alternative approach that would avoiding any modifications to cores that don't support NUOPC: mgduda@5c4563a .
| all: mpas | ||
| BUILD_ALL = mpas | ||
| ifeq "$(NUOPC)" "true" | ||
| BUILD_ALL = nuopc_lib |
There was a problem hiding this comment.
Should = be += here? Otherwise, compiling the atmosphere core with NUOPC=true will not produce an atmosphere_model executable.
There was a problem hiding this comment.
@mgduda
We discussed this back in April 2026 NCAR#14. The guidance I was given was to utilize an existing preprocessor directive MPAS_NO_ESMF_INIT during NUOPC builds. This makes the atmosphere_model unusable because ESMF will never be initialized. For what it's worth I mentioned that I don't like using preprocessor directives for this type of behavior. In order to avoid this we'd need to add a flag that tracks whether ESMF was initialized by the MPAS code or by an external driver.
| core_$(CORE)/*.o \ | ||
| core_$(CORE)/diagnostics/*.o \ | ||
| core_$(CORE)/libchem/*.o \ | ||
| core_$(CORE)/dynamics/*.o \ |
There was a problem hiding this comment.
Some of these directories are specific to the atmosphere core and so I don't think they should be hard-wired in the src/Makefile for the nuopc_lib target. An alternative may be to let a core's build_options.mk file specify all core-specific files and directories that are needed to support its NUOPC build.
Overview
The MPAS Atmosphere NUOPC cap infrastructure is designed to build an MPAS NUOPC library and Fortran module file for use within a NUOPC driven system. The initial work is an MPAS Atmosphere NUOPC cap "stub", which does not execute the MPAS Atmosphere. The stub provides entry point for initializing, running, and finalizing the future MPAS Atmosphere NUOPC model. Follow on work will include execution of the MPAS Atmosphere model from within the NUOPC cap along with adding coupling fields to the import and export states.
Testing infrastructure is implemented on a separate branch: https://github.com/NCAR/MPAS-Model-NUOPC-dev/tree/nuopc/testing
Configuration options
MPAS_PREFIX: Installation prefix used to determine location for
libandmodinstallation directoriesMPAS_LIBDIR: Full path to the
libinstallation directory - location for installation MPAS NUOPC libraryMPAS_MODDIR: Full path to the
modinstallation directory - location for installation of MPAS NUOPC Fortran module filesNUOPC: Generate NUOPC library for the desired CORE. Options are
true|false(default)Testing
Checkout the testing work from this branch
https://github.com/NCAR/MPAS-Model-NUOPC-dev/tree/nuopc/testing
Testing requires a system and environment capable of building and running MPAS-A with these additional requirements
cd testing_and_setup/nuopc/atmosphere ./mpas_nuopc_atm_test.pyFor detailed instructions see the README
https://github.com/NCAR/MPAS-Model-NUOPC-dev/tree/nuopc/testing/testing_and_setup/nuopc/atmosphere