Skip to content

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   and unit vectors , , and . By convention, points east, points north, and points "upward", opposite to the direction of gravitational acceleration.

We denote time with , partial derivatives with respect to time or a coordinate with or , and the gradient operator

Horizontal gradients are

We use , , and to denote the velocity components in the , , and directions, such that the three-dimensional velocity is    . We use    to denote the horizontal velocity.

Geographic coordinates

Geographic (or spherical) coordinates represent longitude, latitude, and the vertical coordinate and are used by LatitudeLongitudeGrid and OrthogonalSphericalShellGrid. The corresponding unit vectors are , , and and at each grid location the point eastward, northward, and upward (radially outward from the center of the sphere) respectively.

The velocity components in geographic coordinates are where is the eastward velocity, is the northward velocity, and is the vertical velocity:

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 , momentum fluxes, and other vector quantities are represented in the intrinsic coordinate system, aligned with the local grid directions.

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.