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

Unexpected concretization of Laplace operator #491

Open
fabiopierella opened this issue Oct 22, 2021 · 3 comments
Open

Unexpected concretization of Laplace operator #491

fabiopierella opened this issue Oct 22, 2021 · 3 comments

Comments

@fabiopierella
Copy link

Congrats for the great work you are doing in the DiffEqOperators package. I was trying to create a 2D Laplacian matrix, but I can’t seem to manage to be able to concretize it to the right Array.

MWE (Win10, julia 1.6, DiffEqOperators 4.29.0)


n = 10

Lxx = CenteredDifference{1}(2,2,1.,n) 
Lyy = CenteredDifference{2}(2,2,1.,n) 
D = Lxx + Lyy

Mxx = Array(D.ops[1], (n,n))
Myy = Array(D.ops[2], (n,n))

D = Lxx + Lyy

heatmap(Array(D, (n,n)))

Image I get:
mwe

Image I'd expect:
reference

@ChrisRackauckas
Copy link
Member

Thanks for the issue. Peculiar. Looks like an indexing issue.

@eschnett
Copy link
Contributor

I find that the problem is that D has the wrong size. Lxx and Lyy have different sizes, and D inherits the size of Lxx. Instead, both Lxx and Lyy should be zero-extended to have the same size.

@eschnett
Copy link
Contributor

My comment above was wrong. I was confused about the matrix sizes.

The plot looks correct to me. The matrix you are plotting has size (n, n+2) because ghost points have been added. If you plot either Mxx or Myy separately, you see that they are correct. If you were to omit the ghost points then you would see the diagonal structure you expect.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants