-
Notifications
You must be signed in to change notification settings - Fork 69
Description
Hello. I want to solve the Helmholtz equation on the square [-1,1] x [-1,1] with the Dirichlet or Neumann boundary conditions where the boundary values are prescribed by the boundary value of a given 2D function. For example, let's use a Gabor function of the form:
julia> d = Interval()^2
julia> g=Fun((x,y)->exp(-(x^2+3*y^2)*cos(5*pi*x+7*pi*y),d)
Now, I want to use the boundary values of this function g to solve the Helmholtz equation. Following the example in README.md, I tried:
julia> Δ = Laplacian(d) # Represent the Laplacian
julia> f = g(∂(d)) # f should represent the boundary value of g
julia> u = [dirichlet(d);Δ+500I]\[f;0.] # Solve the PDE
However, it generates the following error at the 2nd line. What should I do?
Thanks!
PS: By the way, there is a typo in the Helmholtz solver example in README.md.
The third line above in README.md says:
julia> u = [Dirichlet(d); Δ+500I]\[f;0.] # Solve the PDE
But Dirichlet should be replaced by dirichlet; otherwise it causes an error.
Here is the error generated by:
julia> f = g(∂(d)) # f should represent the boundary value of g
MethodError: no method matching start(::ApproxFun.PiecewiseInterval{Complex{Float64}})
Closest candidates are:
start(!Matched::SimpleVector) at essentials.jl:170
start(!Matched::Base.MethodList) at reflection.jl:258
start(!Matched::IntSet) at intset.jl:184
...
in append_any(::ApproxFun.PiecewiseInterval{Complex{Float64}}, ::Vararg{ApproxFun.PiecewiseInterval{Complex{Float64}},N}) at ./essentials.jl:98
in evaluate(::ApproxFun.Fun{ApproxFun.TensorSpace{Tuple{ApproxFun.Chebyshev{ApproxFun.Interval{Float64}},ApproxFun.Chebyshev{ApproxFun.Interval{Float64}}},ApproxFun.RealBasis,2},Float64}, ::ApproxFun.PiecewiseInterval{Complex{Float64}}) at /Users/xxx/.julia/v0.5/ApproxFun/src/Fun/Fun.jl:141
in (::ApproxFun.Fun{ApproxFun.TensorSpace{Tuple{ApproxFun.Chebyshev{ApproxFun.Interval{Float64}},ApproxFun.Chebyshev{ApproxFun.Interval{Float64}}},ApproxFun.RealBasis,2},Float64})(::ApproxFun.PiecewiseInterval{Complex{Float64}}, ::Vararg{ApproxFun.PiecewiseInterval{Complex{Float64}},N}) at...