polaris.tasks.ocean.horiz_press_grad.finite_volume.anchor_difference
- polaris.tasks.ocean.horiz_press_grad.finite_volume.anchor_difference(pieces: dict, order: int = 2, guards: set[str] | None = None) float[source]
The design’s
[anchor]: the fixed-pressure height difference at the interface the scan starts from.\[D_{K+1} = \Delta_e Z_{K+1} - \frac{1}{g}\,\Delta_e \int_{p_{i,K+1}}^{\bar q_{K+1}} \hat\alpha^{(e)}_i(p)\,dp\]The two columns’ interfaces sit at different pressures, so this is their geometric height difference corrected to the common pressure \(\bar q_{K+1}\). The two short integrals are over different pressure ranges and so cannot be combined into a matched-pressure difference the way the interior can; each is taken inside that column’s own outermost layer.
The anchor is at the sea floor (design §3.7.4), \(K\) being the deepest layer valid in both columns. Which end it sits at is not a free choice and not merely a conditioning preference:
VertCoord builds geometric height upward from a prescribed bathymetry, accumulating \(\rho_0\alpha_{i,k}\tilde h_{i,k}\) over each column’s own layers. On a profile the reconstruction does not resolve, two columns with different layer partitions give sums differing at \(O(\tilde h^2)\), so their derived sea-surface heights differ by that much even when the two columns hold the same water. Anchored at the surface that discrepancy enters \(D_1\) directly and exactness is lost; anchored at the sea floor over a flat floor \(\Delta_e Z\) is exact input and vanishes identically.
The two ends therefore agree only for profiles inside the exact set, where both columns’ sums agree term by term. The
anchor_at_surfaceguard exists to measure the gap rather than assume it.
Where the two columns have different
maxLevelCellthis needs no special case: the anchor sits at the deepest interface index valid in both, which is the shallower column’s own floor and an interior interface of the deeper one, and each column is shifted to the common pressure from whichever interface pressure it has there.The anchor is computed, not assumed. It is whatever the model’s geometric heights and interface pressures imply, evaluated at a common pressure, and it is the deepest instance of the same fixed-pressure comparison the recurrence makes at every other interface. A state only approximately at rest carries a real gradient, and the scheme reports it.
The shift to a common pressure never spans more than one layer. The short integrals use one first-order expansion, so stretched across a floor offset of several layers – as terrain-following layers over a steep slope produce – they leave an error that grows with the cube of the offset and is the same at every depth. Where the shallower floor’s pressure lies above the deeper column’s own layer
K, the deeper column is represented instead by its own interface at or just below that pressure, its height there taken fromGeomZInterface, and the expansion is shared by the two layers that meet there. The result is then carried down to \(\bar q_{K+1}\) with the matched-pressure integrand, which vanishes on the exact set. Where the floors are within one layer of each other, which includes every flat floor and every floor cut by partial cells beneath level interior layers, this is the comparison above unchanged. It mirrors Omega’sPressureGrad::computeColumnScan.- Parameters:
pieces (dict) – From
matched_pressure_pieces().order (int) – Number of Gauss-Legendre points, matching Omega’s
QuadraturePoints. The integrand is linear in pressure within a layer, so 2 integrates it exactly.guards (set of str, optional) – Verification-only switches; see
finite_volume_hpga().
- Returns:
anchor (float) – \(D\) at
anchor_index(), in m.