Coordinate systems
Every grid in Oceananigans is associated with an extrinsic coordinate system. The extrinsic coordinate system is either Cartesian or geographic (spherical / latitude-longitude).
Cartesian coordinates
Cartesian coordinates are used by RectilinearGrid and provide a local, flat (Euclidean) representation of space with coordinates
We denote time with
Horizontal gradients are
We use
Geographic coordinates
Geographic (or spherical) coordinates LatitudeLongitudeGrid and OrthogonalSphericalShellGrid. The corresponding unit vectors are
The velocity components in geographic coordinates are
Intrinsic coordinates on OrthogonalSphericalShellGrid
While RectilinearGrid and LatitudeLongitudeGrid have extrinsic and intrinsic coordinate systems that coincide, the OrthogonalSphericalShellGrid also possesses an intrinsic coordinate system that is associated with the local grid directions.
The intrinsic coordinate system on an OrthogonalSphericalShellGrid is defined by the orientation of the grid lines at each point. This intrinsic system may be rotated relative to the extrinsic geographic coordinates (latitude and longitude). Vectors such as C-grid velocity components
The operators intrinsic_vector and extrinsic_vector convert vectors between these two coordinate systems:
intrinsic_vector: Converts from extrinsic (geographic) to intrinsic (grid-aligned) coordinates.extrinsic_vector: Converts from intrinsic (grid-aligned) to extrinsic (geographic) coordinates.
For example, to set velocities on an OrthogonalSphericalShellGrid from geographic velocity data, the velocities must first be rotated from geographic to intrinsic coordinates.