Open stephankramer opened 3 weeks ago
This is very curious. I have looked at the commits for TSFC and UFL in the last year and none of them seem to touch CellDiameter
.
My guess is https://github.com/FEniCS/ufl/pull/197
That probably changed the implemented of cell_diameter
in apply_geometry_lowering
in UFL to return CellDiameter
for extruded hex cells, rather than fall-through to the Q1 case.
Spot on @wence-, thanks! For an extruded mesh we have domain.ufl_coordinate_element().degree() == (1, 1)
which was a previously permissible element. Now though we have domain.ufl_coordinate_element().embedded_superdegree == 2
which is no longer allowed.
This might well be a simple fix. Looking at where embedded_superdegree
is defined we should probably be using max
instead of sum
(we even use min
for embedded_subdegree
).
Nah, sum
is correct, since a Q1 element contains some quadratic polynomials, so it is embedded in the complete polynomial space P2.
That implementation is, however, probably wrong because it should probably say sum(sub.embedded_superdegree() for sub in sub_elements())
(which would handle the case of TPE(TPE(interval, interval), interval)
(say)
OK. Do you have any suggestion for what the right thing is to do here? Should CellDiameter
for an extruded mesh not be supported?
I think in apply_geometry_lowering the check for Q1 cells needs to be reinstated. So it does something like:
if all(degree == 1 for degree in self.degree()):
# can do affine and/or Q1 lowering
I don't know exactly how to check for Q1, but notice that previously the check was (pseudo-code)
if not (P1 or Q1):
dont_lower
elif P1:
lower_simplex
else:
# must be Q1
lower_hypercube
But now the check is:
if not P1:
dont_lower
elif P1:
lower_simplex
else:
# unreachable
lower_hypercube
I believe that degree()
is no longer a UFL finite element property and now only embedded_{super,sub}degree
exist so this may be tricky to fix. I have added this to the agenda for the next Firedrake meeting.
This looks like a mistake in the UFL changes last year. The test for geometry lowering is using the embedded_superdegree but it should be using the embedded_subdegree. The reason subdegree is right is that you care about whether the edges are straight, not whether there are any quadratic functions on the interior.
Fixed in https://github.com/FEniCS/ufl/pull/295 (though we also need to update our UFL fork).
The following code
produces the following error
This does seem to work on an older Firedrake installation (about Jul '23).