Skip to content

Grid Classes

Arakawa C-grid spatial discretization containers for 1-D, 2-D, and 3-D domains.

1-D Grid

finitevolx.ArakawaCGrid1D

Bases: Module

1-D Arakawa C-grid topology (no metric).

Records only the integer dimension and the ghost-cell convention; no physical spacing. Concrete subclasses (CartesianGrid1D, etc.) attach a metric.

Parameters:

Name Type Description Default
Nx int

Total number of cells in x (including 2 ghost cells).

required
Notes

Array layout (total length Nx)::

i= 0    1    2   ...   Nx-2  Nx-1
  [g]  [ ]  [ ]  ...    [ ]  [g]
   ^    \______ interior ______/    ^
ghost                              ghost
(west)                             (east)

The 1-D C-grid uses two staggering locations (T-cell centres and U-east-faces); see CartesianGrid1D for the colocation rule.

Source code in finitevolx/_src/grid/base.py
class ArakawaCGrid1D(eqx.Module):
    """1-D Arakawa C-grid topology (no metric).

    Records only the integer dimension and the ghost-cell convention;
    no physical spacing.  Concrete subclasses (``CartesianGrid1D``,
    etc.) attach a metric.

    Parameters
    ----------
    Nx : int
        Total number of cells in x (including 2 ghost cells).

    Notes
    -----
    Array layout (total length ``Nx``)::

        i= 0    1    2   ...   Nx-2  Nx-1
          [g]  [ ]  [ ]  ...    [ ]  [g]
           ^    \\______ interior ______/    ^
        ghost                              ghost
        (west)                             (east)

    The 1-D C-grid uses two staggering locations (T-cell centres and
    U-east-faces); see ``CartesianGrid1D`` for the colocation rule.
    """

    Nx: int

2-D Grid

finitevolx.ArakawaCGrid2D

Bases: Module

2-D Arakawa C-grid topology (no metric).

Records only the integer dimensions and the ghost-cell convention; no physical spacing. Concrete subclasses (CartesianGrid2D, SphericalGrid2D, ...) attach a metric.

Parameters:

Name Type Description Default
Nx int

Total number of cells in x (including 2 ghost cells).

required
Ny int

Total number of cells in y (including 2 ghost cells).

required
Notes

Array layout (total shape [Ny, Nx])::

j=Ny-1  +--+--+--+--+  ghost row (north)
        |  |  |  |  |
j=Ny-2  +--+--+--+--+
        |  |  |  |  |  physical interior  [1:-1, 1:-1]
j=1     +--+--+--+--+
        |  |  |  |  |
j=0     +--+--+--+--+  ghost row (south)
        i=0  ...    i=Nx-1
        ghost      ghost
        (west)     (east)

The 2-D C-grid uses four staggering locations (T, U, V, X); array index [j, i] encodes the south-west corner of the stencil neighbourhood. See CartesianGrid2D for the colocation rule.

Source code in finitevolx/_src/grid/base.py
class ArakawaCGrid2D(eqx.Module):
    """2-D Arakawa C-grid topology (no metric).

    Records only the integer dimensions and the ghost-cell convention;
    no physical spacing.  Concrete subclasses (``CartesianGrid2D``,
    ``SphericalGrid2D``, ...) attach a metric.

    Parameters
    ----------
    Nx : int
        Total number of cells in x (including 2 ghost cells).
    Ny : int
        Total number of cells in y (including 2 ghost cells).

    Notes
    -----
    Array layout (total shape ``[Ny, Nx]``)::

        j=Ny-1  +--+--+--+--+  ghost row (north)
                |  |  |  |  |
        j=Ny-2  +--+--+--+--+
                |  |  |  |  |  physical interior  [1:-1, 1:-1]
        j=1     +--+--+--+--+
                |  |  |  |  |
        j=0     +--+--+--+--+  ghost row (south)
                i=0  ...    i=Nx-1
                ghost      ghost
                (west)     (east)

    The 2-D C-grid uses four staggering locations (T, U, V, X); array
    index ``[j, i]`` encodes the **south-west** corner of the stencil
    neighbourhood.  See ``CartesianGrid2D`` for the colocation rule.
    """

    Nx: int
    Ny: int

3-D Grid

finitevolx.ArakawaCGrid3D

Bases: Module

3-D Arakawa C-grid topology (no metric).

Records only the integer dimensions and the ghost-cell convention; no physical spacing. Concrete subclasses (CartesianGrid3D, SphericalGrid3D, ...) attach a metric.

Parameters:

Name Type Description Default
Nx int

Total number of cells in x (including 2 ghost cells).

required
Ny int

Total number of cells in y (including 2 ghost cells).

required
Nz int

Total number of cells in z (including 2 ghost cells).

required
Notes

Array layout (total shape [Nz, Ny, Nx]). Each z-level is a 2-D slab identical to ArakawaCGrid2D::

k=Nz-1  +================+  ghost slab (top)
        |   2-D slab     |
k=Nz-2  +================+
        |   2-D slab     |  physical interior  [1:-1, 1:-1, 1:-1]
k=1     +================+
        |   2-D slab     |
k=0     +================+  ghost slab (bottom)

Only the horizontal axes are staggered (T, U, V, X share the same z-level); vertical staggering for W-fields uses a separate [Nz+1, Ny, Nx] array — see finitevolx._src.operators.diagnostics.vertical_velocity.

Source code in finitevolx/_src/grid/base.py
class ArakawaCGrid3D(eqx.Module):
    """3-D Arakawa C-grid topology (no metric).

    Records only the integer dimensions and the ghost-cell convention;
    no physical spacing.  Concrete subclasses (``CartesianGrid3D``,
    ``SphericalGrid3D``, ...) attach a metric.

    Parameters
    ----------
    Nx : int
        Total number of cells in x (including 2 ghost cells).
    Ny : int
        Total number of cells in y (including 2 ghost cells).
    Nz : int
        Total number of cells in z (including 2 ghost cells).

    Notes
    -----
    Array layout (total shape ``[Nz, Ny, Nx]``).  Each z-level is a
    2-D slab identical to ``ArakawaCGrid2D``::

        k=Nz-1  +================+  ghost slab (top)
                |   2-D slab     |
        k=Nz-2  +================+
                |   2-D slab     |  physical interior  [1:-1, 1:-1, 1:-1]
        k=1     +================+
                |   2-D slab     |
        k=0     +================+  ghost slab (bottom)

    Only the horizontal axes are staggered (T, U, V, X share the same
    z-level); vertical staggering for W-fields uses a separate
    ``[Nz+1, Ny, Nx]`` array — see
    ``finitevolx._src.operators.diagnostics.vertical_velocity``.
    """

    Nx: int
    Ny: int
    Nz: int