Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/firedrake/submesh/test_submesh_solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def _test_submesh_solve_3d_2d_poisson(simplex, direction, nref, degree):
mesh12 = Submesh(mesh2, dim - 1, label_interf)
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.

dx12_ds1_ds2 = Measure(
"dx", mesh12,
intersect_measures=(
Expand Down
9 changes: 5 additions & 4 deletions tsfc/kernel_interface/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,13 @@ def prepare_coefficient(coefficient, name, domain_integral_type_map):
shape = finat_element.index_shape
size = numpy.prod(shape, dtype=int)
domain = extract_unique_domain(coefficient)
integral_type = domain_integral_type_map[domain]
if integral_type is None:
try:
integral_type = domain_integral_type_map[domain]
except KeyError:
# This means that this coefficient does not exist in the DAG,
# 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.

if integral_type.startswith("interior_facet"):
varexp = gem.Variable(name, (2 * size,))
plus = gem.view(varexp, slice(size))
minus = gem.view(varexp, slice(size, 2 * size))
Expand Down
32 changes: 20 additions & 12 deletions tsfc/kernel_interface/firedrake_loopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,12 @@ def set_cell_orientations(self, domains):
# Cell orientation
self._cell_orientations = {}
for i, domain in enumerate(domains):
integral_type = self._domain_integral_type_map[domain]
if integral_type is None:
# See comment in prepare_coefficient.
self._cell_orientations[domain] = None
elif integral_type.startswith("interior_facet"):
try:
integral_type = self._domain_integral_type_map[domain]
except KeyError:
# skip unused domain
continue
if integral_type.startswith("interior_facet"):
cell_orientations = gem.Variable(f"cell_orientations_{i}", (2,), dtype=gem.uint_type)
self._cell_orientations[domain] = (gem.Indexed(cell_orientations, (0,)),
gem.Indexed(cell_orientations, (1,)))
Expand All @@ -157,6 +158,9 @@ def set_cell_sizes(self, domains):
"""
self._cell_sizes = {}
for i, domain in enumerate(domains):
if domain not in self._domain_integral_type_map:
# skip unused domain
continue
if domain.ufl_cell().topological_dimension > 0:
# Can't create P1 since only P0 is a valid finite element if
# topological_dimension is 0 and the concept of "cell size"
Expand Down Expand Up @@ -326,13 +330,13 @@ def set_entity_numbers(self, domains):
self._entity_numbers = {}
self._entity_ids = {}
for i, domain in enumerate(domains):
try:
integral_type = self.integral_data_info.domain_integral_type_map[domain]
except KeyError:
# skip unused domain
continue
fiat_cell = as_fiat_cell(domain.ufl_cell())
integral_type = self.integral_data_info.domain_integral_type_map[domain]
if integral_type is None:
# Set placeholder for unused domain.
entity_ids = None
else:
_, entity_ids = lower_integral_type(fiat_cell, integral_type)
_, entity_ids = lower_integral_type(fiat_cell, integral_type)
self._entity_ids[domain] = entity_ids
if integral_type in ['exterior_facet', 'exterior_facet_vert']:
facet = gem.Variable(f'facet_{i}', (1,), dtype=gem.uint_type)
Expand All @@ -359,7 +363,11 @@ def set_entity_orientations(self, domains):
"""
self._entity_orientations = {}
for i, domain in enumerate(domains):
integral_type = self.integral_data_info.domain_integral_type_map[domain]
try:
integral_type = self.integral_data_info.domain_integral_type_map[domain]
except KeyError:
# skip unused domain
continue
variable_name = f"entity_orientations_{i}"
if integral_type in ['exterior_facet', 'exterior_facet_vert']:
o = gem.Variable(variable_name, (1,), dtype=gem.uint_type)
Expand Down
Loading