Coupling Glimmer to External Dynamic Cores
Last revised: 8/26/2010 Doug Ranken

The purpose of the Glimmer/Dycore interface is to provide a flexible method for connecting the 
Fortran-based Glimmer package to C/C++ based dynamic cores (though it could be modified to
connect external Fortran dynamic cores, as well).  This document provides instructions for
building the external dynamic core interface between Glimmer and BISICLES (or Ymir, when it
is available).  With the current design, adding new dynamic cores can be done using small
modifications to DyCoreModelRegistry.H and DyCoreModelRegistry.cpp.  Since the 
DyCoreModelRegistry class is a small code, it would be relatively easy to have a build system
couple-in a specific set of dynamic cores, based on a few user specified configuration
parameters.   

The interface is designed so that all glimmer calls to external dynamic core routines are
contained in the Fortran module glimmer_to_dycore.F90.  To allow glimmer to be built without
including any external dynamic cores, there is also a glimmer_to_dycore_stubs.F90 module.

The rest of the interface is written in C/C++.  The dycore_to_glimmer_extern.cpp provides a
bridge between the Fortran and C++.  The C++ routines provide a registry class designed to
handle multiple dynamic core interfaces (which can be of different types), and classes that
implement the interface.  The DycoreToGlimmer class is designed to be a parent class for
subclasses that handle the interface to specific dynamic cores.  

The rest of this document tells how to build an interface connecting Glimmer to the BISICLES
dynamic core. 

There are 3 main steps to the build process, to be done in this order:
1) Build the interface library
2) Build BISICLES (or Ymir) library
3) Compile simple_bisicles

1) Build the interface library
In directory your_glimmmer/src/libdycore
make BISICLES

2) Build BISICLES and single-file Chombo libraries (libBisicles.a, libChomboLibs.a)
In the BISICLES installation, code/interface directory:
 make bisicles

3) Compile simple_bisicles
rm simple_bisicles
make -f Makefile.dycore simple_bisicles

To compile with stub routines for the interface:
1) Build the interface library
In directory your_glimmmer/src/libdycore
make DYCORE_STUBS

2) Compile simple_bisicles
rm simple_bisicles
make -f Makefile.dycore simple_bisicles
make -f Makefile.dycore_stubs simple_bisicles

DyCoreModelRegistry.cpp + .H  
DyCoreToGlimmer.cpp + .H
dycore_to_glimmer_extern.cpp


Testing simple_bisicles: 
1) simple_bisicles, load hump.config
2) simple_bisicles_run
3) gdb simple_bisicles, load hump.config


BISICLES Build Notes:


Chombo:
with a fresh checkout, need to set Chombo/lib/mk/Make.defs.local
with machine-dependent info

latest resolved dependencies:
HDF5, which needs szip.
Atlas version of lapack. 

Glimmer-CISM:

using LANL parallel branch:
svn co https://username@svn.berlios.de/svnroot/repos/glimmer-cism/glimmer-cism-lanl/branches/parallel

Dan's configure command:

./configure --with-netcdf=/home/loren/users/dmartin/util/netcdf/netcdf-4.0.1/ --prefix=/home/loren/users/dmartin/cleanCheckout/gc1/parallel --with-blas=-lblas FC=gfortran FCFLAGS="-ffree-line-length-none -g -DNO_RESCALE" FFLAGS="-g -DNO_RESCALE" CFLAGS="-g -DNO_RESCALE"

Doug's configure command:

./configure --with-netcdf=/home/ranken/util/netcdf/netcdf-4.0.1 --with-hdf5-lib=/home/ranken/util/hdf/hdf5-1.8.4/hdf5/lib/ --prefix=$PWD --with-blas=-lblas --with-lapack=-llapack --with-tags=gfortran --with-slap-slap FC=gfortran FCFLAGS="-ffree-line-length-none -g -DNO_RESCALE" FFLAGS="-g -DNO_RESCALE" CFLAGS="-g -DNO_RESCALE"

./configure --with-netcdf=/home/ranken/util/netcdf/netcdf-4.0.1 --with-hdf5-lib=/home/ranken/util/hdf/hdf5-1.8.4/hdf5/lib/ --prefix=$PWD --with-blas=-lblas --with-lapack=-llapack --with-tags=gfortran --with-slap-slap FC=gfortran FCFLAGS="-ffree-line-length-none -g -DNO_RESCALE" FFLAGS="-g -DNO_RESCALE" CFLAGS="-g -DNO_RESCALE" --with-hdf5=/home/ranken/util/hdf/5-1.6.10-linux-x86_64-static --with-szip=/home/ranken/util/hdf/szip-2.1/src/.libs/libsz.a --with-libdycore=/home/ranken/util/BISICLES/code/interface/libdycore --with-bisicles=/home/ranken/util/BISICLES
