wiki:Documentation/UserGuide/Perturb

Version 11 (modified by abierjon, 6 weeks ago) (diff)

--

How to estimate the uncertainty of an LMDZOR run?

Author: S. Luyssaert
Last revision: S. Luyssaert (2020/03/19)

Objective

Background of this item: a LMDzOR run comes without uncertainty. When comparing, for example, the surface temperature of two treatments, having an uncertainty would allow you to use formal statistics to test whether one treatment is significantly warmer than another.

Rationale

simulations in LMDZOR start with a prescribed atmospheric temperature. This initial temperature is estimated in the ELI experiment. The model results are rather sensitive to the initial conditions. However, the initial condition does not account for the specifics of the land surface. Therefore, one could reason that the initial conditions estimated during the ELI experiment are just one possible realisation from a population of initial conditions. The sensitivity of the model result to the initial conditions can then be tested by running the model for a (small) population of slightly different initial conditions. Such runs could be used as a sensitivity test but they could likewise be used as a proxy for the uncertainty on the simulated climate variables. This approach has been used by for example Fischer et al. 2013. DOI: 10.1038/NCLIMATE2051 (see Methods, Model experiment).

How?

At present the easiest way to perturb the initial conditions of LMDZOR seems to consist of adjusting the results of the ELI experiments. Although the ELI files contain the initial conditions of the model, a spin-up of LMDZOR is still required. Depending on your experiment and the variables you are interested in, discard the first years of the simulation. As an alternative approach one could first spin-up the model for a couple of years starting from the ELI file and then apply the perturbation on the ATM restart files of LMDZOR.

Step-by-step

Run the ELI experiment, for example ELI-128x118x39-2010-R1. Instructions of how to set-up such an experiment can be found at https://forge.ipsl.fr/orchidee/wiki/Documentation/UserGuide/PresentDay. The suffix R1 denotes that this is the first realization from a population of possible, equally likely initial conditions. Copy and rename ELI-128x118x39-2010-R1 to ELI-128x118x39-2010-R2

cd .../p529luy/IGCM_OUT/LMDZ/
cp -rf ELI-128x118x39-2010-R1 ELI-128x118x39-2010-R2
cd ELI-128x118x39-2010-R2/ATM/Output/Restart/
rename 2010-R1 2010-R2 *.nc
cd ../Boundary
rename 2010-R1 2010-R2 *.nc

The folder .../p529luy/IGCM_OUT/LMDZ/ELI-128x118x39-2010-R2 should now look as an independent folder. The initial atmospheric conditions are given in .../p529luy/IGCM_OUT/LMDZ/ELI-128x118x39-2010-R2/ATM/Output/Restart/ in the file JOBNAME_YEAR_start.nc as the variable called TETA. Subsequently we will open this file, perturb TETA by a random field of small perturbations and then save the file with a perturbed value for TETA. Several libraries with ncdf4 functionality (confirmed for nco, R and python) contain commands that enable you to manipulate a variable in a netcdf file. In this example a python script was used to perform these tasks.

#!/usr/bin/env python
#-------------------------------------------------------------------
# Objectives
#-------------------------------------------------------------------
# The script opens the limit file from LMDZOR and perturbs the 
# initial temperature (TETA) as described by Fisher et al.
 
#-------------------------------------------------------------------
# Load modules and functions Definitions
#-------------------------------------------------------------------
import netCDF4
from netCDF4 import Dataset
import numpy as np

#----------------------------------------------------------------
# Simulation settings
#----------------------------------------------------------------
year = 2101
mu = 0.0
sigma = 0.00001
jobname = 'ELI-128x118x39-2100-RCP85-P2'
path = '.../p529luy/IGCM_OUT/LMDZ/'+ jobname+'/ATM/Output/Restart/'
file_name = jobname +'_'+str(year)+'_start.nc'

#----------------------------------------------------------------
# Open file and extract some dimensions 
#----------------------------------------------------------------
fullfile_name = path+file_name
ncfile = Dataset(fullfile_name, mode='r+')
n_lon = len(ncfile.variables['rlonu'])
n_lat = len(ncfile.variables['rlatu'])
n_lev = len(ncfile.variables['nivsigs'])
teta = ncfile.variables['teta']
perturbation = np.random.normal(mu, sigma,[1,n_lev,n_lat,n_lon])
ncfile.variables['teta'][:,:,:,:] = teta[:,:,:,:] + perturbation[:,:,:,:]
ncfile.close()

Before running the script, copy the initial start file because the script will overwrite it. If something goes wrong you will loose the initial values of the ELI simulation. Remember to change the permissions so that python can write the changes into the netcdf file.

cd .../p529luy/IGCM_OUT/LMDZ/ELI-128x118x39-2010-R2/ATM/Output/Restart/
cp JOBNAME_FIRESTYEAR_start.nc JOBNAME_FIRSTYEAR_start_original.nc
chmod 744 JOBNAME_FIRESTYEAR_start.nc

If all went well JOBNAME_FIRESTYEAR_start.nc should have been changed. This can be easily checked by comparing TETA in JOBNAME_FIRESTYEAR_start.nc against JOBNAME_FIRESTYEAR_start_original.nc. A map with the random perturbations should appear. For example,

ferret
use JOBNAME_FIRESTYEAR_start.nc; use JOBNAME_FIRESTYEAR_start_original.nc; shade TETA[k=1,d=1]-TETA[k=1,d=2]; go land

Finally, the perturbed atmospheric temperature can now be used in a simulation. For a detailed description on how to set-up a simulation see https://forge.ipsl.fr/orchidee/wiki/Documentation/UserGuide/PresentDay. For the sake of this example it is assumed that the JOBNAME is CONTROL-R1.

cp -rf CONTROL-R1 CONTROL-R2

The ELI experiment that will be used by LMDZOR is specified in the lmdz.card. Thus makes sure that in config/LMDZOR_v5.2/CONTROL-R1/COMP/lmdz.card ELI-128x118x39-2010-R1 is used and that in config/LMDZOR_v5.2/CONTROL-R2/COMP/lmdz.card ELI-128x118x39-2010-R2 is used. Launch both jobs

ccc_msub Job_CONTROLR1
ccc_msub Job_CONTROLR2

If 3 or more realizations are required, simply repeat this procedure.