$u_t+(u(1-u))_x=a(1-2u)$, method of characteristics for traffic flow equation with riemann initial data We consider the non conserving equation
$$u_t+(f(u))_x=af'(u)$$
where $a$ is a constant and $f(u)=u(1-u)$.
I am trying to solve this equation by method of characteristics with the initial condition
$$u(x,0)=\begin{cases}
u_l & x\leq0 \\
u_r & x>0 \\
\end{cases}
$$
By method of characteristics, I have $\displaystyle \frac{dt}{1}=\frac{dx}{1-2u}=\frac{du}{a(1-2u)}$, this means that the characteristics equation is $$\displaystyle \frac{dx}{dt}=1-2u$$ along with $\displaystyle \frac{du}{dx}=a, \displaystyle \frac{du}{dt}=a (1-2u).$
Solving these equations, I reached upto $u(x,t)=ax+ g(t)$ where $g$ is some function of $t$ alone. I don't know how to proceed further.
I was able to solve this when we had the equation $$u_t+(f(u))_x=0$$ as there $u$ was constant along the line of characteristics.
Thanks in advance for any help.
 A: Note that the initial data $u(x,0)$ consists of a jump discontinuity from $u_l$ to $u_r$, thus this initial-value problem is a Riemann problem. The popular Lighthill-Witham-Richards (LWR) traffic flow model is recovered when $a=0$, and the corresponding Riemann solution is described in this post. Let us tackle the case of arbitrary $a$, e.g. by following a similar approach to this post. Setting $v = 1 - 2u$ provides the PDE
$$
v_t + vv_x = -2av
$$
for which the method of characteristics yields $v = c_1e^{-2at}$, $\frac{v-c_1}{2a} = -x+c_2$ and
$$
v = f\!\left(x - v\,\frac{e^{2at}-1}{2a}\right) e^{-2at} \, ,
$$
which is equivalent to the solution found in the answer by @Dmoreno. However, for discontinuous initial data, the method of characteristics is not sufficient (it is only valid where $u$ is smooth). Thus, we use appropriate methods for solving this problem in the weak sense, see related post. Here, we find the shock-wave solution
$$
v(x,t) = \left\lbrace
\begin{aligned}
&v_le^{-2at} &&\text{if}\quad x< x_s(t) \\
&v_re^{-2at} &&\text{if}\quad x> x_s(t)
\end{aligned}\right. ,\qquad
x_s(t) = \frac{v_l+v_r}{2}\frac{1-e^{-2at}}{2a} .
$$
if $v_l > v_r$, and the rarefaction wave solution $$
v(x,t) = \left\lbrace
\begin{aligned}
&v_le^{-2at} &&\text{if}\quad x< v_l (e^{-2at} - 1) \\
& \frac{x e^{-2at}}{e^{-2at} - 1} && \text{if}\quad v_l (e^{-2at} - 1)\leq x\leq v_r (e^{-2at} - 1) \\
&v_re^{-2at} &&\text{if}\quad x> v_r (e^{-2at} - 1)
\end{aligned}\right.
$$
if $v_l < v_r$. One could check that the same solution $u = \frac{1-v}2$ is obtained by tackling the initial PDE problem directly (without changing variables).
A: From $\mathrm{d}u/\mathrm{d}x = a$ you get $u - ax = c_1$, and from $a\mathrm{d}t = \mathrm{d}u/(1-2u)$ you obtain $u = \frac{1}{2}(1-c_2 \mathrm{e}^{-2 at})$. Let $c_2 = f(c_1)$ to derive an implicit solution for $u$, determined by the equation
$$ u = \frac{1}{2}\left[1-f(u - ax) \, \mathrm{e}^{-2 at}\right]$$
The task at hand now is to determine $f$ from the initial condition and eventually solve for $u$. Can you take it from here?
