% $Id: non_cyclic_boundary_conditions.tex 1515 2015-01-02 11:35:51Z hoffmann $
\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.eps}}

\title[PALM - Using Non-Cyclic Boundary Conditions]{PALM - Using Non-Cyclic Boundary Conditions}
\author{PALM group}

% Notes:
% jede subsection bekommt einen punkt im menu (vertikal ausgerichtet.
% jeder frame in einer subsection bekommt einen punkt (horizontal ausgerichtet)
\begin{document}

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

% Folie 2
\begin{frame}
   \frametitle{Cyclic Horizontal Boundary Conditions}
   In many cases, LES models are using cyclic horizontal boundary conditions.
   \par\bigskip
   \textbf{Why?}
   \par\bigskip
   \begin{itemize}
      \item<2->{LES requires that the main energy containing eddies are resolved by the model.}
      \item<3->{With cyclic boundary conditions, turbulence can freely develop and is not effected by the side walls (because there are no walls!).}
      \item<4->{Non-cyclic boundary conditions give problems:}
      \begin{itemize}
         \par\smallskip
         \item<5->{If Dirichlet conditions (fixed vertical profiles) are used at the inflow, the inflow is laminar and some (significant) domain space is needed in order to develop                         turbulence.}
         \par\smallskip
         \item<6->{At the outflow, a boundary condition is required which allows the eddies to freely leave the domain.}
      \end{itemize}
   \end{itemize}   
\end{frame}

\section{Motivation}
\subsection{Motivation}

%Folie 3
\begin{frame}
   \frametitle{Motivation for Non-Cyclic Boundary Conditions}
   \footnotesize
   The main motivation for non-cyclic boundary conditions are studies of isolated phenomena.
   \begin{tabbing}
   \uncover<2->{\textbf{Example:} \= Turbulence generated by a single obstacle. \\}    
                    \\
                    \uncover<6->{ \> Cyclic boundary conditions along x would allow the generated turbulence\\
                     \>  to enter the domain again, and so finally to modify the turbulence \\
                     \>  on the leeward side of the building. \\ }      
                     \\ 
                     \uncover<9>{ \> This wouldn't be a simulation of a single building, but of an\\
                     \> infinite row of buildings!   }
   \end{tabbing}
   \begin{center}
   \includegraphics<3|handout:0>[width=0.7\textwidth]{non_cyclic_figures/motivation_non_cyclic_1.png}
   \includegraphics<4|handout:0>[width=0.7\textwidth]{non_cyclic_figures/motivation_non_cyclic_2.png}
   \includegraphics<5-6|handout:0>[width=0.7\textwidth]{non_cyclic_figures/motivation_non_cyclic_3.png}
   \includegraphics<7|handout:0>[width=0.7\textwidth]{non_cyclic_figures/motivation_non_cyclic_4.png}
   \uncover<8-|handout:1>{\begin{center} \includegraphics[width=0.7\textwidth]{non_cyclic_figures/motivation_non_cyclic_5.png} \end{center}}
   \end{center}
   \normalsize
\end{frame}

% Folie 4
\begin{frame}
   \frametitle{Implications of Non-Cyclic Boundary Conditions}
   \footnotesize
   \onslide<2->{Using Dirichlet-conditions (e.g u(z) = const.), there is no turbulence at the inflow. \quad $\rightarrow$ the flow is laminar \quad $\rightarrow$ LES approach fails!}
   \par\bigskip
   \includegraphics<3|handout:0>[width=0.8\textwidth]{non_cyclic_figures/implications_non_cyclic_1.png}
   \includegraphics<4|handout:0>[width=0.8\textwidth]{non_cyclic_figures/implications_non_cyclic_2.png}
   \uncover<5-|handout:1>{\includegraphics[width=0.8\textwidth]{non_cyclic_figures/implications_non_cyclic_3.png}}
   \par\bigskip
   \onslide<6->{Flow internal turbulence may develop, but this may require a very long model domain.}
   \par\bigskip
   \includegraphics<7|handout:0>[width=\textwidth]{non_cyclic_figures/implications_non_cyclic_4.png}
   \includegraphics<8|handout:0>[width=\textwidth]{non_cyclic_figures/implications_non_cyclic_5.png}
   \uncover<9-|handout:1>{\includegraphics[width=\textwidth]{non_cyclic_figures/implications_non_cyclic_6.png}}
   \onslide<10->{There is a need to supply turbulence information at the inflow.}
\end{frame}

\section{How to Create a Turbulent Inflow}
\subsection{How to Create a Turbulent Inflow}

% Folie 5
\begin{frame}
   \frametitle{How to Create a Turbulent Inflow (I)}
   Two methods:
   \begin{itemize}
      \item<2->{by a statistical model}
      \item<3->{by recycling-method  (Lund et al., 1998)}
   \end{itemize}
   \includegraphics<4|handout:0>[width=\textwidth]{non_cyclic_figures/create_turbulent_inflow_1/create_turbulent_inflow_1_neu.png}
   \includegraphics<5|handout:0>[width=\textwidth]{non_cyclic_figures/create_turbulent_inflow_1/create_turbulent_inflow_2_neu.png}
   \includegraphics<6|handout:0>[width=\textwidth]{non_cyclic_figures/create_turbulent_inflow_1/create_turbulent_inflow_3_neu.png}
   \includegraphics<7|handout:0>[width=\textwidth]{non_cyclic_figures/create_turbulent_inflow_1/create_turbulent_inflow_4_neu.png}
   \includegraphics<8|handout:0>[width=\textwidth]{non_cyclic_figures/create_turbulent_inflow_1/create_turbulent_inflow_5_neu.png}
   \uncover<9-|handout:1>{\includegraphics[width=\textwidth]{non_cyclic_figures/create_turbulent_inflow_1/create_turbulent_inflow_6.png}}
   \par\bigskip
   \uncover<10>{How do we get the initial turbulence in the recycle area? \\
   If there is no turbulence, there is nothing to recycle!}
\end{frame}

%Folie 6
\begin{frame}
   \frametitle{How to Create a Turbulent Inflow (II)}
   \footnotesize
   Initial  turbulence is created by a precursor run with cyclic boundary conditions and much smaller domain size than used for the main run.
   \tikzstyle{line} = [draw, blue, thick, dashed, -latex']    
   \begin{tikzpicture}      
      \uncover<1>{\node(picture) {\includegraphics[width=0.4\textwidth]{non_cyclic_figures/create_turbulent_inflow_2/create_turbulent_inflow_1.png}};}
      \uncover<2>{\node(picture) {\includegraphics[width=0.4\textwidth]{non_cyclic_figures/create_turbulent_inflow_2/create_turbulent_inflow_2.png}};}
      \uncover<3->{\node(picture) {\includegraphics[width=0.4\textwidth]{non_cyclic_figures/create_turbulent_inflow_2/create_turbulent_inflow_3.png}};}
      \node(text) [right=0.1cm of picture]{
         \parbox{5cm}{
         \scriptsize
         \begin{itemize}
         \item<4->{When the precursor run is finished, data of the last timestep are stored on disc.}
         \item<5->{These data are then read by the main run and repeatedly mapped to the main run domain, until it is completely filled.}
         \end{itemize}}};
     \uncover<6>{\node(picture2) [below=1.8cm of picture.east] {\includegraphics[width=0.9\textwidth]{non_cyclic_figures/create_turbulent_inflow_2/create_turbulent_inflow_4.png}};}
     \uncover<7>{\node(picture2) [below=1.8cm of picture.east] {\includegraphics[width=0.9\textwidth]{non_cyclic_figures/create_turbulent_inflow_2/create_turbulent_inflow_5.png}};}
     \uncover<8>{\node(picture2) [below=1.8cm of picture.east] {\includegraphics[width=0.9\textwidth]{non_cyclic_figures/create_turbulent_inflow_2/create_turbulent_inflow_6.png}};}
     \uncover<9>{\node(picture2) [below=1.8cm of picture.east] {\includegraphics[width=0.9\textwidth]{non_cyclic_figures/create_turbulent_inflow_2/create_turbulent_inflow_7.png}};}  
     \uncover<10>{\node(picture2) [below=1.8cm of picture.east] {\includegraphics[width=0.9\textwidth]{non_cyclic_figures/create_turbulent_inflow_2/create_turbulent_inflow_8.png}};} 
     \uncover<11>{\node(picture2) [below=1.8cm of picture.east] {\includegraphics[width=0.9\textwidth]{non_cyclic_figures/create_turbulent_inflow_2/create_turbulent_inflow_9.png}};} 
    \path<7->[line] (-0.45,-1) -- (-0.7,-2.6);
    \path<7->[line] (1.78,-1) -- (1.68,-2.6);  
    \path<8->[line] (-0.45,-1) -- (1.68,-2.6);
    \path<8->[line] (1.78,-1) -- (4,-2.6);
    \path<9->[line] (-0.45,-1) -- (4,-2.6);
    \path<9->[line] (1.78,-1) -- (6.4,-2.6);
    \path<10->[line] (-0.45,-1) -- (6.4,-2.6);
    \path<10->[line] (1.78,-1) -- (6.9,-2.6);
   \end{tikzpicture} 
\end{frame}

% Folie 7
\begin{frame}
   \frametitle{How to Create a Turbulent Inflow (III)}
   \scriptsize
   \begin{itemize}
      \item{Inflow profiles for the main run have to be taken from the precursor run. It is recommended to use the horizontally averaged profiles from 
            the last time step of the precursor run.}
      \item<2->{Alternatively, $u$,$v$-profiles can be prescribed by parameters \texttt{u\_profile}, \texttt{v\_profile}. They should match the turbulence state of the flow.}
   \end{itemize}
   \vspace{-4mm}
   \tikzstyle{line1} = [draw, red, thick, -latex'] 
   \tikzstyle{line2} = [draw, red, thick, -] 
   \begin{tikzpicture}
      \uncover<3>{\node(picture) {\includegraphics[width=0.4\textwidth]{non_cyclic_figures/create_turbulent_inflow_3/create_turbulent_inflow_1.png}};}
      \uncover<4->{\node(picture) {\includegraphics[width=0.4\textwidth]{non_cyclic_figures/create_turbulent_inflow_3/create_turbulent_inflow_2.png}};}
      \node(text) [right=0.1cm of picture]{
         \parbox{6.5cm}{
         \scriptsize
         \vspace{3mm}
         \begin{itemize}
         \item<7->{Since the height of the turbulent boundary layer may increase with increasing distance from the inflow boundary, recycling has 
               to be limited to the height of the turbulent boundary layer at the inflow. Otherwise, the boundary layer height will continuously increase with time.}
         \end{itemize}}};
   \uncover<5>{\node(picture2) [below=1.8cm of picture.east] {\includegraphics[width=0.8\textwidth]{non_cyclic_figures/create_turbulent_inflow_3/create_turbulent_inflow_3.png}};}
   \uncover<6-7>{\node(picture2) [below=1.8cm of picture.east] {\includegraphics[width=0.8\textwidth]{non_cyclic_figures/create_turbulent_inflow_3/create_turbulent_inflow_4.png}};}
   \uncover<8>{\node(picture2) [below=1.8cm of picture.east] {\includegraphics[width=0.8\textwidth]{non_cyclic_figures/create_turbulent_inflow_3/create_turbulent_inflow_5.png}};}
   \uncover<9>{\node(picture2) [below=1.8cm of picture.east] {\includegraphics[width=0.8\textwidth]{non_cyclic_figures/create_turbulent_inflow_3/create_turbulent_inflow_6.png}};}
   \uncover<10>{\node(picture2) [below=1.8cm of picture.east] {\includegraphics[width=0.8\textwidth]{non_cyclic_figures/create_turbulent_inflow_3/create_turbulent_inflow_7.png}};}
      
   \path<6->[line2] (picture.east) -- (2.25,-1.3);
   \path<6->[line2] (2.25,-1.3)    -- (-1.2,-1.3);
   \path<6->[line2] (-1.2,-1.3)    -- (-1.2,-3.2);
   \path<6->[line1] (-1.2,-3.2)      -- (-0.8,-3.2);
   \end{tikzpicture}
\end{frame}

\section{Implementation in PALM}
\subsection{Implementation in PALM}

% Folie 8
\begin{frame}
   \frametitle{Non-Cyclic Boundary Conditions in PALM (I)}
   \textbf{Status of availability:}
   \begin{itemize}
      \item<2->{Non-cyclic boundary conditions along \textbf{one} of the horizontal directions (\textit{x} \textbf{or} \textit{y}).}
      \begin{itemize}
         \item<3->{Dirichlet conditions at inflow (stationary vertical profiles, \textit{u}(\textit{z}), \textit{v}(\textit{z}),
                   \textit{pt}(\textit{z}), \textit{q}(\textit{z}), \textit{w}=0).}
         \item<4->{Radiation conditions at outflow. Tendencies at the boundary are replaced by e.g.}
      \end{itemize}      
      \uncover<4->{\begin{math} \frac{\partial u}{\partial t} = -\left(c_g + u\right) \frac{\partial u}{\partial x} = -u^* \frac{\partial u}{\partial x} 
                     \qquad \textnormal with \qquad u^* = \frac{\Delta x}{\Delta t} \frac{u_{b-1}^t - u_{b-1}^{t-1}}{u_{b-1}^{t-1} - u_{b-2}^{t-1}} \end{math}}
      \par\bigskip
      \item<5->{Turbulence recycling method for inflow \textbf{from left}.}
   \end{itemize}  
\end{frame}

% Folie 9
\begin{frame}
   \frametitle{Non-Cyclic Boundary Conditions in PALM (II)}
   \par\bigskip
   \small
   \textbf{Further requirements for PALM runs using non-cyclic boundary conditions:}
   \par\smallskip
   \begin{itemize}
      \item<2->{The \textbf{multigrid-method} has to be used for solving the Poisson-equation.}
      \item<3->{A \textbf{damping zone} has sometimes to be activated in the vicinity of the in- and outflow in order to avoid reflection of gravity waves.}
      \item<4->{\textbf{Volume flow conservation} may have to be activated, because flow acceleration or deceleration may appear along the non-cyclic direction. The resulting horizontal divergence creates a mean vertical velocity.}
      \item<5->{If turbulence recycling is not used, it may be neccessary to \textbf{continuously impose perturbations} on the horizontal velocity field in the vicinity of the
                inflow throughout the whole run, in order to maintain a turbulent state of the flow.}
   \end{itemize}
   \normalsize
\end{frame}

\section{Current Applications}
\subsection{Current Applications}


% Folie 10
\begin{frame}
   \frametitle{Current Applications of Non-Cyclic BCs (I)}
   \textbf{Cold air outbreaks}
   \par\bigskip
   \includegraphics[width=\textwidth]{non_cyclic_figures/cold_air_outbreaks.png} \\
   \par\bigskip
   \tiny
   \textbf{Gryschka, M., C. Dr\"ue, D. Etling and S. Raasch. 2008}: On the influence of sea-ice inhomogeneities onto roll convection in cold-air outbreaks. Geophys. Res. Lett.,
   \textbf{35}, L23804, doi:10.1029/2008GL035845. \\
   \par\bigskip
   \textbf{Gryschka, M. and S. Raasch, 2005}: Roll Convection During a Cold Air Outbreak: A Large Eddy Simulation with Stationary Model Domain. Geophys. Res. Lett., \textbf{32}, L14805,
    doi:10.1029/2005GL022872. \\
   \normalsize
   \begin{center} \uncover<2->{\textbf{Turbulence recycling has not been used!}} \end{center}
\end{frame}

% Folie 11
\begin{frame}
   \frametitle{Current Applications of Non-Cyclic BCs (II)}
   \textbf{Cold air outbreaks}
   \begin{center}  
   \includegraphics[width=0.85\textwidth]{non_cyclic_figures/cold_air_outbreaks_2.png} \\
   liquid water content (vertically intgrated)  
   \end{center}
\end{frame}

\section{How to set up}
\subsection{How to set up}

% Folie 12
\begin{frame}
   \frametitle{How to set up non-cyclic runs with PALM}
   \begin{itemize}
      \item{\textbf{required} / recommended parameter settings:}
   \end{itemize}
   \par\bigskip
   \tikzstyle{box} = [rectangle, draw, text width=\textwidth, font=\small]
   \begin{tikzpicture}      
      \node[box](inipar){ \begin{tabbing} 
         \&inipar \= ....... \\
                  \\
                  \> \textbf{bc\_lr = 'dirichlet/radiation'}, (bc\_ns = 'dirichlet/radiation',) \\ 
                  \> \textbf{psolver = 'multigrid'}, \\
                  \\
                  \> initializing\_actions = 'set\_1d-model\_profiles', \\
                  \> conserve\_volume\_flow = .T., \\
                  \\
                  \> ...... / \\ \end{tabbing}};
   \end{tikzpicture}
\end{frame}

% Folie 13
\begin{frame}
   \frametitle{How to set up turbulence recycling with PALM (I)}
   \small
   \begin{itemize}
      \item<1->{First, a prerun has to be carried out. The domain size of the prerun has to be large enough to capture all relevant scales of turbulence.}
      \item<2->{Restart data has to be output and output of instantaneous, horizontally averaged profiles has to be switched on and performed at the end of the run. 
                This enables writing of profiles to the restart file, which can then be used by the main run.}
      \item<3->{Instead of using averaged profiles from the prerun, inflow profiles for the main run can also be prescribed using parameters \texttt{u\_profile}, \texttt{v\_profile}, and \texttt{uv\_heights}.}
   \end{itemize}
   \tikzstyle{box} = [rectangle, draw, text width=\textwidth, font=\small]
   \onslide<2->{
   \begin{tikzpicture}      
      \node[box](inipar){ \begin{tabbing} 
         \&d3par \= end\_time = 3600.0, \\
                 \> dt\_dopr = 3600.0, data\_output\_pr = 'u', \\
                 \> ....... / \\ \end{tabbing}};
   \end{tikzpicture}}
   \normalsize
\end{frame}

% Folie 14
\begin{frame}
   \frametitle{How to set up turbulence recycling with PALM (II)}
   \small
   \begin{itemize}
      \item{The main run has to read the data from the precursor run (however, it is not a restart run!). This requires an extra activating string (e.g. turrec) in 
            the file connection statement for restart data.}           
   \end{itemize}
   \begin{center}
   \includegraphics[width=0.8\textwidth]{non_cyclic_figures/list_of_input_files.png}
   \end{center} 
   \begin{itemize}
      \item<2->{The mrun-command to start the main run then has to look like \par\bigskip
          {\tt mrun ... -r \dq d3\# turrec\dq}   \par\bigskip
          The main run is allowed to use a different number of processors and a different domain decomposition than the precursor run!}
   \end{itemize}
\end{frame}

\begin{frame}
   \frametitle{How to set up turbulence recycling with PALM (III)}
   \begin{itemize}
      \item{\textbf{required} / recommended parameter settings for the main run:}
   \end{itemize}
   \tikzstyle{box} = [rectangle, draw, text width=\textwidth, font=\footnotesize]
   \tikzstyle{box2} = [rectangle, draw, text width=0.4\textwidth, font=\tiny]
   \tikzstyle{line} = [draw, -latex']
   \begin{tikzpicture}      
      \node[box](inipar){ \begin{tabbing} 
         \&inipar \= ....... \\
                  \\
                  \> \textbf{turbulent\_inflow = .TRUE.}, \\ 
                  \> \textbf{bc\_lr = 'dirichlet/radiation'}, \\
                  \> \textbf{psolver = 'multigrid'}, \\
                  \> \textbf{initializing\_actions = 'cyclic\_fill'}, \\
                  \> \textbf{recycling\_width = ...}, \\
                  \> inflow\_damping\_height = ..., \\
                  \> conserve\_volume\_flow = .T., \\
                  \\
                  \> ...... / \\ \end{tabbing}};
      \uncover<2->{\node[box2] (horizontal_width) at (3,-0.6) {\textbf{Horizontal width of the recycling domain.}};}
      \uncover<3->{\node[box2] (vertical_extend)  at (3,-2) {\textbf{Vertical extent of the recycling domain. If the precursor run simulated a convective boundary layer, 
                                                information is automatically taken from the precursor data.}};}

      \path<2->[line] (horizontal_width.west) -- (-1.2,-0.4);
      \path<3->[line] (vertical_extend.west)  -- (-0.4,-0.9);
   \end{tikzpicture}
\end{frame}

\section{Final remarks}
\subsection{Final remarks}

% Folie 16
\begin{frame}
   \frametitle{Final remarks}
   \begin{itemize}
      \item<1->{Non-cyclic boundary conditions and turbulence recycling method require extreme care with setting of the respective parameters.}
      \item<2->{So far, these methods have been applied only to a few special cases (cold air outbreaks, urban canopy layer for neutral stratification). Other setups may require modifications.}
      \item<3->{Biggest problems are caused by gravity waves in capping inversions. Simulations with pure neutral stratification cause less problems.}
   \end{itemize}
\end{frame}

\end{document}
