CESM1 supports both CESM designed coupling interfaces based on MCT datatypes and ESMF coupling interfaces based on the ESMF design. In both cases, a top level driver calls init, run, and finalize methods for each gridded component. The primary and default method for running CESM1 is with the MCT based interfaces and an ESMF library is not required in that case.
ESMF interfaces are supported via translation methods that are instantiated in the models/drv/shr_esmf directory. These methods translate between the datatypes in the MCT interfaces and the datatypes in the ESMF interfaces. In the current CESM1 ESMF interface implementation, the top level driver still calls the init, run, and finalize component methods using the MCT interfaces. That interface does not match the ESMF interface provided by the gridded components. To facilitate translation, each component provides an additional layer where the MCT interfaces are translated to the ESMF interfaces and data is copied between datatypes on entry and exit of each method. The translation of MCT to ESMF datatypes and vice versa is supported via the shared source code in the models/drv/shr_esmf directory. In the future, the CESM1 driver could be modified and the ESMF interfaces called directly thereby eliminating the extra translation layer.
All CESM1 components support both MCT interfaces and ESMF interfaces at the top level independently. This is specifically implemented using two distinct directories of source code to separate the interfaces, so one or the other can be compiled with the component model. These directories exist in all components and are generally called cpl_mct and cpl_esmf. The cpl_mct directory contains the MCT coupling interface. The cpl_esmf directory contains the ESMF coupling interfaces as well as the additional translation layer. At the present time, these interfaces are maintained independently and modifications within any of the interface methods will likely require modifications to the alternative interface for consistency.
To use the ESMF interfaces, the ESMF version 530 release library must be installed locally and the USE_ESMF_LIB environment variable must be set to TRUE in the case env_build.xml file. In addition, the COMP_INTERFACE value in env_build.xml must be set to ESMF. When those variables are set, components compile the source code in cpl_esmf instead of cpl_mct and the ESMF library is linked to the CESM executable. Results using either interface are bit-for-bit identical for several configurations tested, and validation of the implementation is ongoing.