Splitting Blocks

Split blocks is combination of help from Dave Rigby and Tim Beach

class plot3d.split_block.Direction(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
plot3d.split_block.max_aspect_ratio(X: ndarray, Y: ndarray, Z: ndarray, ix: int, jx: int, kx: int)[source]

Finds the maximum cell aspect ratio

Parameters:
  • X (np.ndarray) – 3 dimensional Array containing X values. X[i,j,k]

  • Y (np.ndarray) – 3 dimensional Array containing X values. X[i,j,k]

  • Z (np.ndarray) – 3 dimensional Array containing X values. X[i,j,k]

Returns:

Maximum value of aspect ratio

Return type:

float

plot3d.split_block.split_blocks(blocks: List[Block], ncells_per_block: int, direction: Direction = None)[source]

Split blocks is used to divide an array of blocks based on number of cells per block. This code maintains the greatest common denominator of the parent block. Number of cells per block is simply an estimate of how many you want. The actual number will change to meet the greatest common denominator (GCD). GCD of 4 means multigrid of 3 e.g. grid/4 (coarse), 2 (fine), and 1 (finest). If a direction is not specified then for each block the longest index either i,j, or k is used.

Wisdom from Dave Rigby:

For example, for radial equilibrium we must integrate across the span. Some codes (GlennHT used to) would want a single block across the entire span. In that case you would want some additional control.

Another example might be if you would like a block to include the entire boundary layer. In that case you might introduce an aspect ratio control.

Parameters:
  • blocks (List[Block]) – List of blocks

  • ncells_per_block (int) – number of cells desired per block

  • direction (Direction) – direction to split the blocks in. Direction.(i,j,k). Defaults to None. None means it will pick the direction for you based on which is greater IMAX, JMAX, or KMAX

Returns:

list of blocks split in the specified direction

Return type:

Blocks (List[Block])