avexy_ibm Subroutine

public subroutine avexy_ibm(aver, var, ib, ie, jb, je, kb, ke, ih, jh, kh, II, IIs, lnan)

Arguments

Type IntentOptional Attributes Name
real :: aver(kb:ke+kh)
real :: var(ib:ie,jb:je,kb:ke+kh)
integer :: ib
integer :: ie
integer :: jb
integer :: je
integer :: kb
integer :: ke
integer :: ih
integer :: jh
integer :: kh
integer :: II(ib:ie,jb:je,kb:ke+kh)
integer :: IIs(kb:ke+kh)
logical :: lnan

Calls

proc~~avexy_ibm~~CallsGraph proc~avexy_ibm avexy_ibm mpi_allreduce mpi_allreduce proc~avexy_ibm->mpi_allreduce

Called by

proc~~avexy_ibm~~CalledByGraph proc~avexy_ibm avexy_ibm proc~bcpup bcpup proc~bcpup->proc~avexy_ibm proc~diagfld diagfld proc~diagfld->proc~avexy_ibm proc~fluidvolume fluidvolume proc~fluidvolume->proc~avexy_ibm proc~masscorr masscorr proc~masscorr->proc~avexy_ibm proc~readinitfiles readinitfiles proc~readinitfiles->proc~avexy_ibm proc~thermodynamics thermodynamics proc~readinitfiles->proc~thermodynamics proc~statsdump statsdump proc~statsdump->proc~avexy_ibm proc~tkestatsdump tkestatsdump proc~statsdump->proc~tkestatsdump proc~thermodynamics->proc~avexy_ibm proc~thermodynamics->proc~diagfld proc~tkestatsdump->proc~avexy_ibm proc~calcfluidvolumes calcfluidvolumes proc~calcfluidvolumes->proc~fluidvolume program~dalesurban DALESURBAN program~dalesurban->proc~masscorr program~dalesurban->proc~readinitfiles program~dalesurban->proc~statsdump program~dalesurban->proc~thermodynamics program~dalesurban->proc~calcfluidvolumes

Source Code

  subroutine avexy_ibm(aver,var,ib,ie,jb,je,kb,ke,ih,jh,kh,II,IIs,lnan)
    implicit none

    integer :: ib,ie,jb,je,kb,ke,ih,jh,kh
    real    :: aver(kb:ke+kh)
    real    :: var(ib:ie,jb:je,kb:ke+kh)
    integer :: II(ib:ie,jb:je,kb:ke+kh)
    integer :: IIs(kb:ke+kh)
    integer :: IId(kb:ke+kh)
    real    :: averl(kb:ke+kh)
    real    :: avers(kb:ke+kh)
    integer :: k
    logical :: lnan

    averl       = 0.
    avers       = 0.

    do k=kb,ke+kh
      averl(k) = sum(var(ib:ie,jb:je,k)*II(ib:ie,jb:je,k))
    enddo

    IId = IIs

    ! tg3315 22.03.19 - if not calculating stats and all blocks on lowest layer...
    ! should not be necessary but value at kb is used in modthermo so reasonable value must
    ! be assigned. Potentially should leave as before and only account for in modthermo...
    if ((.not. lnan) .and. (IId(kb)==0)) then
      averl(kb) = sum(var(ib:ie,jb:je,kb))
      IId(kb) = IId(ke)
    end if

    call MPI_ALLREDUCE(averl, avers, ke+kh-kb+1,  MY_REAL, &
                          MPI_SUM, comm3d,mpierr)

    where (IId==0)
      aver = -999.
    elsewhere
      aver = avers/IId
    endwhere

    return
  end subroutine avexy_ibm