Class restructuring and new H(Div) trace element
Thomas Gibson
Branch: mapdes/fiat:hdiv-trace-implementation
Branch: fenics-project/fiat:master
Merged
Merged pull request
Merge branch 'mapdes/hdiv-trace-implementation'
Merge branch 'mapdes/hdiv-trace-implementation'
Brief summary of changes:
1) A restructuring of the class inheritance system for both nodal and non-nodal finite elements in
finite_element.py
;2) A new implementation of the trace of H(Div)-elements (designed to replace both
trace.py
andtrace_hdiv.py
.Description:
1) By a "nodal" finite element, we mean a FIAT element that satisfies the Ciarlet triple abstraction:
(K, V, N)
, whereK
is some reference cell,V
is a function space, andN
is a nodal basis dual toV
. Practically, this means that the element's basis can be captured as aPolynomialSet
object. Most finite elements in FIAT currently support this abstraction, but there are several cases where it is not possible to use the same abstraction. Notable examples include, in general,TensorProductElement
andEnrichedElement
(as well as trace elements).The changes to FIAT's class inheritance system include the following changes in
finite_element.py
: the addition of a baseFiniteElement
class, and theCiarletElement
class. Do not confuseFiniteElement
in this PR with FiniteElement in the current master branch;CiarletElement
is designed to replace the current implementation of FiniteElement infinite_element.py
. The newFiniteElement
is simply a more general class that performs most of the leg-work associated with representing a general finite element: methods for reference element, order,dual
,entity_dofs
, etc. Basically anything that doesn't rely on a specifiedPolynomialSet
is implemented in the newFiniteElement
class.CiarletElement
represents the usual Ciarlet abstraction described above, and is functionally equivalent to the current master branch's FiniteElement. This class inherits fromFiniteElement
and extends the abstraction context by building the generalized Vandermonde system for coefficients, providing thenodal_basis
as aPolynomialSet
object, and the usual method oftabulate
.Other changes that were needed as a result of this feature are minimal: a simple name change of the inherited class is required of all "nodal" finite elements. Nodal elements such as
Lagrange
,CubicHermite
, andRaviartThomas
now inherit fromCiarletElement
. General non-nodal elements likeTensorProductElement
andEnrichedElement
inherit fromFiniteElement
.2) A new implementation of the trace element in
hdiv_trace.py
is provided in this PR. Under the nameHDivTrace
, this element is intended to replace Marie'sDiscontinuousLagrangeTrace
element intrace.py
and Andrew's element intrace_hdiv.py
.This element inherits from
FiniteElement
and provides two-modes of tabulating: (1) Whenentity
is provided, direct facet tabulation is possible without any ambiguity of which facet entity we're on. (2) ifentity
is not provided, it defaults to Marie's implementation ofDiscontinuousLagrangeTrace
by performing the same composition of mappings to help determine the unique facet id (as implemented intrace.py
). In other words,HDivTrace
is functionally equivalent toDiscontinuousLagrangeTrace
whenentity=None
.This gives us a single implementation of a trace element that makes use of the new
entity
-parametrizedtabulate
method, while also being backwards compatible when noentity
argument is provided. Currently,HDivTrace
works for simplex domains, but future patches will extend this to quadrilaterals and tensor product cells.In summary: we believe that the changes in (1) provides an additional mode of abstraction for representing general finite element classes. As a result of this change, all nodal elements are an instance of
CiarletElement
and non-nodal elements areFiniteElement
instances. And we also believe it's nice to have a single implementation of the trace element,HDivTrace
, which makes use of FIAT's modifiedtabulate
API and remains backwards compatible.The changes made to UFL to support this PR can be found here: UFL PR #62