I’m trying to solve the one-dimensional nonlinear Schrodinger equation using MethodOfLines. I looked at the code on the docs: http://methodoflines.sciml.ai/dev/tutorials/brusselator/, and adapted it as:
using ModelingToolkit, MethodOfLines, OrdinaryDiffEq, DomainSets
@parameters x z
@variables A(..)
Dx = Differential(x)
Dz = Differential(z)
Dzz = Differential(z)^2
xmin = 0.
xmax = 1e-1
zmax = 10.
zmin = -zmax
c0 = 1.
A0(x,z) = c0*sech(c0*z/sqrt(2))*exp(im*c0^2*x/2)
domains = [x ∈ Interval(xmin,xmax), z ∈ Interval(zmin,zmax)]
eq = [im*Dx(A(x,z))+Dzz(A(x,z)) ~ -abs2(A(x,z))*A(x,z)]
bcs = [A(xmin,z) ~ A0(xmin,z),
A(x,zmin) ~ 0,
A(x,zmax) ~ 0]
@named pdesys = PDESystem(eq,bcs,domains,[x,z],[A(x,z)])
N = 100
dz = 1/N
order = 2
discretization = MOLFiniteDifference([z=>dz], x)
@time prob = discretize(pdesys,discretization)
However this won’t run, giving error type Array has no field lhs
. I think the only main difference between my code and the tutorial is that my PDE is for a single function, but I don’t know why that would be causing this error.
Does anyone have any ideas why?