Compiling the model and setting up a directory for model run

Compilation of the model and preparation of a directory for the model run is performed by combination of make and perl scripts. They are designed to automatically detect model configuration and resolve dependencies between Fortran modules. Typical user would never need to modify any of these scripts.

Typical command for compiling the model and setting up a directory for model run is

     make setup RUN=<RunID>
This command will read model configuration from <RunID>.R rundeck and compile the corresponding executable. It will also create a directory for the run and link it to the current directory with the name <RunID>. The executable will be put into this run directory together with all the scripts which are needed to run the model. This command compiles the model for serial run. If one wants to compile the model for parallel run (using MPI) one has to append a flag MPI=YES on the command line, i.e.
     make setup RUN=<RunID> MPI=YES

Normally, once the model is compiled and before you start a long run, you want to perform a "cold start", i.e. you want to start your simulations from initial conditions, run the model for 1 hour of model time and save its state into a checkpoint file (restart file). This can be done with a command

    ../exec/runE <RunID> -np <NP> -cold-restart
where <NP> is the number of MPI threads you want to use (typically the number of available cpu cores). Keep in mind that on big computers you may not be allowed to run MPI jobs interactively. In this case you have to set a variable QSUB_STRING in your ~/.modelErc file to a command which would submit your task as a batch job (see next section). Once first-hour run finishes successfully your model is ready for longer runs.

If you really want to, you can request make to automatically run the model for the first hour after it finishes the setup. To do this use the target "setup-run" instead of "setup", i.e.

    make setup-run RUN=<RunID> MPI=YES NPES=<NP>
where <NP> is the number of MPI threads for the first hour run.

Typically make resolves dependencies well when code changes and recompiles only those files which have to be recompiled. But when one switches to a completely different rundeck or checks out a different branch from the git repository, it may be safer to delete all precompiled object files and start a fresh compilation. To do it just execute

    make clean
before starting a new compilation.

If for some reason you want to compile the model, but don't want to set up a run directory you can do it by using a target "gcm" instead of "setup".