This page is meant to track the growth of the stand-alone driver for CVMix, as well as provide a place for me to attach tarballs until we set up a subversion repository. The notes below can be found in the README file in the CVMix directory of the attached tarball.

NOTE: Repository is up at

https://cvmix.googlecode.com/svn/trunk

December 1, 2012 (mlevy)

I've made a lot of changes, but don't think I'm quite ready for a tag. Apologies for the long delay between updates, I need to do better maintaining this page.

I've added a vmix_shear module to handle shear mixing, and it currently "supports" Paconowski-Philander as well as the Richardson mixing from the KPP scheme. I use quotes because neither is complete - I'm still testing PP with POP trying to figure out the best structure for storing Ri on both the T and U grids (if the grids are different), and the KPP scheme currently only returns viscosity on the T grid.

I've also added a new stand-alone driver to test the KPP shear mixing. Whereas the Bryan-Lewis stand-alone driver produces a plot with diffusivity on the x-axis and depth on the y-axis, the shear mixing driver produces a plot with Richardson number on the x and viscosity on the y (normalized so that nu=1 when Ri=0).

A couple of smaller updates include fixing the error message when you try to build without VMIX_DRIVER set, improving compiler support (we can now build with the IBM compiler... just in time for bluefire to get decomissioned), and improving the formatting in the protex documentation. Now each routine starts on a new page, making it a little easier to read. Also, the NCL scripts now look for data from the netCDF files - if it's not availble, they look for ascii data (and provides an error message if no output data is found).

Right now, there are only three options for the stand-alone driver which can be
used to test two different mixing methods. The first test is to output Bryan-
Lewis mixing on two columns (a high latitude column and a tropical column),
and output the diffusivity coefficients at each level. This can be run using
pointers (allocate memory in the driver, have CVMix data structures point to
it) or using pure memory copies (allocate memory in the driver AND CVMix).

The third driver sets up a single column using the shear mixing formula found in
the Large, et al. KPP paper. For this test, each level is a different local
gradient Richardson number rather than a different depth to show how viscosity
varies with different choices of Ri.


DIRECTORY STRUCTURE
-------------------

bld/ -- Contains the Makefile, is also where the build process will keep a
        couple of setup files to help with the build. It has two subdirectories:
  bld/obj -- Where .o  and .mod files are stored.
  bld/exe -- Where the Makefile will put the executable.

doc/ -- Contains documentation. At this point, it only has a PDF of the latest
        protex in-code notes and a script to generate said PDF.

src/ -- Contains the source code, organized as follows. The top directory
        contains modules needed by the stand-alone driver (output, for example).
  src/drivers -- Stand-alone drivers for different tests.
  src/shared  -- Where all the modules that are needed to use CVMix with an
                 outside model are stored. (Use as an svn:external!)

reg_tests/ -- I envision this becoming a way to do regression tests as we
              develop the code, but for now it just contains two tests. One
              outputs the diffusivity coefficients when using Bryan-Lewis
              mixing on two columns (with each column having its own B-L
              parameterization) and the other outputs the viscosity
              coefficients when using the shear mixing scheme in the KPP
              paper.

              Note that all scripts have a "-h" (or "--help") flag to print
              usage options and a "-nc" (or "--netcdf") flag to turn on netCDF
              output.

              BL Pointer test
              ---------------
              reg_tests/Bryan-Lewis]$ ./BL_test.sh

              BL Mem copy test
              ----------------
              reg_tests/Bryan-Lewis]$ ./BL_test.sh -mc

              Shear mixing test
              -----------------
              reg_Tests/shear-KPP]$ ./Large_test.sh

              Both directories also contain a basic NCL script to produce a
              plot.

              Bryan-Lewis/plot_diff_coeffs.ncl -- makes a plot with depth on
                   the y-axis and diffusivity (for both columns) on the x-axis.
              shear-KPP/plot_visc_coeffs.ncl -- makes a plot with local gradient
                   Richardson number on the x-axis and normalized viscosity
                   coefficient on the y-axis.


INSTALLATION NOTES
------------------

The bld directory contains a Makefile and a 'setup' utility. bld/setup is a
python script that asks for compiler / netcdf information (it only needs to
be run once, info is saved in bld/.CVMix_env). If you just run 'make' without
.CVMix_env, then setup will run automatically. The makefile does require one
variable as input: you need to specify which driver to build. If you omit this
field, you will see an error like

ERROR: You must compile using 'make VMIX_DRIVER=[driver]'. Valid choices are:
vmix_BL_driver-mem_copy.F90
vmix_BL_driver-pointers.F90
vmix_KPP-shear_driver.F90

To build with netcdf, run 'make VMIX_DRIVER=[] netcdf'.

The default executable is $CVMix/bld/exe/cvmix, but it can be overwritten with
'make EXE=[executable]'.

September 30, 2012 (mlevy)

cvmix_20120930

New tag that features ability to output to netCDF. At this point the write script is very primitive, it will need to be updated when we reach the point of wanting to see more than just the diffusivity coefficients. Also, I realized the README file is slightly out of date (rather than have two separate scripts to use either pointers or memory copy, rolled them into one script that defaults to pointers but can be run with the '-mc' flag to force memory copies instead). I think I'm at the point where I can design some automated regression tests by looking at the differences between netcdf files.

September 14, 2012 (mlevy)

This was a big update, but I didn't create a tag yet because I want to finish my work with the netCDF output. The changes in this commit are:

  1. Rather than a single vmix_driver.F90, at build time you specify which driver you want to use. Right now there are two drivers, and both use Bryan-Lewis parameterization on two columns / output the diffusivity coefficients. (They both generate the same columns but one driver uses pointers and the other uses memory copies.) As we develop new physics, we can write individual drivers to test the new packages.
  2. When you build, you must pass the make command the name of the driver you want to use. See either of the shell scripts in reg_tests/Bryan-Lewis/ for examples.
  3. I reorganized the bld/ directory so .o and .mod files now end up in bld/obj/ and the cvmix executable is put in bld/exe/. The root of bld/ contains 3 files in the repository: README, Makefile, and setup, and building will also generate .CVMix_env (containing info about compiler and netcdf) and .netcdf_info (whether you last built with netCDF or not). Note that I placed the .mod files using the "-J [dir]" flag, which is probably specific to gfortran. As the code develops, we should talk about a way to store compiler-specific flags somewhere.

The end result is that you should be able to run either of the scripts in reg_tests/Bryan-Lewis/ and, after being prompted for compiler / netcdf information (the netcdf stuff is ignored at this time), get output that looks something like

   0.0000000000000000       1.07453050216759668E-005  3.01809041483410142E-005
   175.00000000000000       1.09881504915210703E-005  3.03815156234304469E-005
   350.00000000000000       1.12701407772416626E-005  3.06144641203300676E-005
   525.00000000000000       1.16015270366266342E-005  3.08882179867785232E-005
   700.00000000000000       1.19964621542568653E-005  3.12144687361252347E-005

(but with the first column running all the way to 5250); the untitled columns are "interface depth", "low-latitude diffusivity coefficient", and "high-latitude diffusivity coefficient." If you save the output in $CVMix/reg_tests/Bryan-Lewis/data.out, you can plot the data by going to $CVMix/ncl and running make_diff_plot-BryanLewis.ncl.

Right now, the stand-alone driver isn't very powerful. It is set up to run
Bryan-Lewis mixing on a single column, and output the diffusivity coefficients
at each level. Obviously this program will grow as we develop CVMix, but it
seems like a good starting point.

Directory structure:

bld/ -- Contains the Makefile, is also where the build process will keep a
        couple of setup files to help with the build. It has two subdirectories:
  bld/obj -- Where .o  and .mod files are stored.
  bld/exe -- Where the Makefile will put the executable.

doc/ -- Contains documentation. At this point, it only has a PDF of the latest
        protex in-code notes.

src/ -- Contains the source code, organized as follows. The top directory
        contains modules needed by the stand-alone driver (output, for example).
  src/drivers -- Stand-alone drivers for different tests.
  src/shared  -- Where all the modules that are needed to use CVMix with an
                 outside model are stored. (Use as an svn:external!)

reg_tests/ -- I envision this becoming a way to do regression tests as we
              develop the code, but for now all it contains is one test that
              outputs the resulting diffusivity coefficients when using
              Bryan-Lewis mixing on two columns (with each column having its
              own Bryan-Lewis parameterization).

ncl/ -- Will eventually contain NCL scripts for making various plots depending
        on the namelist settings. At this point, it contains one script for
        generating the comparison of two Bryan-Lewis parameter sets. To use
        right now, you need to run

        reg_tests/Bryan-Lewis] $ ./pointer_test.sh > data.out
        (or ./memcopy_test.sh > data.out)
        ncl/] $ ncl make_diff_plot-BryanLewis.ncl

INSTALLATION NOTES:

The bld directory contains a Makefile and a 'setup' utility. bld/setup is a
python script that asks for compiler / netcdf information (it only needs to
be run once, info is saved in bld/.CVMix_env). If you just run 'make' without
.CVMix_env, then setup will run automatically. The makefile does require one
variable as input: you need to specify which driver to build. If you omit this
field, you will see an error like

ERROR: You must compile using 'make VMIX_DRIVER=[driver]'. Valid choices are:
vmix_BL_driver-mem_copy.F90
vmix_BL_driver-pointers.F90

To build with netcdf, run 'make VMIX_DRIVER=[] netcdf'.

September 11, 2012 (mlevy)

Stand-alone driver tarball

This update has hooks for netCDF output (the Makefile will include / link netCDF libraries and will define the _NETCDF macro), but the output routines aren't written yet so the output is still just ascii on stdout.

Right now, the stand-alone driver isn't very powerful. It is set up to run
Bryan-Lewis mixing on a single column, and output the diffusivity coefficients
at each level. Obviously this program will grow as we develop CVMix, but it
seems like a good starting point.

Directory structure:

bld/ -- Contains the Makefile, is also where the build process will store .o
        and .mod files.

doc/ -- Contains documentation. At this point, it only has a PDF of the latest
        protex in-code notes.

exe/ -- Where the Makefile will put the vmix executable, also contains two
        namelists that can be used to recreate Fig. 3.1 in Steve's notes.

src/ -- Contains the source code. Right now it just contains the driver and
        the subdirectory shared/, which is all the modules that are needed
        to use CVMix with an outside model. (At some point, src/shared/ will
        be picked up as an svn:external for POP and, I assume, MPAS and MOM.

ncl/ -- Will eventually contain NCL scripts for making various plots depending
        on the namelist settings. At this point, it contains one script for
        generating the comparison of two Bryan-Lewis parameter sets. To use
        right now, you need to run

        exe/] $ vmix < low_lat.ncl > diff1.txt
        exe/] $ vmix < high_lat.ncl > diff2.txt
        ncl/] $ ncl make_diff_plot-BryanLewis.ncl

reg_tests/ -- This is a place-holder, but at some point we will want to create
              a suite of regression tests to ensure everything in CVMix is
              functioning correctly.

INSTALLATION NOTES:

The bld directory contains a Makefile and a 'setup' utility. bld/setup is a
python script that asks for compiler / netcdf information (it only needs to
be run once, info is saved in bld/.CVMix_env). If you just run 'make' without
.CVMix_env, then setup will run automatically.

To build with netcdf, run 'make netcdf' instead of just 'make'.

August 14, 2012 (mlevy)

Stand-alone driver tarball

Right now, the stand-alone driver isn't very powerful. It is set up to run
Bryan-Lewis mixing on a single column, and output the diffusivity coefficients
at each level. Obviously this program will grow as we develop CVMix, but it
seems like a good starting point.

Directory structure:

bld/ -- Contains the Makefile, is also where the build process will store .o
        and .mod files.

doc/ -- Contains documentation. At this point, it only has a PDF of the latest
        protex in-code notes.

exe/ -- Where the Makefile will put the vmix executable, also contains two
        namelists that can be used to recreate Fig. 3.1 in Steve's notes.

src/ -- Contains the source code. Right now it just contains the driver and
        the subdirectory shared/, which is all the modules that are needed
        to use CVMix with an outside model. (At some point, src/shared/ will
        be picked up as an svn:external for POP and, I assume, MPAS and MOM.

ncl/ -- Will eventually contain NCL scripts for making various plots depending
        on the namelist settings. At this point, it contains one script for
        generating the comparison of two Bryan-Lewis parameter sets. To use
        right now, you need to run

        exe/] $ vmix < low_lat.ncl > diff1.txt
        exe/] $ vmix < high_lat.ncl > diff2.txt
        ncl/] $ ncl make_diff_plot-BryanLewis.ncl

reg_tests/ -- This is a place-holder, but at some point we will want to create
              a suite of regression tests to ensure everything in CVMix is
              functioning correctly.

INSTALLATION NOTES:

The Makefile in bld/ is very simplistic -- I've just been testing it out in X11
on my MacBook. It builds everything in src/ and src/shared/ using gfortran, and
this initial version of the code is entirely serial. I'd like to automate the
process of determining dependencies, but I really just tried to throw something
together quickly so I can make the code available.
  • No labels

3 Comments

  1. Hi Mike,

    Thanks! I was able to download it, build it (ifort) and run it.

    I have a packed week getting ready for the long trip to the UK on Saturday. I will play with it on way over there.

    Thanks again for putting this together.

    Cheers,

    Todd

  2. Hi,

    It seems to me that we should not require CVMix to perform the horizontal averaging to produce viscosity on the U-grid.  I am thus ambivalent now with this point.  Perhaps we should instead send CVMix just information on the T-grid, compute all terms appropriate for that grid, and send back to the calling model just the T-grid information.  MOM, POP, and MPAS will then produce any staggered grid information needed based on the CVMix returns.  In particular, MOM and POP will produce B-grid viscosity based on CVMix's T-grid viscosity.  To require CVMix to perform the horizontal averaging seems more than we wish...

    Thoughts?  

    Steve 

    1. That makes sense to me. For POP, I could even envision doing something like

      1. Calculate Ri on T points
      2. Calculate nu and kappa on T points (since kappa is a function of nu)
      3. Calculate Ri on U points
      4. Calculate nu on U points (over-writing the nu calculated in step 2)

      The trick would be adding an optional "calc_kappa" logical flag to avoid un-necessary computation in step 4. Models that don't use a staggered grid would just use steps 1 and 2.

      Since CVMix is running on a single column, it doesn't really know / care if it is a column on the T grid or the U grid. Though this brings up some questions about how to properly account for grid staggering. Should I have separate arrays of vmix_data_type, one to represent the T grid and one to represent the U grid? Or should I just have multiple nlev variables to account for indexing on different grids? Then I'd need to tell CVMix which nlev to use... (Also, I don't understand why this didn't crop up in the constant mixing. In POP, the variable KMT is the number of levels on the T grid while KMU is the number of levels on the U grid; as far as I remember, everything in the constant mixing module used KMT.)