chkdiv Subroutine

private subroutine chkdiv()

Uses

  • proc~~chkdiv~~UsesGraph proc~chkdiv chkdiv module~modfields modfields proc~chkdiv->module~modfields module~modglobal modglobal proc~chkdiv->module~modglobal module~modmpi modmpi proc~chkdiv->module~modmpi decomp_2d decomp_2d module~modfields->decomp_2d mpi mpi module~modmpi->mpi

Arguments

None

Calls

proc~~chkdiv~~CallsGraph proc~chkdiv chkdiv mpi_allreduce mpi_allreduce proc~chkdiv->mpi_allreduce

Called by

proc~~chkdiv~~CalledByGraph proc~chkdiv chkdiv proc~checksim checksim proc~checksim->proc~chkdiv program~dalesurban DALESURBAN program~dalesurban->proc~checksim

Source Code

  subroutine chkdiv

    use modglobal, only : ib,ie,jb,je,ke,kb,dx,dxi,dy,dyi,dzf,dzfi
    use modfields, only : u0,v0,w0!,divergentie
    use modmpi,    only : myid,comm3d,mpi_sum,mpi_max,my_real,mpierr
    implicit none



    real div, divmax, divtot
    real divmaxl, divtotl
    integer i, j, k

    divmax = 0.
    divtot = 0.
    divmaxl= 0.
    divtotl= 0.

    do k=kb,ke
    do j=jb,je
    do i=ib,ie
      div = &
                (u0(i+1,j,k) - u0(i,j,k) )*dxi + &
                (v0(i,j+1,k) - v0(i,j,k) )*dyi + &
                (w0(i,j,k+1) - w0(i,j,k) )*dzfi(k)
!      divergentie(i,j,k)=div
      divmaxl = max(divmaxl,abs(div))
      divtotl = divtotl + div*dx*dy*dzf(k)
    end do
    end do
    end do

    call MPI_ALLREDUCE(divtotl, divtot, 1,    MY_REAL, &
                          MPI_SUM, comm3d,mpierr)
    call MPI_ALLREDUCE(divmaxl, divmax, 1,    MY_REAL, &
                          MPI_MAX, comm3d,mpierr)

    if(myid==0)then
      write(6,'(A,2ES11.2)')'divmax, divtot = ', divmax, divtot
    end if

    return
  end subroutine chkdiv