Unstructured blocks

Flow data on an unstructured triangulated surface.

An UnstructuredBlock joins a one-dimensional Block of flow data at a set of nodes to the triangular faces that connect them. It is what ember.cut.unstructured() returns, and it is accepted by the integrals and averages in ember.average alongside a structured 2D cut.

Each node is stored once, however many faces share it. The flow is set and read through nodes, an ordinary Block of shape (n_node,); face quantities have shape (n_face, ...).

The nodes are built as any other block, and then joined by their faces:

nodes = Block((n_node,))
nodes.set_xrt(xrt)
nodes.set_fluid(fluid)
nodes.set_P_T(P, T)
nodes.set_Vxrt(Vxrt)
u = UnstructuredBlock(nodes, i_face)  # int, shape (n_face, 3)

UnstructuredBlock(nodes, i_face)

Join flow data at a set of nodes into a triangulated surface.

class unstructured.UnstructuredBlock(nodes, i_face)[source]

Join flow data at a set of nodes into a triangulated surface.

Each face is a triple of node indices \((A, B, C)\). Its area vector, dA, follows the right-hand rule around \(A \to B \to C\) in the pseudo-Cartesian space \((x, r, r\theta)\), the same sense as the face areas of a structured cut.

The nodes are held by reference, so the flow on them can be changed in place through nodes. The faces are copied and stored read-only; to change them, or the number of nodes, build a new UnstructuredBlock.

A volume mesh would extend this class rather than replace it: each face would also store the cells either side of it, and the cells, their volumes and their node lists would be derived from those.

Parameters:
  • nodes (Block, shape (n_node,)) – Flow data at the nodes.

  • i_face (array_like of int, shape (n_face, 3)) – Indices into nodes of the three nodes of each face, each in [0, n_node). Their order sets the direction of the face’s area vector by the right-hand rule.

classmethod from_structured(block)[source]

Triangulate a structured 2D cut.

Every node of block becomes a node of the result, and every quad face is split into two triangles, giving n_face = 2 (ni - 1) (nj - 1) faces. The metadata of block come across, but not its patches.

Parameters:

block (Block, shape (ni, nj)) – 2D structured block to triangulate.

Returns:

cut – Unstructured block with n_node = ni * nj nodes, node (i, j) of block being node i + ni * j.

Return type:

UnstructuredBlock

copy()[source]

Create a copy with its own nodes.

The faces are shared, being read-only.

Returns:

out – A new block whose node data can be changed independently.

Return type:

UnstructuredBlock

property dA

Face area vectors \(\delta\!A\) [m^2], shape (n_face, 3).

See dA_nd for the nondimensional form and the geometry reference.

property dA_nd

Face area vectors \(\delta\!A / L_\mathrm{ref}^2\) [-], shape (n_face, 3).

Pseudo-Cartesian components \((x, r, r\theta)\) on the trailing axis, directed by the right-hand rule around each face’s nodes.

See Face areas for the calculation.

property i_face

Node indices of each face, read-only int32, shape (n_face, 3).

property n_face

Number of faces.

property n_node

Number of nodes.

property nodes

Flow data at the nodes, a Block of shape (n_node,).