climate.uvic.ca

Notes Index: (Model)

mk script
mk.in and mk.ver files
source data utility
file rotation utility
run files
other source file extensions
UVic_ESCM files
default mk options
bash shell and OSTYPE
mk listing in printout file
missing data
location of perl
Auto_Update and No_Warnings



mk script: (
Index, Model)
The most recent version of mk provides specific help given a 'help string'. If you type 'mk h run', mk will print help for all mk settings containing the string 'run'. Help string character case is ignored. New variables Change_Mount, Run_Copy and Run_Directory are now passed to run files allowing for the setting of a common file system mount point and running on local or remote 'scratch' directories (see
run files). Mk will also check machine names and operating systems with 'uname', if it can not find settings through environment variables. All machine names and operating systems are now converted to lower case so this may affect settings in your mk.in or mk.ver files. If you are using the latest version of mk, make sure all operating system and machine name dependent variables (in mk.in and mk.ver files) use lower case machine names and operating systems or they may not be recognized. For example, the linker for the IBM AIX operating system would be 'Linker_aix', not 'Linker_AIX' or 'Linker_Aix'). Some people have experienced some as yet undetermined problems with the mk script that was released with the first version of the model. It is recommended that you download an updated version of mk ( UVic_ESCM.mk.tar.gz).

mk.in and mk.ver files: (Index, Model)
The most recent version of mk.ver includes new definitions for source extensions (see
other source file extensions), Run_Copy (see mk script) and settings for the IRIX operating system (see Read_me). The mk script will read a local mk.in file first, then look for other variable definitions in a ~/mk.in file and finally in a mk.ver file. You can set variables once in the mk.in file in your home directory and these will be used by all mk scripts (unless set differently in your local mk.in file) allowing you to set personal global default values for mk settings. The mk.ver file can reside in either the UVic_ESCM/2.6 directory or, if not found there, in the "run" subdirectory. Any settings here are applied to all mk scripts unless set in a local or home mk.in file.

source data utility: (Index, Model)
Data source utilities are a suite of data extraction routines which may be used to set up a new model grid or modify existing data files. Some file names have been changed from the original model version, so you may need to copy new data files to old data file names (see
Read_me). These routines expect to find source data in directory data_source (see links for links to data sources). A script called 'cmd' can be edited and run to only extract desired data sets. Some extraction routines require data files (such as grid.nc or kmt.nc) to be present, so the order of the extraction may be important. A script called get_path (called by cmd) will look through your PATH environment variable in order to locate the data_source directory. You may need to set the location of perl at the start of the script if it is not at /usr/bin/perl (see location of perl).

file rotation utility: (Index, Model)
The rotation utility call rot_nc (see
Read_me) may be used to "rotate" netcdf files from or to a "rotated" model. It requires both an input and an output file for variable definitions. The input data will be rotated into the output file so the original contents of the output file is lost. Since the variables in the output file are not needed (only their definitions) copies of the input file may be used for both the input and output file. In this case, data will be rotated onto the model grid defined by "xt" and "yt". If variable definitions are missing from either file, that field is ignored.

run files: (Index, Model)
The most recent 'run files' include examples which run locally or queue under PBS (Portable Batch System) or Loadleveler. The generic 'run' file, runs on the local machine but in steps allowing for intermediate restarts, scripts to be run before and/or after each execution step and for the executable to be run in a different 'run directory'. 'run_pbs' is similar to 'run' but queues a job under PBS. run_loadleveler queues a serial run with Loadleveler and run_parallel_loadleveler queues a parallel run. Any run file will run in a Run_Directory if it exists. The entire directory structure (from /) will be copied to the remote directory. For example if your Executable_Directory is in /home/user/model and your Run_Directory is /scratch, your model will be run in /scratch/home/usr/model. If you are running in a Run_directory, you will also need to set Run_Copy to the files and directories that are required to start the run (restatm.nc restocn.nc and data). For example, if you wanted to run on a local 'scratch' directory your mk.in or mk.ver might contain:
Run_Directory = /scratch
Run_Copy = restatm.nc restocn.nc data

other source file extensions: (
Index, Model)
Other source file extensions may be set in a mk.in or mk.ver file. For example, you may want to set:
Source_Extension = F f F90 f90
in order to allow for processed source code to be recognized as source code. If the source code extension is the same as the code extension (say ".f"), then the code will not be preprocessed (but ".f90" will). You should also add compiler settings for any new source extensions to your mk.in or mk.ver file. For example, settings for linux might be:
Compiler_f_linux = ifc -r8 -O3 -tpp7 -W0 -c
Compiler_f90_linux = ifc -r8 -O3 -tpp7 -W0 -FR -c
See the
Readme for UVic_ESCM.2.6.run.mk.ver.tar.gz which is an example mk.ver file that allows ".f" and ".f90" source extensions.

UVic_ESCM files: (Index, Model)
Individual files from the model may now be accessed directly through the main
UVic_ESCM link.

default mk options: (Index, Model)
If you did not have an OSTYPE or HOST name set, some mk variables remained undefined unless set in a local mk.in or ~/mk.in file (see note about BASH SHELL AND OSTYPE). The latest version of the mk script has been changed to use "Default" settings if a setting would otherwise remain undefined. These may be added to your mk.ver file in the UVic_ESCM/2.6 or run subdirectory. For example, to set them to default to to same settings as if OSTYPE is set to "linux":

#set defaults for any UNSET variables that may be OSTYPE or HOST dependent
Option_Prefix_Default = -D
Preprocessor_Default = /lib/cpp -traditional -P -C
Module_Extension_Default = d
Run_File_Default = run/run_linux
Libraries_Default = -lnetcdf
Libraries_Directory_Default = lib_linux
Libraries_Directory_Prefix_Default = -L
Linker_Default = ifc -r8 -O3 -tpp7 -W0 -o
Compiler_Default_F = ifc -r8 -O3 -tpp7 -W0 -c
Compiler_Default_f = ifc -r8 -O3 -tpp7 -W0 -c
Compiler_Default_F90 = ifc -r8 -O3 -tpp7 -W0 -FR -c
Compiler_Default_f90 = ifc -r8 -O3 -tpp7 -W0 -FR -c

bash shell and OSTYPE: (
Index, Model)
A "bash" shell may not set your OSTYPE environment variable or may set it differently than a csh or tcsh. If you wish to use operating system specific commands, make sure this variable is set correctly. It can be set in a ".bashrc" file.

mk listing in printout file: (
Index, Model)
To remove the listing of mk settings from the beginning of the printout file, you can set the variable "uvic_mk = .false." in the control.in file. If you ever want to see the settings again, just set it to "true" and run the executable. All setting are saved within the executable itself and this may help you recreate your code if you have an executable but your mk.in and code files have been lost.

missing data: (
Index, Model)
There were some missing data files needed to run on a rotated grid in the initial release of the the model. These may be downloaded separately (
UVic_ESCM.2.6.data.tar.gz).

location of perl: (Index, Model)
The mk script needs to know the location of perl. Different operating systems may have perl in different directories. The default location, in the first line of the mk script, is now /usr/bin/perl. If you are running the script on machines which have perl in the same location, then just edit the first line of the mk script to point to the correct location. For machines which share the same UVic_ESCM directory but have perl in different locations, you may be able to create links so that the mk script will be pointed (via a link) to the correct location.

Auto_Update and No_Warnings: (
Index, Model)
If you wish to have a local update directory that contains unpreproceesed (or processed) source code and you would like the code in your code directory to be automatically updated when you edit the updated source files, you can set the Auto_Update variable to true. You will be asked before code is deleted and updated. Since the local updates directory is usually defined as the first (1 or 0) directory, you should set the next directory setting to "false" otherwise changes in any source directory will be automatically updated in the code directory. For example if "Source_Directory(1)" is set to "updates", set:
Auto_Update(1) = true
Auto_Update(2) = false
Setting "Auto_Update(2)" to "false" will turn off automatic updating for all higher level source directories. If you set:
No_Warnings(1) = true
No_Warnings(2) = false
you will not be asked before out of date code (when compared to source code in updates) is deleted from the code directory. Be careful if you set "No_Warnings" to "true" for the first directory as this will result in no warnings before code is deleted due to model option, compiler and possibly other changes.


UVic / SEOS / Climate Group / Model / Notes Last updated: Wednesday, 10-May-2006 10:58:54 PDT