Skip to content

Allow expressions with submeshes#4140

Open
jorgensd wants to merge 45 commits into
mainfrom
dokken/submesh-expression
Open

Allow expressions with submeshes#4140
jorgensd wants to merge 45 commits into
mainfrom
dokken/submesh-expression

Conversation

@jorgensd
Copy link
Copy Markdown
Member

@jorgensd jorgensd commented Apr 1, 2026

With submesh support, it is quite common that one want to evaluate an expression that uses quantities from both the parent and submesh.

This PR extends expression to be able to support:

  • Submesh of codim 0
  • Submesh of codim 1 (one sided facet expressions)

Other structural changes

  • Refactors the pack_coefficients for dolfinx::fem::Expression into a multi-step approach:
    1. Before packing for a coefficient transform the integration entities input into a list of cells for the given coefficient.
    2. Pack entities for given coefficient.

Requires: FEniCS/ffcx#828
Resolves: #3207

@jorgensd jorgensd marked this pull request as ready for review April 1, 2026 11:44
@jorgensd jorgensd added the enhancement New feature or request label Apr 1, 2026
@jorgensd jorgensd requested a review from jpdean April 1, 2026 12:37
Comment thread .github/workflows/fenicsx-refs.env Outdated
Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com>
@jorgensd jorgensd requested a review from garth-wells May 26, 2026 11:41
@jorgensd
Copy link
Copy Markdown
Member Author

CI failing due to global Github issues:
Update - Actions is experiencing degraded performance. We are continuing to investigate.
May 26, 2026 - 12:17 UTC
Update - We are investigating authentication issues leading to failure in starting Actions runs and downloading actions. At this time the majority of Actions runs is impacted.
May 26, 2026 - 11:53 UTC
Update - Actions is experiencing degraded availability. We are continuing to investigate.
May 26, 2026 - 11:19 UTC

Comment thread cpp/dolfinx/fem/Expression.h Outdated
@jorgensd jorgensd requested a review from jhale May 28, 2026 10:27
Comment thread cpp/dolfinx/fem/pack.h Outdated
Comment thread cpp/dolfinx/fem/pack.h Outdated
Comment thread cpp/dolfinx/fem/pack.h Outdated
jorgensd and others added 3 commits May 29, 2026 11:18
Co-authored-by: Paul T. Kühner <56360279+schnellerhase@users.noreply.github.com>
@jorgensd jorgensd requested a review from schnellerhase May 29, 2026 09:27
Comment thread python/test/unit/fem/test_expression.py Outdated
def mark_left_facets(x):
return np.isclose(x[0], 1.0, atol=tol)

left_facets = dolfinx.mesh.locate_entities(mesh, mesh.topology.dim - 1, mark_left_facets)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an empty list. That is not desired for the test, right? Should the marker before be np.isclose(x[0], 0.0, atol=tol)?

Comment thread cpp/dolfinx/fem/assembler.h
@jorgensd
Copy link
Copy Markdown
Member Author

@schnellerhase and I got further. Now we are missing a permutation to compare the output of the two approaches, as they produce the same output, but in a permuted order..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support dolfinx::fem::Expression with co-dim 0 submeshes

4 participants