Class restructuring and new H(Div) trace element

Merged
#30 · Created  · Last updated

Merged pull request

Merge branch 'mapdes/hdiv-trace-implementation'

2b9e9fd·Author: ·Closed by: ·2016-11-04

Description

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 and trace_hdiv.py.

Description:

1) By a "nodal" finite element, we mean a FIAT element that satisfies the Ciarlet triple abstraction: (K, V, N), where K is some reference cell, V is a function space, and N is a nodal basis dual to V. Practically, this means that the element's basis can be captured as a PolynomialSet 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 and EnrichedElement (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 base FiniteElement class, and the CiarletElement class. Do not confuse FiniteElement in this PR with FiniteElement in the current master branch; CiarletElement is designed to replace the current implementation of FiniteElement in finite_element.py. The new FiniteElement 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 specified PolynomialSet is implemented in the new FiniteElement class.

CiarletElement represents the usual Ciarlet abstraction described above, and is functionally equivalent to the current master branch's FiniteElement. This class inherits from FiniteElement and extends the abstraction context by building the generalized Vandermonde system for coefficients, providing the nodal_basis as a PolynomialSet object, and the usual method of tabulate.

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, and RaviartThomas now inherit from CiarletElement. General non-nodal elements like TensorProductElement and EnrichedElement inherit from FiniteElement.

2) A new implementation of the trace element in hdiv_trace.py is provided in this PR. Under the name HDivTrace, this element is intended to replace Marie's DiscontinuousLagrangeTrace element in trace.py and Andrew's element in trace_hdiv.py.

This element inherits from FiniteElement and provides two-modes of tabulating: (1) When entity is provided, direct facet tabulation is possible without any ambiguity of which facet entity we're on. (2) if entity is not provided, it defaults to Marie's implementation of DiscontinuousLagrangeTrace by performing the same composition of mappings to help determine the unique facet id (as implemented in trace.py). In other words, HDivTrace is functionally equivalent to DiscontinuousLagrangeTrace when entity=None.

This gives us a single implementation of a trace element that makes use of the new entity-parametrized tabulate method, while also being backwards compatible when no entity 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 are FiniteElement instances. And we also believe it's nice to have a single implementation of the trace element, HDivTrace, which makes use of FIAT's modified tabulate API and remains backwards compatible.

The changes made to UFL to support this PR can be found here: UFL PR #62

0 attachments

0 comments

Loading commits...