polaris.tasks.ocean.horiz_press_grad.finite_volume.finite_volume_hpga

polaris.tasks.ocean.horiz_press_grad.finite_volume.finite_volume_hpga(ds: Dataset, dx: float, order: int = 2, guards: set[str] | None = None) → DataArray[source]

The assembled FiniteVolume horizontal pressure-gradient acceleration, design [ho-exact].

\[T^p_{e,k} = -\frac{g}{d_e}\,\langle\Delta_e z\rangle_k\]

The tidal-potential and self-attraction-and-loading terms are identically zero in these configurations and are omitted.

Parameters:
  • ds (xarray.Dataset) – The two-column state.

  • dx (float) – The distance d_e between the two columns in m.

  • order (int) – Number of Gauss-Legendre points, matching Omega’s QuadraturePoints. Exactness does not depend on it (design §3.5, consequence 2), so it is an ordinary accuracy knob – but it is not a free one: Omega and Polaris must integrate with the same rule, or omega_vs_polaris_rms_threshold compares two different algorithms rather than two implementations of one. Both are driven by the quadrature_points config option.

  • guards (set of str, optional) –

    Verification-only switches, each deliberately breaking one rule:

    'cell_local_expansion'

    expand about each cell’s own state instead of the edge-shared one.

    'state_by_index'

    evaluate each column at its own layer k instead of the layer containing the pressure.

    'anchor_delta_z_only'

    take the anchor as Delta_e Z alone, dropping the correction to a common pressure.

    'anchor_at_surface'

    anchor the column scan at the sea surface instead of the sea floor. Not a mistake in the arithmetic but a different choice of end, which the design settles in favour of the floor; see anchor_difference(). It exists so the gap between the two can be measured rather than assumed.

Returns:

hpga (xarray.DataArray) – The edge-normal acceleration in m s-2, at layer midpoints, NaN where a layer is not valid in both columns.