tides_update_eta_sal_impl Subroutine

private subroutine tides_update_eta_sal_impl(nx, ny, use_sal, beta_sal, eta_current, eta_eq, eta_sal, eta_forcing)

Flat-impl device fill (explicit-shape dummies). Loop-invariant use_sal branch kept INSIDE the single do concurrent (one launch, uniform branch is ~free). Off ⇒ pure copy of eta_eq into eta_forcing ⇒ bit-identical. Contiguous index (i) innermost.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nx
integer, intent(in) :: ny
logical, intent(in) :: use_sal
real(kind=wp), intent(in) :: beta_sal
real(kind=wp), intent(in) :: eta_current(nx,ny)
real(kind=wp), intent(in) :: eta_eq(nx,ny)
real(kind=wp), intent(inout) :: eta_sal(nx,ny)
real(kind=wp), intent(out) :: eta_forcing(nx,ny)

Called by

proc~~tides_update_eta_sal_impl~~CalledByGraph proc~tides_update_eta_sal_impl tides_update_eta_sal_impl proc~tides_update_eta_sal tides_update_eta_sal proc~tides_update_eta_sal->proc~tides_update_eta_sal_impl proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~tides_update_eta_sal 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

Source Code

   subroutine tides_update_eta_sal_impl(nx, ny, use_sal, beta_sal, eta_current, &
                                        eta_eq, eta_sal, eta_forcing)
      !! Flat-impl device fill (explicit-shape dummies).  Loop-invariant
      !! `use_sal` branch kept INSIDE the single `do concurrent` (one
      !! launch, uniform branch is ~free).  Off ⇒ pure copy of `eta_eq`
      !! into `eta_forcing` ⇒ bit-identical.  Contiguous index (i) innermost.
      integer, intent(in) :: nx, ny
      logical, intent(in) :: use_sal
      real(wp), intent(in) :: beta_sal
      real(wp), intent(in) :: eta_current(nx, ny), eta_eq(nx, ny)
      real(wp), intent(inout) :: eta_sal(nx, ny)
      real(wp), intent(out) :: eta_forcing(nx, ny)
      integer :: i, j

      ! Write straight into the arrays (no `local` scalar): reading back
      ! `eta_sal(i,j)` in the same iteration is a within-iteration RAW
      ! (legal in do concurrent) and sidesteps the gfortran `local()`
      ! if/else codegen artefact that perturbs the product sub-ULP.
      do concurrent(j=1:ny, i=1:nx)
         if (use_sal) then
            eta_sal(i, j) = beta_sal*eta_current(i, j)
            eta_forcing(i, j) = eta_eq(i, j) + eta_sal(i, j)
         else
            eta_forcing(i, j) = eta_eq(i, j)
         end if
      end do
   end subroutine tides_update_eta_sal_impl