\documentclass{article}
\usepackage{fullpage}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{pstricks} % This won't work with pdflatex
\usepackage{pst-plot}
\usepackage{subfigure}

\newcommand{\bigo}{\ensuremath{\mathcal{O}}}
\newcommand{\pderiv}[2]{\ensuremath{\frac{\partial #1}{\partial #2}}}

\begin{document}
\begin{center}
{\bf CME306 / CS205B Homework 1 (Theory)}
\end{center}
\section*{Conservation of Mass (Eulerian Framework)}
\begin{enumerate}
\item In an Eulerian framework, the strong form of Conservation of Mass takes the form below.  Please briefly explain the three nonzero terms in the equation.
\begin{equation}
\rho_t + \rho u_x + u\rho_x = 0
\end{equation}
\\ \\

\item If we are working with a discontinuous density field or velocity field (i.e.\ either $\rho_x$ or $u_x$ don't exist somewhere in the domain), we cannot use the strong form of Conservation
of Mass.  We {\em can} however apply the weak form, which describes how mass changes in a control volume $\Omega$ (here, mass is given as $\int_{\Omega}\rho dV$).  Please derive the weak form
equation for Conservation of Mass from the strong form (note that the weak form should have no spatial derivatives).

\pagebreak
\item In an Eulerian framework, the graphs of $\rho$ and $u$ in the plots below describe the state of a system.  Does $\rho$ increase, decrease,
  or stay the same at the sample point $y_0$ for each system? (You may assume all quantities here are positive)

\newcommand{\urhoplot}[6]{
\psset{unit=.9cm}
\begin{pspicture}(-1.5,-1.5)(6.5,8.0)
\psaxes*[linewidth=.05,labels=none]{<->}(0,0)(-1,-1)(6,4)
\psline[linewidth=.1,linestyle=solid](-1,#1)(6,#2)
\uput[dr](0,#3){\large$\rho$}
\psline[linewidth=.1,linestyle=dashed](-1,#4)(6,#5)
\uput[dr](0,#6){\large$u$}
\psline[linewidth=.08,linestyle=dotted](3,0)(3,4)
\uput[d](3,-.2){\large$y_0$}
\end{pspicture}}

\begin{figure}[h!]
\centering
\subfigure[System 1]{\urhoplot{.5}{4}{1}{3}{3}{3}}
\subfigure[System 2]{\urhoplot{1}{1}{1}{3}{3}{3}}
\subfigure[System 3]{\urhoplot{1}{1}{1}{3.5}{1}{3}}
\subfigure[System 4]{\urhoplot{1.8}{4}{2.2}{.8}{3}{1.2}}
\end{figure}

\end{enumerate}

\pagebreak
\section*{Convergence Analysis}
Consider the wave equation
\[ u_t + au_x = 0 \]
where $a=constant$.  Establish whether or not the following methods for solving the equation converge.  If so, what are the conditions for convergence?  {\bf Hint:} Use the Lax-Richtmyer
equivalence theorem.  Chapters 1 and 2 of the text by Strikwerda will be helpful, in addition to the discussion notes provided online.

Note that $(D^+\phi)_i = \frac{\phi_{i+1}-\phi_i}{\Delta x}$, and $(D^-\phi)_i = \frac{\phi_i-\phi_{i-1}}{\Delta x}$.

\begin{enumerate}
\item Explicit Central Differencing
\begin{displaymath}
\frac{v^{n+1}_{j}-v^n_{j}}{{\Delta}t}+a\frac{v^{n}_{j+1}-v^n_{j-1}}{2{\Delta}x}=0.
\end{displaymath}

\item Implicit Central Differencing
\begin{displaymath}
\frac{v^{n+1}_{j}-v^n_{j}}{{\Delta}t}+a\frac{v^{n+1}_{j+1}-v^{n+1}_{j-1}}{2{\Delta}x}=0.
\end{displaymath}

\item Upwinding
\begin{displaymath}
\frac{v^{n+1}_{j}-v^n_{j}}{{\Delta}t}+aD^{*}v^{n}_j=0
\end{displaymath}

If $a>0$, $D^{*}=D^{-}$. If $a<0$, $D^{*}=D^{+}$.

\item Downwinding
\begin{displaymath}
\frac{v^{n+1}_{j}-v^n_{j}}{{\Delta}t}+aD^{*}v^{n}_j=0
\end{displaymath}

If $a>0$, $D^{*}=D^{+}$. If $a<0$, $D^{*}=D^{-}$.

\end{enumerate}


\end{document}
