CellVolume and FacetArea for quad and hex domains are not handled in UFLACS

Issue #163 new
Ivan Yashchuk created an issue

Currently CellVolume, FacetArea are not handled for quadrilateral and hexahedral cells with UFLACS representation. Resulting in error Missing handler for type CellVolume/FacetArea/Circumradius.

from ufl/algorithms/apply_geometry_lowering.py

def cell_volume(self, o):
     if self._preserve_types[o._ufl_typecode_]:
         return o

     domain = o.ufl_domain()
     if not domain.is_piecewise_linear_simplex_domain():
         # Don't lower for non-affine cells, instead leave it to
         # form compiler
         warning("Only know how to compute the cell volume of an affine cell.")
         return o

     r = self.jacobian_determinant(JacobianDeterminant(domain))
     r0 = ReferenceCellVolume(domain)
     return abs(r * r0)

CellVolume and FacetArea work with TSFC representation.

Comments (8)

  1. Miklós Homolya

    Not sure if Circumradius is even meaningful for non-simplex cell types, since they generally do not have a circumscribed circle/sphere.

  2. Jan Blechta

    As Mikos says, forget Circumradius. Quantity which is meaningful for all (affine) cells is a diameter of cell K defined as \sup_{x,y\in K} \dist(x, y).

    BTW the definition of cell size in DOLFIN

    def CellSize(mesh):
        """Return function cell size for given mesh."""
        return 2.0*ufl.Circumradius(_mesh2domain(mesh))
    

    is really c*cked up. See the meaningless docstring. CellSize should be set diameter and it should be documented what it does.

  3. Martin Sandve Alnæs

    Are you aware of the edge size quantities MinCellEdgeLength, MaxCellEdgeLength, MinFacetEdgeLength, MaxFacetEdgeLength in UFL? Do these work with quads and hexes?

  4. Jan Blechta

    Okay, let's forget Circumradius in this thread. This is about CellVolume and FacetArea. See #164 for a suggestion of good "cell size" measure.

  5. Log in to comment