Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

2d PDE example #196

@jw3126

Description

@jw3126

I tried to do a 2d poisson equation example, but I run into multiple issues. Here is an MWE:

using DiffEqOperators

nx, ny = (3, 3)
hx, hy = 1.0 ./ (1 .+ (nx, ny))
yknots = range(hy, step=hy, length=ny)

qx = [DirichletBC(randn(2)...) for y in yknots]
Qx = MultiDimBC{1}(qx)
D = CenteredDifference{1}(2,2, hx, nx)

D*(Qx*randn(nx, ny)) # no error
D*Qx # no error
(D*Qx)*randn(nx, ny) # error
MethodError: no method matching SparseArrays.SparseMatrixCSC(::MultiDimDirectionalBC{Float64,RobinBC{Float64,Array{Float64,1}},1,2,1})
Closest candidates are:
  SparseArrays.SparseMatrixCSC(::MultiDimDirectionalBC{T,B,D,N,K}, !Matched::Any) where {T, B, D, N, K} at /home/jan/.julia/dev/DiffEqOperators/src/derivative_operators/concretization.jl:188
  SparseArrays.SparseMatrixCSC(!Matched::LinearAlgebra.SymTridiagonal{Tv,V} where V<:AbstractArray{Tv,1}) where Tv at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/SparseArrays/src/sparsematrix.jl:436
  SparseArrays.SparseMatrixCSC(!Matched::LinearAlgebra.Tridiagonal{Tv,V} where V<:AbstractArray{Tv,1}) where Tv at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/SparseArrays/src/sparsematrix.jl:407
  ...

Stacktrace:
 [1] convert(::Type{AbstractArray{T,2} where T}, ::MultiDimDirectionalBC{Float64,RobinBC{Float64,Array{Float64,1}},1,2,1}) at /home/jan/.julia/dev/DiffEqOperators/src/derivative_operators/concretization.jl:162
 [2] *(::MultiDimDirectionalBC{Float64,RobinBC{Float64,Array{Float64,1}},1,2,1}, ::SubArray{Float64,1,Array{Float64,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}) at /home/jan/.julia/packages/DiffEqBase/4V8I6/src/operators/common_defaults.jl:14
 [3] mul!(::SubArray{Float64,1,Array{Float64,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}, ::GhostDerivativeOperator{Float64,DerivativeOperator{Float64,1,false,Float64,StaticArrays.SArray{Tuple{3},Float64,1,3},StaticArrays.SArray{Tuple{0},StaticArrays.SArray{Tuple{4},Float64,1,4},1,0},Nothing,Nothing},MultiDimDirectionalBC{Float64,RobinBC{Float64,Array{Float64,1}},1,2,1}}, ::SubArray{Float64,1,Array{Float64,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}) at /home/jan/.julia/dev/DiffEqOperators/src/derivative_operators/ghost_derivative_operator.jl:12
 [4] mul!(::Array{Float64,2}, ::GhostDerivativeOperator{Float64,DerivativeOperator{Float64,1,false,Float64,StaticArrays.SArray{Tuple{3},Float64,1,3},StaticArrays.SArray{Tuple{0},StaticArrays.SArray{Tuple{4},Float64,1,4},1,0},Nothing,Nothing},MultiDimDirectionalBC{Float64,RobinBC{Float64,Array{Float64,1}},1,2,1}}, ::Array{Float64,2}) at /home/jan/.julia/dev/DiffEqOperators/src/derivative_operators/ghost_derivative_operator.jl:25
 [5] *(::GhostDerivativeOperator{Float64,DerivativeOperator{Float64,1,false,Float64,StaticArrays.SArray{Tuple{3},Float64,1,3},StaticArrays.SArray{Tuple{0},StaticArrays.SArray{Tuple{4},Float64,1,4},1,0},Nothing,Nothing},MultiDimDirectionalBC{Float64,RobinBC{Float64,Array{Float64,1}},1,2,1}}, ::Array{Float64,2}) at /home/jan/.julia/dev/DiffEqOperators/src/derivative_operators/ghost_derivative_operator.jl:32
 [6] top-level scope at In[124]:14

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions