grids.core.UniformGrid.__init__#

UniformGrid.__init__(coordinate_system: _CoordinateSystemBase, bounding_box: Any, domain_dimensions: Any, /, ghost_zones: Sequence[Sequence[float]] | None = None, chunk_size: Sequence[int] | None = None, *args, units=None, center: Literal['vertex', 'cell'] = 'vertex', **kwargs)[source]#

Initialize a uniformly spaced, structured grid.

This constructor sets up a logically Cartesian grid using a bounding box and number of grid points per axis. Optionally supports ghost zones and domain chunking.

Parameters:
  • coordinate_system (CurvilinearCoordinateSystem) –

    An instance of a coordinate system subclass (e.g., CartesianCoordinateSystem3D, CylindricalCoordinateSystem, or SphericalCoordinateSystem), which defines the geometry and dimensionality of the grid.

    Note

    The number of coordinate arrays provided in coordinates must match the dimensionality defined by this coordinate system.

  • bounding_box (numpy.ndarray) –

    The physical extent of the domain (excluding ghost zones).

    The bounding_box must be an array-like object with shape (2,ndim) in which the bounding_box[0,:] corresponds to the lower left corner of the domain and bounding_box[1,:] corresponds to the upper right corner.

    This bounding box defines the continuous coordinate domain that the grid spans. It is used to calculate uniform cell spacing along each axis.

  • domain_dimensions (list of int) –

    The number of grid points per axis, excluding ghost zones. This argument determines the effective resolution of the grid and (in conjunction with bounding_box) determines the grid spacing.

    Note

    If the grid is using vertex-centered points (center='vertex'), then each axis must have at least 2 points otherwise it would lead to a degenerate grid along those dimensions.

  • ghost_zones (numpy.ndarray, optional) –

    The number of inactive (ghost) cells to place adjacent to the edge of the grid along each axis.

    ghost_zones may be scalar, corresponding to a fixed number of cells on each edge. It may be (ndim,) in shape, corresponding to symmetric regions on each axis, or it may be (2,ndim), corresponding to asymmetric regions on each axis.

  • chunk_size (list of int, optional) –

    The number of grid cells per chunk along each axis.

    To be valid, chunk_size must evenly divide the number of cells. If center='cell', then this is equivalent to domain_dimensions, if center='vertex', then chunk_size must divide domain_dimensions + 1 along each axis.

  • units (dict of str or Unit, optional) – A dictionary mapping base physical dimensions (e.g., “length”, “time”, “mass”, “angle”) to their corresponding units, either as strings (e.g., “cm”, “s”) or as Unit instances. If not provided, the grid defaults to the CGS (centimeter–gram–second) unit system. This unit system is used for interpreting coordinate values and for scaling differential geometry operations.

  • center ({'vertex', 'cell'}, optional) –

    The position of each point in the grid lattice. If center is "vertex", then the grid points are placed at the corners of each cell and there are domain_dimensions-1 cells and domain_dimensions edges along each axis.

    If "cell", then the positions of the coordinates are placed at the centers of each cell. There are then domain_dimensions cells along each axis and domain_dimensions + 1 edges.

  • *args – Additional keyword arguments forwarded to subclass initialization routines, such as boundary condition configuration or field metadata. These are currently ignored.

  • **kwargs – Additional keyword arguments forwarded to subclass initialization routines, such as boundary condition configuration or field metadata. These are currently ignored.