# Why does Mathematica dislike my boundary condition in NDSolve?

im trying to solve a PDE-System, with the "periodic boundary condition"

c[t,0]==4*c[t,2pi]


But Mathenmatica says:

NDSolve::bcedge: "Boundary condition c[t,0]==4\ c[t,2\ [Pi]] is not specified on a single edge of the boundary of the computational domain."

If I replace the 4 by 1 everything is fine. Anyone can explain this to me? And/or can tell me how/if Mathematica can solve this?

• It would help to have the rest of your equation as well. Mar 19, 2014 at 16:37

The condition c[t, 0] == 4 * c[t, 2 Pi] does not define a periodic boundary condition. The function value must be the same for it to be periodic. That is also why it works if you replace 4 by 1. You might be able to replace c[t, x] by m[x] u[t, x] where u is periodic and m[x] grows exponentially by a factor of 4 over each period.

Here is an adaptation of the sine-Gordon equation in the NDSolve documentation illustrating this idea.

L = 4;
m[x_] := Exp[Log[4] x/(2 L)];
sol = NDSolve[{D[m[x] u[t, x], t, t] ==
D[m[x] u[t, x], x, x]  + Sin[m[x] u[t, x]], u[t, -L] == u[t, L],
m[x] u[0, x] == Exp[-x^2],
Derivative[1, 0][u][0, x] == 0},
u, {t, 0, L}, {x, -L, L}];

Plot3D[Evaluate[m[x] u[t, x] /. First[sol]], {x, -L, 5 L}, {t, 0, L}]


A check of the constant ratio over the "period" 2 L:

Ratios /@ Table[m[x] u[t, x] /. First[sol],
{t, RandomReal[{0, L}, 5]}, {x, -L, 7 L, 2 L}]
(*
{{4., 4., 4., 4.}, {4., 4., 4., 4.}, {4., 4., 4., 4.},
{4., 4., 4., 4.}, {4., 4., 4., 4.}}
*)