accel_visc_rem_reweight Subroutine

public subroutine accel_visc_rem_reweight(n1, n2, n3, snap, rem, vel)

accel_visc_rem post-apply reweight: vel = snap + rem·(vel − snap) — the whole explicit-tendency sum accumulated since the snapshot is attenuated by the per-layer viscous remnant (linearity ⇒ identical to weighting each tendency individually, MOM6 u = u_init + dt·visc_rem· (CAu + PFu + diffu)). Faces with rem == 1 (the unconditioned source=1.0 init, and every face before the first vdiff fills the producer) are SKIPPED, not rewritten — snap + 1·(vel−snap) is not an FP identity, and the skip keeps rem≡1 bitwise inert. Friction-dominated near-massless layers (rem → 0) keep their entry velocity. Public only for the unit-test suite. Under mem:separate this do concurrent runs on the device-resident arrays in production (all mapped on the ocean state); unit tests must map their own arrays explicitly. The masked write stays inside the do concurrent body (legal — no cross-iteration dep).

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n1
integer, intent(in) :: n2
integer, intent(in) :: n3
real(kind=wp), intent(in) :: snap(n1,n2,n3)
real(kind=wp), intent(in) :: rem(n1,n2,n3)
real(kind=wp), intent(inout) :: vel(n1,n2,n3)

Called by

proc~~accel_visc_rem_reweight~~CalledByGraph proc~accel_visc_rem_reweight accel_visc_rem_reweight proc~run_stage_split run_stage_split proc~run_stage_split->proc~accel_visc_rem_reweight 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 proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j
integer, private :: k

Source Code

   subroutine accel_visc_rem_reweight(n1, n2, n3, snap, rem, vel)
      !! accel_visc_rem post-apply reweight:
      !! `vel = snap + rem·(vel − snap)` — the whole explicit-tendency
      !! sum accumulated since the snapshot is attenuated by the
      !! per-layer viscous remnant (linearity ⇒ identical to weighting
      !! each tendency individually, MOM6 `u = u_init + dt·visc_rem·
      !! (CAu + PFu + diffu)`).  Faces with `rem == 1` (the unconditioned
      !! `source=1.0` init, and every face before the first vdiff fills
      !! the producer) are SKIPPED, not rewritten — `snap + 1·(vel−snap)`
      !! is not an FP identity, and the skip keeps rem≡1 bitwise inert.
      !! Friction-dominated near-massless layers (`rem → 0`) keep their
      !! entry velocity.  Public only for the unit-test suite.  Under
      !! `mem:separate` this `do concurrent` runs on the device-resident
      !! arrays in production (all mapped on the ocean state); unit tests
      !! must map their own arrays explicitly.  The masked write stays
      !! inside the `do concurrent` body (legal — no cross-iteration dep).
      integer, intent(in) :: n1, n2, n3
      real(wp), intent(in) :: snap(n1, n2, n3)
      real(wp), intent(in) :: rem(n1, n2, n3)
      real(wp), intent(inout) :: vel(n1, n2, n3)
      integer :: i, j, k

      do concurrent(k=1:n3, j=1:n2, i=1:n1)
         if (rem(i, j, k) /= 1.0_wp) then
            vel(i, j, k) = snap(i, j, k) &
                           + rem(i, j, k)*(vel(i, j, k) - snap(i, j, k))
         end if
      end do
   end subroutine accel_visc_rem_reweight