Repository navigation
Building
The tested Ubuntu path uses GNU compilers. The source also defines an llvm
target, but macOS validation is deferred.
CheMPAS-A needs the standard MPAS libraries:
- a consistent C, C++, and Fortran compiler family;
- MPI wrappers using that compiler family;
- NetCDF-C and NetCDF-Fortran;
- PNetCDF and PIO; and
-
pkg-config.
The validated Ubuntu build used GNU Fortran 15.2.0, Open MPI 5.0.10, and NetCDF-C 4.10.1. Other compatible versions may work.
The chemistry build additionally requires:
| Component | Required value |
|---|---|
| MUSICA-Fortran version | 0.16.5 |
| MUSICA source revision | 1403e3d22717bc87f3bf9d0aa591caf039c92bbc |
| MIEM source revision | 9fdf14a189262eecb677862d877ab72b06c95e21 |
| MUSICA MIEM option | ON |
| MUSICA TUV-x option | ON |
The CheMPAS-A Makefile rejects a mismatched MUSICA package.
Use the same compiler ABI and NetCDF installation that MPAS will use:
git clone https://github.com/NCAR/MUSICA.git
git -C MUSICA checkout 1403e3d22717bc87f3bf9d0aa591caf039c92bbc
export CC=gcc
export CXX=g++
export FC=gfortran
export MUSICA_PREFIX=/path/to/musica-install
cmake -S MUSICA -B MUSICA/build-chempas \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$MUSICA_PREFIX" \
-DMUSICA_BUILD_FORTRAN_INTERFACE=ON \
-DMUSICA_ENABLE_MIEM=ON \
-DMUSICA_ENABLE_TESTS=ON
cmake --build MUSICA/build-chempas -j8
ctest --test-dir MUSICA/build-chempas --output-on-failure
cmake --install MUSICA/build-chempasMICM and TUV-x are enabled by default at this revision. The TUV-x runtime data
remain in MUSICA/configs/tuvx/data.
Confirm the installed metadata:
export PKG_CONFIG_PATH="${MUSICA_PREFIX}/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}"
pkg-config --modversion musica-fortran
pkg-config --variable=source_revision musica-fortran
pkg-config --variable=miem_revision musica-fortran
pkg-config --variable=miem_enabled musica-fortran
pkg-config --variable=tuvx_enabled musica-fortrangit clone --branch chempas-a https://github.com/NCAR/CheMPAS-A.git
cd CheMPAS-A
export NETCDF=/path/to/netcdf
export NETCDFF=/path/to/netcdf-fortran
export PNETCDF=/path/to/pnetcdf
export PIO=/path/to/pioNETCDFF may equal NETCDF when C and Fortran libraries share one
prefix. Keep it separate when they do not.
Build the initialization core first, then clean the shared framework before building the chemistry-enabled atmosphere core:
make clean CORE=init_atmosphere
make -j8 gfortran CORE=init_atmosphere OPENMP=false \
PIO="$PIO" NETCDF="$NETCDF" NETCDFF="$NETCDFF" PNETCDF="$PNETCDF" \
PRECISION=double
make clean CORE=atmosphere
make -j8 gfortran CORE=atmosphere OPENMP=false \
PIO="$PIO" NETCDF="$NETCDF" NETCDFF="$NETCDFF" PNETCDF="$PNETCDF" \
PRECISION=double MUSICA=trueVerify that init_atmosphere_model, build_tables, and
atmosphere_model exist. A chemistry run must use the
MUSICA=true atmosphere executable; an ordinary MPAS atmosphere build does
not contain the chemistry records or coupling.
If shared MUSICA libraries were built, make their directory visible to the runtime loader. Static MUSICA builds do not need that step.
MPAS cores share generated framework objects, while their build options differ.
A clean boundary between init_atmosphere and atmosphere prevents a
mixed-option executable. The Makefile performs option checks, but an explicit
clean is the reproducible path.