next up previous contents
Next: 6 Pseudo-Code Up: users_guide Previous: 4 Output Data   Contents

Subsections

5 Source Code Maintenance

5.1 Obtaining Source Code

Coupler source code (cpl5) is available as part of the CCSM 2.0 distribution at
http://www.cesm.ucar.edu/models/ . This distribution includes the source code for all CCSM component models. Documentation for other CCSM component models, as well as input data for running the models, is also available at this site.

5.2 Coupler Source Code

The Coupler source code is written almost entirely using standard Fortran 90.

The Coupler source code was developed using the CVS revision control system, but
only one "tagged" version of the Coupler is available within any source code
distribution.  This information can be used to identify the code contained in a 
particular distribution.

A user may wish to modify their copy of the Coupler source code. If one
wishes to modify the Coupler source code, it is strongly recommended that
one first study the "pseudo-code" section of this document in conjunction with
studying the source code file "main.F90." This should provide a good top-down
overview of how the Coupler works, a necessary prerequisite for successful code
modification.

5.3 Shared Source Code

The Coupler source code itself (found in .../models/cpl/cpl5/ ) is incomplete 
and cannot be compiled (due to missing subroutines) unless it is compiled along
with "CCSM shared code" (found in .../models/csm_share/ ).  This shared code is
an un-compiled library of support routines.  

The Coupler source code itself has no machine dependencies, although the CCSM 
shared code does have some machine dependencies.  One function of the shared 
code is to collect and isolate machine Dependant code, and to provide CCSM 
component models with machine-independent wrappers to such code.

Another function of the shared code is to provide a mechanism for the various
component models to be consistent with one another, for example, to use an
identical value for pi or for the latent heat of fusion.  Similarly, the shared
code contains a library routine for calculating a solar angle, so that all
component models can be consistent in their solar angle calculations.

5.4 Shared Build Environment

The CCSM distribution includes a shared build environment which includes a 
makefile (a GNU makefile), a variety of machine-dependent makefile macro files
and a dependency generator.  This common build environment is used to build all
CCSM components including the Coupler.  The build environment is found in 
.../models/bld subdirectory of the CCSM source code distribution.

The makefile, which requires the use of gnu-make, is machine independent, but it
"includes" (a standard make functionality) a machine-dependent macros definition
file.  Several macros files are included in the distribution, but because such
macro definitions are typically very machine and site specific, it is expected
that end users will need to create a new macros definition file for their site.

Also part of the build environment is a dependency generator.  This is written
in standard c, and thus is compiled with the standard Unix cc command.  The 
dependency generator is particularly useful when hacking code, either by
modifying some files or adding new ones.



csm@ucar.edu