# One-dimensional NLS using MethodOfLines 'type Array has no field lhs\`

**URL:** <https://discourse.julialang.org/t/one-dimensional-nls-using-methodoflines-type-array-has-no-field-lhs/78543>\
**Category:** General Usage\
**Tags:** diffeq\
**Created:** [March 27, 2022, 8:04am UTC](https://discourse.julialang.org/t/one-dimensional-nls-using-methodoflines-type-array-has-no-field-lhs/78543 "2022-03-27T08:04:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ruvi\_Lecamwasam](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ruvi_lecamwasam/32/28374_2.png) [@Ruvi\_Lecamwasam](https://discourse.julialang.org/u/Ruvi_Lecamwasam)\
**Post date:** [March 27, 2022, 8:04am UTC](https://discourse.julialang.org/t/one-dimensional-nls-using-methodoflines-type-array-has-no-field-lhs/78543/1 "2022-03-27T08:04:25Z")

</div>

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/](http://methodoflines.sciml.ai/dev/tutorials/brusselator/), and adapted it as:

```julia
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?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 27, 2022, 12:27pm UTC](https://discourse.julialang.org/t/one-dimensional-nls-using-methodoflines-type-array-has-no-field-lhs/78543/2 "2022-03-27T12:27:26Z")

</div>

Open an issue. Might just be a missing tag.
