pystencils.grids.staggered_field.Staggering#

class pystencils.grids.staggered_field.Staggering(*entries)#

A staggered stencil, given by the entries it stores on a cell.

Each member fixes the direction set stored on a cell: the axis faces only, or the faces plus the diagonal edges. The cell centre is never stored.

  • Edge2D : axis faces only, 2D (D2Q5 edges)

  • Corner2D : faces and corners, 2D (D2Q9 edges)

  • Face3D : axis faces only, 3D (D3Q7 edges)

  • Corner3D : faces, edges and corners, 3D (D3Q27 edges)

Only one of each direction/inverse pair is stored; the physical full DdQq stencil (stencil_entries) is derived on demand.

Edge2D = ((0, 1), (1, 0))#

Axis faces only, 2D (D2Q5 edges).

Corner2D = ((0, 1), (1, 0), (1, 1), (1, -1))#

Faces and corners, 2D (D2Q9 edges).

Face3D = ((0, 1, 0), (1, 0, 0), (0, 0, 1))#

Axis faces only, 3D (D3Q7 edges).

Corner3D = ((0, 1, 0), (1, 0, 0), (0, 0, 1), (1, 1, 0), (1, -1, 0), (0, 1, 1), (1, 0, 1), (0, 1, -1), (1, 0, -1), (1, 1, 1), (-1, 1, 1), (1, -1, 1), (1, 1, -1))#

Faces, edges and corners, 3D (D3Q27 edges).

property D: int#

Spatial dimensionality.

property has_center: bool#

Whether the cell centre occupies a stored entry.

property edges: tuple[tuple[int, ...], ...]#

The stored edge directions, never including the centre.

property staggered_entries: tuple[tuple[int, ...], ...]#

The stored entries, exactly as laid out in the field’s buffer.

property Q: int#

Number of full-stencil directions.

staggered_index(direction)#

Storage index of an entry; a direction’s inverse maps to the same index.

Return type:

int

staggered_direction(index)#

The stored entry with the given index.

Return type:

tuple[int, ...]

Parameters:

index (int)

property stencil_entries: tuple[tuple[int, ...], ...]#

the centre, then each edge and its inverse.

Type:

Full DdQq stencil