cell_area_weighted_sum Function

private pure function cell_area_weighted_sum(f, area, ng, nxp, nyp) result(total)

sum_k sum_ij f(i,j,k)*area(i,j) over the physical interior.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: f(:,:,:)
real(kind=wp), intent(in) :: area(:,:)
integer, intent(in) :: ng
integer, intent(in) :: nxp
integer, intent(in) :: nyp

Return Value real(kind=wp)


Called by

proc~~cell_area_weighted_sum~~CalledByGraph proc~cell_area_weighted_sum cell_area_weighted_sum proc~rdb_ocean_get_total_mass rdb_ocean_get_total_mass proc~rdb_ocean_get_total_mass->proc~cell_area_weighted_sum

Variables

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

Source Code

   pure function cell_area_weighted_sum(f, area, ng, nxp, nyp) result(total)
      !! `sum_k sum_ij f(i,j,k)*area(i,j)` over the physical interior.
      ! assumed-shape-ok: host-side scalar diagnostic, not a device kernel.
      real(wp), intent(in) :: f(:, :, :), area(:, :)
      integer, intent(in) :: ng, nxp, nyp
      real(wp) :: total
      integer :: i, j, k
      total = 0.0_wp
      do k = 1, size(f, 3)
         do j = ng + 1, ng + nyp
            do i = ng + 1, ng + nxp
               total = total + f(i, j, k)*area(i, j)
            end do
         end do
      end do
   end function cell_area_weighted_sum