Polytopal Cutters and Automatic Shape Differentiation

The polytopal geometric differentiation capabilities are based on the following work:

Reference

Zachary J. Wegert, Martin Berggren, and Vivien J. Challis (2026). "Shape calculus and automatic differentiation for multi-phase level-set topology optimisation with unfitted finite elements".

To see examples of usage, please refer to the tests in test/seq/PolytopalCuttersTests/. Additional shape and topology optimisation examples can be found here.

Single level-set function

For a single level-set function, please refer to the methods available in GridapEmbedded.

Polytopal cutters

GridapTopOpt.PolytopalLevelSetCutterType
struct PolytopalLevelSetCutter <: Cutter end

A polytopal cutter for geometries defined with DiscreteGeometryFromFEFunction.

Usage

  • cut(::PolytopalLevelSetCutter, model::DiscreteModel,geom::DiscreteGeometryFromFEFunction)
  • cut_facets(::PolytopalLevelSetCutter, model::DiscreteModel,geom::DiscreteGeometryFromFEFunction)
  • computebgcellto_inoutcut(::PolytopalLevelSetCutter, model::DiscreteModel,geom::DiscreteGeometryFromFEFunction)
  • computebgfacetto_inoutcut(::PolytopalLevelSetCutter, model::DiscreteModel,geom::DiscreteGeometryFromFEFunction)
source
GridapTopOpt.DiscreteGeometryFromFEFunctionType
struct DiscreteGeometryFromFEFunction{D,T} <: CSG.Geometry

A discrete geometry defined by a level-set function represented as an FEFunction.

Constructors

DiscreteGeometryFromFEFunction(φh::FEFunction,point_to_coords::AbstractVector;name::String="")
DiscreteGeometryFromFEFunction(φh::FEFunction,model::DiscreteModel;name::String="")
source

Automatic shape differentiation

GridapTopOpt.DifferentiableCutPolyTriangulationType
mutable struct DifferentiableCutPolyTriangulation{Dc,Dp,A,B} <: Triangulation{Dc,Dp}

A DifferentiableCutPolyTriangulation is a wrapper around an embedded triangulation (i.e SubCellTriangulation or SubFacetTriangulation) implementing all the necessary methods to compute derivatives w.r.t. deformations of one or more level-set functions. This is a more general version of the DifferentiableTriangulation type in GridapEmbedded for differentiation through a PolytopalLevelSetCutter.

Constructors:

DifferentiableTriangulation(cutgeo::EmbeddedDiscretization, args...)
DifferentiableEmbeddedBoundary(cutgeo::EmbeddedDiscretization, args...)

where cutgeo is an embedded discretization resulting from PolytopalLevelSetCutter. The args... are the same as for the constructors of Triangulation and EmbeddedBoundary in GridapEmbedded.

Geometries in cutgeo must be of type DiscreteGeometryFromFEFunction.

source

Example

See scripts/Examples/UnfittedMultiphase/AD_Example.jl for an example of basic usage.