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

Disable physics for MPAS dycore-only build #1281

Merged

Conversation

kuanchihwang
Copy link
Contributor

When building MPAS as a dynamical core, all physics-related components are disabled. This build configuration is usually used by CAM/CAM-SIMA, and can be achieved by defining the MPAS_CAM_DYCORE macro in CPPFLAGS.

On the other hand, the PHYSICS Makefile variable controls whether physics are enabled in MPAS, but its logic is decoupled from the MPAS_CAM_DYCORE macro. Disabling physics in MPAS currently requires manual interventions.

This PR disables physics automatically when the MPAS_CAM_DYCORE macro is found in CPPFLAGS. It mainly benefits CAM-SIMA, which reuses the build infrastructure of MPAS for building it as a dynamical core.

For stand-alone MPAS and CAM, this PR is an NFC (No Functional Change).

When building MPAS as a dycore, all physics-related components are disabled.
This build configuration is usually used by CAM/CAM-SIMA, and can be achieved by
defining the `MPAS_CAM_DYCORE` macro in `CPPFLAGS`.

The `PHYSICS` Makefile variable controls whether physics are enabled in MPAS, but
its logic is decoupled from the `MPAS_CAM_DYCORE` macro. Disabling physics in MPAS
currently requires manual interventions.

Therefore, automatically disable physics when the `MPAS_CAM_DYCORE` macro is found
in `CPPFLAGS`.
@abishekg7
Copy link
Collaborator

Is the standalone MPAS build supposed to work if you add MPAS_CAM_DYCORE or -DMPAS_CAM_DYCORE to the CPPFLAGS in the root directory's Makefile?

@kuanchihwang
Copy link
Contributor Author

kuanchihwang commented Feb 3, 2025

@abishekg7

Not really. This build configuration is usually used by CAM(-SIMA), where MPAS will be compiled as a part of another host model. When the MPAS_CAM_DYCORE macro is defined, it introduces an external dependency, which comes from the host model. Therefore, MPAS cannot be compiled independently under this build configuration.

To review this PR, I would suggest the following on Derecho:

git clone https://github.com/ESCOMP/CAM-SIMA.git
cd CAM-SIMA
git checkout development
./bin/git-fleximod update
mkdir -pv ../PR1281 && cd ../PR1281

# Compile with GNU compilers
../CAM-SIMA/cime/scripts/create_newcase --compiler gnu --case PR1281-GNU --compset FKESSLER --project PROJECT_KEY --res mpasa480_mpasa480 --run-unsupported
cd PR1281-GNU
# Compile with Intel compilers
../CAM-SIMA/cime/scripts/create_newcase --compiler intel --case PR1281-Intel --compset FKESSLER --project PROJECT_KEY --res mpasa480_mpasa480 --run-unsupported
cd PR1281-Intel

./case.setup
./case.build

# Inspect the build artifacts of MPAS at:
#   "$SCRATCH/PR1281-GNU/bld/atm/obj/mpas" for GNU compilers
#   "$SCRATCH/PR1281-Intel/bld/atm/obj/mpas" for Intel compilers

The changes that you are reviewing have been applied as a patch: 0002-Disable-physics-for-MPAS-dycore-only-build.patch. This PR is an attempt to upstream that particular patch so we do not have to maintain it downstream at CAM-SIMA.

Copy link
Collaborator

@abishekg7 abishekg7 left a comment

Choose a reason for hiding this comment

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

I've tried building standalone MPAS - seems fine. And I also followed @kuanchihwang 's instructions for CAM-SIMA. Also seems to build fine.

@mgduda mgduda merged commit 0f868c2 into MPAS-Dev:develop Feb 19, 2025
@kuanchihwang kuanchihwang deleted the staging/dycore-without-physics branch February 22, 2025 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants