\documentclass{article}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}

\usepackage{a4wide}
\begin{document}

\def\afaire#1{{\bf Afaire : #1}}
\title{Hands on tutorial : installing, compiling and executing the model}
\date{December 2, 2021}
\author{The LMDZ team}

\maketitle

This first tutorial focuses on installing and making a simple bench run. It ensures that you will be ready for the hands-on tutorials of the training session
starting on the 8th of December

This document can be downloaded as a pdf file:
\begin{verbatim}
wget http://lmdz.lmd.jussieu.fr/pub/Training/Tutorials/Tutorial_simple.pdf
\end{verbatim}
which should ease any copy/paste of command lines to issue.

%\def\infol#1{#1}
%\def\infol#1{\verb+ #1 +}
\def\infol#1{{\bf #1}}
%\newcommand{\infol}[1]{\verb\+ #1 \+}

\def\resol#1#2#3{#1$\times$#2-L#3} %


\section{Prerequisites}

To run LMDZ, you will need a significant amount of memory, so first
ensure this is true. You can use the following command line

\begin{verbatim}
ulimit -Ss unlimited
\end{verbatim}

but be advised we have encounterd cases where this did not work and you had to specify a numeric amount.




\section{Running the install\_lmdz.sh script}

The first step consists in downloading it from the LMD website
and {\em blindly} running it (after having first set the access permissions
to make it executable):
\begin{verbatim}
wget http://lmdz.lmd.jussieu.fr/pub/install_lmdz.sh
chmod +x install_lmdz.sh
./install_lmdz.sh
\end{verbatim}

Launching the script with no options, as indicated above, will 
download the latest version of the source code, compile it and run a simple bench test case
at resolution \resol{32}{32}{39}. \newline
Compilation should take around five minutes.
The test bench is then downloaded and the
1 day long test simulation on a regular \resol{32}{32}{39} grid is run ;
messages about various downloads (via \infol{wget}) and/or compiler
informations are displayed.

The script should then run smoothly (if it isn't the case,
immediately ask for some assistance) and
end with messages such as:
\begin{verbatim}
##########################################################
Simulation finished in ...
You have compiled with:
./makelmdz...
You may re-run it with : cd  ...
or ./bench.sh
##########################################################
\end{verbatim}

You can take advantage of the installation time to open a second terminal
window and explore the downloaded directories and files.\newline

\verb+install_lmdz.sh+ will check if some archives (LMDZ, NetCDF library, etc.) are
on the disk (in the \verb+~/LMDZ+ directory and subdirectories) and if not, will try to retrieve
them through the network using \verb+wget+ command.
It will create the \infol{LMDZtrunk} directory ; inside, you will find subdirectories
\infol{modipsl}, which contains the model, and
\infol{netcdf-4.0.1}, which contains the NetCDF library.

In \infol{modipsl}, you will find directory \infol{modeles}, containing the 
\infol{LMDZ} directory.


Once the test bench simulation has been launched (the final step of the \infol{install\_lmdz.sh}
script), you will also find a  \infol{LMDZ/BENCH32x32x39/} directory from where
you will be able to list the outputs of the run (even if the simulation is still running:
it indeed takes a few minutes to complete the 1 day-long run on a single processor).
Check out the contents of this directory and use your favorite software (Grads,
Ferret,...) to browse the contents of the \infol{histday.nc} file.\newline

\end{document}
