Initialized Prediction

Initialized Prediction

Overview

Teaching: min
Exercises: min
Questions
  • What are Initialized Prediction Experiments?

Objectives

Types of Experiments

Simulation: what the model thinks the climate looks like under certain conditions

These are not necessarily real conditions, they are typically idealized and do not correspond to any specific day or time. That is why we evaluate them using statistics (e.g. mean or variability over the simulation) and often compare these statistics between two simulations (e.g. a control and an experiment) or with the observed statistics.

Projection: what the model thinks the climate will look like in the future under different scenarios

Prediction: a forecast for a specific date given initial conditions for each component

These types of experiment correspond to the model attempting to predict actual conditions that occurred. We can compare directly between what the model predicted and what actually happened (observations).

Key Points


Initializing the Model

Overview

Teaching: min
Exercises: min
Questions
  • How to setup model initial conditions?

Objectives

Setting up Experiments - Review

To setup experiments with CESM, we setup and configure the following things:

Understanding Initial Conditions in CESM

Initial conditions tell the model what state to start from. The files that contain this information are called restart and intial condition files. They represent an instantanous state of each model component at a given time. There are multiple restarts for each componenet of the model.

Initial Conditions in our B1850 simulation (Assignment #3)

Let’s take a look at the initial conditions we used for some of our previous experiments:

$ cd /glade/u/home/cstan/cases/b.day1.0
$ ./xmlquery RUN_TYPE,RUN_STARTDATE,RUN_REFDATE,RUN_REFCASE,GET_REFCASE,RUN_REFDIR
Results in group run_begin_stop_restart
	RUN_TYPE: hybrid
	RUN_STARTDATE: 0001-01-01
	RUN_REFDATE: 0301-01-01
	RUN_REFCASE: b.e20.B1850.f19_g17.release_cesm2_1_0.020
	GET_REFCASE: TRUE
	RUN_REFDIR: cesm2_init

RUN_TYPE=hybrid, so this indicates the information in the other variables need to be set and that this run uses initial conditions from another CESM run to start it.

GET_REFCASE=TRUE means that the code will get the initial condition/restart files for you from the RUN_REFDIR. If it is FASLE, we have to “stage” (meaning copy) the initial condition/restart files in the case run directory ourselves. As an example, we did this in Assignment #4.

RUN_REFDIR is set to the default value of cesm2_init. This is a preset directory of initial condition files for starting CESM2 simulations. The full path is: /glade/p/cesmdata/cseg/inputdata/cesm2_init/

RUN_REFCASE tells it which files in RUN_REFDIR to use. Let’s take a look:

$ ls /glade/p/cesmdata/cseg/inputdata/cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020*
0101-01-01  0161-01-01  0301-01-01

The RUN_REFDATE tells us which of these we are using (0301-01-01)

$ ls /glade/p/cesmdata/cseg/inputdata/cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/
b.e20.B1850.f19_g17.release_cesm2_1_0.020.cam.i.0301-01-01-00000.nc     b.e20.B1850.f19_g17.release_cesm2_1_0.020.ww3.r.0301-01-01-00000
b.e20.B1850.f19_g17.release_cesm2_1_0.020.cam.r.0301-01-01-00000.nc     rpointer.atm
b.e20.B1850.f19_g17.release_cesm2_1_0.020.cam.rs.0301-01-01-00000.nc    rpointer.drv
b.e20.B1850.f19_g17.release_cesm2_1_0.020.cice.r.0301-01-01-00000.nc    rpointer.glc
b.e20.B1850.f19_g17.release_cesm2_1_0.020.cism.r.0301-01-01-00000.nc    rpointer.ice
b.e20.B1850.f19_g17.release_cesm2_1_0.020.clm2.r.0301-01-01-00000.nc    rpointer.lnd
b.e20.B1850.f19_g17.release_cesm2_1_0.020.cpl.r.0301-01-01-00000.nc     rpointer.ocn.ovf
b.e20.B1850.f19_g17.release_cesm2_1_0.020.mosart.r.0301-01-01-00000.nc  rpointer.ocn.restart
b.e20.B1850.f19_g17.release_cesm2_1_0.020.pop.r.0301-01-01-00000.nc     rpointer.ocn.tavg.5
b.e20.B1850.f19_g17.release_cesm2_1_0.020.pop.ro.0301-01-01-00000       rpointer.rof

These are all the files that the model needs to start this run. Notice that they begin with RUN_REFCASE

So what does RUN_STARTDATE do?

Even though the restarts we start from begin on 0003-01-01, we can tell the model to begin our experiment with whatever we want the startdate to be. This is because our simulation does not need to match any specific, real date. You can see in my experiment that the RUN_STARTDATE is set to 0001-01-01 and the output begins at that date:

$ cd /glade/scratch/cstan/archive/b.day1.0/atm/hist
$ ls -lt

Important Note: You can specify a new startdate for your run if the RUN_TYPE=hybrid. You cannot do this if your RUN_TYPE=branch.

Initial Conditions in our Added Heating Experiments (Assignment #5)

In the previous example, all this initial condition information was set for us by default as part of the compset definition. We did not have to set any of this ourselves.

In our added heating experiments (Assignment #5), we set this up ourselves using Dr. Swenson’s scripts. Let’s take a look:

$ cd /glade/u/home/cstan/cases/addheat
$ ./xmlquery RUN_TYPE,RUN_STARTDATE,RUN_REFDATE,RUN_REFCASE,GET_REFCASE,RUN_REFDIR
Results in group run_begin_stop_restart
	RUN_TYPE: branch
	RUN_STARTDATE: 0005-01-01
	RUN_REFDATE: 0005-01-01
	RUN_REFCASE: test1
	GET_REFCASE: FALSE
	RUN_REFDIR: cesm2_init

RUN_TYPE is branch, meaning that the model components are initialized from restart files generated by a user specified CESM.

RUN_REFCASE is set to test1 which is the name of my case for experiment we did for Assignment #2.

GET_REFCASE is set to FALSE, so we must stage the restart files in the run directory for this case.

RUN_REFDIR is not used since GET_REFCASE is set to FALSE.

RUN_STARTDATE must match RUN_REFDATE since this is a branch run.

Staging the restart files

One of the lines in our script for setting up the added heating runs is:

# Initial conditions for Branch run
cp $refdir/* $ptmp/$expname/run/

This resolves to:

cp /glade/scratch/cstan/archive/b.day1.0/rest/0005-01-01-00000/* /glade/scratch/cstan/addheat/run/

We copied the restart files from the restart directory to the run directory for our new case.

ls /glade/scratch/cstan/addheat/run/
CASEROOT              rpointer.rof                      b.day1.0.clm2.r.0005-01-01-00000.nc
rpointer.atm          b.day1.0.cam.h0.0004-12.nc           b.day1.0.clm2.rh0.0005-01-01-00000.nc
rpointer.drv          b.day1.0.cam.h1.0005-01-01-00000.nc  b.day1.0.cpl.r.0005-01-01-00000.nc
rpointer.glc          b.day1.0.cam.i.0005-01-01-00000.nc   b.day1.0.mosart.h0.0004-12.nc
rpointer.ice          b.day1.0.cam.r.0005-01-01-00000.nc   b.day1.0.mosart.r.0005-01-01-00000.nc
rpointer.lnd          b.day1.0.cam.rs.0005-01-01-00000.nc  b.day1.0.mosart.rh0.0005-01-01-00000.nc
rpointer.ocn.ovf      b.day1.0.cice.r.0005-01-01-00000.nc  b.day1.0.pop.r.0005-01-01-00000.nc
rpointer.ocn.restart  b.day1.0.cism.r.0005-01-01-00000.nc  b.day1.0.pop.ro.0005-01-01-00000
rpointer.ocn.tavg.5   b.day1.0.clm2.h0.0004-12.nc          b.day1.0.ww3.r.0005-01-01-00000

Now that we know better how initializing the model works, we will learn about initialized prediction experiments.

Key Points


An Initialized Prediction Experiment

Overview

Teaching: min
Exercises: min
Questions
  • How to setup an Initialized Prediction Experiment

  • How to setup an experiment with your own script

Objectives

An Initialized Prediction Experiment

We will run a subseasonal initialized prediction experiment with CESM. A whole suite of these experiments have been run with CESM1 and CESM2 following a protocol set forth by SubX which is a multi-model subseasonal prediction experiment. Many modeling groups ran a suite of hindcasts for subseasonal prediction following this protocol so they could all be compared. A paper about it is here

The experiment will be initialized on Jan 7, 2019 and run for 45 days.

Which version of the model?

We will use CESM2.1. This is a little different than the one we have been using (CESM2.1.1). It is located in /glade/u/home/ssfcst/cesm2_1

Which Resolution?

We will use f09_g17 (about 1x1deg).

Which compset?

We will run with all components active, so a B compset. The correct GHGs will need to be defined and this is also handled by the compset. For dates initialized before 2014, we use the BHIST compset. For dates initialized in 2014 or later, we use the BSSP585 compset (this is nearly equivalent to RCP8.5 scenario). GHGs in 2014 are projected based on this scenario.

Since we will initialize on Jan 7, 2019, we will use the BSSP585 compset.

Namelist Configurations

To meet the output requirements of the SubX protocol, we will want to set the namelists to give us daily data for many variables and some additional variables that are not default in CESM. The namelist files can be copied from my experiment directory: ~cstan/cases/s2sfcst/user_nl_*

Initial Conditions

It is not easy or advisable to make your own initial conditions for each component of the model. If you want initial conditions, you need to get them from someone at NCAR. The Earth System Prediction Working Group is the best source.

The experiment will be a hybrid run (RUN_TYPE=hybrid) in which the initial conditions are staged by the user (GET_REFCASE=FALSE). They are located in:

/glade/scratch/cstan/fcst/rest/2019-01-07/

$ ls /glade/scratch/cstan/fcst/rest/2019-01-07/
b.e21.f09_g17.cam.i.2019-01-07-00000.nc
I2000Clm50BgcCrop.002runRealtime.cism.r.2019-01-07-00000.nc
I2000Clm50BgcCrop.002runRealtime.clm2.h0.2019-01-01-00000.nc
I2000Clm50BgcCrop.002runRealtime.clm2.h1.2019-01-01-00000.nc
I2000Clm50BgcCrop.002runRealtime.clm2.r.2019-01-07-00000.nc
I2000Clm50BgcCrop.002runRealtime.clm2.rh0.2019-01-07-00000.nc
I2000Clm50BgcCrop.002runRealtime.clm2.rh1.2019-01-07-00000.nc
I2000Clm50BgcCrop.002runRealtime.cpl.r.2019-01-07-00000.nc
I2000Clm50BgcCrop.002runRealtime.mosart.h0.2018-12.nc
I2000Clm50BgcCrop.002runRealtime.mosart.h1.2019-01-01-00000.nc
I2000Clm50BgcCrop.002runRealtime.mosart.r.2019-01-07-00000.nc
I2000Clm50BgcCrop.002runRealtime.mosart.rh0.2019-01-07-00000.nc
I2000Clm50BgcCrop.002runRealtime.mosart.rh1.2019-01-07-00000.nc
rpointer.atm
rpointer.drv
rpointer.glc
rpointer.ice
rpointer.lnd
rpointer.ocn.ovf
rpointer.ocn.restart
rpointer.ocn.tavg
rpointer.rof

The model will look for restart files that begin with the name RUN_REFCASE, but our files don’t all begin with that name. We will need to copy them to our run directory and change their name so the model will find them. We will change most of them to b.e21.f09_g17

SourceMods

There are changes to source code in this run. We will need to copy the new SourceMods from my experiment directory ~cstan/cases/s2sfcst/SourceMods/ to the SourceMods in the experiment directory.

Configuration changes in env_run.xml

RUN_TYPE=hybrid

RUN_STARTDATE=2019-01-07

RUN_REFDATE=2019-01-07

RUN_REFCASE=b.e21.f09_g17

GET_REFCASE=FALSE

STOP_OPTION=ndays

STOP_N=45

Specific to this run configuration (these were obtained from NCAR and are not something you would know offhand):

./xmlchange –force CLM_NAMELIST_OPTS=use_init_interp=.true.

./xmlchange CCSM_BGC=CO2A

./xmlchange OCN_CHL_TYPE=diagnostic

./xmlchange OCN_TRACER_MODULES=iage

Since the run is short, we can reduce the wallclock times the run and archiving:

./xmlchange JOB_WALLCLOCK_TIME=01:00:00

./xmlchange –subgroup case.st_archive JOB_WALLCLOCK_TIME=01:00:00

Setup Experiment with a script

Go to your home directory and create a scripts directory.

Go to your scripts directory, create a file called s2sfcsts.sh and open it in your preferred editor..

The .sh indicates that we will write a bash shell script. A bash shell script is a collection of Unix commands combined with a set of syntax rules for assigning variables and making loops and conditionals.

Note: The script we got from Dr. Swenson for the added heading experiments was a c-shell script. It is also a collection of Unix commands, but it has a different set of syntax rules for assigning variables and making loops and conditionals.

Which to use is a matter of personal preference. You will likely see bash shell (.sh) more often than c-shell (.csh), so I will show you how to write a bash shell script.

We will write the script together. A copy is located here on Cheyenne for reference: ~cstan/scripts/s2sfcsts.sh

Once your script is ready, you can make is executable.

$ chmod +x s2sfcsts.sh

and run it

$ ./s2sfcsts.sh

It will take a few minutes to run since it has to do everything so setup and build the model. If it fails to build, you will get an error.

Want to learn more about unix commands and shell scripting? See the Software carpentry tutorial

Key Points