phipict.grid.shapes

Generation and manipulation of structured grid coordinates.

Functions

coords_to_center_coords(coords)

Compute cell-center coordinates by averaging the vertices of each cell.

extrapolate_boundary_layers(grid[, boundaries])

Add linearly extrapolated vertex layers at the given boundaries.

extrude_grid_z(grid, res_z[, start_z, ...])

Extrude a 2D grid along z.

generate_grid_vertices_2D(res, corner_vertices)

Generate the vertices of a 2D block from its corners and borders.

get_extrapolated_boundary_layer(grid, bound, ...)

Get the boundary vertex layer together with a linearly extrapolated one.

get_grid_coords(size[, dtype])

Build a grid of integer cell indices.

get_grid_cube_centered(size, cube_size[, dtype])

Build a grid that is 1 inside a centered box and 0 elsewhere.

get_grid_normal_dist(size, mean, var[, dtype])

Build a grid with a separable normal distribution over [-1, 1].

get_grid_normal_dist_from_ortho_transforms(...)

Evaluate a separable normal distribution on an orthogonal grid.

get_grid_striped_x(size[, dtype])

Build a grid with alternating 0/1 values along the first axis.

interpolate_vertices_from_borders_2D(borders)

Interpolate inner grid vertices from the four border vertex lists.

invert_weights(weights)

Mirror interpolation weights so the refinement is at the other end.

make_matrix_rotation_2D(angle[, degrees])

Build a 2D rotation matrix.

make_matrix_rotation_3D(rotvec[, degrees])

Build a 3D rotation matrix from a rotation vector.

make_rotation_distance_scaling_fn_sine(...)

Build a sine-shaped rotation weighting for rotate_grid().

make_rotation_distance_scaling_fn_sine_half(...)

Build a half-cosine rotation weighting for rotate_grid().

make_torus_2D(res, r1, r2, start_angle, angle)

Generate a 2D grid of a torus (annulus) segment.

make_wall_refined_ortho_grid(res_x, res_y[, ...])

Generate an axis-aligned 2D grid with exponential refinement at walls.

make_weights(grading_type, res, grading, ...)

Create cell weights using the requested grading scheme.

make_weights_chebyshev_identity(res, gamma, ...)

Create cell weights by blending the Chebyshev and identity transforms.

make_weights_cos(res, refinement)

Create interpolation weights with cosine spacing.

make_weights_exp(res, base, refinement)

Create interpolation weights with exponentially growing cell sizes.

make_weights_exp_global(res, global_scale, ...)

Create exponential weights from the ratio of the largest to smallest cell.

make_weights_linear(res)

Create uniform interpolation weights.

make_weights_simple_grading(res, grading, ...)

Create cell weights using OpenFOAM-style simpleGrading cell expansion ratio.

make_weights_tanh(res, A, refinement)

Create cell weights using the classical tanh transformation.

ortho_transform_to_coords(transform, dims)

Reconstruct vertex coordinates from orthogonal per-cell transforms.

rotate_grid(grid, angle[, axis, center, ...])

Rotate grid coordinates.