Allow ufl.Measure
without subdomain_data
to be used in form with another measure with subdomain data
#3528
Labels
bug
Something isn't working
Summarize the issue
Consider the following variational form for a diffusion problem with a source term
f
defined on some subdomain.Here I have intentionally created two measures where one of the measures contain
subdomain_data
.When solving this problem (see full example below) it yields an
AssertionError
which requires that thesubdomain_data
should be the same for alldx
(seedolfinx/python/dolfinx/fem/forms.py
Lines 245 to 247 in 3e7c708
The full backtrace is here
In this case
subdomain_data
would beNone
for two elements and equal tofacet_tags
for the final element.I think in scenarios where all elements are
None
and one is not (e.g equal tofacet_tags
), then I belive it is more natural to addfacet_tags
assubdomain_data
to all the elements.I would also like to note that in this example, it is easy to fix this problem, but in more complicated code you might build up your variational form in different parts of the code where some parts don't have access to the
MeshTags
, in which case this is more relevant.Finally, if you think this behaviour should be kept, then I would encourage to add a better error message.
I am happy to help out by submitting a PR (just need to decide on the right path moving forward).
How to reproduce the bug
Minimal Example (Python)
No response
Output (Python)
No response
Version
main branch
DOLFINx git commit
No response
Installation
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: