mark_entities does not refresh the cached unique_markers of facet sets
メンテナーはふだん 1 日以内に返信
@pbrubeck がすでに取り組んでいます。
2026年9月23日 から。
評価
この issue はまだ評価されていません。
説明
Describe the bug
MeshTopology.mark_entities writes new values into the Face Sets label of the plex, but measures on the mesh do not see them. interior_facets and exterior_facets are cached_propertys, and MeshTopology._facets reads unique_markers from the Face Sets label only once, when the property is first accessed. Anything that builds the facet data before the call to mark_entities (for example, interpolating the HDiv Trace marker function that mark_entities requires) leaves unique_markers stale. A later dS(new_id) or ds(new_id) then raises LookupError, although the plex label contains new_id.
Steps to Reproduce
from firedrake import *
mesh = UnitSquareMesh(2, 2)
x, y = SpatialCoordinate(mesh)
marker = Function(FunctionSpace(mesh, "HDiv Trace", 0))
marker.interpolate(conditional(lt(abs(y - 0.5), 1e-12), 1, 0))
mesh.mark_entities(marker.topological, 99)
print("plex label values:", mesh.topology_dm.getLabelIdIS("Face Sets").indices)
print("interior markers:", mesh.interior_facets.unique_markers)
print(assemble(Constant(1) * dS(99, domain=mesh)))
Expected behavior
The script prints the length of the line y = 1/2, which is 1.0.
Error message
plex label values: [ 3 2 4 1 99]
interior markers: [1 2 3 4]
...
File ".../firedrake/mesh.py", line 265, in subset
raise LookupError("{0} are not a valid markers (not in {1})".format(invalid, self.unique_markers))
LookupError: {99} are not a valid markers (not in [1 2 3 4])
Environment
Firedrake main at 065b77334. The facet-marker code path in firedrake/mesh.py is the same on main and on the branch where this was found.
Additional Info
RelabeledMesh(mesh, [marker], [99]) does not have this problem, because it creates a new mesh whose facet data is built after the label is set. Possible fixes are to invalidate the cached interior_facets/exterior_facets (and their marker subsets) inside mark_entities, or to compute unique_markers from the label each time it is needed.
This issue was written by Claude (Claude Code) on behalf of @pbrubeck.
- 主要言語
- Python
- スター
- 684
- フォーク
- 204
- 平均マージ
- 4日 14時間
- マージ済み PR(30日)
- 46
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
firedrakeproject/firedrake のほかの issue
-
BUG: NonlinearVariationalSolver errors with adj_kwargs対応中かも @dham が 151 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
firedrakeproject/firedrake#5186 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
firedrakeproject/firedrake#5091 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
firedrakeproject/firedrake#3556 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
firedrakeproject/firedrake#5644 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Function.assign on a subset fails with a Constant, a Real Function or abs in the expression対応中かも @connorjward が 2 日前に担当しました。 オープン
firedrakeproject/firedrake#5643 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
firedrakeproject/firedrake の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Sienna-Platform/SiennaSchemas#130 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
firedrakeproject/Irksome#293 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ida-arbeitszeit/workers-control#1578 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
aws-samples/sample-per-model-bedrock#898 ·
メンテナーはふだん 1 日以内に返信