morphogen.iga.geometry

NURBS patches and their assemblies: the geometry of an isogeometric analysis.

A patch is a tensor product of B-spline bases (morphogen.iga.basis) with control points P_a and positive weights w_a: a point of parameters xi is:

x(xi) = sum_a R_a(xi) P_a,    R_a = N_a w_a / sum_b N_b w_b,

N_a the product of the functions of each direction. Rational functions give conics — circles, ellipses — exactly; with unit weights the patch is a polynomial spline. A patch of two parameters in the plane is a surface (plane stress or plane strain), of three parameters a solid; their sides are patches of one parameter less.

A Multipatch assembles patches that share whole sides: their control points there coincide (with their weights and their knots, so that the patches fit along the whole side), and are one control point of the assembly. The unknowns of an analysis are attached to these control points (the isoparametric concept: the functions of the geometry are those of the fields).

Refinement keeps the geometry (Patch.refined()): every element cut in parts (h), the degree raised (p), or the degree raised then the elements cut (k, which keeps the continuity of the higher degree across the new knots). The control points of the refined patch are linear in those of the coarse one for given weights: Multipatch.refinement() returns the matrix of that map, by which a design made of few control points drives the many of its analysis (morphogen.iga.optimization).

class morphogen.iga.geometry.Patch(degrees: tuple, knots: tuple, points: ndarray, weights: ndarray | None = None, phase: int = 0, metadata: dict = <factory>)[source]

Bases: object

A NURBS patch: the degrees and the knots of its directions, its control points (n_1 x ... x n_d x dim) and their weights (n_1 x ... x n_d; unit weights by default), and the phase of its material.

property ndim: int

1 (curve), 2 (surface) or 3 (solid).

Type:

The number of parameters

property dim: int

The dimension of the space of the control points.

property shape: tuple[int, ...]

The numbers of control points along the directions.

property n_elements: int
property rational: bool
at(params) → ndarray[source]

The points of the patch at parameters (points x ndim): points x dim.

jacobian(params) → tuple[ndarray, ndarray][source]

The points at parameters and the derivatives of the position with respect to the parameters there (points x dim x ndim).

sample(counts=8) → ndarray[source]

The points of a grid of parameters, counts per element and direction (and the end of the last element): m_1 x ... x m_d x dim.

side_indices(axis: int, end: int) → ndarray[source]

The control points of a side (end 0: the start of direction axis, 1: its end): their indices in the raveled arrays of the patch.

side(axis: int, end: int) → Patch[source]

A side of the patch: a patch of one parameter less.

refinement_operators(subdivisions=1, elevate=0) → tuple[list, list, list][source]

The matrices of the refinement of each direction (new functions x old ones; morphogen.iga.basis.embedding()), with the new degrees and knots.

refined(subdivisions=1, elevate=0) → Patch[source]

The same patch with every element cut into subdivisions parts along each direction and its degrees raised by elevate (one value, or one per direction): the degree is raised first (k-refinement).

with_points(points) → Patch[source]

The patch with other control points (the same weights and knots).

class morphogen.iga.geometry.Multipatch(patches, tolerance: float = 1e-08, lattice=None)[source]

Bases: object

Patches that share whole sides (see the module): patches, the control points of the assembly (nodes, weights) and, for each patch, the indices of its control points among them (ids, of the shape of the patch). Control points closer than tolerance times the size of the assembly are one.

lattice (optional; one vector per row) gives the periods of an assembly that is the cell of a periodic medium without being a box — a parallelogram, or any set of patches that tiles the plane (the space) by these translations: the sides of its boundary then match by a period (morphogen.iga.homogenization).

property ndim: int
property dim: int
property n_nodes: int
property n_elements: int
property lower: ndarray

The lower corner of the box of the control points.

property upper: ndarray
property phases: list[int]
side_nodes(patch: int, axis: int, end: int) → ndarray[source]

The control points of a side of a patch (indices in the assembly).

boundary_nodes() → ndarray[source]

The control points of the sides that belong to one patch only: the boundary of the assembly (the outer one and those of its holes).

free_sides() → list[tuple[int, int, int]][source]

The sides (patch, axis, end) that belong to one patch only.

with_nodes(nodes) → Multipatch[source]

The assembly with its control points moved to nodes (the same weights, knots and connections).

refined(subdivisions=1, elevate=0) → Multipatch[source]

The assembly of the refined patches (Patch.refined()).

refinement(subdivisions=1, elevate=0) → tuple[Multipatch, csr_matrix][source]

The refined assembly and the matrix T of its control points in terms of those of this one, for given weights: refined.nodes = T @ nodes (and for any other positions of the control points of this assembly: refined.with_nodes(T @ other)).

jacobians(counts: int = 6) → tuple[float, float][source]

The smallest and the largest determinants of the Jacobian of the patches, on grids of parameters that hold the ends of the elements (counts per element and direction): a negative one where a patch folds or turns over — at its boundary first, where the points of integration of an analysis do not look.

polygons(counts: int = 12) → list[ndarray][source]

The boundary of each patch as a closed polygon (for figures: the patches filled): surfaces only.

voxelize(shape, lower=None, upper=None, hole: int | None = None, depth: int = 1, counts: int = 16)[source]

The image of an assembly of surfaces on a grid of shape pixels over the box from lower to upper (that of its control points by default): each pixel takes the phase of the patch that holds its centre, hole where there is none (by default the largest phase plus one). With a lattice, the copies of the patches by its periods are drawn as well, so that a box that is a period of the medium gives a periodic image — the square of two spacings for alternating_holes(). Curved sides are drawn as polygons of counts points per element.

Returns a periodic VoxelImage of depth voxels along the third axis: the shape for the voxel solvers (plane strain), the nonlinear behaviours and the exports.

outline(counts: int = 12) → list[ndarray][source]

The sides of the patches as polylines (for figures): surfaces only.