subroutine calcdiffnr
use modglobal, only : ib,ie,jb,je,kb,ke,kh,dxh2i,dy2i,dzh,dt,timee
use modsubgriddata, only : ekm,ekh
use modmpi, only : myid,comm3d,mpierr,mpi_max,my_real
implicit none
real diffnrtotl,diffnrtot
integer :: i,j,k
diffnrtotl = 0.
diffnrtot = 0.
do k=kb,ke
do j=jb,je
do i=ib,ie
! diffnrtotl = max(diffnrtotl, ekm(i,j,k)*(1/dzh(k)**2 + dxh2i(i) + dy2i)*dtmn ) ! or should I interpolate ekm to the correct position?
diffnrtotl = max(diffnrtotl, ekm(i,j,k)*(1/dzh(k)**2 + dxh2i(i) + dy2i)*dtmn, &
ekh(i,j,k)*(1/dzh(k)**2 + dxh2i(i) + dy2i)*dtmn ) ! or should I interpolate ekm to the correct position?
end do
end do
end do
call MPI_ALLREDUCE(diffnrtotl,diffnrtot,1,MY_REAL,MPI_MAX,comm3d,mpierr)
if (myid==0) then
write(6,'(A,ES10.2)') 'Diffusion number:',diffnrtot
end if
return
end subroutine calcdiffnr