kipe.fenicsx.sampling.displaced_vertices module
Displaced coordinates of tagged mesh vertices: fenicsx.displaced_vertices.
The forward solver provides the mesh and facet tags for the selected field. The sampler selects vertices of mesh facets with the given tags, combines their vertex sets by union or intersection, and adds the sampled displacement to their coordinates, returning X + u(X).
Selection and ordering are fixed at construction. Tags are combined globally before intersecting their vertex sets, including when different ranks hold the adjacent surfaces. The original geometry input indices define a partition-independent order. Like PointSampler, this implementation replicates the selected vertices’ coordinates on all ranks at construction; each sample returns only this rank’s entries, with components of each vertex together.
- class kipe.fenicsx.sampling.displaced_vertices.DisplacedVertexSampler(field: str, source: dolfinx.fem.FunctionSpace, facet_tags: dolfinx.mesh.MeshTags, tags: list[int], combine: Literal['union', 'intersection'], comm: mpi4py.MPI.Comm = mpi4py.MPI.COMM_WORLD)[source]
Bases:
SpatialSamplerEvaluate
X + u(X)at vertices selected from tagged mesh facets.Only topological vertices are selected, including on higher-order meshes. The displacement is evaluated through its function space; geometry indices are never treated as field DOFs. The mesh is not modified.
- Parameters:
field – name of the displacement field
source – displacement function space on the mesh
facet_tags – facet tags on the source mesh, with the same MPI partition
tags – nonempty list of facet tag IDs
combine – union or intersection of the facets’ vertex sets; must be specified explicitly
comm – communicator of the mesh and run
- Raises:
StudyFileError – if the field is not a displacement vector, a tag is absent globally, the facet tags belong to another mesh, or the selection is empty or invalid
- kipe.fenicsx.sampling.displaced_vertices.build_displaced_vertex_sampler(options: DisplacedVertexSamplingOptions, fields: list[str], solver: ForwardSolver, comm: mpi4py.MPI.Comm = mpi4py.MPI.COMM_WORLD) DisplacedVertexSampler[source]
Construct the displaced vertex sampler from study options and solver capabilities.
- Parameters:
options – spatial sampling options
fields – names of the observed fields; exactly one displacement field
solver – solver providing
function_space(field)andfacet_tags(field)comm – communicator of the run
- Returns:
the displaced vertex sampler
- Raises:
StudyFileError – if the solver does not provide the required capabilities