phipict.meshing.Mesh

class phipict.meshing.Mesh(blocks: Iterable[MeshBlock] = (), *, auto_connect: bool = True, rel_tol: float = 0.0001)[source]

Structured multi-block mesh.

Parameters:
  • blocks (iterable of MeshBlock, optional) – Blocks of the mesh. Blocks with the same name are renamed.

  • auto_connect (bool, optional) – Whether to connect the coinciding free faces of the blocks. Default is True.

  • rel_tol (float, optional) – Tolerance of the face matching, relative to the smallest vertex spacing of a face. Default is 1e-4.

__init__(blocks: Iterable[MeshBlock] = (), *, auto_connect: bool = True, rel_tol: float = 0.0001) → None[source]

Methods

__init__([blocks, auto_connect, rel_tol])

add(block)

Add a block (without connecting it) and return its index.

assign_patch(faces, patch)

Put block faces into a patch.

auto_connect([rel_tol])

Connect the free faces whose vertices coincide.

block(name)

The block called name.

boundaries(domain, patch)

The solver boundaries of a patch in a domain made by get_domain().

bounds()

Lower and upper corner of the axis-aligned bounding box.

check()

Check the cells, faces and patches of the mesh.

connect(block_a, face_a, block_b, face_b, *)

Connect two faces explicitly.

extrude(z_range, cells[, grading, periodic, ...])

A 3D mesh from this 2D mesh, extruded along z.

faces(patch)

The (block, face) pairs of a patch.

free_faces()

Faces without a patch or connection, as (block, face).

from_domain(domain)

The mesh of a solver domain, e.g. one from load_domain().

get_domain(viscosity, *[, dtype, device, ...])

A solver domain with the blocks, connections and conditions of the mesh.

index(name)

Index of the block called name.

make_periodic([axis, translation, rel_tol])

Connect free faces that coincide after a shift.

outflow_hook(domain, velocity[, tol])

A callback that advects the Outflow faces.

patch(name)

The patch called name.

plot([ax, color, linewidth, z_index])

Plot the grid lines of the blocks with matplotlib.

set_bc(patch, spec)

Set the condition of a patch.

transform(fn)

A copy with every block mapped by fn(block) -> block.

Attributes

blocks

The blocks, in the order of the solver blocks.

connections

The connections between block faces, periodic ones included.

n_cells

Total number of cells.

ndims

Number of spatial dimensions.

patches

The patches, one per name.