fenicsxconcrete.util package

Submodules

fenicsxconcrete.util.logger module

class LogMixin[source]

Bases: object

property logger

fenicsxconcrete.util.mori_tanaka_homogenization module

fenicsxconcrete.util.parameters module

class Parameters(dict=None, /, **kwargs)[source]

Bases: UserDict

A class that contains physical quantities for our model. Each new entry needs to be a pint quantity.

to_magnitude() dict[str, int | str | float][source]

fenicsxconcrete.util.projection module

project(v: Function | Expr, V: functionspace, dx: Measure, u: Function | None = None) None | Function[source]

Calculates an approximation of v on the space V

Parameters:
  • v – The expression that we want to evaluate.

  • V – The function space on which we want to evaluate.

  • dx – The measure that is used for the integration. This is important, if

  • space. (either V is a quadrature space or v is a ufl expression containing a quadrature)

  • u – The output function.

Returns:

A function if u is None, otherwise None.

fenicsxconcrete.util.quadrature module

class QuadratureEvaluator(ufl_expression: Expr, mesh: Mesh, rule: QuadratureRule)[source]

Bases: object

A class that evaluates a ufl expression on a quadrature space.

Parameters:
  • ufl_expression – The ufl expression.

  • mesh – The mesh on which we want to evaluate ufl_expression

  • rule – The quadrature rule.

evaluate(q: ndarray | Function | None = None) ndarray | None[source]

Evaluate the expression.

Parameters:

q – The object we want to write the result to.

Returns:

A numpy array with the values if q is None, otherwise the result is written on q and None is returned.

class QuadratureRule(type: QuadratureType = QuadratureType.default, cell_type: Cell = triangle, degree: int = 1)[source]

Bases: object

An object that takes care of the creation of a quadrature rule and the creation of quadrature spaces.

Parameters:
  • type – The quadrature type. Examples are basix.QuadratureType.Default for Gaussian quadrature and basix.QuadratureType.gll for Gauss-Lobatto quadrature.

  • cell_type – The type of FEM cell (triangle, tetrahedron,…).

  • degree – The maximal degree that the quadrature rule should be able to integrate.

type

The quadrature type “gauss” for standard Faussian quadrature or “gll” for Gauss-Lobatto quadrature.

Type:

string

cell_type

The type of FEM cell.

Type:

ufl.Cell

degree

The quadrature degree.

Type:

int

points

The quadrature points on the refernce cell.

Type:

np.ndarray

weights

The weights of the quadrature rule.

Type:

np.ndarray

dx

The appropriate measure for integrating ufl forms with the specified quadrature rule. Always use this measure when integrating a form that includes a quadrature function.

Type:

ufl.measure

create_quadrature_array(mesh: Mesh, shape: int | tuple[int, int] = 1) ndarray[source]

Creates array of a quadrature function without creating the function or the function space. This should be used, if operations on quadrature points are needed, but not all values are needed in a ufl form.

Parameters:
  • mesh – A mesh.

  • shape – Local shape of the quadrature space. Example: shape = 1 for Scalar, shape = (n, 1) for vector and shape = (n,n) for Tensor.

Returns:

An array that is equivalent to quadrature_function.x.array.

create_quadrature_space(mesh: Mesh) functionspace[source]
Parameters:

mesh – The mesh on which we want to create the space.

Returns:

A scalar quadrature FunctionSpace on mesh.

create_quadrature_tensor_space(mesh: Mesh, shape: tuple[int, int]) functionspace[source]
Parameters:
  • mesh – The mesh on which we want to create the space.

  • shape – The shape of the tensor at each dof.

Returns:

A tensor valued quadrature FunctionSpace on mesh.

create_quadrature_vector_space(mesh: Mesh, dim: int) functionspace[source]
Parameters:
  • mesh – The mesh on which we want to create the space.

  • dim – The dimension of the vector at each dof.

Returns:

A vector valued quadrature FunctionSpace on mesh.

number_of_points(mesh: Mesh) int[source]
Parameters:

mesh – A mesh.

Returns:

Number of quadrature points that the QuadratureRule would generate on mesh

fenicsxconcrete.util.unit_registry module

This module contains the default unit registry that is used throughout the codebase.

ureg

The default unit registry.

Type:

pint.UnitRegistry

Module contents