\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{December 7th, 2020}


\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.

You will run a simulation with modified \verb+.def+ files.

\begin{itemize}
\item Create a new simulation folder in \verb+TUTORIAL+ :

\verb+mkdir SIMU1_test1 +

\item Prepare the folder with the needed files (or links to files) :

The simulation will start from initial files produced by SIMU1. If you performed another optional tutorial exercise, you might already have a start.nc and a startphy.nc file in SIMU1. If you don't have them, rename the SIMU1/restart* files :

\begin{verbatim}
mv SIMU1/restart.nc SIMU1/start.nc
mv SIMU1/restartphy.nc SIMU1/startphy.nc
\end{verbatim}

In \verb+SIMU1_test1+ , create links to the limit.nc and start* files that are in SIMU1:
\begin{verbatim}
cd SIMU1_test1
ln -s ../SIMU1/start.nc .
ln -s ../SIMU1/startphy.nc .
ln -s ../SIMU1/limit.nc .
\end{verbatim}
 
 If you used \verb+veget=1+, you must also create a link called \verb+sechiba_rest_in.nc+ pointing to the 
\verb+../SIMU0/sechiba_rest_out.nc+ file:

\begin{verbatim}
ln -s ../SIMU0/sechiba_rest_out.nc sechiba_rest_in.nc+
\end{verbatim}

Copy from \verb+SIMU1+ all the \verb+*.def+ files from, except for those beginning with \verb+used_+ :

\begin{verbatim}
cp ../SIMU1/*.def .
rm -f used_*.def
\end{verbatim}

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

\item In your new directory \verb+SIMU1_test1+, in file \verb+physiq.def+, change the
  boundary layer parameterization by deactivating the Mellor and
  Yamada boundary-layer scheme (based on a prognostic equation
  for the Turbulent Kinetic Energy):
\begin{verbatim}
iflag_pbl = 1
\end{verbatim}
  instead of the nominal value 12 (which corresponds to the Mellor-Yamada variant
  for very stable planetary boundary layer and exact dissipation, with vertical diffusion off q2).
  Thus, you will switch to the "Standard Physics" (SP, LMDZ5A).
  
\item Run the model in \verb+SIMU1_test1+, using the executable \verb+gcm.e+ available in TUTORIAL :
\begin{verbatim}
../gcm.e
\end{verbatim}

\item 
Compare the results of \verb+SIMU1+ and \verb+SIMU1_test1+. You can use a 
convenient command called \verb+ncdiff+ to directly compute the difference between 
the two NetCDF files in a new file (provided that the 2 files have the same number of timesteps):

\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}
