Cutting

Cuts through a grid along a curve in the meridional plane.

The cut is the surface of revolution swept by an \((x, r)\) curve, carried on straight past both ends. Three functions take it, each from a grid or a single block:

  • structured_traverse() gives a blade-free traverse plane as one structured 2D Block, hub to casing by once round the pitch, ready for the averages in ember.average.

  • structured_multiblock() gives any cut, through blades and tip gaps too, as a list of structured 2D blocks, split at each solid and between blade rows.

  • unstructured() gives any cut as triangles from marching cubes, a list of UnstructuredBlock, one per blade row it crosses. It makes no demands of the grid’s topology, but triangles are harder to plot and to work along than a structured sheet.

The structured cuts are built from the grid’s own lines, every node interpolated along one grid edge where the grid lines cross the cut cleanly, and need the grid’s periodic pairs to coincide, as ember.grid.Grid.snap_periodic() makes them. structured_multiblock() and unstructured() cut a grid of several blade rows, separated by mixing planes, a row at a time from inlet to outlet, so each piece carries one row’s blade count and rotation. UnstructuredBlock.from_structured turns a structured 2D cut into triangles.

Cuts along grid surfaces by index

The functions here extract cuts along an arbitrary meridional curve. To take a cut along a grid surface of constant index, none of them are needed: a Block supports numpy-style indexing, so block[i] or block[:, j] returns a lower-dimensional structured cut that shares the parent’s data as a zero-copy view. See the indexing section of ember.block for the full rules.

cut.unstructured(grid, xr_cut)[source]

Take an unstructured cut through a grid using marching cubes.

Extracts a triangulated isosurface where the meridional cut curve intersects the grid, by running the marching cubes algorithm on the signed distance field of each block. Within each block the curve reaches, or comes within a tenth of its end segments’ length of reaching, the cut runs on past both ends straight along those segments, so a curve ending on an endwall cuts the wall cells cleanly. A single straight segment is thus its whole line, which is also the quicker case to evaluate.

A grid of several blade rows is cut a row at a time, from inlet to outlet, giving one unstructured block per row the cut crosses, with that row’s fluid, blade count and rotation; rows the cut misses give none. Within a row, the triangles of every block the cut crosses are joined into one block, a node on an interface between blocks being kept once per block.

Parameters:
  • grid (Grid or Block) – Grid containing blocks to cut, or a single block.

  • xr_cut (array_like, shape (n_points, 2)) – Meridional \((x, r)\) curve defining the cut surface.

Returns:

The triangulated cut through each row it crosses.

Return type:

list of UnstructuredBlock

Raises:

ValueError – If the cut misses every row of the grid, or crosses blocks of one row with different blade counts, rotation or length scales.

cut.structured_traverse(grid, xr_cut, factor=1, untwist=0)[source]

Cut a blade-free traverse plane into one structured sheet.

The sheet is built from the grid’s own lines rather than resampled. Where one family of a block’s grid lines each crosses the cut the same number of times, or a run of them crosses once from hub to casing, each node of the sheet is a linear interpolation along one grid edge, exactly as the nodes of unstructured() are. These exact patches are joined across interfaces and periodic faces. Between them, where the cut crosses the grid lines only part-way, as it does near an O-grid’s nose, the sheet is filled from the cut’s triangles along rows that start and end on the exact nodes either side. With no exact patch at all, as where an inclined cut crosses one block near the hub and the next near the casing, each spanwise surface crossed cleanly round the pitch gives an exact row on the grid lines of the row below; one crossed part-way, at the interface, is cut alone and interpolated round the pitch between its neighbours. Failing that, the sheet is filled between two copies of the periodic seam. The sheet runs once round the pitch.

Axis 0 of the result runs from hub to casing and axis 1 up in \(\theta\), with the last column the first a pitch on. Rows follow the grid’s own spanwise surfaces, so they lie at constant \((x, r)\) only where those surfaces are surfaces of revolution, and the spacing in \(\theta\) follows the grid’s. Grid lines twisted round the annulus twist the sheet’s columns with them; untwist instead slides every row round to start at the hub’s first \(\theta\), keeping its own spacing, so the boundary columns lie at constant \(\theta\) and the others nearly so, with the data interpolated along each row.

The grid’s periodic pairs must coincide exactly, as ember.grid.Grid.snap_periodic() makes them: nodes are matched by position, to within a few single precision steps.

Parameters:
  • grid (Grid or Block) – Grid to cut, or a single block.

  • xr_cut (array_like, shape (n_points, 2)) – Meridional \((x, r)\) curve defining the cut surface, carried on straight past both ends.

  • factor (int, default 1) – Cells across a filled region per grid cell along its endwalls. The exact patches and rows are the grid’s own lines and are not refined.

  • untwist (int, default 0) – If not zero, slide the rows round so the columns lie at constant \(\theta\), each interval along a row split into this many, the data interpolated by monotone cubics. That costs accuracy where a flow feature twists with the grid lines, as near a leading edge, whose resolution the straight columns no longer follow: 2 is a reasonable choice for a plot. Zero, the default, keeps every node exact.

Returns:

2D structured block, shape (n_span, n_pitch).

Return type:

Block

Raises:

ValueError – If the cut misses the grid; meets a blade, tip gap or other solid, so does not close round the pitch or leaves a boundary that is not an endwall; crosses blocks of different blade counts; or meets grid pieces with different numbers of spanwise nodes.

cut.structured_multiblock(grid, xr_cut, factor=1)[source]

Cut a grid into structured 2D blocks, through blades as well.

Where the cut makes one sheet, the result is exactly that of structured_traverse(). Where it meets a solid, it is the pieces of the same exact patches and filled holes, split at each solid: a blade or cusp in an H-mesh, between the two faces it leaves, and a blade inside an O-grid, between the patches either side of it. Pieces with fewer spanwise nodes than the rest, as the cut makes across a tip gap meshed in blocks of its own, are blocks of their own. Every node is either interpolated along one grid edge or filled from the cut’s triangles as in structured_traverse().

A grid of several blade rows is cut a row at a time, from inlet to outlet, so a blade-to-blade cut gives at least one block per row, each with its own row’s pitch; rows the cut misses give none.

Each block runs along the cut curve on axis 0, from hub to casing for a traverse plane, and up in \(\theta\) on axis 1. Pieces that meet share their nodes along the side between them. The blocks are labelled cut0, cut1 and so on, as a piece can span several of the grid’s blocks.

Parameters:
  • grid (Grid or Block) – Grid to cut, or a single block, its periodic pairs snapped as for structured_traverse().

  • xr_cut (array_like, shape (n_points, 2)) – Meridional \((x, r)\) curve defining the cut surface, carried on straight past both ends.

  • factor (int, default 1) – Cells across a filled region per grid cell along its endwalls.

Returns:

The 2D structured blocks of the cut.

Return type:

list of Block

Raises:

ValueError – If the cut misses every row of the grid, or leaves a gap between its pieces that is neither fluid nor a solid.