\documentclass{article}
\input{macros.tex}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{siunitx}
\newcommand{\tangent}{\mathbf T}
\newcommand{\utangent}{\mathbf t}
\newcommand{\normal}{\mathbf N}
\newcommand{\unormal}{\mathbf n}
\DeclareMathOperator{\diag}{diag}
\begin{document}
\pagestyle{empty}
% Name : \rule[-3pt]{6cm}{1pt} \\
\begin{center}
{\Large Homework \# 7} \\
\vskip 0.2cm
{\large Math 427/527}
\vskip 0.5cm
\end{center}
{\bf Note : } Math 427 students may do the Math 527 questions for extra credit. You may work in pairs on this assignment, but pairs can only be two 427 students or two 527 students but not mixed pairs.
If you work together (pairs of two only), {\em you may turn in a single homework with both names.}
All plots must have axes labels, and a title. Also, be sure to use appropriate axis limits for each plot. Make your plots interesting!
\begin{enumerate}
\item \label{prob:system} The wave equation discussed in class can be used to model acoustic waves (e.g. sound waves or pressure waves) in air. In this case, the wave equation is written in terms of pressure $p(x,t)\; (\si{\newton/\meter^2)}$ and is given by
\begin{equation}
p_{tt} = c^2 p_{xx}, \qquad -\infty < x < \infty
\label{eqn:pressure}
\end{equation}
where $c\; (\si{\meter\per\second})$ is the speed of sound in air. A second quantity, $u(x,t)\; (\si{\meter\per\second})$ is the velocity of a parcel of air as it is perturbed by the pressure wave.
A model for both the pressure and velocity can be written as a system of first order equations (e.g. containing first derivatives only), given by
\begin{equation}
\begin{aligned}
p_t + \rho c^2 u_x & = 0 \\
\rho u_t + \phantom{\rho c^2} p_x & = 0
\end{aligned}
\label{eqn:system}
\end{equation}
where $\rho\; (\si{\kg\per\meter^3})$ is the constant density of air.
\begin{enumerate}
\item Show that equation \eqn{pressure} can be derived from the system \eqn{system}.
{\bf Hint:} Eliminate $u(x,t)$ from \eqn{system} by computing
\begin{equation}
\frac{\partial \; (p_t + \rho c^2 u_x)}{\partial t} -
c^2 \frac{\partial \; (\rho u_t + p_x)}{\partial x}.
\end{equation}
\item Follow a similar procedure to eliminate $p(x,t)$ from \eqn{system} to get an equation for $u(x,t)$.
\end{enumerate}
\item We can solve first order system of equations described in \Prob{system} to get a solution for both the pressure and the velocity using a "wave-decomposition" approach. This is another way to obtain the D'Alembert solution {\bf (12)} (page 554, Section 12.4) in the course text book.
To see how this works, we write the system \eqn{system} as a vector equation, given by
\begin{equation}
\begin{pmatrix} p \\ u \end{pmatrix}_t +
\begin{pmatrix} 0 & \rho c^2 \\ \frac{1}{\rho} & 0 \end{pmatrix}
\begin{pmatrix} p \\ u \end{pmatrix}_x =
\begin{pmatrix} 0 \\ 0 \end{pmatrix}
\end{equation}
or
\begin{equation}
\mathbf q_t + A \mathbf q_x = \mathbf 0
\label{eqn:vector}
\end{equation}
where $\mathbf q(x,t) = (p(x,t),u(x,t))$ and $A$ is the $2 \times 2$ matrix
\begin{equation}
A = \begin{pmatrix} 0 & \rho c^2 \\ \frac{1}{\rho} & 0 \end{pmatrix}.
\end{equation}
To solve the system, carry out the following steps.
\begin{enumerate}
\item Find the eigenvalues $\lambda^1$ and $\lambda^2$ and eigenvectors $\mathbf r^1$ and $\mathbf r^2$ of the matrix $A$. Order your eigenvalues so that
$\lambda^1 < \lambda^2$ and normalize your eigenvectors so that the first component of
each eigenvector is 1.
\item Using the eigen-decomposition of $A$ you found above, write the vector equation \eqn{vector} as a de-coupled system of two "1-way" wave equations in terms of new
variables $w^1(x,t)$ and $w^2(x,t)$, given by
\begin{equation}
\begin{aligned}
w^1_t + \lambda^1 w^1_x & = 0 \\
w^2_t + \lambda^2 w^2_x & = 0
\end{aligned}
\label{eqn:oneway}
\end{equation}
The variables $w^1(x,t)$ and $w^2(x,t)$ are known as {\em characteristic variables}.
{\bf Hint:} Write $A = R\Lambda R^{-1}$, where $R$ is a $2 \times 2$ matrix
$R = [\mathbf r^1, \; \mathbf r^2]$ and $\Lambda$ is the $2 \times 2$ diagonal matrix
$\diag(\lambda^1, \lambda^2)$. Set $\mathbf w = R^{-1} \mathbf q$ and obtain a vector equation for $\mathbf w = (w^1(x,t), w^2(x,t))$.
\item Show that the solutions to the 1-way wave equations in \eqn{oneway} are given by
\begin{equation*}
\begin{aligned}
w^1(x,t) & = w^1(x-\lambda^1 t,0) \\
w^2(x,t) & = w^2(x-\lambda^2 t,0) \\
\end{aligned}
\label{eqn:charvar}
\end{equation*}
\item Show that the solution $\mathbf q$ is given by
\begin{equation}
\begin{pmatrix} p(x,t) \\ u(x,t) \end{pmatrix} =
\frac{1}{2}w^1(x-\lambda^1 t,0) \mathbf r^1 + \frac{1}{2} w^2(x-\lambda^2 t,0) \mathbf r^2
\label{eqn:solution}
\end{equation}
\label{eqn:pu}
\item Show that the solution \eqn{pu} for $p(x,t)$ is exactly the D'Alembert solution
\begin{equation}
p(x,t) = \frac{1}{2}\left(f(x+ct) + f(x-ct)\right)+
\frac{1}{2c}\int_{x-ct}^{x+ct} g(s) \; ds
\label{eqn:dalembert}
\end{equation}
where $f(x) = p(x,0)$ is the initial pressure field and $g(x) = p_t(x,0)$ is initial rate of change of pressure. {\bf Hint: } Use the definition $\mathbf w = R^{-1} \mathbf q$ in
\eqn{solution}. Then use the first equation in \eqn{system} to show that the solution you get can be interpreted as a d'Alembert solution \eqn{dalembert} with non-zero initial conditions $g(x)$.
\item Use \eqn{solution} to show that $u(x,t)$ is also a d'Alembert solution.
\end{enumerate}
The acoustics equations above is one of the simplest examples of a hyperbolic system of PDEs. In general, a hyperbolic system can be written as a matrix system (as is done in \eqn{vector}), where the eigenvalues of the $n \times n$ matrix $A$ are all real, and that the eigenvectors span $\mathcal R^n$. These $n$ eigenvectors $\mathbf r^p$ can be interpreted as "waves", which move with speed given by their associated eigenvalues $\lambda^p$. This idea is at the heart a class of numerical methods known as "finite volume schemes" for solving hyperbolic PDEs.
\item When we hear a sound from a distant source, the "sound" we hear is a perturbation to the background pressure field. This sound is initiated by the air parcels being instantaneously disturbed (or "pushed") through a clap, the vibrations of a drumhead, or jet engines ejecting high velocity air. Through our model equations, this initial velocity disturbance perturbs the pressure field and a pressure wave travels with sound speed $c$, until it arrives at our eardrums.
Although we refer to $p(x,t)$ and $u(x,t)$ as pressure and velocity, these quantities are actually pressure and velocity {\em perturbations} to a background atmospheric pressure and mean windfield. With this interpretation, it makes sense to set the initial perturbation $p(x,t)$ to zero.
For the following questions, assume that we are in an infinite domain $-\infty < x < \infty$, so we do not need to consider even and odd extensions of our initial conditions.
\begin{enumerate}
\item Consider an initial pressure field $p(x,0) = 0$, and an initial velocity disturbance given by
\begin{equation*}
u(x,0) = \left\{\begin{array}{rr}
-1 & -1 < x < 0 \\
1 & 0 < x < 1\\
0 & \mbox{otherwise}
\end{array}
\right.
\end{equation*}
Set $c = \rho = 1$ and sketch the solution for $p(x,t)$ and $u(x,t)$ at time $t = 5$.
\item How does increasing or decreasing the density $\rho$ of the background medium affect the sound that we might hear? How does increasing the sound speed $c$ in the medium change the sound we hear?
\end{enumerate}
\item A model for heat transport in a rod is given by the one-dimensional heat equation \begin{equation}
u_t = D u_{xx}, \qquad 0 < x < L
\end{equation}
where $u(x,t)$ ($\si{\joule\per\meter^3}$) is the heat density in the rod, and $D$ ($\si{\meter^2\per\second}$) is the diffusion coefficient. As with the wave equation, initial conditions $u(x,0) = f(x)$ and boundary conditions at $x=0$ and $x=L$ need to be supplied.
Read section 12.6 in the course textbook to understand how the method of {\em separation of variables} can be used to obtain a Fourier Series solution to this model problem.
Set the initial conditions $u(x,0) = f(x) = 1-\cos(2\pi x)$, diffusion coefficient $D=1$ and the domain length $L=1$.
\begin{enumerate}
\item ({\bf Dirichlet conditions.}) Using boundary conditions $u(0,t) = u(1,t) = 0$, compute the first three non-zero terms in the series solutions to the model heat equation.
\item ({\bf Neumann ("insulated") conditions.}) Using boundary conditions
$u_x(0,t) = u_x(1,t) = 0$, compute the series solution to the model heat equation in which the ends of the rod are insulated. Show that
\begin{equation}
\lim_{t \rightarrow \infty} u(x,t) = 1
\end{equation}
\item The total heat in the rod can be computed as
\begin{equation}
H(t) = \int_0^1 u(x,t) \; dx
\end{equation}
Use the solutions you obtained above to obtain expressions for the total heat $H(t)$ in the rod to both the Dirichlet and Neumann problems. For which problem is heat lost in the rod? For which problem is total heat conserved, e.g. doesn't change in time?
\item Show that at time $T=0.1$, the total heat in the rod using Dirichlet boundary conditions is $H(T) = 0.4027974611593919$ to machine precision.
\end{enumerate}
\end{enumerate}
\end{document}