4.1. Compiling MITgcm for the Hg simulation

Selecting the number of CPUs for the Hg simulation

First, you need to decide whether you will run the MITgcm as a debugging simulation (with 13 CPUs), or as a full science simulation (with 96 CPUs).  You can change the number of CPUs for your MITgcm simulation with the setcpus script:

To select a 13 CPU debugging simulation, type the following commands:

cd /n/regal/sunderland_lab/YOUR-USER-NAME/MITgcm_code/

./setcpus 13 hg

Or to select a 96 CPU science simulation, type:

cd /n/regal/sunderland_lab/YOUR-USER-NAME/MITgcm_code/

./setcpus 96 hg

The setcpus script will copy a couple of files into place with appropriate settings for each simulation.

Changing default Hg simulation parameter settings (if necessary)

If you need to override any of the default settings in the various header files (i.e. to increase parameter sizes), you can place updated files into this directory:

MITgcm_code/verification/global_hg_llc90/code

Here is a list of the most important settings:

FileModification
PROFILES_SIZE.hChanged parameter NOBSGLOB from 500 to 400000 to allow MITgcm to read certain files in the run/profiles directory
HG_OPTIONS.h

You can define (or undefine) several C-preprocessor switches to turn activate (or deactivate) various Hg simulation options.

  • To activate an option, use #define OPTION-NAME
  • To deactivate an option, use #undef OPTION-NAME
OptionDescriptionDefault status
#define METHY_MODETurns on methylmercuryON
#define FOODW_MODETurns on Darwin food web modelON
#define USE_EXFIWRUse external forcing fields (needed for online run)ON
#define BC_Mason1996Use Mason et al 1996 bioduluation?ON
#define PART_NOTurn off partitioiningOFF
#define PART_EQTurn on instantaneous equlibriumON
#define PART_DITurn on release (disassociation)OFF
#define HG2REFRACTORYUse a separate tracer for riverine Hg2OFF
#define ISHG2LABILEIs the Hg2 tracer exclusively labile?OFF
#define f_depo_refracFraction of refractory Hg2 for atmospheric deposition0.0
#define HGPREFRACTORYUse a separate tracer for riverine HgPOFF
#define HGPR_IRREDUCIBLEIs riverine HgP irreducible?OFF
#define HGPR_SLOWRELEASINGIs riverine HgP slow-releasing?ON
#define WALSH_FILTERActivate Walsh & Nittrouer typology filter for riverine particles?Activated when #define HGPREFRACTORY is ON
#define walsh_depth

disable sedimentation:
0: no disable
1: only river mouth
2: over depth <= 55 m (top 4 levels)
3: over depth <= 185 m (top 8 levels)
4: over river mouth AND depth shallower than 55 m

0
#define VARI_RED_POOLIs Hg2 reducible pool a function of DOC concentrations?OFF
HG_SIZE.h

You can modify tracer indices and size parameters for the Hg simulation if necessary:

ParameterDescriptionDefault status
iHg0Hg0 tracer index1
iHg2Hg2 tracer index2
iHgPHgP tracer index3
iHg2RHg2R (riverine Hg2) tracer index)

4 if #define HG2REFRACTORY is ON

iHg2PHgPR (riverine HgP tracer index)5 (if #define HG2REFRACTORY and #define HGPREFRACTORY are both ON)
4 (if #define HGPREFRACTORY is ON but #define HG2REFRACTORY is OFF)
npmaxNumber of functional groups of phytoplankton6 (only if #define FOODW_MODE is ON)
nzmaxNumber of functional groups of zooplankton2 (only if #define FOODW_MODE is ON)
nrmaxNumber of river inputs1 (only if #define HGPREFRACTORY is ON)
iMMHgMethyl mercury tracer indexiHgPR + nrmax (only if #define METHY_MODE and #define HGPREFRACTORY is ON)
iHg2PR + 1 (only if #define_METHY_MODE and #define HG2REFRACTORY is ON)
iMMHgPParticulate methyl mercury tracer indexiMMHgP + 1 (only if #define METHY_MODE is ON)
iDMHgDissolved (question) Methyl mercury tracer indexiDMHg + 1

You will probably not need to change any of the above settings unless you are making your own modifications to the Hg simulation.

Building the mitgcmuv executable for the Hg simulation

Once you are sure that you have made the proper settings in MITgcm_code/verification/global_hg_llc90/code directory, change to the build directory:

cd ../build

and type the following commands:

premake

make -j13 depend

make -j13

cp mitgcmuv ../run

Each of these commands will be described in more detail below:

CommandDescription
premakepremake is an alias in your ~/.bashrc_mitgcm file.

premake calls the MITgcm_code/tools/genmake program, which

    • Queries your computer system to find out where various libraries (i.e. MPI, netCDF, etc) are located,
    • Uses the compilation options that you specify in the file MITgcm_code/tools/build_options/inux_ifort_odyssey
    • Generates the main MITgcm makefiles.
    • For more information about genmake, see the MITgcm User Manual, Chapter 3.4.2.
make -j13 depend

This command builds the “dependencies” listing and adds it to the Makefile.  In other words, it tells the Makefile which source code files depend on which other files. 
This is done in order to reduce compilation time.

  • NOTE: the -j13 option tells the Make command to use 13 CPUs. 
  • This number should be the same as the number of CPUs your interactive session uses.  This will reduce the overall compilation time.
make -j13

Builds the MITgcm source code into an executable.

  • A symbolic link to each Fortran (*.F) and include file (*.h) will be made in the build/ directory.
  • For each *.F file, include files will be inlined and C-preprocessor switches evaluated.  The resultant "clean" Fortran file will be saved with a *.f extension.
  • The *.f files will be compiled into an executable file named mitgcmuv. 
cp mitgcmuv ../runCopies the mitgcmuv executable to the run directory, where it will be used to run MITgcm simulations.

Previous | Up | Next

Copyright © 2024 The President and Fellows of Harvard College * Accessibility * Support * Request Access * Terms of Use