Skip to content

Conversation

@pbrubeck
Copy link
Contributor

@pbrubeck pbrubeck commented Jan 21, 2026

Description

A multi-domain Form is split into single-domain terms. Each term knows that it belongs to a multidomain problem, but is assembled individually. During the assembly of each single-domain term, we may skip the setup on the all the other domains.

firedrake/tsfc/driver.py

Lines 170 to 175 in 4a5cba1

builder.set_entity_numbers(all_meshes)
builder.set_entity_orientations(all_meshes)
builder.set_coordinates(all_meshes)
builder.set_cell_orientations(all_meshes)
builder.set_cell_sizes(all_meshes)
builder.set_coefficients()

These methods will now skip a mesh not found in integral_data.domain_integral_type_map (as returned by ufl.algorithms.compute_form_data).

This is to remove the integral_type = None entries that were hacked into the domain_integral_type_map, which lead to obscure errors for illegal forms.

@pbrubeck pbrubeck marked this pull request as draft January 21, 2026 09:34
@pbrubeck pbrubeck force-pushed the pbrubeck/fix/integral_type_map branch 5 times, most recently from 4d265ea to 4bb8288 Compare January 21, 2026 10:12
@pbrubeck pbrubeck changed the title TSFC: error gracefully on unexpected domains TSFC: avoid setup of unused domains Jan 21, 2026
@pbrubeck pbrubeck marked this pull request as ready for review January 21, 2026 10:36
@pbrubeck pbrubeck requested a review from connorjward January 21, 2026 10:36
connorjward
connorjward previously approved these changes Jan 21, 2026
Copy link
Contributor

@connorjward connorjward left a comment

Choose a reason for hiding this comment

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

Thanks

# so corresponding gem expression will never be needed.
expression = None
elif integral_type.startswith("interior_facet"):
return None
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that here is another case of using Nones inappropriately, but that's not relevant here.

dx1 = Measure("dx", mesh1)
dx2 = Measure("dx", mesh2)
ds1_ds2 = Measure("ds", mesh1, intersect_measures=(Measure("ds", mesh2),))
ds1_ds2 = Measure("ds", mesh1, intersect_measures=(Measure("ds", mesh2), Measure("dx", mesh12)))
Copy link
Contributor Author

@pbrubeck pbrubeck Jan 21, 2026

Choose a reason for hiding this comment

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

We are hitting an error for Forms involving legal integrals on codim 1 multidomain problems. We are able to assemble each term individually. However, the interface mesh must be included in every surface Measure if assembling all integrals all at once.

Base automatically changed from pbrubeck/revert-domain-integral-type to main January 22, 2026 16:34
@dham dham dismissed connorjward’s stale review January 22, 2026 16:34

The base branch was changed.

@pbrubeck pbrubeck force-pushed the pbrubeck/fix/integral_type_map branch from 9f26aab to c85d2b6 Compare January 23, 2026 14:27
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.

3 participants