relax_map_u_impl Subroutine

private pure subroutine relax_map_u_impl(u, u_ref, idamp_u, nxu, ny, nz, dt)

Relax u_face_x_layer toward u_ref at rate idamp_u. Explicit- shape dummies, dims declared first (decl-order hook). idamp_u(i,j) <= 0 is a bit-exact no-op (Idamp = 0 IS the sponge mask; also guarantees sponge_idamp_zero_is_exact_identity, since decay = exp(-0*dt) = 1.0 exactly would already be a no-op algebraically — the early if skips the arithmetic entirely instead of relying on that).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: u(nxu,ny,nz)
real(kind=wp), intent(in) :: u_ref(nxu,ny,nz)
real(kind=wp), intent(in) :: idamp_u(nxu,ny)
integer, intent(in) :: nxu
integer, intent(in) :: ny
integer, intent(in) :: nz
real(kind=wp), intent(in) :: dt

Calls

proc~~relax_map_u_impl~~CallsGraph proc~relax_map_u_impl relax_map_u_impl local local proc~relax_map_u_impl->local proc~relax_toward relax_toward proc~relax_map_u_impl->proc~relax_toward

Called by

proc~~relax_map_u_impl~~CalledByGraph proc~relax_map_u_impl relax_map_u_impl proc~ocean_sponge_apply_maps ocean_sponge_apply_maps proc~ocean_sponge_apply_maps->proc~relax_map_u_impl proc~run_stage_split run_stage_split proc~run_stage_split->proc~ocean_sponge_apply_maps 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_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 :: decay
integer, private :: i
integer, private :: j
integer, private :: k

Source Code

   pure subroutine relax_map_u_impl(u, u_ref, idamp_u, nxu, ny, nz, dt)
      !! Relax `u_face_x_layer` toward `u_ref` at rate `idamp_u`. Explicit-
      !! shape dummies, dims declared first (decl-order hook). `idamp_u(i,j)
      !! <= 0` is a bit-exact no-op (Idamp = 0 IS the sponge mask; also
      !! guarantees `sponge_idamp_zero_is_exact_identity`, since `decay =
      !! exp(-0*dt) = 1.0` exactly would already be a no-op algebraically —
      !! the early `if` skips the arithmetic entirely instead of relying on
      !! that).
      integer, intent(in)    :: nxu, ny, nz
      real(wp), intent(inout) :: u(nxu, ny, nz)
      real(wp), intent(in)    :: u_ref(nxu, ny, nz)
      real(wp), intent(in)    :: idamp_u(nxu, ny)
      real(wp), intent(in)    :: dt
      integer :: i, j, k
      real(wp) :: decay
      do concurrent(k=1:nz, j=1:ny, i=1:nxu) local(decay)
         if (idamp_u(i, j) > 0.0_wp) then
            decay = exp(-idamp_u(i, j)*dt)
            u(i, j, k) = relax_toward(u(i, j, k), u_ref(i, j, k), decay)
         end if
      end do
   end subroutine relax_map_u_impl