You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Without MRE, we would only be able to help you to a limited extent, and attention to the issue would be limited. to know more about MRE refer to wikipedia and stackoverflow.
using MethodOfLines, OrdinaryDiffEq, Plots, DomainSets, ModelingToolkit
@parameters t, x
@variablesψ(..)
Dt =Differential(t)
Dxx =Differential(x)^2
xmin =0
xmax =1V(x) =0.0
eq = [im*Dt(ψ(t,x)) ~Dxx(ψ(t,x)) +V(x)*ψ(t,x)] # You must enclose complex equations in a vector, even if there is only one equation
ψ0 = x ->sin(2pi*x)
ψ0(0.1)
bcs = [
ψ(0,x) =>ψ0(x),
ψ(t,xmin) ~0,
ψ(t,xmax) ~0
]
domains = [t ∈Interval(0, 1), x ∈Interval(xmin, xmax)]
@named sys =PDESystem(eq, bcs, domains, [t, x], [ψ(t,x)])
disc =MOLFiniteDifference([x =>100], t)
prob =discretize(sys, disc)
sol =solve(prob, TRBDF2(), saveat =0.01)
discx = sol[x]
disct = sol[t]
discψ = sol[ψ(t, x)]
anim =@animatefor i in1:length(disct)
u = discψ[i, :]
plot(discx, [real.(u), imag.(u)], ylim = (-1.5, 1.5), title ="t = $(disct[i])", xlabel ="x", ylabel ="ψ(t,x)", label = ["re(ψ)""im(ψ)"], legend =:topleft)
endgif(anim, "schroedinger.gif", fps =10)
Error & Stacktrace ⚠️
Environment (please complete the following information):
Describe the bug 🐞
Schroedinger example fails out of the box -- but only requires simple fix in the bcs:
Real problem is that solution seems to blow up:
Expected behavior
See gif in docs example
Minimal Reproducible Example 👇
Without MRE, we would only be able to help you to a limited extent, and attention to the issue would be limited. to know more about MRE refer to wikipedia and stackoverflow.
Error & Stacktrace⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: