\documentclass[a4paper]{article}

                                % Packages

\usepackage[utf8]{inputenc}
\usepackage{ifpdf}

\ifpdf
\else
\usepackage[active]{srcltx}
\fi

\usepackage{amsmath}

\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{geometry}

\usepackage[np]{numprint}

\usepackage{hyperref}
\ifpdf
\hypersetup{pdftitle={Tutorial Nudging}, pdfauthor={LMDZ team},
  hypertexnames=false, pdfstartview=FitBH}
\fi

\author{LMDZ team}
\title{LDMZ tutorial: Nudging}
\date{December 9th, 2021}


\geometry{top=2cm,bottom=2cm,left=2.5cm,right=2.5cm}


                                %---------------

\begin{document}

\maketitle

This tutorial focuses on using the nudging capability with LMDZ.


This document can be downloaded as a pdf file (so you could copy/paste command lines from it):
\begin{verbatim}
wget http://lmdz.lmd.jussieu.fr/pub/Training/Tutorials/Tutorial_Nudging.pdf
\end{verbatim}


\section{Prerequisits }
\textbf{You should have executed the mandatory part of Tutorial \#2.}

\section{Experimenting with nudging}

\begin{itemize}
\item The program \verb+ce0l.e+ (which was run by \verb+init.sh+ in
  Tutorial2) created the file \verb+grilles_gcm.nc+ in the \verb+INITIAL+ directory. 
  \verb+grilles_gcm.nc+ contains the longitudes and latitudes of the model grids (staggered) grids for 
zonal wind, meridional wind and temperature. 

You can open this file with \verb+ferret+, \verb+ncview+ or \verb+grads+ 
and visualize the grid by plotting the variable \verb+grille_s+. 

You can visualize the orography as seen by the zoomed grid by plotting the variable \verb+phis+ (which, despite its name, actually contains the surface altitude, in m). 

  You can also get an idea about the horizontal resolution of the model
  by plotting the square root of the grid mesh area (variable \verb+aire+, in m$^2$).
  
\item You will nudge the model with wind fields (u and v components) from the ERA-Interim reanalysis. 
These files must be retrieved from a repository, and interpolated on the model grid.
For that, in the directory \verb+TUTORIAL+, run the script \verb+get_era.sh+ :

\verb+./get_era.sh+

  You should end up with a directory called \verb+GUIDAGE+ 
("nudging" in French) that contains the the ERAI files (\verb+GLOBAL_075+), and the interpolated ones, \verb+u.nc+ and
  \verb+v.nc+. 
  
  \textbf{Note 1:} For this tutorial, we have given open access to a subset of the ERA-interim wind fields.  
  ERA-interim files are stored at IDRIS, CCRT and Climserv, with restricted access. 
  To access these files at IDRIS or on Climserv, you should contact Sophie Bouffies-Cloché (IPSL). 
  For access at CCRT, contact Anne Cozic (LSCE). 
  
  \textbf{Note 2:} \verb+get_era.sh+ is a simplified script for use with the tutorial. More general scripts
  are available on the Subversion server of IGCMG: 
  \url{http://forge.ipsl.jussieu.fr/igcmg/browser/CONFIG/LMDZOR/branches/LMDZOR_v4/CREATE/SCRIPT}.  
For example, if you want to run long simulations, you can use the script \verb+era2gcm.ksh+ which interpolates the ERA data on the GCM grid, 
called on multiple months by another script (see \verb+interp_from_era.ksh+ for example) 

\item In the directory \verb+TUTORIAL+, create a new directory, called for example \verb+SIMU1_nudged+, 
and gather in it all the (links to) files you need to run a new simulation:

\begin{verbatim}
mkdir SIMU1_nudged
cd SIMU1_nudged
ln -s ../SIMU1/start.nc .
ln -s ../SIMU1/startphy.nc .
ln -s ../SIMU1/limit.nc .
cp ../SIMU1/*.def .
rm -f used_*.def
\end{verbatim}

Point to the nudging files:

\begin{verbatim}
ln -s ../GUIDAGE/u.nc .
ln -s ../GUIDAGE/v.nc .
\end{verbatim}


\item Take a look at the file \verb+guide.def+. Nudging is activated for
  variables u and v only (as is often the case). The relaxation time
  is set to 3 hours inside the zoomed area (\verb+tau_max=0.125+ days)
  and half an hour outside (\verb+tau_min+=0.0208333 days). The
  smaller the relaxation time, the stronger the nudging. You can
  change the parameters of this file if you want.
\item In \verb+run.def+ add the line:
\begin{verbatim}
INCLUDEDEF=guide.def
\end{verbatim}

\item Run the model again with nudging:
\begin{verbatim}
../gcm.e > listing
\end{verbatim}
\item Make sure that the nudged simulation worked, by comparing the 6-hourly winds in the \verb+histhf.nc+ output file
to those in the \verb+u.nc+ and \verb+v.nc+ files.
For a given time and pressure level, you should see the same patterns of \verb+u+ and \verb+v+ wind components.

For example compare the first timestep of the \verb+u.nc+ and \verb+v.nc+ files at 500~hPa level (k=22 in Ferret)
with the first timestep of the \verb+u+ and \verb+v+ variables in the \verb+histhf.nc+ output file at about the same level (k=28 in Ferret). 
(Note that the pressure levels on the nudging files are in millibars, while in the LMDZ output they are in Pa.)

% Ferret script : 
% cancel mode logo
% use u.nc ; use histhf.nc ; use "../SIMU1/histhf.nc" ; 
% set reg/l=4
% set v ul ; shade/lev=(-25,65,10) UWND[d=1,k=22] ; go land  
% set v ll ; shade/lev=(-25,65,10) vitu[d=2,k=28] ; go land
% set v lr ; shade/lev=(-25,65,10) vitu[d=3,k=28] ; go land

\item Compare the results of the simulations with and without nudging.


\end{itemize}


\end{document}
