Block

class plot3d.block.Block(X: ndarray[tuple[Any, ...], dtype[_ScalarT]], Y: ndarray[tuple[Any, ...], dtype[_ScalarT]], Z: ndarray[tuple[Any, ...], dtype[_ScalarT]])[source]

Plot3D Block definition

cell_volumes()[source]

Compute volume of all cells

Returns:

volume of all cells

Return type:

numpy.ndarray

Reference:

Davies, D.E. and Salmond, D.J., “Calculation of the Volume of a General Hexahedron for Flow Predicitons”, AIAA Journal, vol. 23, No. 6, pp. 954-956, June 1985. It is (supposedly) exact for a hexahedral whose faces are bi-linear surfaces (i.e., the simplest surface that can be fit through the four nodes defining the face).

check_handedness() bool[source]

Check if the block has right-handed (positive volume) cells.

Samples cells at the block center and corners using a scalar triple product. Returns True if right-handed, False if left-handed (negative volume).

cylindrical()[source]

Converts the block to cylindrical coordinate system. The rotation axis is assumed to be “x” direction

fix_handedness() bool[source]

Fix left-handed blocks by reversing the k-axis.

If the block has negative cell volumes (left-handed), the k-index is reversed so that the cell orientation becomes right-handed. Reversing k (spanwise) preserves the i and j conventions (i=chord, j=wall-normal) that connectivity and boundary conditions depend on.

Returns:

True if a fix was applied, False if already right-handed.

Return type:

bool

get_faces()[source]

Returns a dictionary of the six faces of the block. Each face is a tuple of (X_face, Y_face, Z_face).

scale(factor: float)[source]

Scales a mesh by a certain factor

Parameters:

factor (float) – _description_

shift(shift_amount: float, direction: str = 'z')[source]

shifts the blocks by a certain amount

Parameters:
  • shift_amount (float) – _description_

  • direction (str, optional) – _description_. Defaults to “z”.

property size: int

returns the total number of nodes

Returns:

number of nodes

Return type:

int

plot3d.block.reduce_blocks(blocks: List[Block], factor: int)[source]

reduce the blocks by a factor of (factor)

Parameters:
  • blocks (List[Block]) – list of blocks to reduce in size

  • factor (int, optional) – Number of indicies to skip . Defaults to 2.

Returns:

[description]

Return type:

[type]