How to discretize and solve a 3D Poisson Equation with Dirichlet boundary conditions owing to DiffEqOperators

I love the following example of solving a 1D Poisson equation with DiffEqOperators.
However , I struggle to do the analog 3D example. Can somebody indicate me the right steps?

The 1D formulation is:

using DiffEqOperators, Plots
#Poisson Eq in 1D

Δu = f with boundary conditions u(0) = 0 and u(1) = 0

Δx = 0.1
x = Δx:Δx:1-Δx # Solve only for the interior: the endpoints are known to be zero!
N = length(x)
f = sin.(2π*x)

Δ = CenteredDifference(2, 2, Δx, N)
bc = Dirichlet0BC(Float64)
u = (Δ*bc) \ f

u_analytic(x) = -sin(2π*x)/4(π^2)

plot(x, u)
plot!(x, u_analytic.(x))

An equivalent 1D formulation, which works well, is:

Δx = 0.1
x = Δx:Δx:1-Δx # Solve only for the interior: the endpoints are known to be zero!
N = length(x)
f = sin.(2πx)
Δ = CenteredDifference(2, 2, Δx, N)
M = zeros(N,N)
for i in 1:N
for j in 1:N
if i==j M[i,j] = 1.0 end
end
end
Qx = Dirichlet0BC{1}(Float64, size(M))
MwBC = Qx
M

u_analytic(x) = -sin(2πx)/4(π^2)
u = (Δ
MwBC) \ f

plot(x, u)
plot!(x, u_analytic.(x))

In 3D, I could define Δ as:

Δxx = CenteredDifference{1}(2,2,Δx,N)
Δyy = CenteredDifference{2}(2,2,Δx,N)
Δzz = CenteredDifference{3}(2,2,Δx,N)
Δ = Δxx + Δyy + Δzz

Then I could define a 3D matrix M and boundary conditions as:
M = zeros(N, N, N)
for i in 1:N
for j in 1:N
for k in 1:N
if i==j M[i, j, k] = 1.0 end
end
end
end

Qx = Dirichlet0BC{1}(Float64, size(M))
Qy = Dirichlet0BC{2}(Float64, size(M))
Qz = Dirichlet0BC{3}(Float64, size(M))
Q = compose(Qx, Qy, Qz)

MwBC = Q*M

Finally the Laplace operator would be placed in M
mult!(M, Δ, MwBC)

Is that correct ?
But then, what to do ?
Thanks in advance for any kind of answer …

Hey,
The package isn’t quite ready for this. The PR to fix 3D BCs is still a work in progress but is making a lot of progress over the last week: Rebased #168 by ChrisRackauckas · Pull Request #246 · SciML/DiffEqOperators.jl · GitHub

Dear Chris, thanks a lot for your answer. I thought indeed the package was not really ready for 3D yet. The work in progress looks very exciting. Thanks a lot for all this and good luck with its development. I’d love to use it and help, but I am afraid I am too far from the required knowledge for that …!