Quickstart Guide

This quickstart guide is for quick reference on how to download, build, and run GEOS-Chem Classic, which is the single-node instance of GEOS-Chem.

Tip

Please also see our GCHP Quickstart Guide if you would like to run GEOS-Chem across using more than one computational node.

This guide assumes that your environment satisfies GEOS-Chem Classic hardware and software requirements. This means you should load a compute environment such that programs like cmake are available before continuing. If you do not have some of the required software dependencies, you can find instructions for installing external dependencies in our Spack instructions.

For simplicity we will also refer to GEOS-Chem Classic as simply GEOS-Chem on this page. More detailed instructions on downloading, compiling, and running GEOS-Chem can be found in the User Guide elsewhere on this site.

1. Clone GEOS-Chem Classic

Download the source code:

$ git clone --recurse-submodules https://github.com/geoschem/GCClassic.git GCClassic
$ cd GCClassic

Tip

If you wish, you may choose a different name for the source code folder, e.g.

$ git clone --recurse-submodules https://github.com/geoschem/GCClassic.git my_code_dir
$ cd my_code_dir

Upon download you will have the most recently released version. You can check what this is by printing the last commit in the git log and scanning the output for tag.

$ git log -n 1

Tip

To use an older GEOS-Chem Classic version (e.g. 14.0.0), follow these additional steps:

$ git checkout tags/14.0.0                  # Points HEAD to the tag "14.0.0"
$ git branch version_14.0.0                 # Creates a new branch at tag "14.0.0"
$ git checkout version_14.0.0               # Checks out the version_14.0.0 branch
$ git submodule update --init --recursive   # Reverts submodules to the "14.0.0" tag

You can do this for any tag in the version history. For a list of all tags, type:

$ git tag

If you have any unsaved changes, make sure you commit those to a branch prior to updating versions.

2. Create a run directory

Navigate to the run/ subdirectory. To create a run directory, run the script ./createRunDir.sh:

$ cd run/
$ ./createRunDir.sh

Creating a run directory is interactive, meaning you will be asked multiple questions to set up the simulation. For example, running createRunDir.sh will prompt questions about configurable settings such as simulation type, grid resolution, meteorology source, and number of vertical levels. It will also ask you where you want to store your run directory and what you wish to name it, including whether you want to use the default name, e.g. gc_4x5_merra2_fullchem. We recommend storing run directories in a place that has a large storage capacity. It does not need to be in the same location as your source code. When creating a run directory you can quit and start from scratch at any time.

For demonstration purposes, we will use a full chemistry simulation run directory with the default name (gc_merra2_4x5_fullchem). The steps to setup and run other types of GEOS-Chem simulations follow the same pattern as the examples shown below.

Attention

The first time you create a run directory, you will be asked to provide registration information. Please answer all of the questions, as it will help us to keep track of GEOS-Chem usage worldwide. We will also add your information to the GEOS-Chem People and Projects web page.

3. Load your Environment

Prior to building GEOS-Chem always make sure all libraries and environment variables are loaded. An easy way to do this is to write an environment file and load that file every time you work with GEOS-Chem. To make this extra easy you can create a symbolic link to your environment file within your run directory or for reference. For example, do the following in your new run directory to have a handy link to the environment you plan on using.

$ cd /path/to/gc_4x5_merra2_fullchem   # Skip if you are already here
$ ln -s ~/envs/gcc.gfortran10.env gcc.env

Then every time you start up a session to work with GEOS-Chem in your run directory you can easily load your environment.

$ source gcc.env

4. Configure your build

You may build GEOS-Chem from within the run directory or from anywhere else on your system. But we recommend that you always build GEOS-Chem from within the run directory. This is convenient because it keeps all build files in close proximity to where you will run the model. For this purpose the GEOS-Chem run directory includes a build directory called build/.

First, navigate to the build/ folder of your run directory:

$ cd /path/to/gc_4x5_merra2_fullchem  # Skip if you are already here
$ cd build

The next step is to configure your build. These are persistent settings that are saved to your build directory. A useful configuration option is -DRUNDIR. This option lets you specify one or more run directories that GEOS-Chem is “installed” to; that is, where where the executable is copied, when you do make install.

Configure your build so it installs GEOS-Chem to the run directory you created in Step 2. The run directory is one directory level higher than the build directory. Also located one level higher than the build directory is the CodeDir symbolic link to the top-level GEOS-Chem source code directory. Use the following command to configure your build:

$ cmake ../CodeDir -DRUNDIR=..

GEOS-Chem has a number of additional configuration options you can add here. For example, to compile with RRTMG after running the above command:

Note

The . in the cmake command above is important. It tells CMake that your current working directory (i.e., .) is your build directory.

$ cmake . -DRRTMG=y

A useful configuration option is to build in debug mode. Doing this is a good idea if you encountered an error (such as a segmentation fault) in a previous run and need more information about where the error happened and why.

$ cmake . -DCMAKE_BUILD_TYPE=Debug

See the GEOS-Chem documentation for more information on configuration options.

5. Compile and install

Compiling GEOS-Chem Classic should take about a minute, but it can vary depending on your system, your compiler, and your configuration options. To maximize build speed you should compile GEOS-Chem in parallel using as many cores as are available. Do this with the -j flag from the build/ directory:

# cd /path/to/gc_4x5_merra2_fullchem/build   # Skip if you are already here
$ make -j

Upon successful compilation, install the compiled executable to your run directory:

$ make install

This copies executable build/bin/gcclassic and supplemental files to your run directory.

Note

You can update build settings at any time:

  1. Navigate to your build directory.

  2. Update your build settings with cmake (only if they differ since your last execution of cmake)

  3. Recompile with make -j. Note that the build system automatically figures out what (if any) files need to be recompiled.

  4. Install the rebuilt executable with make install.

If you do not install the executable to your run directory you can always get the executable from the directory build/bin.

6. Configure your run directory

Now, navigate to your run directory:

$ cd /path/to/gcc_4x5_merra2_fullchem

You should review these files before starting a simulation:

  • geoschem_config.yml
    • Controls several frequently-updated simulation settings (e.g. start and end time, which operations to turn on/off, etc.)

  • HISTORY.rc
    • Controls GEOS-Chem diagnostic settings.

  • HEMCO_Diagn.rc
    • Controls emissions diagnostic settings via HEMCO.

  • HEMCO_Config.rc
    • Controls which emissions inventories and other non-emissions data will be read from disk (via HEMCO).

Please see our Customize simulations with research options Supplemental Guide to learn how you can customize your simulation by activating alternate science options in your simulations.

Once you are satisfied that your simulation settings are correct, you may proceed to run GEOS-Chem.

7. Run GEOS-Chem Classic

If you used an environment file to load software libraries prior to building GEOS-Chem then you should load that file prior to running. To run GEOS-Chem Classic, type at the command line:

$ ./gcclassic

If you wish to send output to a log file, use:

$ ./gcclassic > GC.log 2>&1

We recommend running GEOS-Chem Classic as a batch job, although you can also do short runs interactively. Running GEOS-Chem as a batch job means that you write a script (usually bash) and then you submit that script to your local job scheduler (SLURM, LSF, etc.). If you write a batch script you can include sourcing your environment file within the script to ensure you always use the intended environment. Submitting GEOS-Chem as a batch job is slightly different depending on your scheduler. If you aren’t familiar with scheduling jobs on your system, ask your system administrator for guidance.

Those are the basics of using GEOS-Chem Classic! See this user guide, step-by-step guides, and reference pages for more detailed instructions.