%==============================================================================
\chapter{Hawking Radiation}
\label{chap:hawrad}
%==============================================================================

%------------------------------------------------------------------------------
\section{$(3+1)$-dimensional Einstein gravitation}
\label{sec:hawrad-einstein}
%------------------------------------------------------------------------------

Based on the advances in the geometry of space-time and `mechanics' of black
holes, as well as in quantum field theory in curved space-time,
\citeauthor{HAWKING1974} quantitatively revealed a semi-classical property of
the black holes in \cite{HAWKING1974}. In his model, the Einsteinian
gravitational
background is fixed to be that of a spherically collapsing body\footnote{A
detailed account for space-times of collapsing body can be found in
\cite{Joshi2007}.}, the conformal diagram of which is shown in
\cref{fig:sph-col-bod}. A neutral (real), massless scalar field $\rfun{\phi}{x}$
is minimally coupled to the gravitational background, so the action of the model
reads
\begin{equation}
S \coloneqq \int_{\mscrM} {\dd^4 x} \,\sqrt{-g}\,
\cbr{g^{\mu\nu}\rbr{\partial_\mu \phi}\rbr{\partial_\nu \phi}}.
\end{equation}
One quantises the scalar field canonically on the Cauchy surface $\mscrI^-$ by
introducing ladder operators $a^\mp$'s, and on $\mscrI^+ \cup \mscrH^+$ by
$b^\mp$'s (for $\mscrI^+$) and $c^\mp$'s (for $\mscrH^+$). An \emph{early-time
vacuum} is defined by
\begin{equation}
	\rfun{a^-}{p}\Ket{h} \coloneqq 0,
\end{equation}
where $\rfun{a^-}{p}$ annihilates a particle with momentum $p$, so that
\begin{equation}
\abr{\rfun{{n}_a}{p}}_h \coloneqq \Braket{h | \rfun{{n}_a}{p} | h}
\equiv 0,\qquad \forall p,
\end{equation}
where $\rfun{n_a}{p} = \rfun{a^+}{p}\rfun{a^-}{p}$ is the number operator of
mode with momentum $p$. This means that an asymptotic observer at early time,
whose definition of particles agrees with $a^\mp$, detects no particle.

\begin{figure}
\begin{center}
\input{./graphics/graph_hawking_einstein}
\end{center}
\caption[Spherically collapsing body in Einstein gravitation]{A schematic
conformal diagram of a spherically collapsing body in Einstein gravitation, in
which massive matter (presumably a star) spherically collapses by gravitational
interaction. The boundary of the collapsing body is denoted by the thick
line with arrow. The quantum field is solved on $\mscrI^-$ and $\mscrI^+ \cup
\mscrh^+$. \label{fig:sph-col-bod}}
\end{figure}

For asymptotic observers, \citeauthor{Hawking1975} was able to evaluate the
\emph{late-time} properties, or those with respect to the $b$'s, of
$\Ket{h}$. He derived in \cite{Hawking1975} that\footnote{Possible divergent
$\rfun{\delta}{0}$ factors in the particle-number expectations have been
systematically ignored.}
\begin{equation}
\abr{\rfun{{n}_b}{\omega}}_h \approx
\Gamma_\omega\rbr{\ee^{2\pp\omega/\kappa}-1}^{-1},
\label{eq:hawking-distri}
\end{equation}
where $0 < \Gamma_\omega < 1$ is the \emph{grey-body factor}, and $\omega$
being the angular frequency of the mode regarded. Comparing
\cref{eq:hawking-distri} with that of a Bose--Einstein distribution, or a
\emph{black-body} radiation field,
\begin{equation}
\abr{\rfun{{n}}{\omega}}_\text{BE} = \rbr{\ee^{\omega/T} - 1}^{-1},
\end{equation}
it is appealing to conclude that \cref{eq:hawking-distri} describes a
\emph{grey-body} radiation field, with the temperature
\begin{equation}
T_\text{H} \coloneqq \kappa/2\pp \equiv \phs/\lc \bk \cdot \kappa/2\pp,
\label{eq:hawking-temperature}
\end{equation}
also named after \citeauthor{Hawking1975}, and an absorption coefficient
$\Gamma_\omega$.

\citeauthor{Hawking1975} himself argued that his calculation also holds for
a matter field with spin, as well as for the collapse result being a rotating
black hole. Further quantities could also be obtained in the background of
an eternal black hole, whose connection to an astrophysical collapsing body
has been constructed, showing the evaluation is physically robust
\cite{Candelas1980}. The algebraic approach to quantum fields showed that it is
also mathematically reliable \cite{Hollands2015}.

Though widely acknowledged, Hawking temperature is in fact technically
ill-defined, if we take the calculation \emph{seriously enough}. Recall that a
temperature $T$ of a quantum system can only be defined if the system is in a
thermal equilibrium, which can be described by a density operator
\begin{equation}
	\rho = Z^{-1} \ee^{-H/T}
\end{equation}
of a \emph{mixed state}, where $H$ is the Hamiltonian of the system, and $Z =
\tr\ee^{-H/T}$ is the partition function. For a bosonic system, the density
operator reads
\begin{equation}
{\rho}_\text{BE} \sim Z^{-1} \sum_E \ee^{-E/T} \Ket{E}\Bra{E},
\label{eq:bos-ein-dis}
\end{equation}
where $\rbr{E, \Ket{E}}$ are the energy eigenvalue and the corresponding
eigenstate of the system, respectively. As $\Ket{h}$ is a \emph{pure state},
whose density operator reads
\begin{equation}
\rho_h \coloneqq \Ket{h}\Bra{h},
\label{eq:haw-den-optr}
\end{equation}
it is drastically different from \cref{eq:bos-ein-dis}. One naturally asks, how
different are the pure and mixed states, and what does it imply?

%------------------------------------------------------------------------------
\section{In $(1+1)$-dimensional dilaton gravity}
\label{sec:hawrad-1+1dila}
%------------------------------------------------------------------------------

In the Einsteinian background of a collapsing body, in which
\citeauthor{HAWKING1974} did his calculation, no analytic solution of a quantum
field theory has so far been found due to technical difficulties. To study the
problem in more detail, alternative solvable gravity models can be used, which
may help understanding the quantum aspects of Einstein gravitation. Here a
gravity model in $\rbr{1+1}$ space-time dimensions with a dilaton field is
adapted, which is further explained in \cref{sec:1+1ddlt}. The solution with a
collapsing null-matter-shell in such a model, also known as the
CGHS\footnote{Introduced by \citeauthor{Callan1992} in \cite{Callan1992}.} black
hole, has been found at the classical level and can also be formally quantised
canonically \cite{Callan1992,Demers1996}. The conformal diagram of the classical
solution is shown in \cref{fig:dil-col-bod}.

\begin{figure}
\begin{center}
\input{./graphics/graph_hawking_CGHS}
\end{center}
\caption[Collapsing null matter in dilaton gravity]{The conformal
diagram of collapsing null shell in $\rbr{1+1}$ dimensional dilaton gravity.
The black-hole horizon is marked by the dashed line, whereas the ingoing null
shell is expressed by the thick line with arrow. The \emph{linear dilaton
vacuum region} and the \emph{black hole region} mark the space-time blocks
before and after the ingoing shell, respectively. The quantum field, on the
other hand, is solved on the hyper-surface connecting $i^0_\text{L/R}$ and the
intersection of the null shell and the horizon.
\label{fig:dil-col-bod}}
\end{figure}

At the next-to-leading order in the semi-classical approximation scheme, the
matter field can be separated from the gravity and the dilaton, and a quantum
theory of fields in curved space-time can be \emph{derived} in terms of a
functional Schrödinger equation
\begin{equation}
	\ii \frpa{\sfun{\chi}{f}}{t} = \int \dd x\,\frac{1}{2}
	\cbr{-\frdva{^2}{f^2} + \rbr{\frpa{f}{x}}^2} \sfun{\chi}{f},
\label{eq:functional-Sch-chi}
\end{equation}
where $\rfun{f}{x}$ is the classical matter field promoted to an operator, and
$\sfun{\chi}{f}$ the corresponding matter wave-functional. Before the collapse
of the ingoing null-matter-shell where the region is called \emph{linear dilaton
vacuum}, a `vacuum' state can be found, whose wave functional reads
\begin{equation}
	\sfun{\chi_0}{f} \propto
	\cfun{\exp}{-\frac{1}{2}\int_{0}^{+\infty}\dd k\, k \, \rfun{f}{k}^2},
\label{eq:vacuum-wave-functional-f}
\end{equation}
where $\rfun{f}{k}$ is the Fourier sine transform of $\rfun{f}{x}$.
\Cref{eq:vacuum-wave-functional-f} is nothing else but a generalisation of the
ground-state wave function of a simple harmonic oscillator, see
\cref{chap:harosc}.

After the collapse where the region is called \emph{black hole}, the spacial
slice is shifted, and so are the Fourier modes of the matter field. It can be
shown that
\begin{equation}
	\rfun{f}{k} = \int_{-\infty}^{+\infty} \dd l\,
	\rfun{\alpha}{k;l} \rfun{g}{l}\qquad k > 0,
\end{equation}
where $\rfun{g}{l}$ is the Fourier transform of matter field after the ingoing
shock wave. The Bogolyubov-type coefficient $\rfun{\alpha}{k;l}$ has been
computed, substituting which into \cref{eq:vacuum-wave-functional-f} yields
\begin{equation}
\sfun{\chi_b}{g} \propto
\cfun{\exp}{-\int_{-\infty}^{+\infty}\dd p\, p \,\rfun{\coth}{\frac{\pp
p}{2\lambda}} \vbr{\rfun{g}{p}}^2}
\label{eq:squeezed-wave-functional}
\end{equation}
in the black hole region, which is a squeezed-state wave functional
\cite{Kiefer2001} and obviously different from a ground-state wave
functional. The particle-number expectation of
\cref{eq:squeezed-wave-functional} reads
\begin{equation}
	\abr{\rfun{n}{k}}_{\chi_b} = \rbr{\ee^{2\pp\vbr{k}/\lambda} - 1}^{-1},
	\label{eq:particle-num-exp-dilaton}
\end{equation}
%\begin{equation}
%\rfun{g}{k} = \int_{-\infty}^{+\infty}\dd v\,
%\frac{\ee^{-\ii k v}}{\sqrt{2\pp}} \rfun{f}{v},
%\end{equation}
leading to a Hawking-like \emph{black-body} temperature
\begin{equation}
T_\text{HD} \coloneqq \lambda/2\pp.
\label{eq:hawking-dilaton-temperature}
\end{equation}
Here it is the cosmological constant $\lambda$ which takes the place of surface
gravity $\kappa$ in \cref{eq:hawking-temperature}.

%------------------------------------------------------------------------------
\section{Discussion}
\label{sec:hawrad-discussion}
%------------------------------------------------------------------------------

Though used throughout this work, the density operators can be mathematically
defined only when they are \emph{trace-class} for which a trace may be defined,
and this is not proved for any of the cases concerned. Unfortunately, the
density operators are often not trace-class, especially in quantum field
theory. A rigorous approach to deal with such thermal states can be the
Kubo--Martin--Schwinger state \cite{Kubo1957,Martin1959,Haag1967} defined in
algebraic quantum theory, which is concisely introduced in
\cite[ch.~3]{David2015}.

Alert readers may be concerned about the result
\cref{eq:squeezed-wave-functional}, which is derived in dilaton gravity model,
not from Einstein gravitation. The solution is believed to be physically
relevant, not only because it gives a same Hawking-like temperature for the CGHS
black hole. It has also been shown that the wave functional of a massless,
neutral scalar field in the Unruh effect yields exactly the same particle-number
fluctuation and Hawking temperature \cite{Freese1985,Kiefer2001}. People have
argued and widely believed that the Unruh effect is closely connected to
Hawking radiation in Einstein gravity, especially in the space-time region near
the horizon (e.g.\ \cite{Susskind2004}). It is therefore reasonable to believe
that the aforementioned results from the CGHS model give hints about reality.

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../mythesis"
%%% End:


\documentclass{article}

\usepackage[nonatbib, final]{nips_2017}

\usepackage[utf8]{inputenc} % allow utf-8 input
\usepackage[T1]{fontenc}    % use 8-bit T1 fonts
\usepackage{hyperref}       % hyperlinks
\usepackage{url}            % simple URL typesetting
\usepackage{booktabs}       % professional-quality tables
\usepackage{amsfonts}       % blackboard math symbols
\usepackage{nicefrac}       % compact symbols for 1/2, etc.
\usepackage{microtype}      % microtypography
\usepackage{todonotes}      % todo
\usepackage{algpseudocode}
\usepackage{algorithm}  % algorithm pseudocode
\usepackage{cite}
\usepackage{amsmath}
\usepackage{bm}
\usepackage{bbm}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usepackage{siunitx}

\newcommand{\RR}{I\!\!R} %real numbers
\newcommand{\Nat}{I\!\!N} %natural numbers
\newcommand{\CC}{I\!\!\!\!C} %complex numbers
\newcommand{\norm}[1]{\left\lVert #1 \right\rVert} % norm
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}
\newcommand{\rpm}{\raisebox{.2ex}{$\scriptstyle\pm$}}

\title{Active Robotic Mapping through Deep Reinforcement Learning}

\author{
  Shane Barratt \\
  Department of Electrical Engineering\\
  Stanford University \\
  Stanford, CA 94305 \\
  \texttt{sbarratt@stanford.edu} \\
}

\begin{document}

\maketitle

\begin{abstract}
We propose an approach to learning agents for active robotic mapping, where the goal is to map the environment as quickly as possible. The agent learns to map efficiently in simulated environments by receiving rewards corresponding to how fast it constructs an accurate map. In contrast to prior work, this approach learns an exploration policy based on a user-specified prior over environment configurations and sensor model, allowing it to specialize to the specifications. We evaluate the approach through a simulated Disaster Mapping scenario and find that it achieves performance slightly better than a near-optimal myopic exploration scheme, suggesting that it could be useful in more complicated problem scenarios.
\end{abstract}

\section{Introduction}
For most of the paper, we will use the following terminology borrowed from \cite{thrun2005probabilistic}:
\begin{itemize}
\itemsep0em
\item robot: an autonomous agent in an environment
\item pose $(x_t)$: position and orientation of the robot in that environment
\item observations $(z_t)$: readings from on-board sensors
\item controls $(u_t)$: control inputs to actuators
\item policy ($\pi(u_t|x_{1:t-1}, z_{1:t})$): method for choosing controls based on past poses and observations
\end{itemize}

Autonomous robots face two fundamental problems: \emph{mapping} and \emph{localization}. The goal of mapping is to obtain a spatial model of the robot's environment using poses and observations. Simultaneously, the goal of localization is to estimate the robot's pose using observations and a map. These problems are inherently linked, as mapping requires poses and localization requires maps. Addressing both is commonly referred to as the simultaneous localization and mapping (SLAM) problem \cite{leonard1991mobile}. In this work, we focus on the problem of efficient mapping with known poses, which assumes that the localization problem has already been solved for us. We view the integration of localization into our approach as future work.

There are three main hurdles we must overcome when designing robotic mapping systems. First, we require a representation of the map as well as our belief over possible maps. Second, we need a way to update our belief over maps given observations. Third, we need to choose controls to reduce our uncertainty in our belief as quickly as possible.

One of the most widely used (and elegant) ways to represent the map probabilistically and incorporate observations sequentially is via occupancy grids \cite{elfes1989using}. Occupancy grids exhibit several desirable properties: they are adaptable for many applications, they compute an exact posterior distribution over maps (under some independence assumptions), they are strongly convergent, they can deal with any type of sensor noise, and they can handle raw sensor data. However, occupancy grid maps lack a principled method for our third hurdle: how to choose control inputs. The original proposal assumes that control inputs are specified by a third-party and not chosen by the robot. This leads to an issue when applying occupancy grids in practice; how should the actions be chosen?

We pose the problem of designing agents that actively map the environment as a Markov Decision Process (MDP), where the state of this MDP is the robot's pose and its belief of the environment. From this state, the robot should be able to identify areas in the map that require exploration and to move to them and map them, based on its knowledge of how its sensors work. The robot's belief is a high-dimensional matrix of probability values. Accordingly, we turn to deep reinforcement learning techniques to find policies. To train such policies, we use a prior over maps the robot might encounter and repeatedly train the robot to explore these maps in simulation. We evaluate our algorithm on a simulated Disaster Mapping environment, and find that it is able to achieve performance on-par with a near-optimal greedy strategy. This suggests that the algorithm will be able to scale to more complex environments and sensors, which we view as future work.

\section{Related Work}

The two most popular methods for addressing the third hurdle in occupancy grids are frontier-based exploration \cite{yamauchi1997frontier}, where the robot actively seeks to visit new poses, and information-based exploration \cite{bourgault2002information}, where the robot myopically chooses control inputs to maximize information gain over one step.

\subsection{Frontier-Based Exploration}

In frontier-based exploration, the robot maintains a set of \emph{frontiers}, which are defined as regions on the boundary between open and unexplored space. The robot then navigates to the closest frontier by performing a depth-first-search (DFS) on the maximum likelihood map. If, after a predetermined number of steps, the robot fails to reach the frontier region it repeats the process over again. There is also a natural multi-robot extension\cite{yamauchi1998frontier}.

\subsection{Information-Based Adaptive Robotic Exploration}
\label{sec:igain}

In information-based exploration, the robot moves in the direction that maximizes the expected information gain

$$
\argmax_{u_t} H(b_t) - \mathbb{E}_{x_{t+1}, z_{t+1}}[H(b_{t+1})|u_t, x_t],
$$

where

$$\mathbb{E}_{x_{t+1}, z_{t+1}}[H(b_{t+1})|u_t, x_t] = \sum_{x_{t+1}} \sum_{z_{t+1}} P(x_{t+1}|x_t, u_t) P(z_{t+1}|x_{t+1}) H(b_{t+1}|x_{t+1}, z_{t+1}).$$

Note that this summation can become extremely hard to compute, as the summation becomes an integral when the sensor outputs continuous values and the summation can be exponential with the number of possible sensor outputs. Also, this is a myopic exploration strategy; it only looks one step into the future to decide its next action. However, in discrete environments with simple sensors it can be a near-optimal exploration scheme. This is the baseline that we compare our approach to.

\section{Preliminaries}

In this section, we introduce Occupancy Grids, Markov Decision Processes and the Advantage Actor-Critic Algorithm. The section also serves as an introduction of the mathematical notation that will be used throughout the paper.

\subsection{Occupancy Grids}

The basic idea behind occupancy grid maps is to represent the map as a two-dimensional grid of binary random variables that represent whether or not the location is \emph{occupied} or \emph{not occupied}.

More concretely, we posit that there is an underlying grid map $m \in M = \{0, 1\}^{N \times N}$ that is a-priori unknown to the robot. We wish to calculate our belief over maps $M$ at time $t$ given all previous poses and observations leading up to that time step $b_t(m) = p(m|x_{1:t}, z_{1:t})$. Reasoning about all possible maps quickly becomes intractable, as there are $2^{N^2}$ possible maps. To simplify the problem, we assume the individual map random variables, indexed as $m_i$, are independent given the poses and measurements, or

$$b_t(m)= \prod_{i} p(m_i|x_{1:t}, z_{1:t}) = \prod_{i} b_t(m_i).$$

We work with the log-odds posterior $l_{t, i} = \log \frac{b_t(m_i=1)}{1 - b_t(m_i=1)}$ for simplicity and can recover our posterior probabilities using $b_t(m_i=1) = 1 - \frac{1}{1 + \exp\{l_{t, i}\}}$. We can update our posterior given a sensor reading via an inverse sensor model $p(m_i | x_t, z_t)$ using a recursive Bayes filter \cite{thrun2005probabilistic}:

\begin{equation}l_{t, i} = l_{t-1, i} + \log \frac{p(m_i=1 | x_t, z_t)}{1-p(m_i=1 | x_t, z_t)} - \log \frac{p(m_i = 1)}{p(m_i = 0)}.
\label{recbayesfilter}
\end{equation}

Later, we will use the information-theoretic entropy of the belief state to quantify our uncertainty, which factorizes over the individual map random variables because they are assumed to be independent,

$$H(b_t(m)) = \sum_i H(b_t(m_i)) = \sum_i b_t(m_i = 1) \log b_t(m_i = 1) + b_t(m_i = 0) \log b_t(m_i = 0).$$

\subsection{Markov Decision Processes}
\label{sec:mdp}

Markov decision processes (MDP) are a mathematical framework for decision making where the outcomes are random and potentially affected by the decision maker \cite{sutton1998reinforcement}. An MDP is formally defined as a tuple $<S, A, T, R, \gamma>$. $S$ is a set of states the decision maker might be in. $A$ is the set of actions the decision maker can take. $T(s'|s, a)$ is the distribution over next states given the decision maker took action $a$ in state $s$. $R(s, a)$ is the reward the agent receives for taking action $a$ in state $s$. $\gamma$ is the discount factor, weighing short-term rewards versus long-term rewards.

\subsection{Advantage Actor-Critic}
\label{sec:a2c}

The Advantage Actor-Critic (A2C) algorithm is the single-threaded version of \cite{mnih2016asynchronous}, and has enjoyed lots of success in playing classic ATARI games from raw pixel observations. It prescribes a method for learning a differentiable stochastic policy $\pi(a|s; \theta')$ and value function $V(s; \theta_v')$ through interactions with an environment. More concretely, after $n$ interactions with the environment, it performs a gradient step on the following loss functions for each interaction:

$$L(\theta) = -\log \pi(a_t|s_t; \theta')(R-V(s_t;\theta_v')) - \lambda H(\pi(a_t|s_t; \theta')),$$

$$L(\theta_v') = (R-V(s_t;\theta_v'))^2,$$

where $R$ is the bootstrapped $n-$step reward. We use the A2C algorithm to train our agents.

\section{Approach}

We separate the problem of updating the posterior of the belief from selecting actions. At each time step $t$, the robot receives an observation $z_t$ and its pose $x_t$. It updates its posterior $b_t$ using Equation~\ref{recbayesfilter}. In other words, the agent only has control over $u_t$ and not how $b_t$ is updated. At this point, the robot is faced with the decision of what control input $u_t$ to select given $b_t$ and $x_t$. Instead of choosing the action myopically or planning, we resort to flexible model-free reinforcement learning to train our mapping agent to act directly based on its belief state.

We convert our notation to the MDP notation in Section~\ref{sec:mdp}. We let the state be defined as $s_t=[b_t, x_t]$ and the action as $a_t=u_t$. The state evolves according to Equation~\ref{recbayesfilter} and the underlying map. In our RL formulation, the robot seeks a policy $\pi(a|s)$ that reduces uncertainty as quickly as possible, or equivalently one that maximizes the following discounted expected cumulative reward

$$\mathbb{E}_{\pi, m} \big [ \sum_{t=0}^{T-1} \gamma^t R_t \big ],$$

where $R_t=H(b_t) - H(b_{t+1})$ is the reduction in the entropy of the robot's belief state at time step $t$ and the expectation is taken over maps, the policy and the imposed MDP dynamics. The dynamics of the environment are presented in Figure~\ref{fig:dynamics}.

\begin{figure}[h]
    \centering
    \label{fig:dynamics}
    \caption{A full transition of our mapping environment.}
    \medskip
    \includegraphics[scale=.4]{figs/dynamics.png}
\end{figure}

We can then train a policy to maximize the expected reward in simulation using a prior over initial maps and the A2C algorithm from Section~\ref{sec:a2c}. Our prior over initial maps can be thought of as a representative distribution over the environments our robot might encounter. We could learn this distribution by training a generative model over a database of previously acquired maps, or hand-design it. The full learning procedure is summarized in Algorithm~\ref{alg:l2map}.

This learning procedure can accommodate a variety of posterior updates, priors over maps and pose/control spaces, as long as the architecture of the actor-critic is chosen correctly.

\begin{algorithm}[b!]
  \caption{Learning to Map}
  \label{alg:l2map}
  \begin{algorithmic}[1]
    \Require $p(m)$, prior distribution over maps. $p(x)$, prior distribution over initial poses. $p(m|x, z)$, inverse sensor model. $\pi$ and $V$, differentiable actor and critic.
    \For{$N$ episodes}
    \State Sample $m \sim p(m)$
    \State Simulate episode updating $\pi$ and $V$ using A2C algorithm
    \EndFor
\end{algorithmic}
\end{algorithm}

\subsection{Why is the posterior update part of the environment?}

This formulation treats the posterior update as part of the environment, which seems counter-intuitive as the robot normally updates its posterior itself. However, we assume we already have a sensible posterior update rule and we seek a complementary policy that can reduce uncertainty as quickly as possible.

\section{Application: Disaster Mapping}

We will use the following motivating scenario to set up an environment to test our approach. A large earthquake has occurred on the San Andreas Fault, decimating many of the buildings in San Francisco. We would like to find out which buildings are still standing, but the entire city is covered in smoke so we cannot use imaging from planes or satellites. Luckily, we have a quad-copter that is able to fly through the smoke and get close to the buildings. This is a robotic mapping problem. We represent the map of buildings as a $25 \times 25$ occupancy grid. We discretize the location of the drone so that it is in a single position in the grid and assume it is flying at a fixed altitude. The drone can sense whether or not there is a building in the adjacent positions, but has a noisy sensor that is wrong 20\% of the time. The drone cannot can move to adjacent positions that do not contain buildings. We have an independent Bernoulli($.1$) prior over maps. Figure~\ref{fig:env} is a visual representation of the environment.

\begin{figure}[H]
    \centering
    \label{fig:env}
    \caption{The Disaster Mapping Environment. Left, the fully observable environment with the quad-copter (pink) and buildings (gray). Right, the belief state of the robot with the quad-copter (pink) where occupancy probabilities are represented as a gradient from black (0) to green (1).}
    \medskip
    \includegraphics[scale=.25]{figs/map.png}
\end{figure}

\subsection{Architecture Design}

To use A2C, we need a differentiable policy $\pi(a_t|b_t, x_t; \theta)$ and value function $V(b_t, x_t; \theta')$. For the case of disaster mapping, our belief state is a two-dimensional grid of occupancy probability values $b_t(m_i)$ and our pose $x_t$ is a position in that grid. In order to take advantage of the spatial representation of the belief and pose, we form a $N \times N$ matrix $B_t$ where each entry has its corresponding belief value $b_t(m_i)$. If our robot is at a pose $x_t=(i, j)$, we form a \emph{centered} version of the belief: a $(2N-1) \times (2N-1)$ matrix $C_t=B_t[i-(N-1):i+(N-1), j-(N-1):j+(N-1)]$. We pad $B$ with 1's before forming $C_t$, because we are sure that positions outside the map contains obstacles. We note that the index $(N, N)$ in $C_t$ always represents the robot's current pose and that all of $B$ is always present in $C_t$, thus making it a sufficient statistic of $[b_t, x_t]$.

This whole process can be made more concrete with an example. Suppose we have a $3 \times 3$ belief state $B_0$ that is $.5$ everywhere and $0$ at the current pose $x_0=(0, 0)$. Then $C_0$ is $5 \times 5$ and defined as

$$C_t =
\begin{bmatrix}
    1       & 1 & 1 & 1 & 1 \\
    1       & 1 & 1 & 1 & 1 \\
    1       & 1 & 0 & .5 & .5 \\
    1       & 1 & .5 & .5 & .5 \\
    1       & 1 & .5 & .5 & .5
\end{bmatrix} \ \
H(C_t) =
\begin{bmatrix}
    0       & 0 & 0 & 0 & 0 \\
    0       & 0 & 0 & 0 & 0 \\
    0       & 0 & 0 & .69 & .69 \\
    0       & 0 & .69 & .69 & .69 \\
    0       & 0 & .69 & .69 & .69
\end{bmatrix}
.$$

We propose to also add the point-wise entropy map of $C_t$ as a feature channel in our state, to allow our robot to guide itself to high entropy areas, resulting in the state $s_t=[C_t, H(C_t)]$.

We experiment with three different network architectures, of increasing complexity. They all result in a tensor $\in \mathbb{R}^{256}$ that is processed in parallel by a fully-connected (FC) layer followed by a soft-max for $\pi$ and a FC layer for $V$.

\paragraph{Multi-Layer Perceptron (MLP)} The input features $s_t$ are flattened and passed through a single FC layer to a hidden layer of size $256$ followed by a rectified linear unit (ReLU) nonlinearity.

\paragraph{Convolutional Neural Network (CNN-MLP)} The input features $s_t$ are processed by the following convolutional layers with ReLU nonlinearities:
\begin{enumerate}
\itemsep0em
\item[{(1)}] 32 $3 \times 3$ filters with stride 2
\item[{(2)}] 32 $4 \times 4$ filters with stride 2
\item[{(3)}] 32 $8 \times 8$ filters with stride 1
\item[{(4)}] A FC layer to a hidden layer of size $256$ followed by ReLU
\end{enumerate}

\paragraph{Residual Network (ResNet)} The input features $s_t$ are processed by a single convolutional layer then 6 residual blocks \cite{he2016deep} with ReLU nonlinearities. Each convolutional layer in the network has 64 $3 \times 3$ filters with stride $1$ and padding $1$. Finally, the flattened features are passed through a FC layer to a hidden layer of size $256$ followed by a ReLU.

All of the architectures are implemented in PyTorch \cite{PyTorch} and the code is available online\footnote{https://www.github.com/sbarratt/rl-mapping}. A video of a trained policy in action is also available online\footnote{https://www.youtube.com/watch?v=6m4U7mWNOzs}.

\subsection{Training Details}

We use a discount rate $\gamma=.99$ and episode length of $300$. The agent runs for $20$ steps until an A2C update. We run the learning algorithm ADAM for $12.5$k episodes, resulting in $100$k gradient updates to the actor-critic\cite{kingma2014adam}. We use a learning rate of $10^{-4}$ annealed every $5$k episodes by a multiplicative factor of $.5$. We set the maximum gradient norm of an update to be $50$. We use an entropy regularization constant of $.001$ for the A2C updates. Even though we have a $.1$ prior over maps, we initialize the belief map with all $.5$ to guarantee that the entropy will decrease. The features are also linearly scaled to be in the range $[-1, 1]$. For all other implementation details, the reader is referred to the source code.

\subsection{Results}

We first compare the training characteristics of the three network architectures. The training curves for the three architectures can be found in Figure~\ref{fig:learningcurve}, which contains plots of the episode reward over the number of training episodes for one random seed. The episode rewards have been smoothed with a Gaussian kernel for visualization purposes. The ResNet architecture at first performed the best, which is expected given its superior expressiveness and extensive success in computer vision. However, the training procedure diverged and in fact in the long run the CNN-MLP architecture resulted in a higher average episode reward.

\begin{figure}[h]
    \centering
    \label{fig:learningcurve}
    \caption{Training curves for different network architectures.}
    \includegraphics[scale=.3]{figs/learningcurve.pdf}
\end{figure}

After the training procedure, we evaluate all of the networks, the myopic exploration strategy and a random exploration strategy on $1000$ random, unseen maps. We present the average full episode rewards in Table~\ref{tab:results}. Ultimately, the ResNet architecture outperforms the hand-crafted myopic exploration strategy. This leads us to believe that this training methodology could scale to more complex inverse sensor models where designing myopic exploration strategies is infeasible.

\begin{table}[H]
  \caption{Episode Rewards averaged over 1000 out-of-sample episodes.}
  \label{tab:results}
  \centering
  \begin{tabular}{ll}
    \toprule
    Approach & Performance \\
    \midrule
    ResNet   & $\mathbf{254.87} \ \rpm \ 47.26$  \\
    CNN-MLP  & $201.20 \ \rpm \ 47.25$ \\
    MLP      & $184.61 \ \rpm \ 75.75$ \\
    Myopic   & $251.07 \ \rpm \ 29.2$ \\
    Random   & $92.19 \ \rpm \ 23.84$ \\
    \bottomrule
  \end{tabular}
\end{table}

\section{Conclusion}

In this work, we introduce an approach to train agents that perform efficient robotic mapping using reinforcement learning. This work is preliminary in that it only evaluated the approach on a scenario with a simple inverse sensor model. One could imagine switching the sensor model to be, say, a sonar sensor that depends on the robot's orientation. Then rotating the robot could become part of the action space. Since A2C can be used with continuous action spaces as long as there is an analytical log-probability of actions, this method can be generalized to robotic exploration problems that have continuous action spaces. On the contrary, it is not clear how to generalize information gain-based methods or frontier-based methods to continuous action spaces.

In future work, we hope to apply this approach to problem setups with multiple agents. This is a challenging, unsolved problem, for which we believe our approach could lead to tangible benefits. We would also like to integrate it with recent work on Active Neural Localization \cite{nal}, leading to a fully trainable SLAM system, the holy grail of autonomous navigation robots.

\section*{Acknowledgments}

Shane Barratt is supported by the National Science Foundation Graduate Research Fellowship Program.

\bibliography{mybib}{}
\bibliographystyle{unsrt}

\appendix

\end{document}


\section{Memory Layout}

\frame{\tableofcontents[currentsection]}

\begin{frame}
    \frametitle{Arrays}
    \begin{center}
        \begin{tikzpicture}
            \draw[help lines] (-2,0) grid (8,1);
            \draw[thick] (0,0) grid (6,1);
            \foreach \x in {0,...,5} {
                \node[font=\tiny] at ($ (\x,0.5) + (0.5,0) $) { \texttt{xs[\x]} };
            }
        \end{tikzpicture}
    \end{center}
    \vskip4mm
    \begin{itemize}
        \item One piece of contiguous memory
    \end{itemize}
\end{frame}

\begin{frame}
    \frametitle{Arrays}
    \code[language=c++14]{array.cpp}
\end{frame}

\begin{frame}
    \frametitle{Linked Lists}
    \begin{center}
        \begin{tikzpicture}[link/.style={thick,-latex},scale=0.8,transform shape]
            \coordinate (p1) at (1,2);
            \coordinate (p2) at (4,3);
            \coordinate (p3) at (2,0);
            \coordinate (p4) at (5,0);
            \coordinate (p5) at (8,1);

            \draw[help lines] (0,0) grid (10,4);
            \foreach[evaluate={int(\i-1)} as \j] \i in {1,...,5} {
                \llnode[position={p\i},value={xs[\j]},value font=\ttfamily\small]
            }

            \draw[link] ($ (p1) + (1.5, 0.5) $) -- ($ (p2) $);
            \draw[link] ($ (p2) + (1.5, 0.5) $) -- ($ (p3) + (0,1) $);
            \draw[link] ($ (p3) + (1.5, 0.5) $) -- ($ (p4) + (0,0.5) $);
            \draw[link] ($ (p4) + (1.5, 0.5) $) -- ($ (p5) $);
        \end{tikzpicture}
    \end{center}
    \vskip4mm
    \begin{itemize}
        \item List consists of series of nodes
        \item Each node has two fields
              \begin{itemize}
                \item Item
                \item Reference to next node
              \end{itemize}
        \item Nodes scattered across memory
    \end{itemize}
\end{frame}

\begin{frame}
    \frametitle{Linked Lists in Code}
    \code[language=csharp]{LinkedList.cs}
\end{frame}

\begin{frame}
    \frametitle{Creating a Linked List}
    \begin{center}
        \begin{tikzpicture}[link/.style={thick,-latex},scale=0.8,transform shape]
            \coordinate (p1) at (1,2);
            \coordinate (p2) at (4,3);
            \coordinate (p3) at (2,0);
            \coordinate (p4) at (5,0);
            \coordinate (p5) at (8,1);

            \draw[help lines] (0,0) grid (10,4);
            \foreach \i in {1,...,5} {
                \llnode[position=p\i,value=\i]
            }

            \draw[link] ($ (p1) + (1.5, 0.5) $) -- ($ (p2) $);
            \draw[link] ($ (p2) + (1.5, 0.5) $) -- ($ (p3) + (0,1) $);
            \draw[link] ($ (p3) + (1.5, 0.5) $) -- ($ (p4) + (0,0.5) $);
            \draw[link] ($ (p4) + (1.5, 0.5) $) -- ($ (p5) $);
        \end{tikzpicture}
    \end{center}
    \vskip4mm
    \code[language=csharp]{LinkedListCreation.cs}
\end{frame}


\documentclass[letterpaper]{article}

\usepackage{fullpage}
\usepackage{nopageno}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage[utf8]{luainputenc}
\usepackage{aeguill}
\usepackage{setspace}

\tikzstyle{edge} = [fill,opacity=.5,fill opacity=.5,line cap=round, line join=round, line width=50pt]
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}

\pgfdeclarelayer{background}
\pgfsetlayers{background,main}

\allowdisplaybreaks

\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}

\begin{document}
\title{Notes}
\date{25 février, 2015}
\maketitle
\section*{6.2 planarity vs nonplanarity}

how to tell if a graph is planar without drawing it in a plane?

on monday we saw some options for finding non-planarity.
\begin{enumerate}
\item
$e> 3v-6$
\item
can't have $K_{3,3}$ or $K_5$ as a subgraph
\item
didn't get to this last time, but all vertices have degree 6 or more (this follows from one of the above)
\end{enumerate}

if $G$ is a graph then $H$ is a {\bfseries subdivision} of $G$ if $H$ is obtained from $G$ by adding a vertex on any edge of $G$.

The process can be iterated.

\subsubsection*{example}
\begin{tikzpicture}[main_node/.style={circle,draw,text=black,inner sep=1pt,outer sep=0pt]}]
  \node[main_node] (1) at (0,0) {};
  \node[main_node] (2) at (0,1) {};
  \node[main_node] (3) at (1,1) {};
  \node[main_node] (4) at (1,0) {};
  \draw (1)--(2)--(3)--(4)--(1);
\end{tikzpicture}
\begin{tikzpicture}[main_node/.style={circle,draw,text=black,inner sep=1pt,outer sep=0pt]}]
  \node[main_node] (1) at (0,0) {};
  \node[main_node] (2) at (0,1) {};
  \node[main_node] (3) at (1,1) {};
  \node[main_node] (4) at (1,0) {};
  \node[main_node] (5) at (0.5,0) {};
  \draw (1)--(2)--(3)--(4)--(5)--(1);
\end{tikzpicture}

\begin{enumerate}
\item
$H$ is a subdivision of $G$ implies that $H$ and $G$ have the same number of cycles (faces if planar)
\item
$H$ is a subdivision of $G$ implies that $|G|=m$ and $|E(G)|=m$ implies that $|H|=n+c$ and $|E(H)|=m+c$.
\end{enumerate}

\subsection*{kuratowski's theorem}
a graph $G$ is planar if and only if $G$ contains no subdivisions of $K_{3,3}$ or $K_5$ as subgraphs.

\subsubsection*{remark}
there is an inverse operation to subdivision called {\bfseries edge contraction}

an {\bfseries edge contraction} of $uv\in E(G)$ is when $uv$ is replaced by vertex $w$. The neighbors of $w$ are the neighbors of $u$ and $v$ with duplicates deleted. Then $u$ and $v$ are removed.

\subsubsection*{example}
\begin{tikzpicture}[main_node/.style={circle,draw,text=black,inner sep=1pt,outer sep=0pt]}]
  \node[main_node] (1) at (0,0) {};
  \node[main_node] (2) at (0,1) {};
  \node[main_node] (3) at (1,1) {u};
  \node[main_node] (4) at (1,0) {v};
  \draw (1)--(2)--(3)--(4)--(1)--(3);
\end{tikzpicture}
\begin{tikzpicture}[main_node/.style={circle,draw,text=black,inner sep=1pt,outer sep=0pt]}]
  \node[main_node] (1) at (0,0) {};
  \node[main_node] (2) at (0,1) {};
  \node[main_node] (3) at (1,1) {w};
  \draw (1)--(2)--(3)--(1);
\end{tikzpicture}

\begin{tikzpicture}[main_node/.style={circle,draw,text=black,inner sep=1pt,outer sep=0pt]}]
  \node[main_node] (1) at (0,1) {a};
  \node[main_node] (2) at (1,0) {b};
  \node[main_node] (3) at (2,0) {c};
  \node[main_node] (4) at (3,1) {z};
  \node[main_node] (5) at (1,2) {x};
  \node[main_node] (6) at (2,2) {y};
  \draw (1)--(2)--(3)--(4)--(6)--(5)--(1);
  \draw (2)--(5)--(3)--(6);
\end{tikzpicture}
contract $bc$
\begin{tikzpicture}[main_node/.style={circle,draw,text=black,inner sep=1pt,outer sep=0pt]}]
  \node[main_node] (1) at (0,1) {a};
  \node[main_node] (3) at (2,0) {bc};
  \node[main_node] (4) at (3,1) {z};
  \node[main_node] (5) at (1,2) {x};
  \node[main_node] (6) at (2,2) {y};
  \draw (1)--(3)--(4)--(6)--(5)--(1);
  \draw (6)--(3)--(5);
\end{tikzpicture}

a {\bfseries minor} of a graph is any graph obtained from edge contraction, edge deletion or vertex deletion

all subgraphs are minors. add in edge contraction to subgraphs and you get a minor.

no connection to minor of a matrix

\section*{wagner/kuratowski thrm}
a graph is planar if and only if it contains no minors isomorphic to $K_{3,3}$ or $K_5$.

\section*{overarching thrm}
if property $P$ is maintained under taking minors then there exists a finite list of excluded/impossible minors.

ie for planarity, the list is $K_{3,3}, K_5$.

what are some minor closed properties? planarity, forest (excluded minor is $K_3$)

\section*{homework}
2,3,7,10
\end{document}


\documentclass{beamer}
\usetheme{Warsaw}
\usepackage{nhtvslides}
\usepackage{graphicx}
\usepackage{listings}
\lstset{language=CAML,
basicstyle=\ttfamily\footnotesize,
frame=shadowbox,
breaklines=true}
\usepackage[utf8]{inputenc}

\title{Differential equations}

\author{Dr. Giuseppe Maggiore}

\institute{NHTV University of Applied Sciences \\
Breda, Netherlands}

\date{}

\begin{document}
\maketitle

\begin{frame}{Table of contents}
\tableofcontents
\end{frame}

\section{Introduction}
\begin{slide}{Introduction}{Differential equation}{
\item Equations of the form $\dot x = f(x,t)$
\item $x$ is the state of the system (an ``array of floats'')
\item $f$ is the function that computes the derivative of $x$ with respect to time
\item General purpose toolbox for dealing with them
}\end{slide}

\begin{slide}{Introduction}{How does this apply to us?}{
\item $x$ is the state of all our rigid bodies
\item $f$ gives us the derivative of the state: velocity, acceleration, \textit{angular velocity}, torque
}\end{slide}

\begin{frame}{Introduction}
\begin{tabular}{| c | c |}
\hline
$x$ & $f(x)$ \\
\hline
position & velocity \\
velocity/linear momentum & acceleration/force \\
rotation & \textit{angular velocity} ($\omega \star R$) \\
angular velocity/angular momentum & angular acceleration/torque \\
\hline
\end{tabular}
\end{frame}

\section{Numerical solutions}
\begin{slide}{Numerical solutions}{Numerical solutions}{
\item We cannot just compute the state at time $t$
\item There is no closed form for it, unless the problem is really simple \footnote{Yeah, you wish :)}
\item We look for an \textit{approximate} solution
}\end{slide}

\begin{slide}{Numerical solutions}{Field of derivatives}{
\item We know how to compute $f$
\item This means that we can compute the \textit{field of slopes} of $x$
}\end{slide}

\begin{frame}{Slope field}
\center
\includegraphics[width=7cm]{Pics/Fig1.png}
\end{frame}

\begin{slide}{Numerical solutions}{Field of derivatives}{
\item Start at $x_0$
\item Follow the slope
\item Discrete steps
}\end{slide}

\begin{frame}{Following the slope}
\center
\includegraphics[width=7cm]{Pics/Fig2.png}
\end{frame}

\section{Euler's method}
\begin{slide}{Numerical solutions}{Euler's method}{
\item Big, discrete steps along the slope: $x(t+h) = x(t) + h \dot x(t)$
\item Actually works correctly and \textit{may be acceptable} in some cases
\item If it is acceptable, it's simple to code and fast to run
\item Otherwise it requires a very small time-step to compensate (more computation!)
}\end{slide}

\begin{frame}{Euler's method}
\center
\includegraphics[width=7cm]{Pics/Fig3.png}
\end{frame}

\begin{slide}{Numerical solutions}{Euler's method}{
\item Why may Euler's method not work?
\item Euler's method is
\begin{itemize}
\item Inaccurate, that is it may jump from one trajectory to another
\item Not stable, that is it may increase the energy of the state where it should decrease
\end{itemize}
}\end{slide}

\begin{frame}{Euler's method}
\center
\includegraphics[width=7cm]{Pics/Fig4.png}
\end{frame}

\section{Deriving more sophisticated methods}
\begin{slide}{Numerical solutions}{Taylor series}{
\item Any function can be expressed as the infinite sum of its derivatives
\item $x(t+h) = x(t) + h \dot x(t) + \frac{h^2}{2} \ddot x(t) + \dots + \frac{h^n}{n!} \frac{d^n}{dt^n}x(t) + \dots$
\pause
\item We can \textit{truncate} this summation to \textit{approximate} the original function
\item All differential equations solvers are based on this technique
}\end{slide}

\begin{slide}{Numerical solutions}{Deriving Euler's method}{
\item $x(t+h) = x(t) + h \dot x(t) + \frac{h^2}{2} \ddot x(t) + \dots + \frac{h^n}{n!} \frac{d^n}{dt^n}x(t) + \dots$
\item $x(t+h) \approx x(t) + h \dot x(t)$
}\end{slide}

\begin{slide}{Numerical solutions}{Deriving the midpoint method}{
\item $x(t+h) \approx x(t) + h \dot x(t) + \frac{h^2}{2} \ddot x(t)$
\pause
\item We must now compute $\ddot x(t)$
\item $\ddot x = \frac{d}{dt} \dot x = \frac{d}{dt} f(x(t)) = f'(x(t)) \dot x = f'(x(t)) f(x(t))$
}\end{slide}

\begin{slide}{Numerical solutions}{Deriving the midpoint method}{
\item $\ddot x = f'(x(t)) f(x(t))$
\item We now approximate $f$ with Euler's method
\item $f(x_0 + \Delta x) = f(x_0) + \Delta x f'(x_0)$
}\end{slide}

\begin{slide}{Numerical solutions}{Deriving the midpoint method}{
\item We (arbitrarily) choose $\Delta x = \frac{h}{2} f(x_0)$ (which is an acceptable solution, check units of measure!)
\item Substitute the approximation of $f$
\item $f(x_0 + \frac{h}{2} f(x_0)) = f(x_0) + \frac{h}{2} f(x_0) f'(x_0)$
\item We multiply both sides by $h$:
\item $h(f(x_0 + \frac{h}{2} f(x_0)) - f(x_0)) = \underbrace{\frac{h^2}{2} f(x_0) f'(x_0)}_{\frac{h^2}{2} \ddot x}$
}\end{slide}

\begin{slide}{Numerical solutions}{Deriving the midpoint method}{
\item $x(t+h) \approx x(t) + h \dot x(t) + \frac{h^2}{2} \ddot x(t)$
\item $\ddot x = f'(x(t)) f(x(t))$
\item $h(f(x_0 + \frac{h}{2} f(x_0)) - f(x_0)) = \frac{h^2}{2} f(x_0) f'(x_0) = \frac{h^2}{2} \ddot x$
\pause
\item $x(t+h) \approx x(t) + h \dot x(t) + h(f(x_0 + \frac{h}{2} f(x_0)) - f(x_0))$
}\end{slide}

\begin{slide}{Numerical solutions}{Deriving the midpoint method}{
\item $x(t+h) \approx x(t) + h \dot x(t) + h(f(x_0 + \frac{h}{2} f(x_0)) - f(x_0))$
\item We sample the derivative at the midpoint of the step, hence the name
}\end{slide}

\begin{frame}{RK2}
\center
\includegraphics[width=6cm]{Pics/Midpoint_method.png}
\end{frame}

\begin{slide}{Numerical solutions}{About the midpoint method}{
\item $x(t+h) \approx x(t) + h \dot x(t) + h(f(x_0 + \frac{h}{2} f(x_0)) - f(x_0))$
\item We compute $f$ twice; in general though, the higher number of evaluations of $f$ in advanced methods is more than offset by the far smaller time step needed
}\end{slide}

\begin{slide}{Numerical solutions}{RK4}{
\item The ``best'' numerical method though is RK4
\item $k_1 = h f(x_0)$, $k_2 = h f(x_0 + \frac{k_1}{2})$, $k_3 = h f(x_0 + \frac{k_2}{2})$, $k_4 = h f(x_0 + \frac{k_3}{2})$
\item $x(t+h) = x_0 + \frac{1}{6} k_1 + \frac{1}{3} k_2 + \frac{1}{3} k_3 + \frac{1}{6} k_4$
}\end{slide}

\begin{frame}{RK4}
\center
\includegraphics[width=6cm]{Pics/RK4.png}
\end{frame}

\section{The ``best'' method?}
\begin{slide}{Numerical solutions}{To the stars and beyond?}{
\item Why not use RK5, RK6, or even more?
\item Is it not more precise after all?
\pause
\item Suspense :)
\pause
\item NO!
\item We can approximate the higher order derivatives with the first derivative only so far
\item After a while we are just not inserting any new information
\item Very high order methods would only work if we could reliably compute third or fourth order derivatives
\item Otherwise we insert spurious oscillations and new errors in the system
}\end{slide}

\begin{frame}{That's it}
\center
\fontsize{18pt}{7.2}\selectfont
Thank you!
\end{frame}

\end{document}

\begin{slide}{SECTION}{SLIDE}{
\item i
}\end{slide}

\begin{frame}[fragile]{SLIDE}
\begin{lstlisting}
CODE
\end{lstlisting}
\end{frame}

\begin{frame}{SLIDE}
\center
%\includegraphics[height=5cm]{Pics/recursive_multiplier.png}
\end{frame}


%Suggested order of slides
% slides-bayes-lm.tex
% slides-gp-basic.tex
% slides-gp-covariance.tex
% slides-gp-prediction.tex
% slides-gp-training.tex
% slides-gp-mean.tex

% not included:
% slides-x-covariance-adv.tex
% slides-x-gp-additional.tex
% slides-x-gp-classification.tex

\subsection{Bayes LM}
\includepdf[pages=-]{../slides-pdf/slides-gp-bayes-lm.pdf}
\subsection{Gaussian Processes - Basics}
\includepdf[pages=-]{../slides-pdf/slides-gp-basic.pdf}
\subsection{Gaussian Processes - Covariance}
\includepdf[pages=-]{../slides-pdf/slides-gp-covariance.pdf}
\subsection{Gaussian Processes - Prediction}
\includepdf[pages=-]{../slides-pdf/slides-gp-prediction.pdf}
\subsection{Gaussian Processes - Training}
\includepdf[pages=-]{../slides-pdf/slides-gp-training.pdf}
\subsection{Gaussian Processes - Mean}
\includepdf[pages=-]{../slides-pdf/slides-gp-mean.pdf}


\documentclass{warpdoc}
\newlength\lengthfigure                  % declare a figure width unit
\setlength\lengthfigure{0.158\textwidth} % make the figure width unit scale with the textwidth
\usepackage{psfrag}         % use it to substitute a string in a eps figure
\usepackage{subfigure}
\usepackage{rotating}
\usepackage{pstricks}
\usepackage[innercaption]{sidecap} % the cute space-saving side captions
\usepackage{scalefnt}
\usepackage{amsmath}
\usepackage{bm}

%%%%%%%%%%%%%=--NEW COMMANDS BEGINS--=%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\alb}{\vspace{0.2cm}\\} % array line break
\newcommand{\mfd}{\displaystyle}
\newcommand{\nd}{{n_{\rm d}}}
\newcommand{\M}{{\bf M}}
\newcommand{\N}{{\bf N}}
\newcommand{\B}{{\bf B}}
\newcommand{\BI}{\overline{{\bf B}}}
\newcommand{\A}{{\bf A}}
\newcommand{\C}{{\bf C}}
\newcommand{\T}{{\bf T}}
\newcommand{\co}{,~~}
\newcommand{\band}{{\rm Band}}
\renewcommand{\fontsizetable}{\footnotesize\scalefont{1.0}}
\renewcommand{\fontsizefigure}{\footnotesize}
\renewcommand{\vec}[1]{\bm{#1}}
\setcounter{tocdepth}{3}
\let\citen\cite

%%%%%%%%%%%%%=--NEW COMMANDS BEGINS--=%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setcounter{tocdepth}{3}

%%%%%%%%%%%%%=--NEW COMMANDS ENDS--=%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\author{
  Bernard Parent
}

\email{
  bernparent@gmail.com
}

\department{
  Department of Aerospace Engineering
}

\institution{
  Pusan National University
}

\title{
  Residual Discretization
}

\date{
  August 2015
}

%\setlength\nomenclaturelabelwidth{0.13\hsize}  % optional, default is 0.03\hsize
%\setlength\nomenclaturecolumnsep{0.09\hsize}  % optional, default is 0.06\hsize

\nomenclature{

  \begin{nomenclaturelist}{Roman symbols}
   \item[$a$] speed of sound
  \end{nomenclaturelist}
}

\abstract{
abstract
}

\begin{document}
\sloppy
  \pagestyle{headings}
  \pagenumbering{arabic}
  \setcounter{page}{1}
%%  \maketitle
  \makewarpdoctitle
%  \makeabstract
  \tableofcontents
%  \makenomenclature
%%  \listoftables
%%  \listoffigures

\section{Discretized Form of the Residual}

The residual associated with the governing equations solved in WARP can be written in Cartesian coordinates as:
%
\begin{equation}
 R=   Z\frac{\partial U}{\partial t} + \sum_{i=1}^3  \frac{\partial }{\partial x_i} D_i U
   + \sum_{i=1}^3 \frac{\partial F_i}{\partial x_i}
     - \sum_{i=1}^3 \sum_{j=1}^3 \frac{\partial }{\partial x_j}\left( K_{ij} \frac{\partial G}{\partial x_i} \right)
     +\sum_{i=1}^3 Y_i \frac{\partial H}{\partial x_i}
   -S
\end{equation}
%
We can write the latter in more compact form as follows:
%
\begin{equation}
 R=   Z \partial_t U + \sum_{i=1}^3  \partial_{x_i} (D_i U)
   + \sum_{i=1}^3 \partial_{x_i} F_i
     - \sum_{i=1}^3 \sum_{j=1}^3 \partial_{x_j}\left( K_{ij}  \partial_{x_i}G \right)
     +\sum_{i=1}^3 Y_i  \partial_{x_i} H
   -S
\end{equation}
%
When discretized, the latter becomes:
%
\begin{equation}
R_\Delta = Z\delta_t U + \sum_{i=1}^3  \delta_{x_i} (D_i U)
   + \sum_{i=1}^3 \delta_{x_i} F_i
     - \sum_{i=1}^3 \sum_{j=1}^3 \delta_{x_j}\left( K_{ij} \delta_{x_i} G \right)
     +\sum_{i=1}^3 Y_i \delta_{x_i} H -S_\Delta
\end{equation}
%
In the following sections the discretization stencils needed for all terms within the discretized residual are outlined.
Although the stencils are here given in Cartesian coordinates, they can also be used in curvilinear coordinates simply by setting $\Delta x =\Delta y =\Delta z =1$ and by substituting the vectors and matrices by their curvilinear analogues (i.e.\ $F \rightarrow F^\star$, $K \rightarrow K^\star$, $Y \rightarrow Y^\star$, etc).

\section{Discretization of $\partial_x F$}

The discretization of the convective flux $F$ is particularly challenging to accomplish for compressible flow. Several schemes using the eigenstructure of the convective flux Jacobian $A$ are here presented. For the schemes that rely on a dimensional splitting strategy, the discretization stencil is the following:
%
\begin{equation}
\delta_x F = \frac{F_{i+1/2}-F_{i-1/2}}{\Delta x}
\end{equation}
%
where the flux at the interface $F_{i+1/2}$ is outlined for each scheme below. Note that the latter is not used for the genuinely multidimensional schemes that do not resort to dimensional splitting. More details on how the multidimensional schemes are discretized will be given in their respective subsections.

\subsection{Flux Vector Splitting First-Order Steger-Warming}

For the Steger-Warming flux vector splitting scheme, the flux at the interface becomes \cite{jcp:1981:steger}:
%
\begin{equation}
F_{i+1/2}=F^+_{i}
         +F^-_{i+1}
\label{eqn:FVS_1o}
\end{equation}
%
where
%
\begin{equation}
F^\pm \equiv  L^{-1} \Lambda^\pm L U
\label{eqn:Fplusminus}
\end{equation}
%
with
%
\begin{equation}
\Lambda^\pm \equiv \frac{1}{2}(\Lambda\pm|\Lambda|)
\label{eqn:Lambdaplusminus}
\end{equation}
%
In the latter, $\Lambda$ is the eigenvalue matrix, $L$  the left eigenvector matrix, and $L^{-1}$ the right eigenvector matrix.

\subsection{Flux Vector Splitting Second-Order MUSCL}

Following the so-called MUSCL-TVD approach outlined in Ref.\ \citen{aiaa:1986:anderson}, the Steger-Warming scheme can be extended to second-order accuracy by rewriting the flux at the interface in the following form:
%
\begin{equation}
F_{i+1/2}=F^+\left(U^{\rm L}_{i+1/2}\right)
         +F^-\left(U^{\rm R}_{i+1/2}\right)
\end{equation}
%
where $F^\pm$ is determined as in Eq.\ (\ref{eqn:Fplusminus}) and where $U^{\rm L}_{i+1/2}$ and $U^{\rm R}_{i+1/2}$ are vectors reconstructed from extrapolated primitive variables. For instance, the temperature, velocity, and density needed to reconstruct $U^{\rm L}_{i+1/2}$ are extrapolated using a limiter with a leftward bias such as:
%
\begin{equation}
T^{\rm L}_{i+1/2}=T_i + \mfd\frac{1}{2}(T_i-T_{i-1}) f_{\rm lim}\left(\frac{T_{i+1}-T_i}{T_i-T_{i-1}}   \right)
\end{equation}
%
On the other hand, the temperature, velocity, and density needed to reconstruct the vector $U^{\rm R}_{i+1/2}$ are extrapolated using a limiter with a rightward bias such as:
%
\begin{equation}
T^{\rm R}_{i+1/2}=T_{i+1} + \mfd\frac{1}{2}(T_{i+1}-T_{i+2}) \, f_{\rm lim}\left(\frac{T_{i}-T_{i+1}}{T_{i+1}-T_{i+2}}  \right)
\end{equation}
%
where $f_{\rm lim}$ is the limiter function. The limiter function  must fall within a certain admissible limiter region to yield high-resolution TVD schemes. Three such limiter functions are the Van Leer, minmod, and superbee limiters \cite{jcp:1974:vanleer,arfm:1986:roe}:
%
\begin{equation}
{f_{\rm lim}}(b) =
\left\{
\begin{array}{ll}
{\rm max} \left( 0,~
{\rm min} \left( 1, \, b  \right) \right)&{\rm (minmod)}\alb
  (b+|b|)/(1+|b|) & ({\rm Van~Leer})\alb
  {\rm max} \left( 0,~
{\rm min} \left( 2, \, b  \right) ,~
{\rm min} \left( 1, \, 2 b  \right)
\right) & {\rm (superbee)}
\end{array}
\right.
\label{eqn:limiterfunction}
\end{equation}
%
When used in conjunction with Eq.\ (\ref{eqn:FVS_2o}) the latter limiter functions have the property to yield symmetric discretization stencils. That is, the discretization stencils are such that the discrete solution of a leftward-travelling wave is symmetric to the one of a rightward-travelling wave.

The latter has been shown to be positivity-preserving \cite{aiaaconf:1997:linde}. However, more recent studies indicate that the Steger-Warming MUSCL scheme is not positivity-preserving for 2D or 3D flows.

\subsection{Flux Vector Splitting Second-Order Van Leer}

The Steger-Warming Flux Vector Splitting (FVS) scheme \cite{jcp:1981:steger} can be extended to second-order accuracy through a Total Variation Diminishing (TVD) scheme as follows:
%
\begin{equation}
\begin{array}{r}
\mfd
F_{i+1/2}=
  F_i^+
+\frac{1}{2} \Phi^+_{i+1/2} \left(  F_i^+  -  F_{i-1}^+\right)
+F_{i+1}^-
+\frac{1}{2} \Phi^-_{i+1/2} \left( F_{i+1}^- -  F_{i+2}^-\right)
\end{array}
\label{eqn:FVS_2o}
\end{equation}
%
where $F^\pm$ is determined as in Eq.\ (\ref{eqn:Fplusminus}) and where the flux limiter matrix $\Phi$ is a diagonal matrix with the elements on the diagonal being greater or equal to 0 and less or equal to 2.  By setting the limiter matrix to the identity matrix (i.e. $\Phi^\pm=I$), a piecewise-linear distribution of the convective fluxes is in effect, hence resulting in a second-order-accurate scheme. On the other hand, setting  the flux limiter matrix to zero (i.e. $\Phi^\pm=0$) yields a first-order-accurate scheme by forcing a piecewise-constant spatial distribution of the convective fluxes. Because the diagonal elements of the limiter matrix are not necessarily equal to each other, it is possible to limit each flux component independently (i.e. component-wise flux limiting).

For a scalar conservation law, the monotonicity of the solution can be preserved by imposing the Total Variation Diminishing (TVD) condition on the limiter. For a system of conservation laws, it is a common practice to impose the TVD condition on each flux component, independently of the other components (while this does not guarantee monotonicity-preservation of all properties per se, this yields a solution that is close to being monotonicity-preserving). This can be done by setting the diagonal elements of the limiter matrices $\Phi^+$ and $\Phi^-$ as follows:
%
\begin{equation}
\left[\Phi_{i+1/2}^-\right]_{r,r} =  {f_{\rm lim}}\left(\mfd\frac{\left[F_{i}^-\right]_r -\left[F_{i+1}^-\right]_r}{\left[F_{i+1}^-\right]_r-\left[F_{i+2}^-\right]_r}  \right)
\label{eqn:psiminus}
\end{equation}
%
\begin{equation}
\left[\Phi_{i+1/2}^+\right]_{r,r} =  {f_{\rm lim}}\left(\mfd\frac{\left[F_{i+1}^+\right]_r -\left[F_{i}^+\right]_r}{\left[F_{i}^+\right]_r-\left[F_{i-1}^+\right]_r}  \right)
\label{eqn:psiplus}
\end{equation}
%
%
where $f_{\rm lim}$ is the limiter function outlined in Eq.\ (\ref{eqn:limiterfunction}).

\subsection{Flux Vector Splitting Second-Order Van Leer Positive}

Following Parent \cite{jcp:2012:parent}, a second-order accurate positivity-preserving version of the Steger-Warming flux vector splitting is the following:
%
\begin{equation}
F_{i+1/2}=
  F_i^+
+\frac{1}{2} L^{-1}_i \Psi^+_{i+1/2} \left(  G_i^+  -  G_{i-1}^+\right)
+F_{i+1}^-
+\frac{1}{2} L^{-1}_{i+1} \Psi^-_{i+1/2} \left( G_{i+1}^- -  G_{i+2}^-\right)
\label{eqn:FVS_2o_plus}
\end{equation}
%
where $G^\pm=\Lambda^\pm L U$, $F^\pm = L^{-1} G^\pm$, $\Lambda^\pm=\frac{1}{2}(\Lambda\pm|\Lambda|)$,  $L$ the left eigenvector matrix, $L^{-1}$ the right eigenvector matrix, $\Lambda$ the eigenvalue matrix, $U$ the vector of conserved variables, and $\Psi^\pm$ some diagonal matrices. The diagonal matrices $\Psi^-$ and $\Psi^+$ correspond to:
%
\begin{align}
  \left[\Psi^-_{i+1/2}\right]_{r,r}
=
{\rm max} &\left\{-\left|  \frac{\xi  \left[G_{i+1}^-\right]_r}{\left[G_{i+1}^- - G_{i+2}^-\right]_r } \right|,
\right.\nonumber\alb
&~~~{\rm min} \left.\left(\frac{ \left[L_{i+1} \Phi^-_{i+1/2} \left( F_{i+1}^- -  F_{i+2}^-\right) \right]_r }{ \left[ G_{i+1}^- -  G_{i+2}^-\right]_r },
 \left|  \frac{\xi   \left[G_{i+1}^-\right]_r}{\left[G_{i+1}^- - G_{i+2}^-\right]_r } \right|
\right)\right\}
\end{align}
%
%
\begin{align}
  \left[\Psi^+_{i+1/2}\right]_{r,r}
=
{\rm max} &\left\{
-\left| \frac{\xi  \left[G_{i}^+\right]_r}{\left[G_{i}^+ - G_{i-1}^+\right]_r}\right|,~
\right.\nonumber\alb
&~~~{\rm min} \left. \left(
 \frac{\left[L_i \Phi^+_{i+1/2} \left(  F_i^+  -  F_{i-1}^+\right)\right]_r}{\left[  G_i^+  -  G_{i-1}^+\right]_r}~,
\left| \frac{\xi  \left[G_{i}^+\right]_r}{\left[G_{i}^+ - G_{i-1}^+\right]_r}\right|
\right)
\right\}
\end{align}
%
where the limiter matrices $\Phi^-$ and $\Phi^+$ are determined as:
%
\begin{equation}
\left[\Phi_{i+1/2}^-\right]_{r,r} =  {f_{\rm lim}}\left(\mfd\frac{\left[F_{i}^-\right]_r -\left[F_{i+1}^-\right]_r}{\left[F_{i+1}^-\right]_r-\left[F_{i+2}^-\right]_r}  \right)
\end{equation}
%
%
\begin{equation}
\left[\Phi_{i+1/2}^+\right]_{r,r} =  {f_{\rm lim}}\left(\mfd\frac{\left[F_{i+1}^+\right]_r -\left[F_{i}^+\right]_r}{\left[F_{i}^+\right]_r-\left[F_{i-1}^+\right]_r}  \right)
\end{equation}
%
where $f_{\rm lim}$ is the flux limiter function outlined in Eq.\ (\ref{eqn:limiterfunction}).
The schemes outlined above achieve high resolution through the use of component-wise flux limiting and are guaranteed to be positivity-preserving as long as the user-specified constant $\xi$ is within the following range:
%
\begin{equation}
0 < \xi < 2
\label{eqn:xi}
\end{equation}
%
The higher $\xi$ is, the less dissipative the stencil becomes. Because of round-off errors due to the use of real or double precision numbers, and because of small errors due to compiler optimization, $\xi$ should be set to a value slightly below 2. For the 1D problems considered herein, $\xi$ can be set to as high 1.99 without resulting in negative internal energies or densities. However, for certain 2D or 3D problems, it is necessary to decrease $\xi$ further. As well, it is found that fixing $\xi$ to a value 10\% less than its theoretical maximum helps to prevent divergence at high time steps. For these reasons,  $\xi$ is set to 1.8 for all test cases here considered.

For the scheme to be positivity-preserving, it is further necessary to restrict the local time step as follows:
%
\begin{equation}
\Delta t
<
\frac{\Delta x}{
2 \left(\left[\Lambda^+ \right]_{r,r}-\left[\Lambda^- \right]_{r,r}\right)
}~~\forall r
\end{equation}
%
Or, noting that $\Lambda^\pm=\frac{1}{2} (\Lambda \pm |\Lambda|)$, we can also write the latter condition as:
%
\begin{equation}
\Delta t
<
\frac{\Delta x}{
2 \left|\Lambda \right|_{r,r}
}~~\forall r
\end{equation}
%
When solving the Euler equations, the latter can be easily shown to correspond to the CFL condition. In 2D and 3D, the time step would need to be further decreased by 2 and 3 times, respectively.

\subsection{Flux Difference Splitting First-Order Roe}

The Roe flux difference splitting scheme yields a flux at the interface of the form \cite{jcp:1981:roe}:
%
\begin{equation}
F_{i+1/2}=\frac{1}{2} F_i + \frac{1}{2} F_{i+1} - \frac{1}{2}|A|_{i+1/2} (U_{i+1}-U_i)
\label{eqn:FDS_1o}
\end{equation}
%
where $F$ is the convective flux,  $U$ the vector of conserved variables, and $|A|$ the Roe matrix equivalent to:
%
\begin{equation}
|A|\equiv L^{-1} |\Lambda| L
\end{equation}
%
where $L$  is the left eigenvector matrix, $L^{-1}$ is the right eigenvector matrix, $\Lambda$ is the eigenvalue matrix of the convective flux Jacobian $A\equiv \partial F / \partial U$, and $|\Lambda|$ is the absolute value of the eigenvalue matrix obtained from $\Lambda$ by taking the absolute value of all elements. To ensure that the scheme does not induce non-physical phenomena, it is necessary to correct the acoustic waves part of the matrix $|A|$ as follows:
%
\begin{equation}
|\Lambda|_{r,r} \rightarrow \sqrt{|\Lambda|_{r,r}^2 + \zeta_A^{\rm a} a^2}
\end{equation}
%
with $a$ the speed of sound and $\zeta_A^{\rm a}$ a user-defined parameter typically set to 0.3. Note that the eigenvalue correction is done only for the acoustic waves (eigenvalues of the form $V_x+a$ or $V_x-a$) but not the convective waves (i.e.\ eigenvalues of the form $V_x$).

\subsection{Flux Difference Splitting First-Order Roe Positive}

As suggested by Parent in Ref.\ \cite{jcp:2013:parent:2}, a positivity-preserving variant of the Roe scheme can be written as:
%
\begin{equation}
F_{i+1/2}=L^{-1}_{i} G_{i}^+  + L^{-1}_{i+1} G_{i+1}^-
\label{eqn:FDS_1o_positive}
\end{equation}
%
with
%
\begin{equation}
G^\pm\equiv \Lambda^\pm LU
\label{eqn:Gplusminus}
\end{equation}
%
with
%
\begin{align}
 \left[\Lambda_{i+1}^-\right]_{r,r}  &= {\min\left(0,~\frac{1}{2} \left[\Lambda_{i+1}\right]_{r,r}  - \frac{1}{2}\frac{\left[L_{i+1} |A|_{i+1/2} U_{i+1}\right]_r}{\left[L_{i+1} U_{i+1}\right]_r}\right)}\nonumber\alb
&+
{\min\left(0,~\frac{1}{2}\left[\Lambda_i\right]_{r,r}    + \frac{1}{2}\frac{\left[L_i |A|_{i+1/2} U_i\right]_r}{\left[L_i U_i\right]_r}\right)}
\label{eqn:lambdaminus_Roepos}
\end{align}
%
%
\begin{align}
 \left[ \Lambda_{i}^+\right]_{r,r}  &= {\max\left(0,~\frac{1}{2}\left[\Lambda_i\right]_{r,r}    + \frac{1}{2}\frac{\left[L_i |A|_{i+1/2} U_i\right]_r}{\left[L_i U_i\right]_r}\right)}\nonumber\alb
&+
{\max\left(0,~\frac{1}{2} \left[\Lambda_{i+1}\right]_{r,r}  - \frac{1}{2}\frac{\left[L_{i+1} |A|_{i+1/2} U_{i+1}\right]_r}{\left[L_{i+1} U_{i+1}\right]_r}\right)}
\label{eqn:lambdaplus_Roepos}
\end{align}
%
The approach proposed here has the advantage of not altering the Roe wave speed at the interface: the amount of wave speed lost on the left node corresponds to the amount of wave speed gained on the right node and vice versa.  Because of this, the flux function yields results that are very close to those obtained with the conventional Roe method within shocks, expansion fans, and contact discontinuities, but introduces slightly more dissipation within high-Reynolds-number laminar viscous layers. To obtain a positivity-preserving Roe scheme that is less dissipative within high-Reynolds-number viscous layers, it is necessary to obtain the $\Lambda^\pm$ eigenvalues through an iterative algorithm as explained in Section 4.1 of Ref.\ \cite{jcp:2013:parent:2}.

For the scheme to be positivity-preserving, it is further necessary to restrict the local time step as follows:
%
\begin{equation}
\Delta t
<
\frac{\Delta x}{
 \left[\Lambda^+ \right]_{r,r}-\left[\Lambda^- \right]_{r,r}
}~~\forall r
\end{equation}
%
In 2D and 3D, the time step would need to be further decreased by 2 and 3 times, respectively.

\subsection{Flux Difference Splitting First-Order Parent}

Consider a system of conservation laws in differential form in three dimensions as follows:
%
\begin{equation}
 \frac{\partial U}{\partial t} + \frac{\partial F}{\partial x} + \frac{\partial G}{\partial y} + \frac{\partial H}{\partial z} =0
\end{equation}
%
where $U$ is the vector of conserved variables, while $F$, $G$, and $H$ are the convective flux vectors along $x$, $y$, and $z$, respectively. When written in finite-volume form, the discretization equation associated with the latter can be written as:
%
\begin{equation}
  \frac{U^{n+1}-U^{n}}{\Delta t} + \frac{F_{i+1/2}-F_{i-1/2}}{\Delta x} + \frac{G_{j+1/2}-G_{j-1/2}}{\Delta y}
+ \frac{H_{k+1/2}-H_{k-1/2}}{\Delta z} = 0
\end{equation}
%
where $F_{i+1/2}$, $G_{j+1/2}$, and $H_{k+1/2}$ denote the flux functions at the interfaces perpendicular to the $x$, $y$, and $z$ axis, respectively. Following Parent in Ref.\ \cite{aiaa:2015:parent}, it can be shown that the proposed flux functions at the interfaces correspond to:
%
\begin{equation}
\begin{array}{l}
 F_{i+1/2}=
    \frac{1}{2}\bigl(F_i+F_{i+1}\bigr)
  -\frac{1}{2}|A|_{i+1/2} \bigl( U_{i+1}- U_i\bigr) \alb
~~~~  - \frac{1}{4} {B_{i+1/2}}\bigl(\frac{\Delta y}{\Delta x}|A|_{i+1/2}  + |B|_{i+1/2} \bigr)^{-1} A_{i+1/2} \bigl( U_{i+1,j+1} -U_{i+1,j-1}+U_{i,j+1} -U_{i,j-1}\bigr)\alb
~~~~  - \frac{1}{4} {C_{i+1/2}}\bigl(\frac{\Delta z}{\Delta x}|A|_{i+1/2}  + |C|_{i+1/2} \bigr)^{-1} A_{i+1/2}\bigl(U_{i+1,k+1} -U_{i+1,k-1}+U_{i,k+1} -U_{i,k-1}\bigr)
\end{array}
\end{equation}
%
%
\begin{equation}
\begin{array}{l}
 G_{j+1/2}=
    \frac{1}{2}\bigl(G_{j}+G_{j+1}\bigr)
  -\frac{1}{2}|B|_{j+1/2} \bigl( U_{j+1}- U_j\bigr) \alb
~~~~  - \frac{1}{4} {A_{j+1/2}}\bigl(\frac{\Delta x}{\Delta y}|B|_{j+1/2}  + |A|_{j+1/2} \bigr)^{-1} B_{j+1/2} \bigl( U_{i+1,j+1}-U_{i-1,j+1} +U_{i+1,j}-U_{i-1,j}\bigr)\alb
~~~~  - \frac{1}{4} {C_{j+1/2}}\bigl(\frac{\Delta z}{\Delta y}|B|_{j+1/2}  + |C|_{j+1/2} \bigr)^{-1} B_{j+1/2}\bigl(U_{j+1,k+1} - U_{j+1,k-1} + U_{j,k+1} - U_{j,k-1}\bigr)
\end{array}
\end{equation}
%
%
\begin{equation}
\begin{array}{l}
 H_{k+1/2}=
   \frac{1}{2}\bigl(H_{k}+H_{k+1}\bigr)
  -\frac{1}{2}|C|_{k+1/2}\bigl( U_{k+1}- U_k \bigr) \alb
~~~~  -\frac{1}{4} A_{k+1/2} \bigl(\frac{\Delta x}{\Delta z}|C|_{k+1/2}+|A|_{k+1/2}\bigr)^{-1} C_{k+1/2} \bigl( U_{i+1,k+1} - U_{i-1,k+1} + U_{i+1,k} - U_{i-1,k} \bigr) \alb
~~~~  -\frac{1}{4} B_{k+1/2} \bigl( \frac{\Delta y}{\Delta z}|C|_{k+1/2} + |B|_{k+1/2} \bigr)^{-1} C_{k+1/2} \bigl( U_{j+1,k+1}-U_{j-1,k+1} +U_{j+1,k}-U_{j-1,k} \bigr)
\end{array}
\end{equation}
%
In the latter, $A$, $B$, and $C$ correspond to the flux Jacobians while $|A|$, $|B|$, and $|C|$ correspond to the Roe matrices along $x$, $y$, and $z$, respectively.

As well, to prevent aphysical phenomena from forming, the eigenvalues within the Roe matrices are altered using the following entropy correction:
%
\begin{equation}
  \left|\left[\Lambda \right]_{r,r}\right| \rightarrow \sqrt{\left[\Lambda \right]_{r,r}^2 + \zeta_A a^2}
\end{equation}
%
where $a$ is the speed of sound and $\zeta_A$ is a user-specified parameter which is either set to $\zeta_A^{\rm c}$ for the convective waves, to $\zeta_A^{\rm a}$ for the acoustic waves, or the $\zeta_A^{\rm d}$ when applied to the terms on the denominator of the flux function. In order to prevent excessive dissipation within viscous layers, $\zeta_A^{\rm c}$ is typically set to zero while $\zeta_A^{\rm a}$ is set to 0.3. On the other hand, the entropy correction applied to all waves for the Roe matrices on the denominator of the flux function, $\zeta_A^{\rm d}$, is set to 0.1 . It is necessary to do so (that is, to apply the entropy correction to all waves for the Roe matrices part of the cross-derivative terms) to prevent the possible formation of a singular matrix which can not be inverted.

\subsection{Flux Difference Splitting Second-Order MUSCL}

For a MUSCL-TVD Roe FDS scheme, the flux at the interface is as follows:
%
\begin{equation}
F_{i+1/2}=\frac{1}{2} F\left(U^{\rm L}_{i+1/2}\right) + \frac{1}{2} F\left(U^{\rm R}_{i+1/2} \right) - \frac{1}{2}|A|\left(U^{\rm L}_{i+1/2}~,~U^{\rm R}_{i+1/2}\right) \cdot \left\{U^{\rm R}_{i+1/2}-U^{\rm L}_{i+1/2}\right\}
\label{eqn:FDS_2o_MUSCL}
\end{equation}
%
where $U^{\rm L}_{i+1/2}$ and $U^{\rm R}_{i+1/2}$ are vectors reconstructed from extrapolated primitive variables and where $F(U)$ stands for the vector $F$ evaluated from $U$ and $|A|(U)$ stands for the Roe matrix $|A|$ evaluated from $U$. The vector $U$ itself is constructed from primitive variables extrapolated from nearby nodes through TVD stencils to reach second-order accuracy. For instance, the temperature, velocity, and density needed to reconstruct $U^{\rm L}_{i+1/2}$ are extrapolated using a limiter with a leftward bias such as:
%
\begin{equation}
T^{\rm L}_{i+1/2}=T_i + \mfd\frac{1}{2}(T_i-T_{i-1}) f_{\rm lim}\left(\frac{T_{i+1}-T_i}{T_i-T_{i-1}}   \right)
\end{equation}
%
On the other hand, the temperature, velocity, and density needed to reconstruct the vector $U^{\rm R}_{i+1/2}$ are extrapolated using a limiter with a rightward bias such as:
%
\begin{equation}
T^{\rm R}_{i+1/2}=T_{i+1} + \mfd\frac{1}{2}(T_{i+1}-T_{i+2}) \, f_{\rm lim}\left(\frac{T_{i}-T_{i+1}}{T_{i+1}-T_{i+2}}  \right)
\end{equation}
%
where $f_{\rm lim}$ is the limiter function taken from Eq.\ (\ref{eqn:limiterfunction}).

\subsection{Flux Difference Splitting Second-Order Yee}

One way the Roe scheme can be extended to second-order accuracy while remaining monotonicity-preserving is through the use of TVD limiters applied to the characteristic variables as proposed by Yee \cite{jcp:1990:yee}. Commonly denoted as the ``Yee-Roe'' scheme, such a strategy has enjoyed considerable popularity in solving compressible viscous flows because it is second-order accurate and, like the first-order Roe scheme, it introduces little dissipation in viscous layers, it is monotonicity-preserving, and it converges reliably for a wide variety of flow conditions.

The Yee-Roe flux at the interface can be written as follows:
%
\begin{equation}
F_{i+1/2}=\underbrace{\frac{1}{2} F_i + \frac{1}{2} F_{i+1}
- \frac{1}{2}L^{-1}_{i+1/2} |\Lambda|_{i+1/2} M_{i+1/2}}_{\textrm{\small first-order~Roe~terms}}
+ \underbrace{\frac{1}{2}L^{-1}_{i+1/2} |\Lambda|_{i+1/2} \Phi_{i+1/2} M_{i+1/2}}_{\textrm{\small second-order~Yee~terms}}
\label{eqn:FDS_2o_TVD}
\end{equation}
%
where the vector $M_{i+1/2}$ is defined as:
%
\begin{equation}
M_{i+1/2} \equiv L_{i+1/2} (U_{i+1}-U_i)
\label{eqn:M}
\end{equation}
%
and where the diagonal elements within the limiter matrix are set as follows:
%
\begin{equation}
\left[\Phi_{i+1/2}\right]_{r,r}=\frac{{\rm minmod}\left( \left[M_{i-1/2}\right]_r, ~ \left[M_{i+1/2}\right]_r, ~\left[M_{i+3/2}\right]_r \right)}{\left[M_{i+1/2}\right]_r}
\label{eqn:Phi}
\end{equation}
%
where the minmod function returns the argument with the smallest magnitude if the arguments all share the same sign and zero if the arguments are of mixed signs. A possible division by zero on the RHS of Eq.\ (\ref{eqn:Phi}) can be avoided by adding a small constant to the denominator, as is common practice when implementing the Yee-Roe scheme. This does not pose problems when doing computations because the minmod function on the numerator will always be as low in magnitude as the denominator, hence keeping the limiter function bounded.

\subsection{Flux Difference Splitting Second-Order Yee Positive}

A positivity-preserving version of the Yee-Roe FDS-TVD scheme was derived by Parent as \cite{jcp:2013:parent:2}:
%
\begin{equation}
\begin{array}{l}\mfd
F_{i+1/2}=L^{-1}_{i} G_{i}^+
        + L^{-1}_{i+1} G_{i+1}^-
        + \frac{1}{2}L^{-1}_{i}  \Psi_{i+1/2}^+ \Delta G_{i+1/2}^+
        - \frac{1}{2} L^{-1}_{i+1} \Psi_{i+1/2}^- \Delta G_{i+1/2}^-
\end{array}
\label{eqn:FDS_2o_TVD_pos}
\end{equation}
%
where the limiter matrices correspond to:
%
\begin{align}
   \left[\Psi_{i+1/2}^-\right]_{r,r}
&=
{\rm max}\left\{ -\left|\frac{\xi\left[ G_{i+1}^-\right]_r}{\left[\Delta G_{i+1/2}^-\right]_r} \right|, \right.\nonumber\alb
&\left.{\rm min}\left(
\frac{\left[L_{i+1} L^{-1}_{i+1/2} \left( \Lambda_{i+1/2} - |\Lambda|_{i+1/2}  \right) \Phi_{i+1/2} M_{i+1/2} \right]_r}{2 \left[\Delta G_{i+1/2}^- \right]_r}
,~\left|\frac{\xi\left[ G_{i+1}^-\right]_r}{\left[\Delta G_{i+1/2}^-\right]_r} \right|
\right)\right\}
\end{align}
%
%
\begin{align}
   \left[\Psi_{i+1/2}^+\right]_{r,r}
&=
{\rm max}\left\{ -\left|\frac{\xi\left[ G_{i}^+\right]_r}{\left[\Delta G_{i+1/2}^+\right]_r} \right|,\right.\nonumber\alb
&\left.{\rm min}\left(
\frac{\left[L_{i} L^{-1}_{i+1/2} \left( \Lambda_{i+1/2} + |\Lambda|_{i+1/2}  \right) \Phi_{i+1/2} M_{i+1/2}  \right]_r}{2 \left[\Delta G_{i+1/2}^+ \right]_r}
,~\left|\frac{\xi\left[ G_{i}^+\right]_r}{\left[\Delta G_{i+1/2}^+\right]_r} \right|
\right)\right\}
\end{align}
%
where the matrix $M$ is determined as in Eq.\ (\ref{eqn:M}) and where
%
\begin{equation}
\Delta G_{i+1/2}^\pm \equiv G_{i+1}^\pm - G_i^\pm
\end{equation}
%
with $G^\pm$ determined from Eq.\ (\ref{eqn:Gplusminus}). For the stencil to be positivity-preserving, the positive and negative eigenvalues $\Lambda^\pm$ (which are used to calculate the vectors $G^\pm$) must be determined as in Eqs.\ (\ref{eqn:lambdaminus_Roepos})-(\ref{eqn:lambdaplus_Roepos}) or through an iterative algorithm as explained in Section 4.1 of Ref.\ \cite{jcp:2013:parent:2} for less dissipation within viscous layers.   As well, the user-defined constant $\xi$ must be less than 2:
%
\begin{equation}
0< \xi<2
\end{equation}
%
Because of errors due to round-off when using double-precision variables within the computer code, it is necessary to fix $\xi$ to 1.99 for most problems. Further, and rather interestingly, lowering $\xi$ to within the range $0.5<\xi<1.0$ can help prevent the solution from diverging to aphysical states when using high time steps, and can also help prevent convergence hangs when solving steady-state problems. For these reasons, $\xi$ is typically given a value of 0.5.

For the scheme to be positivity-preserving, it is further necessary to restrict the local time step as follows:
%
\begin{equation}
\Delta t
<
\frac{\Delta x}{
2 \left(\left[\Lambda^+ \right]_{r,r}-\left[\Lambda^- \right]_{r,r}\right)
}~~\forall r
\end{equation}
%
In 2D and 3D, the time step needs to be further decreased by 2 and 3 times, respectively.

\section{Discretization of $\partial_x (DU)$}

The term $\partial (DU)/\partial x$ is here discretized as
%
\begin{equation}
\delta_x (DU) = \frac{(DU)_{i+1/2}-(DU)_{i-1/2}}{\Delta x}
\end{equation}
%
where the flux at the interface is found from a Steger-Warming Flux Vector Splitting (FVS) scheme \cite{jcp:1981:steger} extended to second-order accuracy through a Total Variation Diminishing (TVD) scheme:
%
\begin{align}
(DU)_{i-1/2}&=
  D_{i-1}^+ U_{i-1}
+\frac{1}{2} \Phi^+_{i-1/2} \left(  D_{i-1}^+ U_{i-1}  -  D_{i-2}^+ U_{i-2}\right)  \nonumber\alb
&+ D_{i}^- U_i
+\frac{1}{2} \Phi^-_{i-1/2} \left(  D_{i}^- U_i -  D_{i+1}^- U_{i+1}\right)
\end{align}
%
In the latter, the flux limiter matrix $\Phi$ is a diagonal matrix with the elements on the diagonal being greater or equal to 0 and less or equal to 2:
%
\begin{equation}
\left[\Phi_{i-1/2}^+\right]_{r,r} =  {f_{\rm lim}}\left(\mfd\frac{\left[D_{i}^+ U_i\right]_r -\left[D_{i-1}^+ U_{i-1}\right]_r}{\left[D_{i-1}^+ U_{i-1}\right]_r-\left[D_{i-2}^+ U_{i-2}\right]_r}  \right)
\end{equation}
%
%
\begin{equation}
\left[\Phi_{i-1/2}^-\right]_{r,r} =  {f_{\rm lim}}\left(\mfd\frac{\left[D_{i-1}^- U_{i-1}\right]_r -\left[D_{i}^- U_i\right]_r}{\left[D_{i}^- U_i\right]_r-\left[D_{i+1}^- U_{i+1}\right]_r}  \right)
\end{equation}
%
where $f_{\rm lim}$ is the limiter function outlined in Eq.\ (\ref{eqn:limiterfunction}).
It could be argued that the use of a Steger-Warming-like stencil leads to excessive dissipation within viscous layers and hence prevents boundary layers to be resolved with high-resolution. However, this is only the case if it is used to discretize the term $\partial_x F$. When discretizing the term $\partial_x (DU)$, the use of flux vector splitting does not lead to any problem.

\section{Discretization of $Y \partial_{x} H$}

Following Parent et al.\ \cite{jcp:2013:parent}, the discretization of the derivative $Y \partial_x H$ can be achieved as follows:
%
\begin{equation}
Y \delta_x H =
  \left(\frac{ Y_{i-1/2} + |Y_{i-1/2}|}{2}\right)\left( \frac{ H_{i} - H_{i-1} }{\Delta x}\right)
+ \left(\frac{ Y_{i+1/2} - |Y_{i+1/2}|}{2}\right)\left( \frac{ H_{i+1} - H_{i} }{\Delta x}\right)\alb
\end{equation}
%
It is noted that the latter use a first-order accurate stencil in contrast to the other terms which utilize second-order accurate stencils. A first-order stencil is here chosen because  it is not clear how to obtain second-order accuracy while keeping the monotonicity-preserving property. Some grid convergence studies performed for steady-state problems in Ref.\ \cite{jcp:2013:parent} have demonstrated that the use of a first-order stencil here for the term $Y\delta_x H$ is not a particular source of concern because most of the numerical error originates from the $\delta_x F$ and $\delta_x(K\delta_x G)$ terms which use second-order stencils.

\section{Discretization of $\partial_{x_j}( K_{ij}  \partial_{x_i}G )$}

Contrarily to the convection terms, the viscous terms can be discretized
in a straightforward way as this will not create
a situation leading to even-odd node discoupling:
%
\begin{equation}
\delta_{x_j}\left( {K_{ij}}\delta_{x_i} G \right)
=\frac{\left( {K_{ij}}\delta_{x_i} G \right)^{X_j+1/2}-
\left({K_{ij}}\delta_{x_i} G \right)^{X_j-1/2} }{\Delta x_j}
\end{equation}
%
Should $i=j$ then the expression is discretized as follows:
%
\begin{equation}
\left( {K_{ij}}\delta_{x_i} G \right)^{X_j+1/2}
=
K_{jj}^{X_j+1/2} \frac{G^{X_j+1}-G^{X_j}}{\Delta x_j}
\end{equation}
%
Should $i \neq j$ the discretization would become:
%
\begin{equation}
\left( {K_{ij}}\delta_{x_i} G \right)^{X_j+1/2}
   =K_{ij}^{X_j+1/2}
   \frac{G^{X_i+1,X_j}+G^{X_i+1,X_j+1}
   -G^{X_i-1,X_j}-G^{X_i-1,X_j+1}  }{4 \Delta x_i}
\end{equation}
%
where $K^{X_j+1/2}_{ij}$ midway between nodes is
taken as half the value of $K^{X_j+1}_{ij}$ and $K^{X_j}_{ij}$.

\section{Discretization of $Z\partial_t U$}

\subsection{Taylor Series Expansion}

The first-order, second-order, and third-order backward stencils used here to discretize the time derivatives using Taylor series expansion can be shown to correspond to:
%
\begin{equation}
  \delta_t U =  \frac{U_{m}-U_{m-1}}{\Delta t} + O(\Delta t)
\end{equation}
%
%
\begin{equation}
  \delta_t U =  \frac{\frac{3}{2} U_{m}
                       -2 U_{m-1} + \frac{1}{2} U_{m-2}}{\Delta t} + O(\Delta t^2)
\end{equation}
%
%
\begin{equation}
  \delta_t U =  \frac{\frac{11}{6}U_{m}-3 U_{m-1} + \frac{3}{2} U_{m-2} - \frac{1}{3} U_{m-3} }{\Delta t} + O(\Delta t^3)
\end{equation}
%

\subsection{Weighted Essentially Non-Oscillatory}

Consider the following backward stencils (obtained from first-order polynomials) to approximate $U$ at the interface $m+1/2$:
%
\begin{equation}
  U^{(1)}_{m+1/2}=\frac{3}{2} U_{m} - \frac{1}{2} U_{m-1}
\end{equation}
%
%
\begin{equation}
  U^{(2)}_{m+1/2}=\frac{5}{2} U_{m-1} - \frac{3}{2} U_{m-2}
\end{equation}
%
If substituted in  $(U_{m+1/2}-U_{m-1/2})/\Delta t$, either polynomial would
yield a second-order accurate discretization equation. Let's now combine these two stencils as follows:
%
\begin{equation}
  U_{m+1/2}=w U^{(1)}_{m+1/2} + (1-w) U^{(2)}_{m+1/2}
\end{equation}
%
Note that if $w$ is given value of $11/9$, the discretization equation would become third order accurate. We will here choose $w$ so that the stencil introduces little oscillations in regions of discontinuities and becomes third-order accurate in smooth regions. Let us choose $w$ as follows:
%
\begin{equation}
w=\frac{11}{9}\left(1-\frac{|U_{m}-2 U_{m-1}+U_{m-2}|}{|U_{m}-U_{m-1}|+|U_{m-1}-U_{m-2}|}\right)
\end{equation}
%

\bibliographystyle{warpdoc}
\bibliography{all}

\end{document}