3: Starting a Historical Simulation from a Spun-Up State#
By default the FHISTC_LTso starts from a default initial condition in 1979, but you can start from another year and use initial conditions coming from a previous run.
Why Start from a Spun-Up State?
In the control exercise, you ran FHISTC_LTso using its default setup, which starts around 1979.
In this exercise, you will run the same compset, FHISTC_LTso, but start the simulation in 1850 using initial conditions from a spun-up pre-industrial simulation.
This allows you to compare two historical atmosphere-only simulations:
fhist.control:
FHISTC_LTsostarting from the default initial conditions, around 1979.fhist.1850:
FHISTC_LTsostarting in 1850 from spun-up pre-industrial initial conditions.
Both cases use FHISTC_LTso. The main differences are the model start date and the initial condition source.
By comparing these two cases, you will learn how to distinguish between:
The compset
The forcing datasets
The model start date
The source of initial conditions
Create, configure, build, and run a case called fhist.1850 using:
Compset: FHISTC_LTso Resolution: ne16pg3_ne16pg3_mg17
Use the same CAM history output settings as in the control case.
Initialize the model using restart files from:
b.e21.B1850.f19_g17.CMIP6-piControl-2deg.001
at model year:
0321-01-01
Start the simulation on: 1850-01-01
Run for 5 days.
Check your solution:
How can you check that there is a difference between the set up of this and your control?
How can you check that it is running the way you intended: using ssts & ghg forcings from time-varying, historical files?
What year is the model running?
Questions to Think About
Before looking at the solution, consider:
What is the default start date of fhist.control?
What is the start date of fhist.1850?
Are both cases using the same compset?
Are both cases using historical forcing datasets?
Which settings control the initial conditions?
Which settings control the calendar date of the simulation?
Click here for hints
How do I start my run using initialization datasets from a previous run?
Look at chapter
Modifify the run type. In that chapter, you learned different ways to start the model, and how to use initial conditions/restart files from a different case to start up a hybrid case. Use that method for the current exercise.
For this exercise, you will create a hybrid run, which allows the model to:
Use restart files from another simulation. Start from a different calendar date. Use a different forcing period than the source simulation.
Where are restart files located?
Many spun-up simulations are available through the CESM inputdata repository (DIN_LOC_ROOT).
For this exercise, the restart files are referenced through:
b.e21.B1850.f19_g17.CMIP6-piControl-2deg.001
Data from spun-up model runs can be found in inputdata (DIN_LOC_ROOT) .
How do I start my run in 1850?
Look at the description of the xml variable
RUN_STARTDATE
How do I output 3 hourly instantaneous variables?
Use namelist variables:
nhtfrq,mfilt,fincl.For more information, look at the chapter:
NAMELIST MODIFICATIONS -> Customize CAM output
I am getting an error: This compset and grid combination is untested in CESM
overide this error by adding
--run-unsupportedto the create_newcase command
Click here for the solution
# Set environment variables
Set environment variables with the commands:
tcsh
set CASENAME=fhist.1850
set CASEDIR=/glade/u/home/$USER/cases/$CASENAME
set RUNDIR=/glade/derecho/scratch/$USER/$CASENAME/run
set COMPSET=FHISTC_LTso
set RESOLUTION=ne16pg3_ne16pg3_mg17
bash
export CASENAME=fhist.1850
export CASEDIR=/glade/u/home/$USER/cases/$CASENAME
export RUNDIR=/glade/derecho/scratch/$USER/$CASENAME/run
export COMPSET=FHISTC_LTso
export RESOLUTION=ne16pg3_ne16pg3_mg17
# Create a new case
Create a new case with the command create_newcase:
cd /glade/u/home/$USER/code/my_cesm_code/cime/scripts/
./create_newcase --case $CASEDIR --res $RESOLUTION --compset $COMPSET --run-unsupported
# Change the job queue and account number
If needed, change job queue and account number.
For instance, to run in the queue tutorial and the project number UESM0014
cd $CASEDIR
./xmlchange JOB_QUEUE=tutorial,PROJECT=UESM0014 --force
This step can be redone at anytime in the process.
# Setup
Invoke case.setup with the command:
cd $CASEDIR
./case.setup
# Customize namelists
Edit the file user_nl_cam and add the lines:
nhtfrq(2) = -3
mfilt(2) = 240
fincl2 = 'TS:I','PS:I', 'U850:I','T850:I','PRECT:I','LHFLX:I','SHFLX:I','FLNT:I','FLNS:I'
interpolate_output(2) = .true.
interpolate_nlat(2) = 91
interpolate_nlon(2) = 180
This creates a second CAM history stream, h1, with 3-hourly instantaneous output.
You can edit the file with a text editor. Alternatively, you can add the lines using echo:
echo "nhtfrq(2) = -3">> user_nl_cam
echo "mfilt(2) = 240">> user_nl_cam
echo "fincl2 = 'TS:I','PS:I', 'U850:I','T850:I','PRECT:I','LHFLX:I','SHFLX:I','FLNT:I','FLNS:I'">> user_nl_cam
echo "interpolate_output(2) = .true.">> user_nl_cam
echo "interpolate_nlat(2) = 91">> user_nl_cam
echo "interpolate_nlon(2) = 180">> user_nl_cam
echo "">> user_nl_cam
You build the namelists with the command:
./preview_namelists
This step is optional as the script preview_namelists is automatically called by case.build and case.submit. But it is nice to inspect the namelists to make sure that your changes made their way into:
$CASEDIR/CaseDocs/atm_in
# change starting date and ref case
Set the simulation start date:
./xmlchange RUN_STARTDATE=1850-01-01
Specify the reference case:
./xmlchange RUN_REFCASE=b.e21.B1850.f19_g17.CMIP6-piControl-2deg.001
Specify the restart date:
./xmlchange RUN_REFDATE=0321-01-01
Configure the run type:
./xmlchange RUN_TYPE=hybrid
Verify the settings:
./xmlquery RUN_TYPE,RUN_STARTDATE,RUN_REFCASE,RUN_REFDATE
**# Set run length**
If needed, change the ``run length``. If you want to run 5 days, you don't have to do this, as 5 days is the default.
./xmlchange STOP_N=5,STOP_OPTION=ndays
------------
Verify the Configuration
Check the Run Type
./xmlquery RUN_TYPE
Expected:
RUN_TYPE: hybrid
Check the Start Date
./xmlquery RUN_STARTDATE
Expected:
1850-01-01
Check the Reference Case
./xmlquery RUN_REFCASE,RUN_REFDATE
Expected:
RUN_REFCASE: b.e21.B1850.f19_g17.CMIP6-piControl-2deg.001 RUN_REFDATE: 0321-01-01
**# Build and submit**:
qcmd – ./case.build ./case.submit
Compare with the Control Case
Compare the settings of fhist.control and fhist.1850:
Setting fhist.control fhist.1850
Compset FHISTC_LTso FHISTC_LTso
Resolution ne16pg3_ne16pg3_mg17 ne16pg3_ne16pg3_mg17
Forcing Protocol Historical Historical
Initial Conditions Default Restart files from spun-up simulation
Start Date ~1979 1850
The key difference is the initialization strategy and model start date.
**# Check your solution**
When the run is completed, look at the history files into the archive directory.
(1) Check that your archive directory on derecho (The path will be different on other machines):
cd /glade/derecho/scratch/\(USER/archive/\)CASENAME/atm/hist ls
As your run is only 5-day, there should be no monthly file (``h0``)
Notice that the start year is `1850`.
(2) Look at the contents of the ``h1`` files using ``ncdump``.
- The file should contain the instantaneous output in the file ``h1`` for the variables:
float FLNS(time, lat, lon) ;
FLNS:Sampling_Sequence = "rad_lwsw" ;
FLNS:units = "W/m2" ;
FLNS:long_name = "Net longwave flux at surface" ;
float FLNT(time, lat, lon) ;
FLNT:Sampling_Sequence = "rad_lwsw" ;
FLNT:units = "W/m2" ;
FLNT:long_name = "Net longwave flux at top of model" ;
float LHFLX(time, lat, lon) ;
LHFLX:units = "W/m2" ;
LHFLX:long_name = "Surface latent heat flux" ;
float PRECT(time, lat, lon) ;
PRECT:units = "m/s" ;
PRECT:long_name = "Total (convective and large-scale) precipitation rate (liq + ice)" ;
float PS(time, lat, lon) ;
PS:units = "Pa" ;
PS:long_name = "Surface pressure" ;
float SHFLX(time, lat, lon) ;
SHFLX:units = "W/m2" ;
SHFLX:long_name = "Surface sensible heat flux" ;
float T850(time, lat, lon) ;
T850:units = "K" ;
T850:long_name = "Temperature at 850 mbar pressure surface" ;
float TS(time, lat, lon) ;
TS:units = "K" ;
TS:long_name = "Surface temperature (radiative)" ;
float U850(time, lat, lon) ;
U850:units = "m/s" ;
U850:long_name = "Zonal wind at 850 mbar pressure surface" ;
Note that these variables have no ``cell_methods`` attribute becasue the output is instantaneous.
</details>
</div>