ocean_pseudo_salt_deviation Subroutine

public 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.

Arguments

Type IntentOptional 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).


Calls

proc~~ocean_pseudo_salt_deviation~~CallsGraph proc~ocean_pseudo_salt_deviation ocean_pseudo_salt_deviation rdb_vl_conc rdb_vl_conc proc~ocean_pseudo_salt_deviation->rdb_vl_conc rdb_vl_is_live rdb_vl_is_live proc~ocean_pseudo_salt_deviation->rdb_vl_is_live

Called by

proc~~ocean_pseudo_salt_deviation~~CalledByGraph proc~ocean_pseudo_salt_deviation ocean_pseudo_salt_deviation proc~fill_pseudo_salt_diff fill_pseudo_salt_diff proc~fill_pseudo_salt_diff->proc~ocean_pseudo_salt_deviation

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: h
integer, private :: i
integer, private :: j
integer, private :: k

Source Code

   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