Coordinate Systems
Cocoa supports multiple cylindrical map projections for representing spherical Earth coordinates in the computational domain. This document describes the available projections and their mathematical formulations.
Overview
Coastal ocean models operate on a spherical Earth but require planar coordinates for finite element computation. Cocoa implements five cylindrical projections, each with different trade-offs between preserving angles, areas, and distances.
All projections use a reference point \((\lambda_0, \phi_0)\) as the origin and Earth’s radius \(R = 6378206.4\) m (Clarke 1866 equatorial radius).
Available Projections
Projection |
Config Name |
Angles |
Areas |
Pole Distortion |
|---|---|---|---|---|
Equidistant Cylindrical |
|
No |
No |
Moderate |
Equal Area |
|
No |
Yes |
None |
Mercator |
|
Yes |
No |
Extreme |
Miller |
|
Partial |
No |
Reduced |
Gall Stereographic |
|
Partial |
Partial |
Moderate |
Fig. 18 Comparison of three cylindrical projections supported by Cocoa. Green ellipses (Tissot indicatrices) show local distortion at different latitudes.
Equidistant Cylindrical (Default)
The equidistant cylindrical projection, also known as the Plate Carrée or Carte Parallelo-grammatique (CPP) projection, is Cocoa’s default. It corresponds to ADCIRC’s ICS=21 setting.
Projection equations:
Properties:
Preserves distances along meridians (constant latitude spacing)
Distorts east-west distances away from the reference latitude
Simple linear relationship between grid and geographic coordinates
Suitable for regional models where the reference latitude \(\phi_0\) is near the domain center
Scale factors:
The governing equations require derivatives in physical space. Because this projection uses \(\cos\phi_0\) rather than the local \(\cos\phi\), x-derivatives must be corrected:
For nodes near the reference latitude, \(S_x \approx 1\). At higher latitudes where \(\cos\phi < \cos\phi_0\), the scale factor exceeds unity.
Equal Area
The cylindrical equal-area projection preserves area relationships across the domain, making it suitable for analysis where accurate area representation is critical.
Projection equations:
Properties:
Preserves area (no distortion in integrated quantities)
Distorts shapes and angles, especially at high latitudes
No singularity at poles
Useful for mass conservation verification
Scale factors:
The projection exponent is 0, yielding scale factors:
Mercator
The Mercator projection is conformal (angle-preserving), historically used for navigation. It provides correct local angles but severely distorts areas at high latitudes.
Projection equations:
Properties:
Conformal (preserves local angles and shapes)
Severe area distortion approaching poles
Singularity at \(\phi = \pm 90^\circ\)
Best for equatorial and mid-latitude regions
Scale factors:
The projection exponent is 2, yielding:
The equal x and y scale factors reflect the conformal property.
Miller Cylindrical
The Miller projection is a compromise between Mercator and equal-area, reducing pole distortion while maintaining reasonable shape preservation.
Projection equations:
Properties:
Reduces extreme distortion near poles compared to Mercator
Neither conformal nor equal-area (a compromise)
Useful for whole-Earth visualizations
Less common for hydrodynamic modeling
Scale factors:
Uses modified latitude scaling with factor 0.4 instead of 1.0, reducing the rate of scale change with latitude.
Gall Stereographic
The Gall stereographic projection uses stereographic latitude scaling with standard parallels at approximately \(\pm 45^\circ\). It does not depend on a reference origin.
Projection equations:
Properties:
Standard parallels at \(\pm 45^\circ\) where distortion is minimized
Compromise between area and shape preservation
Independent of reference latitude (uses fixed standard parallels)
Moderate distortion throughout
Scale Factor System
Cocoa precomputes seven scale factors per element to correct the shallow water equations for projection distortions:
Scale Factor |
Purpose |
|---|---|
|
General coordinate distortion correction |
|
Corrects \(\partial u/\partial x\) in continuity equation |
|
Corrects \(\partial v/\partial y\) in continuity equation |
|
Corrects x-velocity derivatives in momentum equations |
|
Corrects y-velocity derivatives in momentum equations |
|
Y-coordinate correction (\(\cos\phi\) for spherical) |
|
Spherical geometry correction: \(\tan\phi / R\) |
General Scale Factor Formulas
For cylindrical projections with exponent \(p\) (where \(p=0\) for equal-area, \(p=1\) for equidistant, \(p=2\) for Mercator):
The \(S_{\tan\phi}\) factor appears in the spherical metric correction for Coriolis and lateral stress terms.
Application in Equations
GWCE Stiffness Matrix
The stiffness matrix for the \(\nabla \cdot (gH\nabla\zeta)\) term uses scale factors to correct gradient products:
where \(C_x = 1/S_x^2\) and \(C_y = 1\) for the equidistant cylindrical projection.
GWCE Mass Matrix
Nodal contributions to the mass matrix are weighted by \(\cos\phi\) to account for the spherical area element:
Momentum Equations
Velocity derivatives in the momentum equations are corrected by the momentum scale factors. For the pressure gradient:
The spherical metric correction in the effective Coriolis parameter uses \(S_{\tan\phi}\):
Configuration
Specify the projection in the YAML configuration file:
mesh:
filename: domain.nc
projection:
type: EquidistantCylindrical # Default
center: [-90.0, 29.0] # [longitude, latitude]
Available projection type values:
EquidistantCylindrical(default)EqualAreaMercatorMillerGallStereographic
The center specifies \((\lambda_0, \phi_0)\) in decimal
degrees. For most coastal applications, this should be near the center of
the computational domain.
Global Mesh Support
For global ocean modeling, Cocoa provides two features to handle challenges that arise when meshes span the entire Earth:
Prime meridian crossing detection (automatic)
Coordinate rotation (opt-in via configuration)
Prime Meridian Crossing
Elements that straddle the \(\pm 180\)° longitude line (antimeridian) can cause incorrect Jacobian calculations due to the discontinuity in longitude values. Cocoa automatically detects and corrects these elements during mesh initialization.
Detection Algorithm:
Normalize all element vertex longitudes to [0°, 360°)
Compute the element Jacobian and total edge length
If Jacobian < 0 OR edge length > 360°, the element likely crosses the meridian
Apply correction:
If exactly one vertex has longitude > 180°: subtract 360° from that vertex
If exactly one vertex has longitude < 180°: add 360° to that vertex
Verify the correction improved the geometry (positive Jacobian)
If not improved, revert to original coordinates
This handling is automatic and requires no user configuration. It is
implemented in GlobalMeshHandler.cpp and invoked during element projection
from BasisFunctions.cpp.
Coordinate Rotation
For global models that include polar regions, the geographic poles create singularities in the shallow water equations (infinite Coriolis at poles, converging meridians). Cocoa supports rotating the computational coordinate system so that the computational poles are located away from the geographic poles.
Mathematical Basis:
A 3x3 rotation matrix \(\mathbf{R}\) transforms geographic coordinates to a rotated system:
where \((x, y, z)\) are Cartesian coordinates on the unit sphere.
The rotation is specified by providing the location of the new North Pole
in geographic coordinates \((\lambda_{pole}, \phi_{pole})\). The rotation
matrix is constructed using ADCIRC’s GET_ROTMAT_ZNVEC algorithm, which
creates a rotation that moves the geographic North Pole to the specified location.
Workflow:
Coordinate transformation: All node coordinates are rotated from geographic \((\lambda, \phi)\) to rotated \((\lambda', \phi')\) coordinates
Physics computation: Coriolis parameter and spherical metric corrections use the rotated latitude \(\phi'\) (not geographic latitude)
Tidal potential: Uses geographic latitude \(\phi\) (physical requirement)
Velocity transformation: Per-node 2x2 matrices transform velocities between geographic (east, north) and rotated coordinate frames
Output: Velocities can be written in geographic frame for visualization
Configuration:
mesh:
rotation:
enabled: true
pole_location: [0.0, 0.0] # Move North Pole to equator at prime meridian
The pole_location specifies where the geographic North Pole will appear
in the rotated coordinate system, using the same format as ADCIRC’s
znorth_in_spherical_coors.
See Coordinate Rotation (Global Meshes) for full configuration options and Global Simulations for a practical guide.
Implementation Files
geometry/ProjectionTransformer.hpp: Projection type enum and conversionsgeometry/ProjectionTransformer.cpp: Projection implementationsgeometry/ProjectionScaleFactor.hpp: Scale factor data structuregeometry/BasisFunctions.cpp: Scale factor computationsgeometry/GlobalMeshHandler.hpp: Prime meridian crossing detectiongeometry/CoordinateRotation.hpp: Rotation matrix and spherical rotationgeometry/VelocityTransform.hpp: Velocity transformation matricesgeometry/RotationData.hpp: Container for rotation-related data