FELiCS.SpaceDisc.FEMSpaces#

Module Contents#

Classes#

FEMSpaces

Class containing all Finite Element (FE) spaces used in the simulation.

Functions#

getElementShape(meshDim)

Get the element shape (triangle or tetrahedron) based on mesh dimension.

getElementType()

Get the default element type string for finite elements.

createFunctionSpace(mesh[, degree, dim])

Create a finite element function space for the given mesh, order, and dimension.

Attributes#

FELiCS.SpaceDisc.FEMSpaces.logger#
FELiCS.SpaceDisc.FEMSpaces.getElementShape(meshDim)#

Get the element shape (triangle or tetrahedron) based on mesh dimension.

Parameters:

meshDim (int) – Geometric dimension of the mesh (2 or 3).

Returns:

‘triangle’ for 2D, ‘tetrahedron’ for 3D.

Return type:

str

Raises:

Exception – If meshDim is not 2 or 3.

FELiCS.SpaceDisc.FEMSpaces.getElementType()#

Get the default element type string for finite elements.

Returns:

The element type string (‘CG’ for continuous Galerkin).

Return type:

str

FELiCS.SpaceDisc.FEMSpaces.createFunctionSpace(mesh, degree=2, dim=1)#

Create a finite element function space for the given mesh, order, and dimension.

For scalar fields (dim == 1), a standard Basix element is constructed via element(elementType, elementShape, degree). For vector fields, a tuple-based element description (elementType, degree, (dim,)) is used to create a vector-valued function space.

Parameters:
  • mesh (FELiCSMesh) – The mesh object containing dolfinxMesh.

  • degree (int, optional) – Polynomial degree of the element (default is 2).

  • dim (int, optional) – Number of components (default is 1 for scalar fields).

Returns:

The created function space.

Return type:

dolfinx.fem.FunctionSpace

class FELiCS.SpaceDisc.FEMSpaces.FEMSpaces(param, mesh, degree=2)#

Class containing all Finite Element (FE) spaces used in the simulation.

Organizes and initializes various FE spaces such as scalar, vector, mixed, and export function spaces based on the mesh and problem configuration.

Initialize the FEMSpaces object

Parameters:
  • param (ParameterClass) – Configuration object containing simulation parameters including Case, BoundaryCondition, Numerics, and Export settings.

  • mesh (FELiCSMesh) – Computational mesh object used to define the function spaces.

  • degree (int, optional) – Polynomial degree for the function spaces (default is 2).

Variables:
  • element_shape (ufl.Cell) – Shape of the element (triangle or tetrahedron).

  • elementTypeStr (str) – Type of finite element (‘CG’ for continuous Galerkin).

  • _nVelocityComponents (int) – Number of velocity components defined by the case.

  • FunctionSpaceVectorVelocity (dolfinx.fem.FunctionSpace) – Velocity vector space on the main mesh.

  • FunctionSpaceVectorVelocityExport (dolfinx.fem.FunctionSpace) – Velocity vector space on the export mesh.

  • FunctionSpaceVectorVelocityP1 (dolfinx.fem.FunctionSpace) – First-order vector space for velocity.

  • VMixed (dolfinx.fem.FunctionSpace) – Mixed finite element space for all variables.

  • VMixedExport (dolfinx.fem.FunctionSpace) – Export version of the mixed space.

  • P2 (P1,) – First- and second-order scalar function spaces on the main mesh.

  • P2Export (P1Export,) – First- and second-order scalar function spaces on the export mesh.

  • mappingObj (Mapping) – Mapping object that links the function spaces to coordinate mappings.

addCustomScalarSpaceToMixedSpace(mesh, order)#

Deprecated method for adding a scalar element to the mixed function space.

Notes

This method no longer functions as originally intended: it does not modify self.MixedList and uses outdated API calls (MixedElement and FunctionSpace). It is kept only for legacy reference and is not used anywhere in the current codebase. It will be removed in future releases.

Parameters:
  • mesh (FELiCSMesh) – Mesh on which the mixed function space would be defined.

  • order (int) – Intended polynomial order of the added scalar element (unused).