Diagnostic helper: D(i,j,k) = hTr_ps/h - hTr_s/h, i.e. the
pseudo-salt concentration minus the salinity concentration.
A vanished layer (rdb_vl_is_live false — the ONE predicate, see
src/core/ocean/README.md, “The vanished-layer content rule”)
writes missing, which the caller passes as the IEEE NaN sentinel
fill_tracer_impl uses for the two concentrations this is the
difference of. It used to write 0 below a private 1e-6 m
floor: a deviation of zero is the one value this diagnostic
exists to report as “the two transport paths agree”, so a filler
read as a perfect score, and layers between 1e-6 m and
H_VANISHED were divided through at all.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | h_layer(nx,ny,nz) | |||
| real(kind=wp), | intent(in) | :: | hTr_ps(nx,ny,nz) | |||
| real(kind=wp), | intent(in) | :: | hTr_s(nx,ny,nz) | |||
| real(kind=wp), | intent(inout) | :: | buf(nx,ny,nz) | |||
| integer, | intent(in) | :: | nx | |||
| integer, | intent(in) | :: | ny | |||
| integer, | intent(in) | :: | nz | |||
| real(kind=wp), | intent(in) | :: | missing |
Value written on a vanished layer (the diagnostics’ NaN). |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private | :: | h | ||||
| integer, | private | :: | i | ||||
| integer, | private | :: | j | ||||
| integer, | private | :: | k |
pure subroutine ocean_pseudo_salt_deviation(h_layer, hTr_ps, hTr_s, buf, nx, ny, nz, & missing) !! Diagnostic helper: `D(i,j,k) = hTr_ps/h - hTr_s/h`, i.e. the !! pseudo-salt concentration minus the salinity concentration. !! !! A vanished layer (`rdb_vl_is_live` false — the ONE predicate, see !! `src/core/ocean/README.md`, "The vanished-layer content rule") !! writes `missing`, which the caller passes as the IEEE NaN sentinel !! `fill_tracer_impl` uses for the two concentrations this is the !! difference of. It used to write `0` below a private `1e-6 m` !! floor: a deviation of zero is the one value this diagnostic !! exists to report as "the two transport paths agree", so a filler !! read as a perfect score, and layers between `1e-6 m` and !! `H_VANISHED` were divided through at all. integer, intent(in) :: nx, ny, nz real(wp), intent(in) :: h_layer(nx, ny, nz) real(wp), intent(in) :: hTr_ps(nx, ny, nz) real(wp), intent(in) :: hTr_s(nx, ny, nz) real(wp), intent(inout) :: buf(nx, ny, nz) real(wp), intent(in) :: missing !! Value written on a vanished layer (the diagnostics' NaN). integer :: i, j, k real(wp) :: h do concurrent(k=1:nz, j=1:ny, i=1:nx) h = h_layer(i, j, k) if (rdb_vl_is_live(h)) then buf(i, j, k) = rdb_vl_conc(hTr_ps(i, j, k), h) - rdb_vl_conc(hTr_s(i, j, k), h) else buf(i, j, k) = missing end if end do end subroutine ocean_pseudo_salt_deviation