diff --git a/firedrake/mesh.py b/firedrake/mesh.py index 881cdfe523..7f5e1779f7 100644 --- a/firedrake/mesh.py +++ b/firedrake/mesh.py @@ -2447,7 +2447,7 @@ def coordinates(self, value): raise AttributeError(message) - @cached_property + @cached_property_until(lambda self: self.coordinates.dat.dat_version) def cell_sizes(self): """A :class:`~.Function` in the :math:`P^1` space containing the local mesh size. @@ -2463,10 +2463,11 @@ def clear_cell_sizes(self): Use this if you move the mesh. """ - try: - del self.cell_size - except AttributeError: - pass + warnings.warn( + "`clear_cell_sizes` is deprecated and will be removed in a future release. " + "The `cell_sizes` attribute is cleared automatically when mesh coordinates change. ", + FutureWarning, + ) @property def tolerance(self):