Axes¶
Axes are the one-dimensional building blocks from which grids are constructed.
Each axis defines a set of collocation points and the associated
differentiation and integration rules along a single coordinate direction.
Use create_axis() to build an axis of the desired type, or
instantiate one of the concrete classes directly.
- numgrids.create_axis(axis_type: AxisType, num_points: int, low: float, high: float, **kwargs) Axis[source]¶
Create an Axis object of a given type.
- Parameters:
- Return type:
Axis object of specified type.
- class numgrids.AxisType(*values)[source]¶
Enumeration of available axis types.
Members¶
- EQUIDISTANT
Uniformly spaced grid points (non-periodic).
- EQUIDISTANT_PERIODIC
Uniformly spaced grid points with periodic boundary conditions.
- CHEBYSHEV
Chebyshev-node spacing for spectral accuracy on non-periodic domains.
- LOGARITHMIC
Logarithmically spaced grid points (requires
low > 0).
- class numgrids.axes.EquidistantAxis(num_points: int, low: float = 0, high: float = 1, periodic: bool = False, **kwargs)[source]¶
Axis with uniformly spaced grid points.
Supports both non-periodic and periodic boundary conditions. When periodic, the FFT spectral differentiation method is used; otherwise classical finite differences are employed.
For a periodic axis the last point is not included (it would coincide with the first point after wrapping).
Create an equidistant axis.
- Parameters:
num_points (int) – Number of grid points.
low (float, optional) – Lower coordinate bound (default
0).high (float, optional) – Upper coordinate bound (default
1).periodic (bool, optional) – Whether to apply periodic boundary conditions (default
False).**kwargs – Additional keyword arguments forwarded to
Axis(e.g.name).
- class numgrids.axes.ChebyshevAxis(num_points: int, low: float = 0, high: float = 1, **kwargs)[source]¶
Axis with grid points at Chebyshev nodes.
The Chebyshev nodes are defined as
\[x_k = \cos\!\left(\frac{k\pi}{N-1}\right), \quad k = 0, \ldots, N-1\]on the canonical interval
[-1, 1], then linearly mapped to[low, high]. Points cluster near the boundaries, which avoids the Runge phenomenon and enables spectral accuracy for smooth, non-periodic functions.Constructor
- Parameters:
- class numgrids.axes.LogAxis(num_points: int, low: float, high: float, **kwargs)[source]¶
Axis with logarithmically spaced grid points.
Internally the coordinate is transformed to a uniform grid on
[ln(low), ln(high)]. Differentiation uses finite differences on the log-scale and applies the chain rule\[\frac{df}{dx} = \frac{1}{x}\,\frac{df}{d(\ln x)}\]This is useful for problems where fine resolution is needed near the lower boundary (e.g. radial coordinates close to zero).
lowmust be strictly positive.Constructor for LogAxis
- Parameters: