Skip to content

Commit d15f39a

Browse files
committed
new rcesm readme file, taken from github.com/NCAR/TAMURegionalCESM/
1 parent 7668f5f commit d15f39a

File tree

1 file changed

+241
-0
lines changed

1 file changed

+241
-0
lines changed

README_cresm.rst

+241
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
==================================
2+
Community Regional Earth System Model - RCESM
3+
==================================
4+
5+
A Private repo for code and issues related to building a regional coupled version of CESM as part of a joint NCAR/TAMU project.
6+
7+
See the CESM web site for documentation and information on the base model:
8+
9+
http://www.cesm.ucar.edu
10+
11+
This repository provides tools for managing the external components required to run and build the RCESM. The basic components used in this model are included in the repo (unlike CESM), but the scripting infrastructure is maintained in an external repository and managed with the "manage_externals" tool.
12+
13+
.. sectnum::
14+
15+
.. contents::
16+
17+
Obtaining the full RCESM model code and associated scripting infrastructure
18+
=====================================================================
19+
20+
The RCESM code is available from this repository in github. You will need some familiarity with git in order to modify the code and commit any changes. However, to simply checkout and run the code, no git knowledge is required other than what is documented in the following steps.
21+
22+
To obtain the rcesm0.2 (release version 0.2) code you need to do the following:
23+
24+
#. Clone the repository. ::
25+
26+
git clone https://github.com/ihesp/cesm my_rcesm_sandbox
27+
28+
This will create a directory ``my_rcesm_sandbox/`` in your current working directory.
29+
30+
#. Go into the newly created directory and determine what version of the RCESM you want.
31+
To see what ihesp/cesm tags are available, simply issue the **git tag** command. ::
32+
33+
cd my_rcesm_sandbox
34+
git tag
35+
36+
#. Do a git checkout of the tag you want. If you want to checkout ihesp_release_rcesm0.2, you would issue the following. ::
37+
38+
git checkout ihesp_release_rcesm0.2
39+
40+
(It is normal and expected to get a message about being in 'detached
41+
HEAD' state. For now you can ignore this, but it becomes important if
42+
you want to make changes to your Externals.cfg file and commit those
43+
changes to a branch.)
44+
45+
#. Run the script **manage_externals/checkout_externals**. ::
46+
47+
./manage_externals/checkout_externals
48+
49+
The **checkout_externals** script is a package manager that will
50+
populate the rcesm directory with the relevant version of the CIME
51+
infrastructure code.
52+
53+
At this point you have a working version of RCESM.
54+
55+
For general information on using the CIME framework in the context of CESM, see the CIME documentation at http://esmci.github.io/cime/ .
56+
57+
More details on checkout_externals
58+
----------------------------------
59+
60+
The file **Externals.cfg** in your top-level RCESM directory tells
61+
**checkout_externals** which tag/branch of CIME should be
62+
brought in to generate your sandbox. (This file serves the same purpose
63+
as SVN_EXTERNAL_DIRECTORIES when CESM was in a subversion repository.)
64+
65+
NOTE: Just like svn externals, checkout_externals will always attempt
66+
to make the working copy exactly match the externals description.
67+
68+
**You need to rerun checkout_externals whenever Externals.cfg has
69+
changed** (unless you have already manually updated the relevant
70+
external(s) to have the correct branch/tag checked out). Common times
71+
when this is needed are:
72+
73+
* After checking out a new RCESM branch/tag
74+
75+
* After merging some other RCESM branch/tag into your currently
76+
checked-out branch
77+
78+
**checkout_externals** must be run from the root of the source
79+
tree. For example, if you cloned RCESM with::
80+
81+
git clone https://github.com/ihesp/cesm.git my_rcesm_sandbox
82+
83+
then you must run **checkout_externals** from
84+
``/path/to/my_rcesm_sandbox``.
85+
86+
To see more details of **checkout_externals**, issue ::
87+
88+
./manage_externals/checkout_externals --help
89+
90+
91+
Setting up a RCESM case
92+
=====================================================================
93+
94+
When building and running the RCESM it is good to have your working directories set up as follows:
95+
96+
* The RCESM source code in it's own sandbox
97+
98+
* The RCESM case directory in a seperate (parallel) directory
99+
100+
* The RCESM build and run directory in an area with a lot of space for model output
101+
102+
On Cheyenne, your working paths might look like:
103+
104+
* Source code : ``/glade/p/work/user/RCESM/my_rcesm_sandbox``
105+
106+
* Case directory : ``/glade/p/work/user/RCESM/my_case_dirs/case1``
107+
108+
* Build and Run directories : ``/glade/scratch/user/case1``
109+
110+
A RCESM case directory contains all of the configuration xml files, case control scripts, and namelists to start a RCESM run. It also contains the README document which contains information about the case as it was created, and the CaseStatus document that keeps track of changes as you go. To create a case, run the "create_newcase" script from the CIME/scripts directory. As an example: ::
111+
112+
my_rcesm_sandbox/cime/scripts/create_newcase --case my_case_dirs/new_case_1 --compset PBSGULF2010 -res tx9k_g3x -mach Cheyenne --run-unsupported
113+
114+
Where the arguments mean:
115+
116+
- ``--case my_case_dirs/new_case_1`` This is the name of and path to the new case. This directory is created by the create_newcase script and should not exist before calling create_newcase.
117+
- ``--compset PKWUS2003`` compsets in CESM/RCESM describe which components are active and their basic configurations for the run. In the RCESM, some pertinant compsets are:
118+
119+
================ ========================
120+
COMPSET Name Components Used
121+
================ ========================
122+
PKWUS2003 WRF atmosphere, CLM 4.0 land, data ice and data ocean
123+
PRSGULF2010 Data atmosphere, stub land, stub ice and ROMS ocean
124+
PRDXGULF2010 Data atmosphere, stub land, stub ice and ROMS ocean extended via XROMS
125+
PBSGULF2010 WRF atmosphere, CLM 4.0 land, stub ice and ROMS ocean extended via XROMS
126+
================ ========================
127+
128+
- Note that the compsets describe the active components used in an experiment, and also the start date and forcing data, but not the domain or grid size. Thus, the PKWUS2003 compset can be used for the Gulf of Mexico case, if the start date is changed before runtime with the command ::
129+
130+
./xmlchange RUN_STARTDATE=2010-01-01
131+
132+
- ``-res tx9k_g3x`` describes the grids and domains used in this experiment. In the RCESM, the currently available resoultions are:
133+
134+
================= ========================
135+
Resolution Description
136+
================= ========================
137+
wus12_wus12 A 12km Western US domain. Ocean, land, and atmosphere all on the same grid. Has not been tested with ROMS.
138+
3x3_gulfmexico A 3km Gulf of Mexico domain for ROMS only (not extended). Data atmosphere on the same grid.
139+
tx9k_g3x A 9km atmosphere grid and 3km ocean grid (extended for XROMS) in the Gulf of Mexico (as used for the coupled simulation test case).
140+
================= ========================
141+
142+
- ``-mach Cheyenne`` : The machine where the build and run is happening. This allows CIME to load the correct environment and libraries, set up applicable node and task configurations, and configure submission scripts for the correct queues. On many NCAR-supported machines (such as Cheyenne) this flag is optional, as CIME can determine what machine it is on through the shell. For more information on porting to a new machine, see "Porting CIME and the RCESM to a new machine"_ below.
143+
- ``--run-unsupported`` : Currently required flag due to the experimental nature of RCESM in general. Only lets the user know the current configuration is not scientifically supported by the CESM scientific working groups.
144+
145+
146+
Building a RCESM case
147+
=====================================================================
148+
149+
Once the case has been created, only a few commands are required to build the model ::
150+
151+
cd my_case_dirs/new_case_1
152+
./case.setup
153+
./case.build
154+
155+
The ``case.setup`` script builds the ``user_nl_`` user namelists and sets up the PE layout for the run. The ``./case.build`` script actually builds the model into the build directory (such as ``/glade/scratch/user/new_case_1/bld``) and builds the component namelists and copies all of the needed model run data (including boundary forcing files for WRF and ROMS) into the run directory (such as ``/glade/scratch/user/new_case_1/run`` in the example).
156+
157+
**Note that when working on Cheyenne it is very frowned upon to build the model interactively at a login node as is done in this example. It is better to use the wrapper script** ::
158+
qcmd -- ./case.build
159+
**Which will send the build command to an interactive batch node and return when the build is complete. On Cheyenne, please use the above form.**
160+
161+
162+
Running a RCESM case and Looking at Output
163+
=====================================================================
164+
165+
After the model builds successfully, you can submit a run to the compute queue with the command ::
166+
167+
./case.submit
168+
169+
from the case directory. This will rebuild all of the model namelists and recheck to make sure that all of the correct input data has been linked and moved to the correct places within the run directory. It will then put together a submit script for the machine batch system and submit it. You can check on the status of your run either through the job status commands on your system (``qstat`` on Cheyenne) or by investigating the log output in the run directory.
170+
171+
The results of a simulation are located as follows
172+
173+
- *Log files*: If the simulation encounters an error, all log and output files will remain in the run directory. If the model successfully completes the simulation, log files will be zipped and copied to the ``logs/`` subdirectory of the case directory.
174+
175+
- *WRF per process output*: If the WRF component is running as the atmosphere, it produces two output files for each process, an rsl.out.XXXX file and an rsl.error.XXXX file (where XXXX is the process rank, ie. 0036). The standard output and standard error streams can be found in these files, which will remain in the run directory regardless of the success or failure of the model run.
176+
177+
- *History files*: In the model's default configuration and after a successful run, all history files are moved to an archive directory on the user's larger scratch space. On Cheyenne, this is located at ::
178+
179+
\glade\scratch\{$user}\case_name\{$component_name}\hist
180+
181+
This behavior can be turned off (and history files remain in the run directory) by setting the xml variable ``DOUT_S`` to False in the case directory before submition. For more information on XML variables and how to query or change them, see `Useful XML variables in the RCESM case`_.
182+
183+
- Restart files: Currently, restarts have not been tested and are not supported in the RCESM. This is an important "to do" item on the list of `Bugs, Issues and Future work`_. Restart files are written and copied into the archive directory at ::
184+
185+
\glade\scratch\{$user}\case_name\{$component_name}\rest
186+
187+
But there is no guarentee they will work currently.
188+
189+
190+
191+
Porting CIME and the RCESM to a new machine
192+
=====================================================================
193+
194+
Right now, in order to port the RCESM code to a new machine, there are likely three areas of changes that need to be made. The first is in the CIME code for general machine support. For instructions on how to port CIME to a new machine, see this documentation: http://esmci.github.io/cime/users_guide/porting-cime.html
195+
196+
Adding a machine to CIME can be done without making changes to settings for any other machines, and so settings for new machines can be included in the CIME repository. First you will need to `create a branch <https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/>_` for your port changes. Then, test the changes, and create a `Github pull request <https://help.github.com/articles/creating-a-pull-request/>`_ so they are included in the central code repository.
197+
198+
After porting CIME to the new machine, you will need to make a few changes to WRF and ROMS. In WRF, you will need to create a new configure file in the main wrf directory: `RCESM_sandbox/components/wrf` . Look at the files `configure.wrf.cheyenne_intel` or `configure.wrf.yellowstone_intel` as an example. This is the main change needed, but you may need to adjust various makefiles to correct flags for your compilers as well. Similarly, the ROMS makefiles may need to be adjusted as well. If any changes are needed to WRF or ROMS, please add an issue to the `RCESM git repository <https://github.com/ihesp/cesm/issues>`_, as the final goal is to encapsulate all platform-dependant settings within the CIME software infrastructure.
199+
200+
201+
Useful XML variables in the RCESM case
202+
=====================================================================
203+
204+
All of the required configuration options for an experiment with the RCESM are encapsulated in XML variables within various files in the case directory. While it is possible to edit these files directly, it is recommended that users use the "xmlquery" and "xmlchange" scripts to access and manipulate the xml variables. These scripts give more information about each variable, do error checking on changes, and keep track of changes in the CaseStatus file so it is easy to see exactly what has been changed from the default in any given experiment. To learn more about these scripts, go into a case directory and type ::
205+
206+
./xmlquery --help
207+
208+
or ::
209+
210+
./xmlchange --help
211+
212+
CESM xml variables will be documented in the upcoming CESM 2.0 release documents. For now, here is a short compilation of variables that may be useful in testing or running RCESM experiments.
213+
214+
=================== ========================
215+
XML Variable Description
216+
=================== ========================
217+
PROJECT Account project number to charge compute time to
218+
JOB_QUEUE Which queue to submit a job, if different than default
219+
JOB_WALLCLOCK_TIME Wall time to request for a job
220+
STOP_OPTION What units to use for the specified run length. Valid values: nsteps, ndays, nmonths, nyears
221+
STOP_N The number of STOP_OPTION units that the experiment will complete
222+
RUN_STARTDATE The date on which the experimental run begins
223+
DEBUG Whether to compile the model with debug flags on
224+
DOUT_S Turns archiving of history and restart files on (TRUE) or off (FALSE)
225+
DIN_LOC_ROOT Location of the input data directory structure
226+
=================== ========================
227+
228+
229+
Bugs, Issues and Future work
230+
=====================================================================
231+
(Last Updated April 4, 2018)
232+
233+
- Clean up any WRF or ROMS code that is specific to Cheyenne. Generalize it so the only code that needs to be ported is CIME.
234+
- Test Restarts. Get these working if they do not already.
235+
- ROMS%XROMS is the only component configuration actually available through that mechanism. Need to get the `%NULL` working again.
236+
- Create PKGULF2010 compset so the RUN_STARTDATE does not need to be manually changed for this configuration.
237+
- Make sure that WRF history output responds to CIME XML variables correctly. Investigate other WRF namelist options that need to be hooked up to CIME variables.
238+
- Make sure all pertinant ROMS namelist and configuration files are properly hooked up to CIME variables.
239+
- Remove the "csh script" step in WRF and ROMS builds. This is left over from old versions of CESM and should be replaced with python code.
240+
- Set up nightly or some form of automated testing infrastructure.
241+
- Investigate PE layouts for WRF-ROMS coupled runs. Can I find a layout that runs more efficiently?

0 commit comments

Comments
 (0)