next up previous contents
Next: 14.2 The main variables Up: 14. Variables Previous: 14. Variables

   
14.1 Naming convention for variables

The 6 character restriction on naming variables has been relaxed since MOM 2 although economy of characters in choosing names is always desirable. In an attempt to unify naming of variables, a convention is introduced which uses abbreviated forms of the fundamental conceptual pieces of the numerical oceanography. This convention also gives guidance for building the names for variables in future parameterizations and keeps an overall consistency throughout the model. Constructing names for variables is then a matter of assembling these abbreviations in various ways. Note that when names of variables are spelled out, the naming convention should not be applied. However, when names seem cryptic, the convention is intended to help decipher their meaning. A list of abbreviations is given below:


 		u = 		Velocity point 		d = 		Delta 		adv = 		Advective  
t = Tracer point f = Flux diff = Diffusive
n = North face p = Pressure visc = Viscous
e = East face c = Coefficient psi = Stream function
b = Bottom face v = Velocity ps = Surface pressure

Variables described subsequently within this chapter are build in terms of these abbreviations. All variables are positioned relative to the arrangement of grid cells discussed in Chapter 16. When an unknown variable is encountered in MOM, it may be possible to determine its meaning from context or the naming convention. For example, the variable adv_vnt is an advective velocity on the north face of T cells. If this fails, it may be useful to search all include files for comments using the UNIX command: grep as described in Section 3.1.

Operators are used in MOM to construct various terms in finite difference equations which are the counterpart to equations detailed in Chapter 4. Unlike arrays, operators are build using expressions which relate variables but require no explicit memory. The details of a particular operation are forced into the operator and buried from view which allows complicated equations to be written in terms of simple, easy to understand, pieces. At the same time, compilers can expand these pieces in-line into an un-intelligible mess (by human standards) and subsequently optimize it. In fact, there is no difference in speed on the CRAY (or any mature compiler) between writing an equation with operators and writing an equation with all terms expanded out. The big difference is that the former is easier to understand and work with for humans.

Instead of using operators, all terms in the equations could be computed once and stored in arrays. This would allow less redundant calculation but be prohibitive in memory usage. It is an interesting counter intuitive point that it is sometimes faster to do redundant calculation rather than save intermediate results in arrays. Depending on the speed of the load/store operations compared with the multiply/add operations, if redundant computation contains little work it may be faster to compute redundantly. In practice, this depends on the computer and compiler optimizations. This can be verified by executing script run_timer which exercises the timing utilities in module timer by solving a tracer equation in various ways. It is one measure of a mature compiler when the speed differences implied by solving the equations in various ways is relatively small. On the CRAY YMP the differences are about 10% whereas on the SGI workstation, they can exceed 50%.

Within operators, capital letters are reserved for the intended operation and small letters act as qualifiers. A list of abbreviations is given below:


 		ADV_T = 		Advection of tracer 		x = 		longitude direction  
DIFF_T = Diffusion of tracer y = latitude direction
ADV_U = Advection of velocity z = vertical direction
DIFF_U = Diffusion of velocity

As an example, tracer diffusion in the longitude direction at a given point is given by operator DIFF_Tx(i,k,j). These operators are defined in include files and may be located using the UNIX command grep as indicated in Section 3.1.


next up previous contents
Next: 14.2 The main variables Up: 14. Variables Previous: 14. Variables
RC Pacanowski and SM Griffies, GFDL, Jan 2000