warp.fem.periodic_prolongation#

warp.fem.periodic_prolongation(basis, translations, tolerance=None)[source]#

Return a prolongation that ties the nodes of basis to their periodic copies.

For each translation T, every node x that has a partner node at x - T takes the value of that partner. When the domain is a periodic cell that tiles space with the given translations, these are exactly the nodes on the faces that the translations map onto, whether or not the translations are perpendicular to the faces (for instance, the two edge vectors of a parallelogram). Nodes tied by several translations, such as edges and corners, resolve to a single copy. Nodes are matched by position, so any basis that provides BasisSpace.node_positions() works, including a constrained basis returned by make_conforming_basis_space(), whose nodes are its independent nodes. On geometries with several environments, nodes only match nodes of the same environment.

Only nodes with a partner are tied: this function does not check that paired faces carry matching nodes, and nodes without a partner, for instance on a face refined more than its partner, stay independent.

Pass the result to make_constrained_basis_space() with the same basis to build the periodic space. The geometry itself is unchanged: paired faces remain boundary sides, so jumps across the seam are not available and positions are not wrapped.

Matching runs with a warp.HashGrid on the device holding the geometry’s arrays (or those of a constrained basis), and on the current device for Grid2D and Grid3D; only the node bounding box and error status are read back.

Parameters:
  • basis (BasisSpace) – Basis whose nodes are made periodic.

  • translations (Sequence[Any]) – One to three translation vectors with the dimension of the geometry, such as warp.vec2(1.0, 0.0). Each one maps the low face of the periodic domain to its high face.

  • tolerance (float | None) – Distance under which two nodes match. None uses 1e-6 times the diagonal of the node bounding box.

Returns:

A compact BSR matrix with scalar blocks of the geometry scalar type, one row per node of basis and one column per independent node. Independent nodes are numbered in increasing node order, and each has a unit row.

Raises:

ValueError – If a translation is zero or has the wrong dimension, if tolerance is not positive or not smaller than half of every translation length, or if the translations lead to cyclic or inconsistent constraints, for instance when both T and -T are given.

Return type:

BsrMatrix