Entropy Solution of Burgers' equation $u_t+(u^2/2)_x=0$
Solution 1:
We can first create a solution for small $t$ by simply looking at the behavior of the initial condition. Notice that at at $x=-1$ we have a shock, as we are jumping from $1$ to $0$, a rarefaction at $x=0$ as we go from $0$ to $2$, and finally a shock at $x=1$ as we go from $2$ to $0$.
At $x=-1$, the R-H condition gives $\sigma = \frac{1}{2}$, and at $x=1$, $\sigma = 1$. Thus we can form our solution as follows:
$$ u(x,t) = \left\{ \begin{array}{lc} 1 & x<-1+\frac{1}{2}t \\ 0 & -1 + \frac{1}{2}t<x<0 \\ \frac{x}{t} & 0<x<2t \\ 2 & 2t < x< 1+t \\ 0 & x>1+t \end{array} \right. $$
Notice that we have collisions at $t=2$ and $t=1$, therefore this solution only is valid for $0\leq t\leq 1$. We will have to examine each shock seperately. For the shock at $t=2$, we have $u_l = \frac{x}{t}$ and $u_{r} = 0$. Denote the speed of this shock according to the R-H condition by
$$ s'(t) = \frac{ \frac{1}{2} \left( \frac{s(t)}{t} \right) ^2}{ \frac{ s(t)} {t}} = \frac{s(t)}{2t}$$
with $s(1)=2$ since that is the value of $x$ at $t=1$. This gives $s(t) = 2\sqrt{t}$. For the other shock at $t=2$, we have $u_l = -1$ and $u_r = \frac{x}{t}$, so $$q'(t) = \frac{ \frac{1}{2} - \frac{1}{2} \left( \frac{q(t)}{t} \right)^2 }{1 - \frac{q(t)}{t}} = \frac{1}{2} \left( 1+ \frac{q(t)}{t} \right) $$
with $ q(2) = 0 $ by the same reasoning, so that this gives $q(t) = t - \sqrt{2t}$. Note that these two shocks in fact will intersect eachother at $t = 6+4\sqrt{2}$, so our solution for $1 \leq t \leq 2$ and $2 \leq t \leq 6+4\sqrt{2}$ is
$$ \left\{ \begin{array}{lc} 1 & x<-1+\frac{1}{2}t\\ 0 & -1+\frac{1}{2}t < x <0\\ \frac{x}{t} & 0 < x < 2 \sqrt{t}\\ 0 & x >2 \sqrt{t} \end{array} \right. $$ and $$ \left\{ \begin{array}{lc} 1 & x<t-\sqrt{2t}\\ \frac{x}{t} & t-\sqrt{2t} < x < 2 \sqrt{t}\\ 0 & x >2 \sqrt{t} \end{array} \right. $$
respectively. Finally, the shock at $t=6+4 \sqrt{2}$ is given by, with $u_l = 1$, $u_r = 0$, $$ r'(s) = \frac{1}{2}$$ with $r(6+4 \sqrt{2}) = 4+2 \sqrt{2}$. This gives $r(t) = \frac{1}{2} +1$, and so the solution for $t > 6+4 \sqrt{2}$ is given by $$ \left\{ \begin{array}{lc} 1 & x<1+\frac{1}{2}t\\ 0 & x > 1 + \frac{1}{2}t\\ \end{array} \right. $$
This gives you a full solution, and a picture of the shocks can be seen here:
You can readily see where each portion of the solution is assigned to in the picture as well.