apply_surface_src_2d_dyn_impl Subroutine

private pure subroutine apply_surface_src_2d_dyn_impl(hTr, budget, wet_mask, wet_dyn, Q_field, inv_scale, k_top, nz, nx, ny)

Wet/dry variant of apply_surface_src_2d_impl: the DYNAMIC cell wet mask composes multiplicatively with the static one, so a dynamically dry column (total depth below &ocean_wetdry_nml dry_depth) receives NO surface flux — heating a mm-scale residual sliver would blow its temperature up (docs/ocean_wetdry_plan.md §4.4). Separate _impl (not an in-loop optional test): the knob-off path keeps the original kernel untouched, byte-identical.

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) :: wet_mask(nx,ny)
real(kind=wp), intent(in) :: wet_dyn(nx,ny)
real(kind=wp), intent(in) :: Q_field(nx,ny)
real(kind=wp), intent(in) :: inv_scale
integer, intent(in) :: k_top(nx,ny)

See apply_surface_src_2d_impl.

integer, intent(in) :: nz
integer, intent(in) :: nx
integer, intent(in) :: ny

Calls

proc~~apply_surface_src_2d_dyn_impl~~CallsGraph proc~apply_surface_src_2d_dyn_impl apply_surface_src_2d_dyn_impl local local proc~apply_surface_src_2d_dyn_impl->local

Called by

proc~~apply_surface_src_2d_dyn_impl~~CalledByGraph proc~apply_surface_src_2d_dyn_impl apply_surface_src_2d_dyn_impl proc~ocean_surface_flux_apply_tracers ocean_surface_flux_apply_tracers proc~ocean_surface_flux_apply_tracers->proc~apply_surface_src_2d_dyn_impl proc~run_stage run_stage proc~run_stage->proc~ocean_surface_flux_apply_tracers proc~run_stage_split run_stage_split proc~run_stage_split->proc~ocean_surface_flux_apply_tracers 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 proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step

Variables

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

Source Code

   pure subroutine apply_surface_src_2d_dyn_impl(hTr, budget, wet_mask, wet_dyn, &
                                                 Q_field, inv_scale, k_top, nz, nx, ny)
      !! Wet/dry variant of `apply_surface_src_2d_impl`: the DYNAMIC cell
      !! wet mask composes multiplicatively with the static one, so a
      !! dynamically dry column (total depth below `&ocean_wetdry_nml
      !! dry_depth`) receives NO surface flux — heating a mm-scale
      !! residual sliver would blow its temperature up
      !! (docs/ocean_wetdry_plan.md §4.4).  Separate _impl (not an
      !! in-loop optional test): the knob-off path keeps the original
      !! kernel untouched, byte-identical.
      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)    :: wet_mask(nx, ny)
      real(wp), intent(in)    :: wet_dyn(nx, ny)
      real(wp), intent(in)    :: Q_field(nx, ny)
      real(wp), intent(in)    :: inv_scale
      integer, intent(in)    :: k_top(nx, ny)
         !! See `apply_surface_src_2d_impl`.
      integer :: i, j
      real(wp) :: cell
      do concurrent(j=1:ny, i=1:nx) local(cell)
         cell = inv_scale*Q_field(i, j)*wet_mask(i, j)*wet_dyn(i, j)
         hTr(i, j, k_top(i, j)) = hTr(i, j, k_top(i, j)) + cell
         budget(i, j, k_top(i, j)) = budget(i, j, k_top(i, j)) + cell
      end do
   end subroutine apply_surface_src_2d_dyn_impl