Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix simplex boundary #838

Merged
merged 4 commits into from
Nov 28, 2023
Merged

fix simplex boundary #838

merged 4 commits into from
Nov 28, 2023

Conversation

joostvanzwieten
Copy link
Member

This PR fixes two issues with boundaries of the SimplexTopology:

  • If the boundary of a SimplexTopology is empty, an assertion error is raised.
  • A degree one std basis or bubble basis on the boundary of a SimplexTopology typically contains a large number of zeros.

The implementations of the degree one std and the bubble bases for the
`SimplexTopology` incorrectly assume that the `simplices` array contains
vertex in `range(nverts)` without holes, and use this array as is as
dofs, thereby introducing zeros in the basis for every dof in
`set(range(simplices.max() + 1)) - set(simplices.flat)`. The boundary of
a `SimplexTopology`, however, simply returns a subset of the volume
`simplices` array, without renumbering.

This bug was introduced by 7e29a28, which removes `_renumber` as
preprocessor for the `simplices` parameter of
the `SimplexTopology` constructor.

To fix this problem this patch adds a `contiguous_simplices` property
and uses thses as dofs. The alternative, requiring constructing a
`SimplexTopology` with contiguous `simplices`, was rejected because this
puts a computational burden on every boundary of a `SimplexTopology`,
even if we don't create a basis.
This patch adds the `connectivity` attribute to `EmptyTopology` for
completeness.
This patch implements the `boundary` and `interfaces` attributes for the
`EmptyTopology`, which is needed by a subsequent patch fixing empty
boundaries of a `SimplexTopology`.
The constructor of `SimplexTopology` trips over

    assert numpy.greater(self.simplices[:, 1:], self.simplices[:, :-1]).all()

if there are no simplices. This is triggered when taking the boundary of
a fully periodic mesh.

This patch fixes the problem by returning an `EmptyTopology` when the
boundary is empty. In addition this patch adds a slightly improved error
message when trying to create an empty `SimplexTopology.
@gertjanvanzwieten gertjanvanzwieten merged commit d6fed98 into master Nov 28, 2023
19 checks passed
@joostvanzwieten joostvanzwieten deleted the fix-simplex-boundary branch November 29, 2023 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants