fill_ke_impl Subroutine

private pure subroutine fill_ke_impl(u_face, v_face, buf)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: u_face(:,:,:)
real(kind=wp), intent(in) :: v_face(:,:,:)
real(kind=wp), intent(inout) :: buf(:,:,:)

Called by

proc~~fill_ke_impl~~CalledByGraph proc~fill_ke_impl fill_ke_impl proc~fill_ke fill_ke proc~fill_ke->proc~fill_ke_impl

Variables

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

Source Code

   pure subroutine fill_ke_impl(u_face, v_face, buf)
      ! assumed-shape-ok: diag fill — fires once per output frame (cadence-bounded);
      ! face-sized arrays have nx+1/ny+1 first/second dims, incompatible with buf.
      real(wp), intent(in)    :: u_face(:, :, :), v_face(:, :, :)
      real(wp), intent(inout) :: buf(:, :, :)  ! assumed-shape-ok: diag fill — cadence-bounded
      integer :: i, j, k, nx, ny, nz
      nx = min(size(buf, 1), size(u_face, 1) - 1, size(v_face, 1))
      ny = min(size(buf, 2), size(u_face, 2), size(v_face, 2) - 1)
      nz = min(size(buf, 3), size(u_face, 3), size(v_face, 3))
      do concurrent(k=1:nz, j=1:ny, i=1:nx)
         buf(i, j, k) = 0.25_wp*( &
                        u_face(i, j, k)*u_face(i, j, k) + &
                        u_face(i + 1, j, k)*u_face(i + 1, j, k) + &
                        v_face(i, j, k)*v_face(i, j, k) + &
                        v_face(i, j + 1, k)*v_face(i, j + 1, k))
      end do
   end subroutine fill_ke_impl