CVMix source code (including protex documentation) as well as build system and examples / tests

View the Project on GitHub CVMix/CVMix-src

Recent versions

1. Latest trunk (not for the faint of heart!):

2. Version 1.0:
(Expected mid-January, 2015)

3. Version 0.63 for beta-testing:

(Released Oct 31, 2014)

Table of Contents

1. About CVMix
2. How to Build CVMix
3. How to Run CVMix
4. Contributor List

Useful Documents

1. The scientific description of CVMix
2. Protex-generated documentation of the code

Contact Information

Questions about CVMix or this webpage should be directed to Michael Levy (mlevy_AT_ucar_DOT_edu)

About CVMix / How to Download

The Community Vertical Mixing Project (CVMix) is a portable vertical mixing software package providing an extensible framework for the development of first-order closures. It can be downloaded via the links at the left or cloned directly from github:

$ git clone

The scientific description of the project and data needed for some of the stand-alone test cases provided are available from the CVMix project page on github.

How to Build

CVMix offers two options for building:

  1. The primary goal of the model is to provide a selection of vertical mixing libraries for use in ocean general circulation models (OGCMs). This only requires building libcvmix.a, which can be done by running make in the src/shared/ directory. When you run make, you must pass the name of the compiler to use via the $(FC) variable to the Makefile; you can also pass compiler flags in the $(FCFLAGS) variable. Further, you can specify four directories (default value of each is the current directory):

    • SRC_DIR -- directory containing the mixing modules (src/shared/)
    • OBJ_DIR -- directory to store .o and .mod files when compiling.
    • INC_DIR -- directory to store .mod files. When you compile your OGCM, you want to compile your model with the -I$(INC_DIR) option. This directory can be the same as $(OBJ_DIR).
    • LIB_DIR -- directory to store libcvmix.a file. When you compile your OGCM, you want to link your model with the -L$(LIB_DIR) -lcvmix flag.

    For example, in CESM the POP ocean model build is launched from a c-shell script that reads in CESM environment variables; the CVMix library is built by running

    gmake -f $CODEROOT/ocn/pop2/source/cvmix/Makefile   \
             SRC_DIR=$CODEROOT/ocn/pop2/source/cvmix    \
             FC=$FC FCFLAGS="$FFLAGS $FREEFLAGS"        \

    where $CODEROOT/ocn/pop2/source/cvmix is a copy of the src/shared/ directory of the CVMix repository.

  2. CVMix also provides a stand-alone mode to test the library on new machines and to aid in development. There is a simple I/O routine that can be compiled with or without netCDF support and some NCL scripts to produce plots for comparison. Developers wishing to add a mixing module to the library must also provide a stand-alone driver for regression testing.

    The executable for the stand-alone driver is bin/cvmix, which can be built by running make from the src/ directory. The first time you try to build the driver, you will be prompted to enter your compiler (there is no parallel code at this time, so a serial compiler is fine) and the location of netcdf (which is only used if you build the netcdf target). At this time, the following compilers are supported:

    • gfortran
    • pgf90
    • ifort
    • xlf90
    • nagfor
    • pathf95
    • ftn, provided the environment variable PE_ENV is one of the following: GNU, PGI, INTEL, PATHSCALE, or CRAY.

    Given one of the above compilers, the compiler flags will be set as specified in bld/CompileFlags.mak. The supported compilers put object and module files in bld/obj and build at the O2 optimization level. The GNU and Intel compilers will also exit on warnings.

How to Run the Stand-alone Driver

Authors and Contributors

This project is a collaboration driven mainly by the Geophysical Fluid Dynamics Laboratory, Los Alamos National Laboratory, and the National Center for Atmospheric Research. The main contributors are Stephen Griffies, Alistair Adcroft, and Robert Hallberg from GFDL; Todd Ringler and Douglas Jacobsen from LANL; Gokhan Danabasoglu, William Large, and Michael Levy from NCAR.