% $Id: exercise_interface.tex 1515 2015-01-02 11:35:51Z witha $
\input{header_tmp.tex}
%\input{../header_lectures.tex}

\usepackage[utf8]{inputenc}
\usepackage{ngerman}
\usepackage{pgf}
\usepackage{subfigure}
\usepackage{units}
\usepackage{tabto}
\usepackage{multimedia}
\usepackage{hyperref}
\newcommand{\event}[1]{\newcommand{\eventname}{#1}}
\usepackage{xmpmulti}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning}
\usetikzlibrary{decorations.markings}             %neues paket
\usetikzlibrary{decorations.pathreplacing}        %neues paket
\def\Tiny{\fontsize{4pt}{4pt}\selectfont}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{pdfcomment}
\usepackage{graphicx}
\usepackage{listings}
\lstset{language=[90]Fortran,
  basicstyle=\ttfamily \tiny,
  keywordstyle=\color{black},
  commentstyle=\color{black},
  morecomment=[l]{!\ }% Comment only with space after !
}


\institute{Institute of Meteorology and Climatology, Leibniz Universität Hannover}
\selectlanguage{english}
\date{last update: \today}
\event{PALM Seminar}
\setbeamertemplate{navigation symbols}{}

\setbeamertemplate{footline}
  {
    \begin{beamercolorbox}[rightskip=-0.1cm]&
     {\includegraphics[height=0.65cm]{imuk_logo.pdf}\hfill \includegraphics[height=0.65cm]{luh_logo.pdf}}
    \end{beamercolorbox}
    \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,
      leftskip=.3cm,rightskip=0.3cm plus1fil]{title in head/foot}
      {\leavevmode{\usebeamerfont{author in head/foot}\insertshortauthor} \hfill \eventname \hfill \insertframenumber \; / \inserttotalframenumber}
    \end{beamercolorbox}
    \begin{beamercolorbox}[colsep=1.5pt]{lower separation line foot}
    \end{beamercolorbox}
  }
%\logo{\includegraphics[width=0.3\textwidth]{luhimuk_logo.pdf}}

\title[Exercise 3: User Interface]{Exercise 3: User Interface}
\author{PALM group}

\setbeamersize{text margin left=.2cm,text margin right=.2cm}

\begin{document}
\footnotesize
% Folie 1
\begin{frame}
\titlepage
\end{frame}

\section{Exercise}
\subsection{Exercise}

% Folie 2
\begin{frame}
   \frametitle{Exercise 3: User Interface}
   \begin{itemize}
      \item Carry out a run for a convective boundary layer where a surface heat flux is given for a limited rectangular area only.

            \tikzstyle{green} = [rectangle, draw, fill=green!70, minimum size=51pt, font=\tiny]
            \tikzstyle{red} = [rectangle, draw, fill=red!90, text width=44.77pt, minimum size=20pt, font=\tiny]
            \tikzstyle{textd} = [rectangle, font=\normalsize]
            \tikzstyle{line} = [draw, -]
            \begin{center}
            \begin{tikzpicture}[auto, node distance=0]
               \uncover<2->{\node [green] (green) {};}
               \uncover<3->{\node [red, rotate=90] (red) {};}
               \uncover<4->{\node [textd] (textd) {d};}
               \uncover<4->{\draw [latex-,line width=0.8pt] (red.south) -- (textd.east);}
               \uncover<4->{\draw [latex-,line width=0.8pt] (red.north) -- (textd.west);}
            \end{tikzpicture}
            \end{center}

      \item<5-> It should be possible to control the area width d by a user-defined parameter in the parameter file. All other parameters should be chosen as in the example run ({\texttt{\scriptsize example\_cbl}}).
      \item<6-> Create horizontal and vertical cross sections of variables in order to analyze the flow field.
      \item<7-> Create mean vertical profiles of temperature and resolved/subgrid-scale heatflux for the total domain but also for the limited rectangular area and the total domain without the limited area. Also create time series for these three domains.\\ 
      This can be done by using the \textbf{statistic region concept} already implemented in PALM.

   \end{itemize}

\end{frame}

% Folie 3
\begin{frame}
   \frametitle{The statistic region concept}
    \begin{itemize}
       \item<1-> By default, mean horizontal profiles are calculated and output for the total domain.
       \item<2-> The user can define up to nine so-called statistic regions, which can be arbitrary subsets of the total domain and PALM will calculate and output mean profiles for these regions too.
    \end{itemize}
    \vspace{1em}
    \onslide<3->\textbf{Procedure:}
    \begin{enumerate}
       \item<3-> Set the number of statistic regions you additionally want to define by assigning a value to the {\texttt{\scriptsize {\&}inipar}}-parameter {\texttt{\scriptsize statistic\_regions}}.
       \item<4-> Within the user-interface ({\texttt{\scriptsize user\_init}}), set the masking array {\texttt{\scriptsize rmask}}. It is an {\texttt{\scriptsize INTEGER}} array with array-bounds
       \begin{center}
       {\texttt{\scriptsize rmask(nysg:nyng,nxlg:nxrg,0:9)}}
       \end{center}
       The last index represents the respective statistic region (index {\texttt{\scriptsize 0}} stands for total domain). Assign a 1 to each array element (grid point) which shall belong to the respective statistic region.\\
       {\texttt{\scriptsize rmask}} is pre-set as:
       \begin{center}
       {\texttt{\scriptsize rmask(:,:,0:9)   = 1}}
       \end{center}
    \end{enumerate}
\end{frame}


% Folie 4
\begin{frame}
   \frametitle{Additional hints}
    \begin{itemize}
       \item<1-> Keep in mind that every PE calculates for a different subset of the total domain. Array bounds of the total domain are {\texttt{\scriptsize (0:ny,0:nx)}}, those of the subdomains {\texttt{\scriptsize (nys:nyn,nxl:nxr)}}, where {\texttt{\scriptsize nys, nyn, nxl, nxr}} vary for each subdomain.
       \item<2-> {\texttt{\scriptsize rmask}} can also be used to modify the array which defines the surface heatflux ({\texttt{\scriptsize shf}}):
       \begin{center}
       {\texttt{\scriptsize shf $=$ shf * rmask(:,:,1)}}
       \end{center}
       sets the surface heatflux to zero at all those array elements (grid points), where {\texttt{\scriptsize rmask(...,1)}} is zero.
       \item<3-> In case of using the default netCDF format, the profile data for the additional statistic regions are added to the default local file {\texttt{\scriptsize DATA\_1D\_PR\_NETCDF}}.
       \item<4-> The developing mean flow is quasi two-dimensional (in the xz-plane). You can easily get plots of the mean flow by averaging results along the y-axis. The standard output provides such averages. See description of parameter {\texttt{\scriptsize \textcolor{blue}{section\_xz}}} on how to get averages along y.
    \end{itemize}
\end{frame}

% Folie 5
\begin{frame}
   \frametitle{If You Finished the Exercise Very Fast:}
    \begin{itemize}
       \item<1-> Repeat the simulation, but now for a geostrophic wind of 0.5 m/s
       \item<2-> The resulting flow will be (should be) quite similar to the flow over an arctic lead.
    \end{itemize}
\end{frame}

% Folie 6
\section{Results \quad \, }
\subsection{Results}

% Folie 7
\begin{frame}
   \frametitle{XY cross-sections}
   \begin{center}
      \includegraphics[width=0.415\textwidth]{exercise_interface_figures/xy_shf.eps}
      \includegraphics[angle=90,width=0.60\textwidth]{exercise_interface_figures/xy_w.eps}\\
   \end{center}
\end{frame}

% Folie 8
\begin{frame}
   \frametitle{vertical profiles (I)}
   \begin{center}
      \includegraphics[angle=90,width=0.8\textwidth]{exercise_interface_figures/pr_pt0.eps}
   \end{center}
\end{frame}

% Folie 9
\begin{frame}
   \frametitle{XZ cross-sections after 1h (averaged)}
   \begin{center}
      \includegraphics[angle=90,width=0.8\textwidth]{exercise_interface_figures/xz_w_avg.eps}\\
   \end{center}
\end{frame}

% Folie 10
\begin{frame}
   \frametitle{XZ cross-sections after 1h (instantaneous)}
   \begin{center}
      \includegraphics[angle=90,width=0.8\textwidth]{exercise_interface_figures/xz_w_y1000.eps}\\
   \end{center}
\end{frame}

% Folie 11
\begin{frame}
   \frametitle{vertical profiles (II)}
   \begin{center}
      \includegraphics[angle=90,width=0.75\textwidth]{exercise_interface_figures/pr_wpt_resolved.eps}
   \end{center}
\end{frame}

% Folie 12
\begin{frame}
   \frametitle{time series (I)}
   \begin{center}
      \includegraphics[angle=90,width=0.7\textwidth]{exercise_interface_figures/ts_pt0.eps}\\
   \end{center}
\end{frame}

% Folie 13
\begin{frame}
   \frametitle{time series (II)}
   \begin{center}
      \includegraphics[angle=90,width=0.7\textwidth]{exercise_interface_figures/ts_wpt0.eps}\\
   \end{center}
\end{frame}

% Folie 14
\begin{frame}
   \frametitle{time series (III)}
   \begin{center}
      \includegraphics[angle=90,width=0.7\textwidth]{exercise_interface_figures/ts_wpt0_sgs.eps}\\
   \end{center}
\end{frame}

% Folie 15
\begin{frame}
   \frametitle{XZ cross-sections (b) - averaged}
   \begin{center}
      \includegraphics[angle=90,width=0.7\textwidth]{exercise_interface_figures/xz_w_avg_wind.eps}
   \end{center}
\end{frame}

% Folie 16
\begin{frame}
   \frametitle{XZ cross-sections (b) - instantaneous}
   \begin{center}
      \includegraphics[angle=90,width=0.7\textwidth]{exercise_interface_figures/xz_w_y250_wind.eps}\\
   \end{center}
\end{frame}


\end{document}