cdifs_obj_FlowUpdateMonitor Subroutine

subroutine cdifs_obj_FlowUpdateMonitor(this)

Monitors flow data.

Arguments

Type IntentOptional Attributes Name
class(cdifs_obj), intent(inout) :: this

CDIFS solver


Calls

proc~~cdifs_obj_flowupdatemonitor~~CallsGraph proc~cdifs_obj_flowupdatemonitor cdifs_obj_FlowUpdateMonitor proc~monitor_set_set monitor_set%monitor_set_Set proc~cdifs_obj_flowupdatemonitor->proc~monitor_set_set proc~monitor_obj_setval monitor_obj%monitor_obj_SetVal proc~monitor_set_set->proc~monitor_obj_setval proc~monitor_set_getindex monitor_set%monitor_set_GetIndex proc~monitor_set_set->proc~monitor_set_getindex proc~parallel_obj_rankisroot parallel_obj%parallel_obj_RankIsRoot proc~monitor_set_set->proc~parallel_obj_rankisroot none~get~3 hashtbl_obj%Get proc~monitor_set_getindex->none~get~3 proc~hashtbl_obj_hashstring hashtbl_obj%hashtbl_obj_HashString proc~monitor_set_getindex->proc~hashtbl_obj_hashstring proc~hashtbl_obj_get_int4 hashtbl_obj%hashtbl_obj_Get_int4 none~get~3->proc~hashtbl_obj_get_int4 proc~hashtbl_obj_get_int8 hashtbl_obj%hashtbl_obj_Get_int8 none~get~3->proc~hashtbl_obj_get_int8 proc~hashtbl_obj_get_real_dp hashtbl_obj%hashtbl_obj_Get_real_dp none~get~3->proc~hashtbl_obj_get_real_dp proc~hashtbl_obj_get_real_sp hashtbl_obj%hashtbl_obj_Get_real_sp none~get~3->proc~hashtbl_obj_get_real_sp none~get~2 sllist_obj%Get proc~hashtbl_obj_get_int4->none~get~2 proc~hashtbl_obj_get_int8->none~get~2 proc~hashtbl_obj_get_real_dp->none~get~2 proc~hashtbl_obj_get_real_sp->none~get~2 proc~sllist_obj_get_int4 sllist_obj%sllist_obj_Get_int4 none~get~2->proc~sllist_obj_get_int4 proc~sllist_obj_get_int8 sllist_obj%sllist_obj_Get_int8 none~get~2->proc~sllist_obj_get_int8 proc~sllist_obj_get_real_dp sllist_obj%sllist_obj_Get_real_dp none~get~2->proc~sllist_obj_get_real_dp proc~sllist_obj_get_real_sp sllist_obj%sllist_obj_Get_real_sp none~get~2->proc~sllist_obj_get_real_sp proc~sllist_obj_get_int4->proc~sllist_obj_get_int4 proc~sllist_obj_get_int8->proc~sllist_obj_get_int8 proc~sllist_obj_get_real_dp->proc~sllist_obj_get_real_dp proc~sllist_obj_get_real_sp->proc~sllist_obj_get_real_sp

Called by

proc~~cdifs_obj_flowupdatemonitor~~CalledByGraph proc~cdifs_obj_flowupdatemonitor cdifs_obj_FlowUpdateMonitor proc~cdifs_obj_monitor cdifs_obj_Monitor proc~cdifs_obj_monitor->proc~cdifs_obj_flowupdatemonitor interface~cdifs_obj_monitor cdifs_obj%cdifs_obj_Monitor interface~cdifs_obj_monitor->proc~cdifs_obj_monitor proc~cdifs_obj_preparesolver cdifs_obj_PrepareSolver proc~cdifs_obj_preparesolver->interface~cdifs_obj_monitor interface~cdifs_obj_preparesolver cdifs_obj%cdifs_obj_PrepareSolver interface~cdifs_obj_preparesolver->proc~cdifs_obj_preparesolver

Source Code

    subroutine cdifs_obj_FlowUpdateMonitor(this)
      !> Monitors flow data.
      implicit none
      class(cdifs_obj), intent(inout) :: this                                  !! CDIFS solver
      ! Work variables
      real(wp) :: maxdiv
      real(wp) :: maxV(3)
      integer  :: i,j,k
      real(wp) :: maxCFL(3)
      real(wp) :: buf
      integer  :: dir

      associate (op=>this%op, lo=>this%block%lo,  hi=>this%block%hi,   &
        dxm=>this%block%dxm, dym=>this%block%dym, dzm=>this%block%dzm, &
        V=>this%V, dt=>this%timer%dt)

        ! Maximum velocities
        maxV = 0.0_wp
        do dir=1,3
          maxV(dir) = maxval(abs(V(dir)%cell(lo(1):hi(1),lo(2):hi(2),lo(3):hi(3))))
        call this%parallel%max(maxV(dir),buf); maxV(dir)=buf
        end do

        ! Maximum divergence
        ! - Compute divergence field
        this%divu%cell = 0.0_wp
        do k=lo(3),hi(3)
          do j=lo(2),hi(2)
            do i=lo(1),hi(1)
              ! Compute max divergence
              this%divu%cell(i,j,k) = dot_product(this%DIV(:,i,j,k,1),V(1)%cell(i-op%st+1:i+op%st,j,k)) &
                                    + dot_product(this%DIV(:,i,j,k,2),V(2)%cell(i,j-op%st+1:j+op%st,k)) &
                                    + dot_product(this%DIV(:,i,j,k,3),V(3)%cell(i,j,k-op%st+1:k+op%st))
            end do
          end do
        end do

        ! - Get max value
        maxdiv = maxval(abs(this%divu%cell(lo(1):hi(1),lo(2):hi(2),lo(3):hi(3))))
        call this%parallel%max(maxdiv,buf); maxdiv=buf

        ! Maximum CFL
        maxCFL = 0.0_wp
        do k=lo(3),hi(3)
          do j=lo(2),hi(2)
            do i=lo(1),hi(1)
              maxCFL(1) = max(maxCFL(1),abs(V(1)%cell(i,j,k))*dt/dxm(i))
              maxCFL(2) = max(maxCFL(2),abs(V(2)%cell(i,j,k))*dt/dym(j))
              maxCFL(3) = max(maxCFL(3),abs(V(3)%cell(i,j,k))*dt/dzm(k))
            end do
          end do
        end do

        do dir=1,3
          call this%parallel%max(maxCFL(dir),buf); maxCFL(dir)=buf
        end do

        call this%monitors%set('stdout',1,this%timer%iter)
        call this%monitors%set('stdout',2,this%timer%time)
        call this%monitors%set('stdout',3,maxV(1)        )
        call this%monitors%set('stdout',4,maxV(2)        )
        call this%monitors%set('stdout',5,maxV(3)        )
        call this%monitors%set('stdout',6,maxval(maxCFL) )
        call this%monitors%set('stdout',7,maxdiv         )

        call this%monitors%set('Velocity',1,this%timer%iter)
        call this%monitors%set('Velocity',2,this%timer%time)
        call this%monitors%set('Velocity',3,maxV(1)        )
        call this%monitors%set('Velocity',4,maxV(2)        )
        call this%monitors%set('Velocity',5,maxV(3)        )
        call this%monitors%set('Velocity',6,maxval(maxCFL) )
        call this%monitors%set('Velocity',7,maxdiv         )

      end associate

      return
    end subroutine cdifs_obj_FlowUpdateMonitor