wiki:Documentation/UserGuide/Perturb

Version 5 (modified by luyssaert, 7 years ago) (diff)

--

How to perturb the initial conditions in LMDZOR?

Why?

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.

How?

At present the easiest way to perturb the initial conditions of LMDZOR seems to consist of adjusting the results of the ELI experiments.

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.jussieu.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 /ccc/store/cont003/dsm/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 /ccc/store/cont003/dsm/p529luy/IGCM_OUT/LMDZ/ELI-128x118x39-2010-R2 should now look as an independent folder. The initial atmospheric conditions are given in /ccc/store/cont003/dsm/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 = '/ccc/store/cont003/dsm/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+')
lon = ncfile.variables['rlonu']
lat = ncfile.variables['rlatu']
lev = ncfile.variables['nivsigs']
teta = ncfile.variables['teta']
n_lon = len(lon)
n_lat = len(lat)
n_lev = len(lev)
print 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 /ccc/store/cont003/dsm/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

copy the config change COMP/lmdz.card ELI