Download CLM#
In this tutorial, you will download the CLM source code from GitHub into your own CLM workspace on Derecho. This code base will be used throughout the tutorial exercises.
Note: At the time of the tutorial, the final CLM6 release has not yet been completed. Therefore, we will use a preliminary tutorial tag (ctsm6.0_Tutorial2026) that contains the CLM6 code base and configuration needed for the exercises. The exact tag used in the tutorial may differ from the final CLM6 release.
Downloading the CLM code is an important first step, since all subsequent exercises will use this code workspace. If you encounter any problems during this process, please ask for help.
Step 1: Create CLM Code Directory#
First, create a location in the glade file system where you will store your CLM source code.
Throughout this tutorial, $USER is a placeholder for your NCAR HPC username.
NOTE: You may have already done this step.
cd /glade/u/home/$USER
mkdir code
Step 2. Clone the CTSM Repository#
First, we will change into the code workspace location then we will use the git clone command to download the CLM code.
Change the current directory to the code workspace directory:
cd /glade/u/home/$USER/code
Download the CLM code to your code workspace directory as
my_clm_code:
git clone https://github.com/ESCOMP/CTSM.git my_clm_code
cd my_clm_code
git checkout clm6.0_Tutorial2026
The directory name my_clm_code is only an example. You may choose any directory name you prefer. Outside of this tutorial, many users choose names that identify the CLM version they are working with (for example, ctsm6.0, or clm6.0_Tutorial2026).
Verify the Tutorial Tag
You can verify that you are using the correct version by running:
git describe --tags --exact-match
which should return:
clm6.0_Tutorial2026
Versions#
CLM Versions
One of the first decisions when starting a modeling project is choosing which version of CLM to use. Factors to consider include:
Scientific and technical support for the version. As a rule of the thumb, release tags are the most supported version of CLM.
Availability of model features required for your research.
Consistency with community experiments or previous studies.
Compatibility with analysis tools and workflows.
For example, if you plan to compare your simulations with a community project, you should generally use the same CESM version as that project.
More information can be found on the CESM Models website.
To see available CLM tags that were used in CESM releases, use:
git tag --list 'release-cesm*'
Click here for example output
release-cesm2.0.01
release-cesm2.0.02
release-cesm2.2.01
release-cesm2.2.01.asd01
release-cesm2.2.01.asd02
release-cesm2.2.02
release-cesm2.2.03
release-cesm2.2.04
Note CESM3 has not yet been officially released at the time of this tutorial. As a result, you will only see CESM2 release tags when listing official releases. The tutorial tag clm6.0_Tutorial2026 is a pre-release CESM3 tag created specifically for this tutorial and therefore does not appear in the list of official CESM releases.
Step 3. Download Component Models with git-fleximod#
The CTSM repository itself does not contain all component model source code. Individual model components are maintained in separate repositories and must be downloaded after cloning CLM.
CESM3 uses git-fleximod to manage external repositories.
From your CLM source directory, run:
cd /glade/u/home/$USER/code/my_clm_code
./bin/git-fleximod update
Depending on your system configuration, you may be prompted to accept a security certificate. If prompted, accept the certificate permanently. If no prompt appears, that is perfectly normal. During this step, git-fleximod will download the required component models and supporting repositories.
Click here for example output
./bin/git-fleximod update
mosart up to date.
rtm up to date.
ccs_config up to date.
cism up to date.
Recursively checking out submodules of cism
share up to date.
mpi-serial up to date.
cdeps up to date.
Recursively checking out submodules of cdeps
fates up to date.
Recursively checking out submodules of fates
cmeps up to date.
parallelio up to date.
mizuRoute up to date.
Recursively checking out submodules of mizuRoute
cime up to date.
Recursively checking out submodules of cime
The directory
/glade/u/home/$USER/code/my_clm_code
is your CLM source workspace ($SRCROOT), which will be used throughout the tutorial.
The directory
/glade/u/home/$USER/code/my_clm_codeis your CLM source workspace ($SRCROOT), which will be used throughout the tutorial. as described in the workspaces section.
Step 4. Set up a ctsm_pylib conda environment#
Conda environments provide a separate, self-contained description of Python packages that can be used for different tasks. Each environment is isolated from the others and from your system Python. Conda environments allow for reproducibility, testing, and stable Python environments for scientific workflows. We created the ctsm_pylib environment for various python tools we’ll use in CLM.
From the top-level of your CLM checkout
cd /glade/u/home/$USER/code/my_clm_code
you can simply run:
./py_env_create
Heads up, this can take a while.
Congratulations, you have now downloaded the CLM code component of your workspace!!
You downloaded the CLM code with the instructions above. In which directory is the CLM code? How do you navigate to that directory?
Click here for the solution
If you download CLM with the instructions above, the CLM code is located in:
/glade/u/home/$USER/code/my_clm_code
To navigate to that directory, use the UNIX command cd:
cd /glade/u/home/$USER/code/my_clm_code
If you are not familiar with UNIX commands, please review the UNIX chapter of this documentation.