5.1  Routines used in Preparing for a Model Run -- prep.F

Preparation for any model run begins in the PREP subdirectory. This is the subdirectory within which things are done to prepare for a model simulation without actually running it.


The file prep.F is the central routine within the PREP subdirectory. All other routines within this directory and its subdirectories are used to provide information for prep.F. The model domain, grid spacing, Coriolis parameter and initial conditions are all specified in this routine. In addition, the cell masking arrays are determined within prep.F.

As discussed in Sheng et al. (1998), Diecast uses a very efficient elliptic equation solver to calculate the surface pressure field. This solver requires the determination of a variety of matrices and their inverses which depend only on the model geometry. As such, they can be determined once for all time and stored for future use as soon as the geometry is known. The second major function of prep.F is to run the preprocessor for the elliptic solver.

As mentioned, the other files within subdirectory PREP are used to provide information to prep.F. This is done in two distinctly different ways. Parameter values used by prep.F are read from the file Prep_parm.tag_root where tag_root is an identifier for the particular model setup. The second way that information is provided to prep.F is through the inclusion or exclusion of alternative pieces of code. This code to be included is specified in #ifdef blocks for the C-preprocessor options set in Def_prep.h for the case name specified in AN_ID.h.

AN_ID.h and Def_prep.h

To make the prep routine useful for a variety of different runs without requiring a different prep.F program for each run, prep.F includes a variety of options which are specified within the file Define.h. The file Define.h is just a set of C-preprocessor directives that tells prep.F what options to turn on, and hence what code is to be compiled. In developing the model code, we have found it convenient to have several different test cases easily available for which the results are well known. This has been facilitated by specifying the directives for these tests as special cases within Define.h. The particular case to be considered is specified within AN_ID.h (AN_ID stands for AN IDentifier). For example, if you want to do a North Atlantic run with one degree horizontal resolution, you would begin by editing the file AN_ID.h to include the line

#define NA1_TEST_CASE

and insure that the define statements for any other test cases listed in AN_ID.h are commented out. The file AN_ID.h is always included prior to Define.h so that the options required by the test case to be considered are turned on (or defined) automatically. For example, Define.h would include the text

#ifdef NA1_TEST_CASE
#endif (or an #else or #elif directive)

where (directives) is a series of directives turning on the model features required by this test case. If NA1_TEST_CASE is defined, these directives are used, but if NA1_TEST_CASE is not defined, these directives are completely ignored. Each different test case has its own set of directives located in Def_prep.h.


Diecast.h is a file used to set up various arrays and common blocks. It is separated from prep.F so that it can be included in different subroutines both in the PREP directory and in the MAIN directory. Diecast.h uses the definitions in AN_ID.h and Define.h to customize these arrays to the particular run being set up. For example, the array dimensions differ greatly from one test case to another and the correct choice for each case is determined within Diecast.h using C-preprocessor directives that are determined by the case identifier specified in AN_ID.h. Diecast.h is also included in some of the routines within MAIN in order to automatically pass any dimension changes made in PREP through to MAIN. However, there are some arrays in Diecast.h which are required by prep.F, but not by main.F. These routines are separated from those required by both prep.F and main.F using #ifdef PREP_ARRAYS to avoid excessive waste of RAM by main.F.

CANDIE Home User Guide Contents Previous Section Top of Page Next Section