\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 Physics}, pdfauthor={LMDZ team},
  hypertexnames=false, pdfstartview=FitBH}
\fi

\author{LMDZ team}
\title{LDMZ tutorial: physics}
\date{November 30th, 2017}


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


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

\begin{document}

\maketitle

This tutorial focuses on switching between different physics parametrizations in LMDZ.

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

\section{Prerequisits}

You should be familiar with setting up simulations, as described in tutorials
\#1 and \#2.

\section{Switching between physics parametrizations}

You can change the parameters of the model that are set up in the \verb+.def+ files 
and run new simulations without having the compile the model again. This is very 
convenient to test different parameterizations.

\begin{itemize}
\item Prepare for five more days of simulation: rename files
  \verb+restart.nc+ and \verb+restartphy.nc+ (created at the end of
  the first simulation) to \verb+start.nc+ and \verb+startphy.nc+.

\item Create a directory where you will run the model with modified
  \verb+.def+ files. In this new directory, you can create symbolic
  links to the files \verb+start.nc+, \verb+startphy.nc+ and
  \verb+limit.nc+ which are in \verb+TUTO/SIMU1+, and you need to copy the
  \verb+*.def+ files from \verb+TUTO/SIMU1+, except those beginning with
  \verb+used_+. If you used \verb+veget=1+, don't forget to create a link called \verb+sechiba_rest_in.nc+ pointing to the 
\verb+../SIMU0/sechiba_rest_out.nc+ file. Here are the commands you will need:

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

In case you re-run the simulation, make sure to remove the \verb+sechiba_rest_out.nc+ file in the directory, or the model 
will stop with an error (\verb+STOP 1+).

\item In your new directory, in file \verb+physiq.def+, change the
  boundary layer parameterization by deactivating the Mellor and
  Yamada scheme for the boundary layer, based on a prognostic equation
  for the Turbulent Kinetic Energy:
\begin{verbatim}
iflag_pbl = 1
\end{verbatim}
  instead of the nominal value 11 (which corresponds to the variant
  for very stable planetary boundary layer and exact dissipation).
  Thus, you will switch to the "Standard Physics" (SP, LMDZ5A).
\item Run the model in the two directories and compare the results. You can use a 
convenient command called \verb+ncdiff+ to directly compute the difference between 
the two NetCDF files in a new file:

\begin{verbatim}
ncdiff ../SIMU1/histday.nc histday.nc histday_diff.nc
\end{verbatim}

\item Another test you can try is to deactivate the thermal plume model:
\begin{verbatim}
iflag_thermals=0
\end{verbatim}
  instead of the nominal value 18.
\end{itemize}

Remember that you can modify the content or time frequency of the
output files if you want to focus on a particular question.

\end{document}
