Skip to content

How to Compile CVMix

Michael Levy edited this page Jun 8, 2014 · 2 revisions

In stand-alone mode, CVMix supports the following compilers:

  • GNU (gfortran)
  • Intel (ifort)
  • PGI (pgf90)
  • IBM (xlf90)
  • NAG (nagfor)
  • PathScale (pathf95)
  • Cray wrapper for any of the above (ftn)

To build, simply run make (for netCDF output, run make netcdf) from src/. The first time you run this you will be prompted to enter the compiler you want to use (must be gfortran, ifort, pgf90, xlf90, nagfor, pathf95, or ftn) and where netCDF is installed. This will build the bin/cvmix executable as well as lib/libcvmix.a (a library containing all the CVMix mixing modules).

To include CVMix in an OGCM, there are two options: Copy src/shared/*.F90 to the directory containing the rest of your OGCM source code and let your build system treat them as part of your model Build lib/libcvmix.a separately, and then link it when building your OGCM.

To build lib/libcvmix.a, run

$ make -f $CVMIX_ROOT/src/shared/Makefile       \
          FC=[fortran compiler]                 \
          FCFLAGS=[compiler flags]              \
          SRC_DIR=$CVMIX_ROOT/src/shared        \
          OBJ_DIR=[place to store .o files]     \
          INC_DIR=[place to store .mod files]   \
          LIB_DIR=[place to create libcvmix.a]