eulerian_obj_Mean Function

private impure function eulerian_obj_Mean(this) result(val)

Computes the mean of an Eulerian_obj.

Type Bound

eulerian_obj_base

Arguments

Type IntentOptional Attributes Name
class(eulerian_obj_base), intent(in) :: this

An Eulerian object

Return Value real(kind=wp)


Calls

proc~~eulerian_obj_mean~~CallsGraph proc~eulerian_obj_mean eulerian_obj_base%eulerian_obj_Mean cell cell proc~eulerian_obj_mean->cell

Called by

proc~~eulerian_obj_mean~~CalledByGraph proc~eulerian_obj_mean eulerian_obj_base%eulerian_obj_Mean proc~cdifs_obj_advancesolutioncorrector cdifs_obj_AdvanceSolutionCorrector proc~cdifs_obj_advancesolutioncorrector->proc~eulerian_obj_mean proc~cdifs_obj_advancesolution cdifs_obj_AdvanceSolution proc~cdifs_obj_advancesolution->proc~cdifs_obj_advancesolutioncorrector interface~cdifs_obj_advancesolution cdifs_obj%cdifs_obj_AdvanceSolution interface~cdifs_obj_advancesolution->proc~cdifs_obj_advancesolution

Source Code

    impure function eulerian_obj_Mean(this) result (val)
      !> Computes the mean of an Eulerian_obj.
      implicit none
      class(eulerian_obj_base), intent(in) :: this                             !! An Eulerian object
      real(wp) :: val
      ! Work variable
      real(wp) :: vol
      integer  :: i,j,k
      real(wp) :: buff_r

      associate (lo => this%block%lo,  hi => this%block%hi,         &
        dxm=>this%block%dxm,dym=>this%block%dym,dzm=>this%block%dzm)

        val = 0.0_wp; vol = 0.0_wp
        select type(this)
          type is (eulerian_obj_r)
            do k=lo(3),hi(3)
              do j=lo(2),hi(2)
                do i=lo(1),hi(1)
                  vol  = vol + dxm(i)*dym(j)*dzm(k)
                  val  = val + this%cell(i,j,k)*dxm(i)*dym(j)*dzm(k)
                end do
              end do
            end do
          type is (eulerian_obj_i)
            do k=lo(3),hi(3)
              do j=lo(2),hi(2)
                do i=lo(1),hi(1)
                  vol  = vol + dxm(i)*dym(j)*dzm(k)
                  val  = val + real(this%cell(i,j,k),wp)*dxm(i)*dym(j)*dzm(k)
                end do
              end do
            end do
          class default
            call this%parallel%Stop("Error encountered with Eulerian object")
        end select
        call this%parallel%Sum(vol,buff_r); vol=buff_r
        call this%parallel%Sum(val,buff_r); val=buff_r/vol
      end associate

      return
    end function eulerian_obj_Mean