MethodOfLines.jl
MethodOfLines.jl copied to clipboard
Complex boundary conditions
Question❓
MWE:
using MethodOfLines, OrdinaryDiffEq, Plots, DomainSets, ModelingToolkit
@parameters t, x
@variables ψ(..)
Dt = Differential(t)
Dxx = Differential(x)^2
xmin = 0
xmax = 1
ϵ = 1e-2
V(x) = 0.0
eq = [(im*ϵ)*Dt(ψ(t,x)) ~ (-0.5*ϵ^2)Dxx(ψ(t,x)) + V(x)*ψ(t,x)] # You must enclose complex equations in a vector, even if there is only one equation
ψ0 = x -> exp((im/ϵ)*1e-1*sum(x))
bcs = [ψ(0,x) ~ ψ0(x),
ψ(t,xmin) ~ exp((im/ϵ)*(1e-1*sum(xmin) - 0.5e-2*t)),
ψ(t,xmax) ~ exp((im/ϵ)*(1e-1*sum(xmax) - 0.5e-2*t))]
domains = [t ∈ Interval(0, 1), x ∈ Interval(xmin, xmax)]
@named sys = PDESystem(eq, bcs, domains, [t, x], [ψ(t,x)])
disc = MOLFiniteDifference([x => 300], t)
prob = discretize(sys, disc)
sol = solve(prob, TRBDF2(), saveat = 0.01)
Use of complex valued boundary conditions, throws an assertion error. Is this a known issue ?
Yes it's not currently supported.