Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

MPAS 8.0.0 build


New member
Following the WRF-MPAS Workshop announcement of the release of MPAS 8, I downloaded the code from the website and attempted to build the new model version. I had previously built MPAS 7.0, so I had that build as a reference.. I found two issues with the version 8.0.0 Makefiles that I needed to correct.

System: CentOS (uname -a: Linux wrf2 3.10.0-1160.49.1.el7.x86_64 #1 SMP Tue Nov 30 15:51:32 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux)
Compiler: PGI: pgf90 -version: pgf90 (aka nvfortran) 23.3-0 64-bit target on x86-64 Linux -tp zen
Build commands:
setenv NETCDF /home/.../sw/MET/external_libs
setenv PNETCDF /home/.../sw/MPAS/pnetcdf
make pgi CORE=init_atmosphere AUTOCLEAN=true PRECISION=single |& tee v8.compile.init.log
make pgi CORE=atmosphere AUTOCLEAN=true PRECISION=single |& tee v8.compile.model.log2

1. Both init_atmosphere and atmosphere compiles failed because of a bad reference to netcdf functions.
/home/.../sw/MET/external_libs/lib/ undefined reference to `nc_inq_var_filter'
/home/.../sw/MET/external_libs/lib/ undefined reference to `nc_def_var_filter'

Interestingly. I modified the top-level Makefile to remove the addition of the libnecddff libraries to the search path. Once that was done and the build only used the netcdf and pnetcdf libraries, the build of initi-atmosphere worked and the atmosphere build continued past that point.

2. The mpas_atm_core.F code apparently tries to include the mp_radar.mod file which exists in the physics/physics_mmm directory. However, the search path doesn't include this directory.

mpif90 -D_MPI -DCPRPGI -DCORE_ATMOSPHERE -DMPAS_NAMELIST_SUFFIX=atmosphere -DMPAS_EXE_NAME=atmosphere_model -DSINGLE_PRECISION -DMPAS_NATIVE_TIMERS -DMPAS_GIT_VERSION=unknown -DMPAS_BUILD_TARGET=pgi -DMPAS_SMIOL_SUPPORT -DDO_PHYSICS -O3 -byteswapio -Mfree -c mpas_atm_core.F -I/home/.../sw/MET/external_libs/include -I/home/.../sw/MPAS/pnetcdf/include -I/home/.../sw/MPAS/MPAS-Model-8.0.0/src/external/SMIOL -I/home/.../sw/MET/external_libs/include -I/home/.../sw/MPAS/pnetcdf/include -I./inc -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_wrf -I../external/esmf_time_f90
NVFORTRAN-F-0004-Unable to open MODULE file mp_radar.mod (mpas_atm_core.F: 51)

Near the end of the core_atmosphere/Makefile, I added the physics_mmm directory into the include search path

$(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_mmm -I./physics/physics_wrf -I../external/esmf_time_f90
$(FC) $(CPPFLAGS) $(PHYSICS) $(FFLAGS) -c $*.F $(CPPINCLUDES) $(FCINCLUDES) -I./inc -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_mmm -I./physics/physics_wrf -I../external/esmf_time_f90

With these two changes, my MPAS 8.0.0 build was successful. I moved these executables and the corresponding data files into my existing MPAS 7.0 operational setting. I didn't modify any of the namelist or stream files and everything seemed to work (at last after one day!). After a few more days of clean running, I hope to test out some of the updated physics parameterizations in MPAS 8.
Thanks for the feedback on these build issues.

1. Are the NetCDF-C, NetCDF-Fortran, and PIO libraries that you're using with MPAS v8.0 the same as those that you've used successfully with v7? I would have guessed that the undefined references to 'nc_inq_var_filter' and 'nc_def_var_filter' in the NetCDF-Fortran library should have been satisfied by the NetCDF-C library if the Fortran library was built using the C library that's being linked.

2. There will be a v8.0.1 release out shortly that should address the missing include path to the physics_mmm directory (see MPAS-Dev/MPAS-Model PR #1096). Thanks for spotting this issue, and if you'd like credit in the release notes, just let me know how you'd like to be credited!
I pulled in the same set of libraries for my version 8 build that I used for version 7. I was actually a bit (pleasantly) surprised that the original libraries still worked.
I pulled in the same set of libraries for my version 8 build that I used for version 7. I was actually a bit (pleasantly) surprised that the original libraries still worked.
Just to check that I'm understanding correctly, you're now able to get MPAS v8.0 compiled without undefined references to nc_inq_var_filter and nc_def_var_filter by using the same libraries that you used with MPAS v7.x?
I basically disabled the check in the (v8.0,0) Makefile, line 724 that added the "-lnetcdff" to the library search path. My new line looks like
ifneq ($(wildcard $(NETCDF)/$(NETCDFLIBLOC)/ZZlibnetcdff.*), ) # CHECK IF NETCDF4.

The unresolved references I was getting were coming from the netcdff library (see the original post). I have the netcdff library within my $NETCDF/lib directory, but apparently my version doesn't have the two offending function calls. It seemed a bit strange that the original sequence worked with MPAS7 but not MPAS8. I thought I would try getting the netcdff library out of the library search path...which then allowed for a ciean compile. I speculate that now I'm pulling some function from a different library that calls these functions...When that function--whatever it was-- was referenced from the netcdff library, then it had some unresolved references. I'm not a netcdf expert nor really a compile expert, but this change got it to compile and v8 MPAS is running for me.
Thanks for following up, and I think your suspicion that there may be something else that's referencing nc_inq_var_filter and nc_def_var_filter -- directly or indirectly -- seems reasonable. My guess is that there's not much that we can or should do in the MPAS-Model Makefile, since in general we may need to link to the netcdff library. But documenting this issue and the fix in this thread for posterity is good.