Skip to content

Support z-areas on single-column latitude-longitude grids#5660

Open
simone-silvestri wants to merge 2 commits into
mainfrom
ss/single-column-latlon-areas
Open

Support z-areas on single-column latitude-longitude grids#5660
simone-silvestri wants to merge 2 commits into
mainfrom
ss/single-column-latlon-areas

Conversation

@simone-silvestri

Copy link
Copy Markdown
Collaborator

The exact spherical z-area formulas for latitude-longitude grids with on-the-fly metrics read neighboring latitude faces (sin φ[j+1] − sin φ[j]). This throws a BoundsError on single-column grids.

The latitudinal sine differences are factored into Δsindφᵃᶠᵃ / Δsindφᵃᶜᵃ helpers that degenerate to a unit factor when both horizontal directions are Flat, mirroring the Δ = 1 convention for Flat spacings.

The exact spherical z-area formulas for latitude-longitude grids with
on-the-fly metrics read neighboring latitude faces (sin φ[j+1] − sin φ[j]).
Grids with Flat horizontal topology carry a single coordinate per Flat
dimension, so any operator touching Az — for example a turbulence closure's
stress divergence through V⁻¹ — threw a BoundsError on single-column grids.

The latitudinal sine differences are factored into Δsindφᵃᶠᵃ / Δsindφᵃᶜᵃ
helpers that degenerate to a unit factor when both horizontal directions are
Flat, mirroring the Δ = 1 convention for Flat spacings. With both directions
Flat all horizontal flux divergences vanish and a constant Az cancels between
the vertical flux areas and the volume, so the choice is exactly consistent.
Single-column hydrostatic models can now use explicit closures.

Grids that are Flat in only one horizontal direction still need
Δx- or Δy-consistent area definitions and are left for a follow-up.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread src/Operators/spacings_and_areas_and_volumes.jl Outdated
@glwagner

glwagner commented Jun 9, 2026

Copy link
Copy Markdown
Member

Single column grids should use RectilinearGrid. We support specifying a horizontal location by specifying singleton x, y coordinates.

@simone-silvestri

Copy link
Copy Markdown
Collaborator Author

well, I guess it is still good to clear an error that could occur. In the end it is a small change to allow supporting a LatitudeLongitudeGrid.

@glwagner

Copy link
Copy Markdown
Member

Well, we should decide which one we want to use and support just one way to do it, I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants