# NDSolveValue::bcedge: Boundary condition is not specified on a single edge of the boundary of the computational domain

I'm solving a Schrödinger's Equation in 1d, where $$\Omega$$ is the domain, bcs the periodic boundary condition, init the initial condition.

eqns = {I D[ψ[t, x], t] == -1/2 D[ψ[t, x], x, x] + 1/2 (x^2) ψ[t, x]};
Ω = Interval[{-10, 10}];
bcs = {ψ[t, -10] == ψ[t, 10]};
init = {ψ[0, x] == Exp[-(1/2) x^2]};
sol = NDSolveValue[{eqns, init, bcs}, ψ, {t, 0, 1}, x ∈ Ω]


But that gives an error: "Boundary condition $$\Psi[t,-10]==\Psi[t,10]$$ is not specified on a single edge of the boundary of the computational domain"

However, when I simply replace the domain in NDSolveValue[] $$x \in\Omega$$ with {x,-10,10}, everything works.

sol = NDSolveValue[{eqns, init, bcs}, ψ, {t, 0, 1}, {x, -10, 10}]


But the Interval[{-10, 10}] should be able to represent a computational domain. I have successfully checked this with a Dirichlet boundary condition.

eqns = {I D[ψ[t, x], t] == -1/2 D[ψ[t, x], x, x] + 1/2 (x^2) ψ[t, x]};
Ω = Interval[{-10, 10}];
bcs = DirichletCondition[ψ[t, x] == Exp[-(1/2) x^2 - 1/2 I t], x == 10 || x == -10];
init = {ψ[0, x] == Exp[-(1/2) x^2]};
sol = NDSolveValue[{eqns, init, bcs}, ψ, {t, 0, 1}, x ∈ Ω]


So now things get weird. Why it doesn't work when Interval[] and periodic boundary condition are used together?

• Looks like a bug to me. – user21 May 8 at 7:12

This looks like a bug to me. You have two options:

1) Use an {x,-10,10} as a region

or

2) Use PeriodicBoundaryCondition like so:

eqns = {I D[\[Psi][t, x], t] == -1/2 D[\[Psi][t, x], x, x] +
1/2 (x^2) \[Psi][t, x]};
\[CapitalOmega] = Interval[{-10, 10}];
bcs = {\[Psi][t, -10] == \[Psi][t, 10]};
bcs = PeriodicBoundaryCondition[\[Psi][t, x], x == -10,
Function[x, x + 20]];
init = {\[Psi][0, x] == Exp[-(1/2) x^2]};
sol = NDSolveValue[{eqns, init, bcs}, \[Psi], {t, 0, 1},(*{x,-10,10} *)
Element[{x}, \[CapitalOmega]] ]

• Thanks for you answer. Yes, I also succeeded with those two options. My last question also appeared as a bug... I'm too lucky.. : ) – Yang Zhou May 8 at 7:34
• @YangZhou, well it shows that you have a good understanding of what the language should behave like. I filed the bug for you and I'll try to get this bug fixed as soon as possible. Sorry for the inconvenience! – user21 May 8 at 7:40