polaris.tasks.ocean.horiz_press_grad.finite_volume.centered_shift

polaris.tasks.ocean.horiz_press_grad.finite_volume.centered_shift(ds: Dataset) → DataArray[source]

The first-order fixed-pressure shift S_{e,k} of the design’s [centered-shift],

\[S_{e,k} = \tfrac{1}{2}\left(\Delta_e Z_{k} + \Delta_e Z_{k+1}\right) + \frac{\bar\alpha_{e,k}}{2g}\left(\Delta_e q_{k} + \Delta_e q_{k+1}\right),\]

where \(Z\) is the geometric height at layer interfaces, \(q\) the gauge pressure at layer interfaces, and \(\bar\alpha_{e,k}\) the edge average of the layer-mean specific volume.

The centered scheme’s entire Montgomery-potential apparatus is this conversion and nothing else, so hpga_from_shift(centered_shift(ds), dx) reproduces the HPGA field written by Init to round-off, at any coordinate tilt.

Parameters:

ds (xarray.Dataset) – The two-column state, which must contain GeomZInterface, ZTildeInterface and SpecVol. Invalid layers are NaN and propagate as NaN.

Returns:

shift (xarray.DataArray) – S_{e,k} at layer midpoints, in m, with the nCells dimension contracted away by the edge operator.