thermal_driving_impl Subroutine

private pure subroutine thermal_driving_impl(t_far, s_far, p_top, active, eos, buf)

Uses

  • proc~~thermal_driving_impl~~UsesGraph proc~thermal_driving_impl thermal_driving_impl module~rdb_eos rdb_eos proc~thermal_driving_impl->module~rdb_eos module~rdb_constants rdb_constants module~rdb_eos->module~rdb_constants module~rdb_grid rdb_grid module~rdb_eos->module~rdb_grid pic_types pic_types module~rdb_constants->pic_types module~rdb_grid->module~rdb_constants

T_far − eos_freezing_point(eos, S_far, p_top). The liquidus comes off the SAME eos_t handle the solve used (&ocean_eos_nml tfreeze_set), never a local copy of the coefficients — the two sets differ by ~0.03 degC, which is enough to flip the sign of this field.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: t_far(:,:)
real(kind=wp), intent(in) :: s_far(:,:)
real(kind=wp), intent(in) :: p_top(:,:)
real(kind=wp), intent(in) :: active(:,:)
type(eos_t), intent(in) :: eos
real(kind=wp), intent(inout) :: buf(:,:,:)

Calls

proc~~thermal_driving_impl~~CallsGraph proc~thermal_driving_impl thermal_driving_impl proc~eos_freezing_point eos_freezing_point proc~thermal_driving_impl->proc~eos_freezing_point

Called by

proc~~thermal_driving_impl~~CalledByGraph proc~thermal_driving_impl thermal_driving_impl proc~fill_thermal_driving fill_thermal_driving proc~fill_thermal_driving->proc~thermal_driving_impl

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j
integer, private :: nx
integer, private :: ny
real(kind=wp), private :: qnan

Source Code

   pure subroutine thermal_driving_impl(t_far, s_far, p_top, active, eos, buf)
      !! `T_far − eos_freezing_point(eos, S_far, p_top)`.  The liquidus
      !! comes off the SAME `eos_t` handle the solve used
      !! (`&ocean_eos_nml tfreeze_set`), never a local copy of the
      !! coefficients — the two sets differ by ~0.03 degC, which is
      !! enough to flip the sign of this field.
      ! assumed-shape-ok: diag fill — fires once per output frame (cadence-bounded).
      use rdb_eos, only: eos_t, eos_freezing_point
      real(wp), intent(in)    :: t_far(:, :), s_far(:, :)  ! assumed-shape-ok: diag fill — cadence-bounded
      real(wp), intent(in)    :: p_top(:, :), active(:, :)  ! assumed-shape-ok: diag fill — cadence-bounded
      type(eos_t), intent(in) :: eos
      real(wp), intent(inout) :: buf(:, :, :)  ! assumed-shape-ok: diag fill — cadence-bounded
      integer :: i, j, nx, ny
      real(wp) :: qnan
      nx = min(size(buf, 1), size(t_far, 1), size(p_top, 1), size(active, 1))
      ny = min(size(buf, 2), size(t_far, 2), size(p_top, 2), size(active, 2))
      qnan = ieee_value(0.0_wp, ieee_quiet_nan)
      do concurrent(j=1:ny, i=1:nx)
         if (active(i, j) > 0.5_wp) then
            buf(i, j, 1) = t_far(i, j) - eos_freezing_point(eos, s_far(i, j), p_top(i, j))
         else
            buf(i, j, 1) = qnan
         end if
      end do
   end subroutine thermal_driving_impl