kipe.fenicsx.forward_solver module

What a FEniCSx forward solver provides on top of kipe.forward_solver.ForwardSolver.

kipe exchanges states with the solver as numpy arrays. Samplers on meshes (fenicsx.*) turn the array of a field back into a dolfinx.fem.Function, for which they need the field’s function space: the solver provides it with SupportsFunctionSpaces.function_space(). A solver without it can still be used with array measurements. describe_function_space() describes such a space briefly, for kipe list-fields.

class kipe.fenicsx.forward_solver.SupportsFunctionSpaces(*args, **kwargs)[source]

Bases: Protocol

A forward solver that provides the function spaces of its distributed state fields.

function_space(field: str) → dolfinx.fem.FunctionSpace[source]

Return the function space of a state field.

The field’s array (see kipe.forward_solver.ForwardSolver.state_spec) holds the values of the space’s degrees of freedom owned by this rank, in their local order.

Parameters:

field – name of the state field

Returns:

the function space

kipe.fenicsx.forward_solver.describe_function_space(space: dolfinx.fem.FunctionSpace) → str[source]

Describe the element of a function space in a few characters, for kipe list-fields.

Examples: P1, DG0, P2, vector 3, P1, tensor 3x3, N1E1, vector 3, mixed: P2, vector 3 + P1.

Parameters:

space – the function space

Returns:

the element family and degree, DG for discontinuous Lagrange, and the value shape of a non-scalar element; the sub-elements of a mixed element