This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Max cell edge length

0 votes

Hi,

Is there a way of efficiently getting the maximum of the egde lengths of the cells for use in UFL forms?
I am looking for something similar to h = CellSize(mesh). I noticed the functions MaxCellEdgeLength() and MaxFacetEdgeLength() exist. While the latter seems to work in surface integrals (i.e., assemble(MaxFacetEdgeLength(mesh)*v*ds)), the cell version is not supported:

from dolfin import *
mesh = UnitSquareMesh(16, 16)
V = FunctionSpace(mesh, 'Lagrange', 1)
v = TestFunction(V)
hmax = MaxCellEdgeLength(mesh)
b = assemble(hmax*v*dx)

gives (version 2016.2)

Exception: This type of GeometricQuantity is not supported (yet).

Are there any other solutions, workarounds?

edit: MaxCellEdgeLength(mesh) seems to work with FEniCS 2017.1.0.

asked Apr 17, 2017 by dajuno FEniCS User (4,140 points)
edited Apr 17, 2017 by dajuno

1 Answer

0 votes
 
Best answer

In FEniCS 2017.1, the method

MaxCellEdgeLength(mesh)

is supported in ufl forms.

answered Apr 22, 2017 by dajuno FEniCS User (4,140 points)
Maximum mesh size
...