PDE: Solving Burgers' equation with initial value given by a self consistency equation

I would like to solve in Mathematica the well known inviscid Burgers' equation \begin{align} \begin{cases} u_t(x,t) + u(x,t)u_x(x,t)= 0 \\ u(x,0) = m(x) \end{cases} \end{align} where $$m(x) =\tanh(x+ m(x))$$ is given in implicit form. In particular, what I am looking for is to get a 3d plot of the pde and eventually the characteristic plot. Any idea how to approach the problem?

• Welcome! Is this question about Mathematica or math in general? Jan 18 '15 at 13:42
• the function $m(x)$ is defined in terms of itself? Jan 18 '15 at 14:12
• Do you want a symbolic solution or a numeric approximation over some domain? Jan 18 '15 at 14:13
• @Nasser yes the function is given in such form. Michael, I just updated the question to make it more clear. Jan 18 '15 at 14:20

Define m in one of two ways:

Clear[m];
m0 = NDSolveValue[{m[x] == Tanh[x + m[x]], s'[x] == 1, s[-1] == -1}, m, {x, -1, 0}]
m[x_] /; x < 0 := m0[x];
m[x_] /; x == 0 := x;
m[x_] /; x > 0 := -m0[-x];


or

Clear[m, m0];
m[x_?NumericQ] := m0 /. FindRoot[m0 == Tanh[x + m0], {m0, x}];


Then solve the PDE:

{sol} = NDSolve[{D[u[x, t], t] + u[x, t] D[u[x, t], x] == 0, u[x, 0] == m[x]},
u,
{x, -1, 1}, {t, 0, 1}]


There are some warnings:

NDSolve::mxsst: Using maximum number of grid points 10000 allowed by the MaxPoints or MinStepSize options for independent variable x. >>

NDSolve::bcart: Warning: an insufficient number of boundary conditions have been specified for the direction of independent variable x. Artificial boundary effects may be present in the solution. >>

The result looks ok, I think:

Plot3D[u[x, t] /. sol, {x, -1, 1}, {t, 0, 1}, AxesLabel -> Automatic]