# Installing your own version of CESM

These instructions are for users who need to download their own version of CESM2.

{% hint style="warning" %}
Do not load the CESM module. If you have a cesm module loaded, unload it:

`module unload cesm`
{% endhint %}

Clone the version of CESM you want from the github repo:

```bash
git clone -b release-cesm2.2.0 https://github.com/ESCOMP/CESM.git my_cesm_sandbox
cd my_cesm_sandbox
./manage_externals/checkout_externals
```

The various Oscar-specific XML files needed to run CESM, including

* config\_batch.xml
* config\_compilers.xml
* config\_machines.xml

can be obtained from [this github repo](https://github.com/brown-ccv/CIME_Oscar). The easiest way to incorporate these files into your build is to place them in a directory named .cime within your home directory (i.e., \~/.cime). For example:

```bash
git clone https://github.com/brown-ccv/CIME_Oscar ~/.cime
```

To setup, build, and run a case on Oscar:

1. Load the necessary modules (line 1-7 below)
2. Move to the cime\_scripts directory (line 8)
3. Create a new case, selecting your desired \<CASENAME>, \<COMPSET>, and \<GRID > (line 9)
4. Move to your CASEROOT directory (line 10)
5. Setup the case (line 11)
6. Build the case (line 12)
7. Submit the case (line 13)

```bash
module load netcdf/4.9.0_intel_2020.2_hdf5_1.12.2_slurm22 \
            hdf5/1.12.2_openmpi_4.0.7_intel_2020.2_slurm22 \
            mpi/openmpi_4.0.7_intel_2020.2_slurm22 \
            perl/5.36.0 \
            intel/2020.2 \
            blas/3.7.0 \
            lapack/3.7.0
cd my_cesm_sandbox/cime/scripts
./create_newcase --mach oscar --case <CASENAME> --compset <COMPSET> --res <GRID>
cd <CASENAME>
./case.setup
./case.build
./case.submit
```

By default, component log files, history files, and restart files for your case will be placed in /oscar/home/$USER/data/$USER/archive/\<CASENAME>.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ccv.brown.edu/oscar/local-install/installing-your-own-version-of-cesm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
