# Solving nonlinear 1D advection pde with MoC

I would like to solve the 1D nonlinear advection equation with the method of characteristics. Here is my notation:

$$$$\begin{cases} \rho_t + (1+\rho)\rho_x = 0\\ \rho = \rho(x,t); \quad \rho(x,0) = \frac{1}{1+x^2} \end{cases}$$$$ What I have been up to is the following, using the parameter s: \begin{align} &\frac{d\rho}{dt} = \frac{dx}{ds}\frac{\partial \rho}{\partial x} + \frac{dt}{ds}\frac{\partial \rho}{\partial t} = 0\\ \Longrightarrow \; & \frac{dt}{ds} = 1 ;\quad t(0)=0 \; \Longrightarrow \; t=s \\ \Longrightarrow \; & \frac{d\rho}{ds} = 0 ;\quad \rho(0)=\rho_0 \; \Longrightarrow \; \rho = \rho_0 \\ \Longrightarrow \; & \frac{dx}{ds}=1+\rho= 1+\rho_0 ;\quad x(0) = f(\rho_0) \; \Longrightarrow \; x = (1+\rho_0)s + f(\rho_0) \end{align} So that I end up with $$$$f(\rho) = x - (1+\rho)t \; \Longrightarrow \; \rho = F(x - [1+\rho]t )$$$$ I tried to apply several techniques I found to find the solution of the above Riemann problem using the method of characteristics. I have the general form of the solution as F but I would like to have the analytic solution for this case so I can plot for several times and see the shockwave.

Note: This problem comes from this online document, chapter 11.

• You must provide a condition on the "inflow" boundary, for instance $\rho(0,t)=1$. If you just want to visualize the solution I can provide two lines of Wolfram code that will do the trick. – PierreCarre Jan 31 at 9:43
• I think you haven't used the initial condition on $\rho$ yet, which yields $\rho_0 = \frac{1}{1+f(\rho_0)^2}$? – Christoph Jan 31 at 9:54
• As J.Jacquelin did below, using the unitial condition on $\rho$ leads to a cubic equation that I have no idea how to solve. – Dash Jan 31 at 14:48

Your calculus is correct. You found the general solution : $$\rho=F\left(x-(1+\rho)t\right)$$ Condition : $$\rho(x,0)=\frac{1}{1+x^2}=F\left(x-(1+\rho)0\right)=F\left(x\right)$$ The function $$F$$ is determined : $$F(X)=\frac{1}{1+X^2}$$ We put this function into the general solution where $$X=x-(1+\rho)t$$ $$\rho=\frac{1}{1+(x-(1+\rho)t)^2}$$ This is the solution on implicit form.

In order to obtain the explicit solution, solve the cubic equation for $$\rho$$ : $$(1+(x-(1+\rho)t)^2)\rho-1=0$$

For exemple, to plot the curves corresponding tu figure 11.1 : $$x=(1+\rho)t\pm\sqrt{\frac{1}{\rho}-1}$$ Plot the two branches with signs $$+$$ and $$-$$.
• Thamks for answering. I actually came to the same conclusion a few minutes ago. My next problem is when I'm computing the $\delta = b^2 - 4ac$ of this equation, which sign is undetermined because, well, in (x,t) parameters are supposed to be both varying parameters and though $\delta$ is not a scalar but a space of solutions. – Dash Jan 31 at 14:26
• There is no need for an explicit formula to plot $\rho(x,t)$ as a function of $t$ for given $x$. Compute the formula of $t$ as a function of $\rho$ which is an explicit equation. Plot $t$ as a function of $\rho$ with $t$ on horizontal axis and $\rho$ on vertical axis. – JJacquelin Jan 31 at 15:25
• If I rewrite the equation as $$\frac{1}{\rho}-1=[x−(1+ρ)t]^2$$ Then I cannot isolate t from ρ because of the square – Dash Jan 31 at 17:02
• Here the advection velocity depends on $\rho$ itself, which is the problem when I look for an explicit analytic solution. Perhaps I should quit looking for a beautiful formula, but do you have an idea of how they did in fig. 11 of the book to plot the solution ? – Dash Jan 31 at 18:55