kipe.fenicsx.sampling.common module

Common functionality for the FEniCSx spatial samplers.

kipe.fenicsx.sampling.common.observed_function_space(kind: str, fields: list[str], solver: ForwardSolver) → tuple[str, dolfinx.fem.FunctionSpace][source]

Return the field a FEniCSx sampler observes, and its function space.

Parameters:
  • kind – the sampler’s type, for error messages, e.g., "fenicsx.mesh"

  • fields – names of the fields the measurement observes; exactly one

  • solver – the forward solver, which provides the field’s function space

Returns:

  • the field’s name

  • its function space, on the solver’s mesh

Raises:

StudyFileError – if the measurement does not observe exactly one distributed field whose function space the solver provides

kipe.fenicsx.sampling.common.observed_facet_tags(kind: str, field: str, solver: ForwardSolver) → dolfinx.mesh.MeshTags[source]

Return facet tags provided by the forward solver for an observed field.

Parameters:
  • kind – the sampler’s type, for error messages

  • field – name of the observed distributed field, checked by observed_function_space

  • solver – the forward solver, which provides the field’s facet tags

Returns:

facet tags on the mesh, with the same MPI partition

Raises:

StudyFileError – if the solver does not provide facet_tags(field)