\chapter{Fourth-Order Accurate Interpolation from
Nearby Control Volume Averages to a Cell Face}
\label{app:fourth_order}

\vspace{20mm}
For simplicity, we demonstrate the interpolation scheme in the
$x$-direction only. The same analysis can be applied to the other directions.
At a given $(y,z)$, let any variable $q$ (e.g. temperature) be a third-degree polynomial:

\be
q(x,y,z)=C_{0}(y,z)+C_{1}(y,z)x+C_{2}(y,z)x^2+C_{3}(y,z)x^3
\ee
We conveniently assign $x_{i+1/2}=0$, see Figure (\ref{fig:diecast_4thorder}) with no loss of generality,
so $q(0,y,z)=q(x_{i+1/2},y,z)=C_{0}(y,z)$.
We can define the quantities $q$ at a time level.
%(see schematic of the cells in Figure~\ref{fig:diecast_4thorder}):

\begin{gather}
\begin{split}
q_{i+2}(y,z)&=\int_{x_{i+\fc{3}{2}}}^{x_{i+\fc{5}{2}}}q(x,y,z)dx\\
&=C_{0}(y,z)x|_{x_{i+\fc{3}{2}}}^{x_{i+\fc{5}{2}}}+
\fc{1}{2}C_{1}(y,z)x^2|_{x_{i+\fc{3}{2}}}^{x_{i+\fc{5}{2}}}+
\fc{1}{3}C_{2}(y,z)x^3|_{x_{i+\fc{3}{2}}}^{x_{i+\fc{5}{2}}}+
\fc{1}{4}C_{3}(y,z)x^4|_{x_{i+\fc{3}{2}}}^{x_{i+\fc{5}{2}}} \\
\end{split}\\
\begin{split}
q_{i+1}(y,z)&=\int_{x_{i+\fc{1}{2}}}^{x_{i+\fc{3}{2}}}q(x,y,z)dx\\
&=C_{0}(y,z)x|_{x_{i+\fc{1}{2}}}^{x_{i+\fc{3}{2}}}+
\fc{1}{2}C_{1}(y,z)x^2|_{x_{i+\fc{1}{2}}}^{x_{i+\fc{3}{2}}}+
\fc{1}{3}C_{2}(y,z)x^3|_{x_{i+\fc{1}{2}}}^{x_{i+\fc{3}{2}}}+
\fc{1}{4}C_{3}(y,z)x^4|_{x_{i+\fc{1}{2}}}^{x_{i+\fc{3}{2}}} \\
\end{split}\\
\begin{split}
q_{i}(y,z)&=\int_{x_{i-\fc{1}{2}}}^{x_{i+\fc{1}{2}}}q(x,y,z)dx\\
&=C_{0}(y,z)x|_{x_{i-\fc{1}{2}}}^{x_{i+\fc{1}{2}}}+
\fc{1}{2}C_{1}(y,z)x^2|_{x_{i-\fc{1}{2}}}^{x_{i+\fc{1}{2}}}+
\fc{1}{3}C_{2}(y,z)x^3|_{x_{i-\fc{1}{2}}}^{x_{i+\fc{1}{2}}}+
\fc{1}{4}C_{3}(y,z)x^4|_{x_{i-\fc{1}{2}}}^{x_{i+\fc{1}{2}}} \\
\end{split}\\
\begin{split}
q_{i-1}(y,z)&=\int_{x_{i-\fc{3}{2}}}^{x_{i-\fc{1}{2}}}q(x,y,z)dx\\
&=C_{0}(y,z)x|_{x_{i-\fc{3}{2}}}^{x_{i-\fc{1}{2}}}+
\fc{1}{2}C_{1}(y,z)x^2|_{x_{i-\fc{3}{2}}}^{x_{i-\fc{1}{2}}}+
\fc{1}{3}C_{2}(y,z)x^3|_{x_{i-\fc{3}{2}}}^{x_{i-\fc{1}{2}}}+
\fc{1}{4}C_{3}(y,z)x^4|_{x_{i-\fc{3}{2}}}^{x_{i-\fc{1}{2}}} \\
\end{split}\\
\end{gather}
Solving the above equations for the interfacial value $C_{0}(y,z)$,
we get
\be
C_{0}(y,z)=q_{i+1/2}(y,z)=\fc{7}{12}(q_{i}(y,z)+q_{i+1}(y,z))
-\fc{1}{12}(q_{i-1}(y,z)+q_{i+2}(y,z))
\label{eq:single_interp}
\ee
The coefficients can also be obtained by Taylor series expansion of
variable $q(x,y,z)$ along $x-$axis and integrating the cell analytically
to get the discretized cell averaged
\be
q_{i}(y,z)=\int_{x_{i-\fc{1}{2}}}^{x_{i+\fc{1}{2}}}q(x,y,z)dx
\ee
which yields
\be
\begin{split}
q_{i+1/2}(y,z)
&=q_{i}(y,z)+q_{i+1}(y,z)+\fc{1}{4}q''(8)(\Delta x)^3 \\
&=q_{i-1}(y,z)+q_{i+2}(y,z)+\fc{1}{4}q''(56)(\Delta x)^3
\end{split}
\ee
Then use Richardson extrapolation to obtain the above
equation~(\ref{eq:single_interp}).
Finally, integrate over the control volume face $\sigma(y,z)$ to
obtain cell face average,
\begin{align}
\iint_{\sigma} q_{i+1/2}(y,z)dydz=
\fc{7}{12}\iint_{\sigma}(q_{i}(y,z)+q_{i+1}(y,z))dydz
\nonumber \\
  -\fc{1}{12}\iint_{\sigma}(q_{i-1}(y,z)+q_{i+2}(y,z))dydz
\end{align}
or in the notation of equation (\ref{eq:interp}):
\be
\overline{q}_{i+1/2,j,k}=\fc{7}{12}(Q_{i,j,k}+Q_{i+1,j,k})
-\fc{1}{12}(Q_{i-1,j,k}+Q_{i+2,j,k})
\ee
 
%The notation $\overline{q}$ in equation~(\ref{eq:interp})
%then represents the integral of the cell face-averaged quantity. 
%\be
%\overline{q}_{i+1/2,j,k}=\iint_{\sigma} q'_{i+1/2}(y,z)dydz
%\ee
%Noting that the right hand side involves triple integral over the
%control volume (CV) and represents the control volume average
%\be
%\overline{q}_{i,j,k}=\iiint_{CV} q(x,y,z)dxdydz
%\ee
%The face integral quantity is then in terms of nearby control volume averages
%and is $4^{th}$ order accuracy for the control volume.
%This is one of the six face integrals in the control volume equation
%for the advanced time level.

\citet{Sanderson98b} obtained the above
face-averaged quantity using a cumulative sum of the cell-averaged quantity.
The current derivation is complete and can be extended to non-uniform grids
when the expansion ratio is known. 
The truncation error of various differencing operators is shown in
Figure~\ref{fig:diecast_order}
in the example that a sinusoidal signal is numerically
differentiated~\cite{Sanderson98b}. The error
is plotted as a function of the ratio of grid spacing $\Delta$ to
wavelength $\lambda$.
The power-law scaling of error with the ratio $\lambda/\Delta$ is
closely followed for wavelengths greater than $4\Delta$ with C-grid
differencing and for wavelengths greater than $6\Delta$ with
A-grid~\cite{Sanderson98b}. Further, the scaling applies with reasonable
approximation to the smallest wavelengths resolvable on the grid.
The error analysis and numerical examples
in~\citet{Sanderson98b} demonstrate
that the fourth-order interpolation used in the DieCAST model
is fourth-order accurate on both A-and C-grids.
%The result is fourth order accurate if one ignores the Reynolds stress terms,
%which must be parameterized.
%These stress terms depend on the deviations from the face averaged
%quantity, whose
%scales are fundamentally not resolved by the discrete control volume grid.
%Noting that in the limit of high resolution such Reynolds stress
%terms approach zero, we have a truly fourth order accurate approximation.
%All steps in producing the face averages use fourth order accurate
%approximations.

\newpage

\begin{figure}
\centerline{
\scalebox{.5}{\includegraphics{FIGS/diecast_4thorder.eps}}
}
\vskip 0.1in
\caption{Schematic of the cells and the index for the fourth-order
interpolation.}	
\label{fig:diecast_4thorder}
\end{figure}


\begin{figure}
\centerline{
\scalebox{.5}{\includegraphics{FIGS/diecast_accuracy.eps}}
}
\vskip 0.1in
\caption{Error $\varepsilon$ for differentiating s sinusoidal function using
the A-grid (collocated) and C-grid (staggered) differencing operators.
The error is plotted as a function of the ratio of grid spacing $\Delta$ to
wavelength $\lambda$. The label 2,A-grid refers to the second-order
operator on a collocated grid. The label 2,C-grid refers to the second-order
operator on a staggered grid. Similarly,
label 4,A-grid refers to the fourth-order
operator on a collocated grid and label 4,C-grid refers to the fourth-order
operator on a staggered grid. The sixth-order differencing operator on the
A grid is labeled 6,A-grid. [Figure 1 of~\citet{Sanderson98b}].
}	
\label{fig:diecast_order}
\end{figure}
