The problem I am trying to solve is: \begin{equation}\label{eq:3.1} \begin{cases} \partial_t u + \partial_x(u^2)=0 & x\in \mathbb{R}, t \in (0,\infty]\\ u(x,0)= \begin{cases} 0 & x\leq 0\\ x & 0<x\leq 1\\ 1 & x>1 \end{cases} \end{cases} \end{equation}
What I have done is:
We will try to reduce the problem to ODEs on a curve $x(t)$ on the $(t,x)$ plane. The equation can be compared with the canonical form,
\begin{equation}
a\frac{\partial u}{\partial x} +b\frac{\partial }{\partial t} = c,
\end{equation}
where $a = 2u$, $b= 1$ and $c=0$. From the Lagrange-Charpit equations, we have,
\begin{align}\label{eq:3.2}
&\frac{dx}{a}=\frac{dt}{b}=\frac{du}{c} & \text{ substituting we have,}\nonumber\\
\implies &\frac{dx}{2u}=\frac{dt}{1}=\frac{du}{0}&
\end{align}
using second and the third ratio from the equation we have,
\begin{align}\label{eq:3.3}
&\frac{du}{dt}=0 & \text{integrating we have,} \nonumber\\
\implies&u=B,&
\end{align}
where $B$ is a arbitrary constant. Using the initial conditions,
\begin{equation}\label{eq:3.4}
u(x,0)=
\begin{cases}
0 & x\leq 0\\
x & 0<x\leq 1\\
1 & x>1
\end{cases}
\end{equation}
where the characteristic curve $x(t)$, passes through $(c,0)$. By substitution we have,
\begin{equation}
B=
\begin{cases}
0 & x\leq 0\\
c & 0<x\leq 1\\
1 & x>1.
\end{cases}
\end{equation}
Therefore solution can be written as
\begin{equation}\label{eq:3.5}
u=
\begin{cases}
0 & x\leq 0\\
c & 0<x\leq 1\\
1 & x>1.
\end{cases}
\end{equation}
using first and the second ratios from the equation we have,
\begin{align}\label{eq:3.6}
&\frac{dx}{dt}=2u & \text{substituting we have,} \nonumber\\
\implies&\frac{dx}{dt}=
\begin{cases}
0 & x\leq 0\\
2c & 0<x\leq 1\\
2 & x>1.
\end{cases}
&\text{integrating we have,}\nonumber\\
\implies&x=
\begin{cases}
B & x\leq 0\\
2ct+B & 0<x\leq 1\\
2t+B & x>1.
\end{cases}
&\nonumber\\
\end{align}
where $B$ is a arbitrary constant. Using the initial conditions , and that the characteristic curve $x(t)$ passes through $(c,0)$ we have,
\begin{equation}
x=
\begin{cases}
c & x\leq 0\\
2ct+c & 0<x\leq 1\\
2t+c & x>1.
\end{cases}
\end{equation}
Therefore $u$ becomes,
\begin{equation}
u(x,t)=
\begin{cases}
0 & x\leq 0\\
\frac{x}{2t+1} & 0<x\leq 1\\
1 & x>1.
\end{cases}
\end{equation}
I think I am missing something. The solution should have $t$ dependence in the intervals. Thanks.