% $Id: exercise_cbl.tex 1534 2015-01-27 09:12:08Z suehring $
\input{header_tmp.tex}
%\input{../header_lectures.tex}

\usepackage[utf8]{inputenc}
\usepackage{ngerman}
\usepackage{pgf}
\usepackage{subfigure}
\usepackage{units}
\usepackage{multimedia}
\usepackage{hyperref}
\newcommand{\event}[1]{\newcommand{\eventname}{#1}}
\usepackage{xmpmulti}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning}
\def\Tiny{\fontsize{4pt}{4pt}\selectfont}

%---------- neue Pakete
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{pdfcomment}


\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 1: Convection Between Plates]{Exercise 1: Convection Between Plates}
\author{PALM group}

\begin{document}

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

\section{Exercise}
\subsection{Exercise}

% Folie 2
\begin{frame}
   \frametitle{Exercise 1: Convection Between Plates}
   
   Please try to carry out a run with following initial and boundary conditions and create the required output.
   \begin{itemize}
      \scriptsize
	   \item<2-> The simulation should represent a stationary convective boundary layer between two uniformly heated/cooled plates with zero mean flow.
	   \item<3-> A free-slip condition for velocity shall be used at the bottom and top boundary.
	   \item<4-> The sensible heat flux at the bottom and top boundary shall be constant throughout the simulation.
   \end{itemize}   
   \onslide<5-> Simulation features:
   \begin{itemize}
      \scriptsize
	   \item<6-> domain size: about $\unit[2000 \times 2000 \times 1000]{m^3}$ ($x$/$y$/$z$)
	   \item<7-> grid size: $\unit[50]{m}$ equidistant
	   \item<8-> simulated time:	$\unit[3600]{s}$
	   \item<9-> surface heatflux: $\unit[0.1]{K\ m\ s^{-1}}$
	   \item<10-> heatflux at top: $\unit[0.1]{K\ m\ s^{-1}}$
	   \item<11-> initial temperature: $\unit[300]{K}$ everywhere
	   \item<12-> initial velocity: zero everywhere
   \end{itemize}  
\end{frame}

% Folie 3
\begin{frame}
   \frametitle{Questions to be Answered:}
   
   \begin{itemize}
   \item<1-> How does the flow field look like after 60 minutes of simulated time? (What kind of output do you need to answer this?)
   \item<2-> How do the horizontally and temporally averaged vertical temperature and heat flux profiles look like?
   \item<3-> Is it really a large-eddy simulation, i.e., are the subgrid-scale fluxes much smaller than the resolved-scale fluxes? (How long should the averaging time interval be?)
   \item<4-> How do the total kinetic energy and the maximum velocity components change in time? Has the flow become stationary?
   \item<5-> Has the domain size and grid size been chosen appropriately?
   \end{itemize}

\end{frame}
	
% Folie 4
\begin{frame}
   \frametitle{Hints (I)}
   \scriptsize
   
   PALM parameter names are displayed by courier style, e.g. \textcolor{blue}{\texttt{end\_time}}.\\

   \begin{itemize}
      \item<2-> Domain size
      \begin{itemize}
         \scriptsize
         \item[-]<2-> Is controlled by grid size (\textcolor{blue}{\texttt{dx}}, \textcolor{blue}{\texttt{dy}}, \textcolor{blue}{\texttt{dz}}) and number of grid points (\textcolor{blue}{\texttt{nx}}, \textcolor{blue}{\texttt{ny}}, \textcolor{blue}{\texttt{nz}}). Since the first grid point along each of the directions has index 0, the total number of grid points used are \textcolor{blue}{\texttt{nx}}+1, \textcolor{blue}{\texttt{ny}}+1, \textcolor{blue}{\texttt{nz}}+1. The total domain size in case of cyclic horizontal boundary conditions is (\textcolor{blue}{\texttt{nx}}+1)*\textcolor{blue}{\texttt{dx}}, (\textcolor{blue}{\texttt{ny}}+1)*\textcolor{blue}{\texttt{dy}}.
      \end{itemize}
      
      \item<3-> Initial profiles
      \begin{itemize}
         \scriptsize
         \item[-]<3-> Constant with height. See parameter \textcolor{blue}{\texttt{initializing\_actions}} for available initialization methods. See \textcolor{blue}{\texttt{ug\_surface}}, \textcolor{blue}{\texttt{vg\_surface}} and \textcolor{blue}{\texttt{pt\_surface}} for initial values of velocity and potential temperature.
      \end{itemize}
      
      \item<4-> Boundary conditions
       \begin{itemize}
         \scriptsize
         \item[-]<4-> For velocity, see \textcolor{blue}{\texttt{bc\_uv\_b}} and \textcolor{blue}{\texttt{bc\_uv\_t}}. See also \textcolor{blue}{\texttt{prandtl\_layer}}, because Neumann conditions don’t allow to use a Prandtl-layer.
         \item[-]<5-> For temperature / heat flux, see \textcolor{blue}{\texttt{surface\_heatflux}} and \textcolor{blue}{\texttt{top\_heatflux}}. Prescribing of heat flux at the boundary requires a Neumann boundary condition for temperature, see \textcolor{blue}{\texttt{bc\_pt\_b}} and \textcolor{blue}{\texttt{bc\_pt\_t}}.
         \item[-]<6-> Use a Neumann condition also for the perturbation pressure both at the bottom and the top (\textcolor{blue}{\texttt{bc\_p\_b}}, \textcolor{blue}{\texttt{bc\_p\_t}}).
      \end{itemize}     
      
      \item<7-> Simulation time: See parameter \textcolor{blue}{\texttt{end\_time}}
      
   \end{itemize}

\end{frame}

% Folie 5
\begin{frame}
   \frametitle{Hints (II)}
   \footnotesize
   
   Hints for data output.
   
   \begin{itemize}
   
      \item<2-> Variables
      \begin{itemize}
         \footnotesize
         \item[-]<2-> Output variables are chosen with parameters \textcolor{blue}{\texttt{data\_output}} (3d-data or 2d-cross-sections) and \textcolor{blue}{\texttt{data\_output\_pr}} (profiles).
      \end{itemize}

      \item<3-> Output intervals
      \begin{itemize}
         \footnotesize
         \item[-]<3-> Output intervals are set with parameter \textcolor{blue}{\texttt{dt\_data\_output}}. This parameter affects all output (cross-sections, profiles, etc.). Individual temporal intervals for the different output quantities can be assigned using parameters \textcolor{blue}{\texttt{dt\_do3d}}, \textcolor{blue}{\texttt{dt\_do2d\_xy}}, \textcolor{blue}{\texttt{dt\_do2d\_xz}}, \textcolor{blue}{\texttt{dt\_do2d\_yz}}, \textcolor{blue}{\texttt{dt\_dopr}}, etc. 
      \end{itemize}
      
      \item<4-> Time averaging
      \begin{itemize}
         \footnotesize
         \item[-]<4-> Time averaging is controlled with parameters  \textcolor{blue}{\texttt{averaging\_interval}},  \textcolor{blue}{\texttt{averaging\_interval\_pr}},  \textcolor{blue}{\texttt{dt\_averaging\_input}},  \textcolor{blue}{\texttt{dt\_averaging\_input\_pr}}.
      \end{itemize}

   \end{itemize}

\end{frame}

% Folie 6
\begin{frame}
   \frametitle{Further Hints}

   \onslide<2-> You will find some more detailed information to solve this exercise in the PALM-online-documentation under:\\
   \ \\
   \small\url{http://palm.muk.uni-hannover.de/wiki/doc/app/examples/cbl}\\
   \ \\
   \normalsize (Attention: This documentation is for atmospheric convection with free upper lid.)
   \ \\
   \ \\
   \onslide<3-> \normalsize Please also visit\\
   \ \\
   \small\url{http://palm.muk.uni-hannover.de/wiki/doc/app/netcdf}\\
   \ \\
   \normalsize where the complete PALM netCDF-data-output and the respective steering parameters are described.

\end{frame}

% Folie 7
\begin{frame}
   \frametitle{How to Start?}

   \begin{itemize}
      \item<2-> Create a data directory for a new run:\\
	   \quad \texttt{cd \~{}/palm/current\_version}\\
	   \quad \texttt{mkdir -p JOBS/uniform\_plates/INPUT}
	   
	   \item<3-> Create the parameter file and set the required parameters in\\
 	   \quad \texttt{JOBS/uniform\_plates/INPUT/uniform\_plates\_p3d}
 	   
 	   \item<4-> Start the run with \texttt{mrun-command}\\
	   \quad \texttt{mrun -d uniform\_plates -h <hi> -K parallel ...}\\
	   and analyze the output files.

   \end{itemize}
   
   \ \\
   
   \onslide<5-> \huge \centering \textcolor{blue}{Good Luck!}

\end{frame}

% Folie 8
\section{Results}
\subsection{Results}

\begin{frame}
   \frametitle{$xy$-cross sections (instantaneous at $t = \unit[3600]{s}$)}
   \begin{center}
      \includegraphics[width=0.4\textwidth]{exercise_cbl_figures/xy_w_100.eps}
      \includegraphics[width=0.4\textwidth]{exercise_cbl_figures/xy_w_500.eps}\\
      \includegraphics[width=0.4\textwidth]{exercise_cbl_figures/xy_w_750.eps}
   \end{center}
\end{frame}

% Folie 9
\begin{frame}
   \frametitle{$xz$-cross sections ($\unit[900]{s}$ average)}
    \includegraphics[width=0.52\textwidth]{exercise_cbl_figures/xz_w_y250m.eps}
    \includegraphics[width=0.52\textwidth]{exercise_cbl_figures/xz_w_y500m.eps}\\
    \includegraphics[width=0.52\textwidth]{exercise_cbl_figures/xz_w_y750m.eps}
    \includegraphics[width=0.52\textwidth]{exercise_cbl_figures/xz_w_y1000m.eps}
\end{frame}

% Folie 10
\begin{frame}
   \frametitle{Vertical profiles}
   \begin{center}
      \includegraphics[angle=90,width=\textwidth]{exercise_cbl_figures/pr_pt.eps}
   \end{center}
\end{frame}

% Folie 11
\begin{frame}
   \frametitle{LES?}
   \begin{center}
      \includegraphics[width=1.0\textwidth]{exercise_cbl_figures/pr_wpt_res_sgs.eps}
   \end{center}
\end{frame}

% Folie 12
\begin{frame}
   \frametitle{Time series (I)}
   \begin{center}
      \includegraphics[angle=90,width=1.0\textwidth]{exercise_cbl_figures/ts.eps}
   \end{center}
\end{frame}

% Folie 13
\begin{frame}
   \frametitle{Time series (II)}
   \begin{center}
      \includegraphics[angle=90,width=1.0\textwidth]{exercise_cbl_figures/ts2.eps}
   \end{center}
\end{frame}


\subsection{Answers}

% Folie 14
\begin{frame}
   \frametitle{Answers to question I}
   \footnotesize
   How does the flow field look like after 60 minutes of simulated time?
   \begin{itemize}
    \item Useful output: for example instantaneous or time-averaged cross-sections of vertical velocity (frames 8--9).
    \item Flow field shows narrower updrafts and broader downdrafts, cellular pattern close to the heated/cooled plates in xy-sections of 
          vertical velocity.
    \item The temporal mean of vertical velocity exhibits a circulation spanning the whole depth of the model domain.
   \end{itemize}
\end{frame}

% Folie 15
\begin{frame}
   \frametitle{Answers to question II}
   \footnotesize
   How do the horizontally and temporally averaged vertical temperature and heat flux profiles look like?
   \begin{itemize}
    \item PALM standard profile output contains potential temperature and its vertical flux (shown in frame 10). 
    \item Heating the lower plate and cooling the upper plate induces convection resulting in a well-mixed boundary layer where the 
          potential temperature profile is constant with height. 
          Temperature gradients remain at the domain boundaries since convective turbulence cannot remove them in the vicinity of the walls. 
    \item In case of horizontal homogeneity, the temperature equation reduces  to 
          $\frac{\partial\theta}{\partial t}=-\frac{\partial\overline{w^{\prime}\theta^{\prime}}}{\partial z}$ in the present case. In a 
          stationary state, it follows that $\frac{\partial\theta}{\partial t}= 0 $. Thus, the flux profile 
          $\overline{w^{\prime}\theta^{\prime}}$ has to be constant with height -- as can be seen in frame 10.
    \item The total vertical heat flux is positive in the whole modeling domain indicating upward transport of warmer air 
          parcels and downward transport of colder air parcels. 
   \end{itemize}
\end{frame}

% Folie 16
\begin{frame}
   \frametitle{Answers to question III}
   \footnotesize
   Is it really a large-eddy simulation? Duration of averaging time?
   \begin{itemize}
    \item It is a large-eddy simulation because the sub-grid fluxes are negligibly small throughout the bulk of the mixed layer. There, the 
          resolved flux is dominating the total flux indicating a well-resolved turbulent flow (frame 11). Sub-grid fluxes dominate close to 
          the surface where the turbulent-eddies cannot be resolved.
    \item Typically, the averaging time should contain several large-eddy turnover times. The large-eddy turnover time can be defined as 
          $\tau_{\mathrm{l}}=L/u$ where $L$ is the length-scale of the largest eddies in the flow and $u$ is their typical velocity scale. 
          $\tau_{\mathrm{l}}$ can be interpreted as a typical time a turbulent eddy needs to traverse the modeling domain. In our case, 
          $L$ is proportional to the domain height ($L\approx1000\,\mathrm{m}$) and $u$ is about $5\,\mathrm{ms^{-1}}$ (see time series of 
          wmax on frame 12). Thus, $\tau_{\mathrm{l}}\approx200\,\mathrm{s}$. An averaging time of 600\,s chosen here 
          is, thus, appropriate. 
   \end{itemize}
\end{frame}

% Folie 17
\begin{frame}
   \frametitle{Answers to question IV}
   \footnotesize
   Has the flow become stationary?
   \begin{itemize}
    \item The time series of total kinetic energy E and the maximum velocities wmax, umax and vmax shown in frames 12-13 exhibit 
          a spin-up phase of the model up to $t\approx2000\,\mathrm{s}$. During this initialization time, turbulence is triggered by 
          random perturbations until turbulence starts to develop.
    \item A stationary state can be seen by means of an (almost) non-changing E with time. Constant maxima of the velocity 
          components also indicate a stationary flow. 
   \end{itemize}
\end{frame}

% Folie 18
\begin{frame}
   \frametitle{Answers to question V}
   \footnotesize
   Has the domain size and grid size been chosen appropriately?
   \begin{itemize}
    \item A domain size is generally appropriately chosen in case that several of the dominating flow structures fit into the modeling 
          domain. From the xy-cross sections in frame 8 it becomes apparent that the typical hexagonal flow structures close to the 
          surface can hardly be seen. The xz-cross sections in frame 9 also contain only 
          one circulation. Thus, the domain size in our example seems to be too small to capture several energy-containing flow structures.
    \item The grid size should be chosen in the way that the dominating flow structures can be represented by at least several 
          grid points (4-5). A grid spacing of 50~m as chosen in this exercise 
          is appropriate since the flow structures exhibit horizontal length scales of about 1~km (see frame 8).
   \end{itemize}
\end{frame}
\end{document}
