grids.base.GridBase.__init__#
- GridBase.__init__(coordinate_system: _CoordinateSystemBase, *args, units: Dict[str, str | Unit] | None = None, **kwargs)[source]#
Initialize a
GridBase
instance.This constructor sets up the core infrastructure for a computational grid by configuring the coordinate system, domain geometry, and boundary/ghost zone settings. All user-facing grid types in Pisces Geometry (e.g.,
GenericGrid
) should subclassGridBase
and implement the required logic in the appropriate initialization hooks.- Parameters:
coordinate_system (
CurvilinearCoordinateSystem
) – A coordinate system instance (fromcoordinates
) which defines the dimensionality, axis names, and differential geometry used by the grid. The coordinate system is assigned to the grid and used to validate all subsequent logic and structure.*args – Positional arguments passed to subclass initialization hooks (e.g.,
__set_grid_domain__
,__set_grid_boundary__
). These may include axis-specific metadata like coordinate arrays, resolutions, or chunking information.units (
dict
, optional) – Dictionary mapping base physical dimensions (e.g.,length
,time
) to string unit names (e.g.,"cm"
,"s"
,"rad"
). If unspecified, the grid defaults to the CGS unit system. This unit system is used for interpreting the coordinates, basis vectors, and unit outcomes of different operations like differentiation.**kwargs – Keyword arguments passed to subclass initialization hooks. May include configuration such as ghost zone specifications, chunk size, domain bounds, and others.
- Raises:
GridInitializationError – Raised if any stage of the setup process fails, including coordinate system assignment, domain geometry, or boundary condition setup.
Notes
This method drives a three-stage initialization sequence by dispatching to the following hooks, each of which may be overridden by subclasses:
__configure_coordinate_system__
:Assigns the grid’s coordinate system. Subclasses may impose constraints (e.g., requiring orthogonality or specific dimensionality).
__configure_unit_system__
:Constructs the grid’s internal unit system based on a supplied
units
dictionary. This unit system informs coordinate scaling, basis behavior, and field interpretation.
__configure_domain__
:Defines the physical domain shape, bounding box, and optionally enables chunking. Subclasses must populate
self.__bbox__
,self.__dd__
, and if chunking is enabled,self.__chunking__
,self.__chunk_size__
, andself.__cdd__
.
__configure_boundary__
:Configures ghost cells and extended domain geometry. Subclasses must set
self.__ghost_zones__
,self.__ghost_dd__
, andself.__ghost_bbox__
.
After these steps,
__post_init__
is called, which may be optionally overridden by subclasses to finalize internal state.This class is abstract and cannot be instantiated directly. Concrete subclasses (e.g.,
GenericGrid
) must implement coordinate handling and domain-specific logic.