finiteelement Package

finiteelement Package

This module defines the UFL finite element classes.

elementlist Module

This module provides an extensive list of predefined finite element families. Users or more likely, form compilers, may register new elements by calling the function register_element.

ufl.finiteelement.elementlist.canonical_element_description(family, cell, order, form_degree)

Given basic element information, return corresponding element information on canonical form.

Input: family, cell, (polynomial) order, form_degree Output: family (canonical), short_name (for printing), order, value shape, reference value shape, sobolev_space

This is used by the FiniteElement constructor to ved input data against the element list and aliases defined in ufl.

ufl.finiteelement.elementlist.feec_element(family, n, r, k)
ufl.finiteelement.elementlist.register_alias(alias, to)
ufl.finiteelement.elementlist.register_element(family, short_name, value_rank, sobolev_space, mapping, degree_range, cellnames)

Register new finite element family

ufl.finiteelement.elementlist.register_element2(family, value_rank, sobolev_space, mapping, degree_range, cellnames)

Register new finite element family

ufl.finiteelement.elementlist.show_elements()

enrichedelement Module

This module defines the UFL finite element classes.

class ufl.finiteelement.enrichedelement.EnrichedElement(*elements)

Bases: ufl.finiteelement.finiteelementbase.FiniteElementBase

The vector sum of two finite element spaces:

EnrichedElement(V, Q) = {v + q | v in V, q in Q}.

is_cellwise_constant()

Return whether the basis functions of this element is spatially constant over each cell.

mapping()
reconstruct(**kwargs)

Construct a new EnrichedElement object with some properties replaced with new values.

reconstruction_signature()

Format as string for evaluation as Python object.

For use with cross language frameworks, stored in generated code and evaluated later in Python to reconstruct this object.

This differs from repr in that it does not include domain label and data, which must be reconstructed or supplied by other means.

shortstr()

Format as string for pretty printing.

signature_data(renumbering)

finiteelement Module

This module defines the UFL finite element classes.

class ufl.finiteelement.finiteelement.FiniteElement(family, domain=None, degree=None, form_degree=None, quad_scheme=None)

Bases: ufl.finiteelement.finiteelementbase.FiniteElementBase

The basic finite element class for all simple finite elements

Create finite element.

Arguments
family (string)
The finite element family
domain
The geometric domain
degree (int)
The polynomial degree (optional)
form_degree (int)
The form degree (FEEC notation, used when field is viewed as k-form)
quad_scheme
The quadrature scheme (optional)
mapping()
reconstruct(**kwargs)

Construct a new FiniteElement object with some properties replaced with new values.

reconstruction_signature()

Format as string for evaluation as Python object.

For use with cross language frameworks, stored in generated code and evaluated later in Python to reconstruct this object.

This differs from repr in that it does not include domain label and data, which must be reconstructed or supplied by other means.

shortstr()

Format as string for pretty printing.

signature_data(renumbering)
sobolev_space()

finiteelementbase Module

This module defines the UFL finite element classes.

class ufl.finiteelement.finiteelementbase.FiniteElementBase(family, domain, degree, quad_scheme, value_shape, reference_value_shape)

Bases: object

Base class for all finite elements

Initialize basic finite element data

cell()

Return cell of finite element

degree(component=None)

Return polynomial degree of finite element

domain(component=None)

Return the domain on which this element is defined.

domains(component=None)

Return the domain on which this element is defined.

extract_component(i)

Recursively extract component index relative to a (simple) element and that element for given value component index

extract_reference_component(i)

Recursively extract reference component index relative to a (simple) element and that element for given reference value component index

extract_subelement_component(i)

Extract direct subelement index and subelement relative component index for a given component index

extract_subelement_reference_component(i)

Extract direct subelement index and subelement relative reference component index for a given reference component index

family()

Return finite element family

is_cellwise_constant(component=None)

Return whether the basis functions of this element is spatially constant over each cell.

mapping()
num_sub_elements()

Return number of sub elements

quadrature_scheme()

Return quadrature scheme of finite element

reconstruction_signature()

Format as string for evaluation as Python object.

For use with cross language frameworks, stored in generated code and evaluated later in Python to reconstruct this object.

This differs from repr in that it does not include domain label and data, which must be reconstructed or supplied by other means.

reference_value_shape()

Return the shape of the value space on the reference cell.

signature_data(renumbering)
sub_elements()

Return list of sub elements

symmetry()

Return the symmetry dict, which is a mapping c0 -> c1 meaning that component c0 is represented by component c1.

value_shape()

Return the shape of the value space on the global domain.

hdivcurl Module

class ufl.finiteelement.hdivcurl.HCurl(element)

Bases: ufl.finiteelement.outerproductelement.OuterProductElement

A curl-conforming version of an outer product element, assuming this makes mathematical sense.

reconstruct(**kwargs)

Construct a new HCurl object with some properties replaced with new values.

reconstruction_signature()
shortstr()
signature_data(domain_numbering)
class ufl.finiteelement.hdivcurl.HDiv(element)

Bases: ufl.finiteelement.outerproductelement.OuterProductElement

A div-conforming version of an outer product element, assuming this makes mathematical sense.

reconstruct(**kwargs)

Construct a new HDiv object with some properties replaced with new values.

reconstruction_signature()
shortstr()
signature_data(domain_numbering)

mixedelement Module

This module defines the UFL finite element classes.

class ufl.finiteelement.mixedelement.MixedElement(*elements, **kwargs)

Bases: ufl.finiteelement.finiteelementbase.FiniteElementBase

A finite element composed of a nested hierarchy of mixed or simple elements

Create mixed finite element from given list of elements

degree(component=None)

Return polynomial degree of finite element

domains(component=None)

Return the domain(s) on which this element is defined.

extract_component(i)

Recursively extract component index relative to a (simple) element and that element for given value component index

extract_reference_component(i)

Recursively extract reference_component index relative to a (simple) element and that element for given value reference_component index

extract_subelement_component(i)

Extract direct subelement index and subelement relative component index for a given component index

extract_subelement_reference_component(i)

Extract direct subelement index and subelement relative reference_component index for a given reference_component index

is_cellwise_constant(component=None)

Return whether the basis functions of this element is spatially constant over each cell.

mapping()
num_sub_elements()

Return number of sub elements.

reconstruct(**kwargs)

Construct a new MixedElement object with some properties replaced with new values.

reconstruct_from_elements(*elements)

Reconstruct a mixed element from new subelements.

reconstruction_signature()

Format as string for evaluation as Python object.

For use with cross language frameworks, stored in generated code and evaluated later in Python to reconstruct this object.

This differs from repr in that it does not include domain label and data, which must be reconstructed or supplied by other means.

shortstr()

Format as string for pretty printing.

signature_data(renumbering)
sub_elements()

Return list of sub elements.

symmetry()

Return the symmetry dict, which is a mapping c0 -> c1 meaning that component c0 is represented by component c1. A component is a tuple of one or more ints.

class ufl.finiteelement.mixedelement.TensorElement(family, domain, degree, shape=None, symmetry=None, quad_scheme=None)

Bases: ufl.finiteelement.mixedelement.MixedElement

A special case of a mixed finite element where all elements are equal

Create tensor element (repeated mixed element with optional symmetries)

extract_subelement_component(i)

Extract direct subelement index and subelement relative component index for a given component index

mapping()
reconstruct(**kwargs)
reconstruction_signature()

Format as string for evaluation as Python object.

For use with cross language frameworks, stored in generated code and evaluated later in Python to reconstruct this object.

This differs from repr in that it does not include domain label and data, which must be reconstructed or supplied by other means.

shortstr()

Format as string for pretty printing.

signature_data(renumbering)
symmetry()

Return the symmetry dict, which is a mapping c0 -> c1 meaning that component c0 is represented by component c1.

class ufl.finiteelement.mixedelement.VectorElement(family, domain, degree, dim=None, form_degree=None, quad_scheme=None)

Bases: ufl.finiteelement.mixedelement.MixedElement

A special case of a mixed finite element where all elements are equal

Create vector element (repeated mixed element)

Arguments
family (string)
The finite element family
domain
The geometric domain
degree (int)
The polynomial degree
dim (int)
The value dimension of the element (optional)
form_degree (int)
The form degree (FEEC notation, used when field is viewed as k-form)
quad_scheme
The quadrature scheme (optional)
mapping()
reconstruct(**kwargs)
reconstruction_signature()

Format as string for evaluation as Python object.

For use with cross language frameworks, stored in generated code and evaluated later in Python to reconstruct this object.

This differs from repr in that it does not include domain label and data, which must be reconstructed or supplied by other means.

shortstr()

Format as string for pretty printing.

signature_data(renumbering)

outerproductelement Module

This module defines the UFL finite element classes.

class ufl.finiteelement.outerproductelement.OuterProductElement(A, B, domain=None, form_degree=None, quad_scheme=None)

Bases: ufl.finiteelement.finiteelementbase.FiniteElementBase

The outer (tensor) product of 2 element spaces:

\[V = A \otimes B\]

Given bases \({\phi_A, \phi_B}\) for \(A, B\), \({\phi_A * \phi_B}\) forms a basis for \(V\).

Create OuterProductElement from a given pair of elements.

mapping()
reconstruct(**kwargs)

Construct a new OuterProductElement with some properties replaced with new values.

reconstruction_signature()

Format as string for evaluation as Python object.

For use with cross language frameworks, stored in generated code and evaluated later in Python to reconstruct this object.

This differs from repr in that it does not include domain label and data, which must be reconstructed or supplied by other means.

shortstr()

Short pretty-print.

signature_data(renumbering)
class ufl.finiteelement.outerproductelement.OuterProductVectorElement(A, B, domain=None, dim=None, form_degree=None, quad_scheme=None)

Bases: ufl.finiteelement.mixedelement.MixedElement

A special case of a mixed finite element where all elements are equal OuterProductElements

reconstruct(**kwargs)

Construct a new OuterProductVectorElement with some properties replaced with new values.

reconstruction_signature()

Format as string for evaluation as Python object.

For use with cross language frameworks, stored in generated code and evaluated later in Python to reconstruct this object.

This differs from repr in that it does not include domain label and data, which must be reconstructed or supplied by other means.

shortstr()

Format as string for pretty printing.

signature_data(domain_numbering)

restrictedelement Module

This module defines the UFL finite element classes.

class ufl.finiteelement.restrictedelement.RestrictedElement(element, cell_restriction)

Bases: ufl.finiteelement.finiteelementbase.FiniteElementBase

Represents the restriction of a finite element to a type of cell entity.

cell_restriction()

Return the domain onto which the element is restricted.

element()

Return the element which is restricted.

is_cellwise_constant()

Return whether the basis functions of this element is spatially constant over each cell.

mapping()
num_restricted_sub_elements()

Return number of restricted sub elements.

num_sub_elements()

Return number of sub elements

reconstruct(**kwargs)

Construct a new RestrictedElement object with some properties replaced with new values.

reconstruction_signature()

Format as string for evaluation as Python object.

For use with cross language frameworks, stored in generated code and evaluated later in Python to reconstruct this object.

This differs from repr in that it does not include domain label and data, which must be reconstructed or supplied by other means.

restricted_sub_elements()

Return list of restricted sub elements.

shortstr()

Format as string for pretty printing.

signature_data(renumbering)
sub_elements()

Return list of sub elements

symmetry()

Return the symmetry dict, which is a mapping c0 -> c1 meaning that component c0 is represented by component c1.

tensorproductelement Module

This module defines the UFL finite element classes.

class ufl.finiteelement.tensorproductelement.TensorProductElement(*elements)

Bases: ufl.finiteelement.finiteelementbase.FiniteElementBase

The tensor product of d element spaces:

\[V = V_0 \otimes V_1 \otimes ... \otimes V_d\]

Given bases {phi_i} for V_i for i = 1, ...., d, { phi_0 * phi_1 * ... * phi_d } forms a basis for V.

Create TensorProductElement from a given list of elements.

mapping()
num_sub_elements()

Return number of subelements.

reconstruction_signature()

Format as string for evaluation as Python object.

For use with cross language frameworks, stored in generated code and evaluated later in Python to reconstruct this object.

This differs from repr in that it does not include domain label and data, which must be reconstructed or supplied by other means.

shortstr()

Short pretty-print.

signature_data(renumbering)
sub_elements()

Return subelements (factors).