# Inconsistent boundary and initial conditions when solving sine Gordon equation

I have been trying to solve the following sine Gordon equation

$$\partial_{x,x} u(x,t) - \partial_{t,t} u(x,t) - \sin (u(x,t)) - \alpha \partial_t u(x,t) + \gamma = 0$$,

for $$x \in [0,15]$$ and $$t \in [0,20]$$ with the boundary conditions

$$\partial_x u(x,t)\vert_{x=0} = h, \hspace{2cm} \partial_x u(x,t)\vert_{x=15} = h + a_{\mathrm{ext}} \sin(\omega_{\mathrm{ext}}t),$$

and the initial conditions

$$\partial_t u(x,t)\vert_{t=0} = 0, \hspace{2cm} u(x,t)\vert_{t=0} = h x$$.

Here is my Mathematica code

const = {al -> 0.08, \[Gamma] -> 0.01, h -> 6,  ax -> 2.5, \[Omega]x -> 1.4};

NDSolveValue[({D[u[x, t], x, x] - D[u[x, t], t, t] - Sin[u[x, t]] - al D[u[x, t], t] + \[Gamma] == 0,

(D[u[x, t], x] /. {x -> 0}) == h, (D[u[x, t], x] /. {x -> 15}) == h +  ax Sin[\[Omega]x  t],
u[x, 0] == h*x, (D[u[x, t], t] /. {t -> 0}) == 0} /.const), u, {x, 0, 15}, {t, 0, 20},

Method -> {"PDEDiscretization" -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid",
"MinPoints" -> 200}}}]


The code works and gives a solution, but there appears an error message like this

NDSolveValue::ibcinc: Warning: boundary and initial conditions are inconsistent.


From the second initial condition we have $$\partial_x u(x,0) = h$$, which are consistent with the two boundary conditions at $$t=0$$. So I don't understand why the above error occurs.

I have read many posts related to this problem. One of the solutions is to increase the "MinPoints" in the "Method". I tried so, but it still did not not get rid of the error.

Any advice is very much appreciated.

Dat.

• D[h + ax Sin[\[Omega]x t], t] /. t -> 0 gives ax \[Omega]x, which is against (D[u[x, t], t] /. {t -> 0}) == 0. May 25, 2021 at 7:27
• @xzczd: Thanks. Can you suggest me how to fix this? May 25, 2021 at 7:59
• You can of course omit the inconsistency by cleverly modify the b.c. at $t=0$, but it's just not necessary. In this case the ibcinc is merely a warning. (You can check the residual error of the solution. ) May 25, 2021 at 9:41