polaris.tasks.ocean.horiz_press_grad.finite_volume.layer_mean_difference
- polaris.tasks.ocean.horiz_press_grad.finite_volume.layer_mean_difference(pieces: dict, order: int = 2, guards: set[str] | None = None) ndarray[source]
The layer mean of \(\Delta_e z(p)\) over each edge layer.
Within an edge layer
[qbar_k, qbar_{k+1}], \(\Delta_e z(p) = D_{k+1} + \frac{1}{g}\int_{p}^{\bar q_{k+1}} \Delta_e\hat\alpha\), so averaging over the layer and integrating the double integral by parts gives\[\langle\Delta_e z\rangle_k = D_{k+1} + \frac{1}{g\,\Delta p_{e,k}} \int_{\bar q_k}^{\bar q_{k+1}} (p - \bar q_k)\,\Delta_e\hat\alpha(p)\,dp\]which is the “second moment of the same integrand over the same interval” of design §3.5.1, on the same quadrature points as the scan.
The moment is taken about the layer’s top interface and paired with \(D_{k+1}\) at its bottom one, the end nearer the sea-floor anchor (design §4.1.3). The mirror form – \(D_k\) with a moment about the bottom – is the same number in exact arithmetic and a different one at finite quadrature, so it is not an interchangeable way to write this.
- Parameters:
pieces (dict) – From
matched_pressure_pieces().order (int) – Number of Gauss-Legendre points, matching Omega’s
QuadraturePoints.guards (set of str, optional) – Verification-only switches; see
finite_volume_hpga().
- Returns:
mean (numpy.ndarray) – \(\langle\Delta_e z\rangle_k\) in m, one per edge layer.