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?