eagles-project/mam4xx

Make mam4xx buildable within a subdirectory of a host project

Closed this issue · 1 comments

(See Haero issue 477 for more background)

In order to build a CIME-enabled E3SM case for testing our C++ port of MAM, we need to be able to incorporate mam4xx into EAMxx's build process in a way that freely passes build configuration parameters from EKAT -> Haero -> mam4xx. Currently, mam4xx assumes that haero is installed as a third-party library. This is fine, but we also need the ability for mam4xx to check for a haero library target within a unified build system.

This issue tracks the addition of this capability.

I am building the model on NERSC as EAMxx works out of the box on PM. Here are the instructions to build EAMxx with MAM4xx:

git clone git@github.com:eagles-project/scream.git
cd scream

git submodule update --init --recursive

# ... or, if you encounter trouble with the above:
git submodule deinit -f . && git submodule update --init --recursive

cd cime/scripts
./create_test SMS_D_P32x1_Ln5.ne4pg2_oQU480.F2010-SCREAMv1 --machine pm-cpu --compiler gnu  -p m3525 -t ne4_test

The command above will build and run the EAMxx model. If you are not part of the m3525 project, the model should just build, not run. The next step is to change the CMAKE flag for MAM4xx and rebuild the model by going into the case directory.
cd $SCRATCH/e3sm_scratch/pm-cpu/SMS_D_P32x1_Ln5.ne4pg2_oQU480.F2010-SCREAMv1.pm-cpu_gnu.ne4_test
Open env_build.xml and change the SCREAM_CMAKE_OPTIONS to include the MAM4xx flag. It should look like the following:
<entry id="SCREAM_CMAKE_OPTIONS" value="SCREAM_NP 4 SCREAM_NUM_VERTICAL_LEV 72 SCREAM_NUM_TRACERS 40 SCREAM_ENABLE_MAM TRUE">
(I changed the number of tracers to 40 as well)

Now clean build the model again:
rm -rf bld && ./case.build && ./case.submit