subroutine calccourant
use modglobal, only : ib,ie,jb,je,kb,ke,kh,dxhi,dyi,dzhi,dt,timee
use modfields, only : um,vm,wm
use modmpi, only : myid,comm3d,mpierr,mpi_max,my_real
implicit none
real :: courtotl, courtot
integer :: i, j, k
courtotl = 0.0
courtot = 0.0
do k=kb,ke
do j=jb,je
do i=ib,ie
courtotl = max(courtotl,(um(i,j,k)*dxhi(i) + vm(i,j,k)*dyi + wm(i,j,k)*dzhi(k))*dtmn)
end do
end do
end do
call MPI_ALLREDUCE(courtotl,courtot,1,MY_REAL,MPI_MAX,comm3d,mpierr)
if (myid==0) then
write(*,'(A,ES10.2)') 'Courant numbers (x,y,z,tot):',courtot
end if
return
end subroutine calccourant