apply_surface_restore_2d_cover_impl Subroutine

private pure subroutine apply_surface_restore_2d_cover_impl(hTr, budget, h_layer, wet_mask, cover_frac, dt_piston, tgt, h_min, nz, nx, ny)

Ice-shelf-cover twin of apply_surface_restore_2d_impl: the open-water factor 1 - cover_frac composes multiplicatively with wet_mask, so a covered column receives EXACTLY zero restoring — and, because the same factor multiplies the budget mirror, exactly zero restoring shows up in the heat/salt surface budget there too. Separate _impl, not an in-loop present() test (house idiom).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: hTr(nx,ny,nz)
real(kind=wp), intent(inout) :: budget(nx,ny,nz)
real(kind=wp), intent(in) :: h_layer(nx,ny,nz)
real(kind=wp), intent(in) :: wet_mask(nx,ny)
real(kind=wp), intent(in) :: cover_frac(nx,ny)
real(kind=wp), intent(in) :: dt_piston
real(kind=wp), intent(in) :: tgt
real(kind=wp), intent(in) :: h_min
integer, intent(in) :: nz
integer, intent(in) :: nx
integer, intent(in) :: ny

Calls

proc~~apply_surface_restore_2d_cover_impl~~CallsGraph proc~apply_surface_restore_2d_cover_impl apply_surface_restore_2d_cover_impl local local proc~apply_surface_restore_2d_cover_impl->local

Called by

proc~~apply_surface_restore_2d_cover_impl~~CalledByGraph proc~apply_surface_restore_2d_cover_impl apply_surface_restore_2d_cover_impl proc~ocean_surface_restore_apply_tracers ocean_surface_restore_apply_tracers proc~ocean_surface_restore_apply_tracers->proc~apply_surface_restore_2d_cover_impl proc~apply_sw_and_restore apply_sw_and_restore proc~apply_sw_and_restore->proc~ocean_surface_restore_apply_tracers proc~run_stage run_stage proc~run_stage->proc~apply_sw_and_restore proc~run_stage_split run_stage_split proc~run_stage_split->proc~apply_sw_and_restore proc~ocean_dyn_step ocean_dyn_step proc~ocean_dyn_step->proc~run_stage proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~run_stage_split proc~engine_step engine_step proc~engine_step->proc~ocean_dyn_step proc~engine_step->proc~ocean_dyn_step_split

Variables

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

Source Code

   pure subroutine apply_surface_restore_2d_cover_impl(hTr, budget, h_layer, &
                                                       wet_mask, cover_frac, dt_piston, &
                                                       tgt, h_min, nz, nx, ny)
      !! Ice-shelf-cover twin of `apply_surface_restore_2d_impl`: the
      !! open-water factor `1 - cover_frac` composes multiplicatively
      !! with `wet_mask`, so a covered column receives EXACTLY zero
      !! restoring — and, because the same factor multiplies the budget
      !! mirror, exactly zero restoring shows up in the heat/salt
      !! surface budget there too.  Separate `_impl`, not an in-loop
      !! `present()` test (house idiom).
      integer, intent(in)    :: nz, nx, ny
      real(wp), intent(inout) :: hTr(nx, ny, nz)
      real(wp), intent(inout) :: budget(nx, ny, nz)
      real(wp), intent(in)    :: h_layer(nx, ny, nz)
      real(wp), intent(in)    :: wet_mask(nx, ny)
      real(wp), intent(in)    :: cover_frac(nx, ny)
      real(wp), intent(in)    :: dt_piston, tgt, h_min
      integer :: i, j
      real(wp) :: surf, inc
      do concurrent(j=1:ny, i=1:nx) local(surf, inc)
         ! vanished-ok: surface restoring measures the surface concentration against a
         ! CALLER-supplied floor `h_min` (a restoring depth), not the
         ! vanish marker; zero would restore toward a fictitious fresh sea.
         surf = hTr(i, j, nz)/max(h_layer(i, j, nz), h_min)
         inc = dt_piston*(tgt - surf)*wet_mask(i, j)*(1.0_wp - cover_frac(i, j))
         hTr(i, j, nz) = hTr(i, j, nz) + inc
         budget(i, j, nz) = budget(i, j, nz) + inc
      end do
   end subroutine apply_surface_restore_2d_cover_impl