grans_obj_monitor Module Subroutine

module subroutine grans_obj_monitor(this)

Analyzes data and posts to monitors.

Arguments

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

GRANS solver


Calls

proc~~grans_obj_monitor~~CallsGraph proc~grans_obj_monitor grans_obj_monitor center center proc~grans_obj_monitor->center particle particle proc~grans_obj_monitor->particle proc~monitor_set_set monitor_set%monitor_set_Set proc~grans_obj_monitor->proc~monitor_set_set proc~respart_set_updatemonitor ResPart_set%ResPart_set_UpdateMonitor proc~grans_obj_monitor->proc~respart_set_updatemonitor proc~timer_obj_gettiming timer_obj%timer_obj_GetTiming proc~grans_obj_monitor->proc~timer_obj_gettiming proc~timer_obj_updatetiming timer_obj%timer_obj_UpdateTiming proc~grans_obj_monitor->proc~timer_obj_updatetiming v v proc~grans_obj_monitor->v 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 proc~respart_set_updatemonitor->proc~monitor_set_set centroid centroid proc~respart_set_updatemonitor->centroid none~get~3 hashtbl_obj%Get proc~timer_obj_gettiming->none~get~3 proc~hashtbl_obj_hashstring hashtbl_obj%hashtbl_obj_HashString proc~timer_obj_gettiming->proc~hashtbl_obj_hashstring proc~timer_obj_updatetiming->none~get~3 proc~timer_obj_updatetiming->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 proc~monitor_set_getindex->none~get~3 proc~monitor_set_getindex->proc~hashtbl_obj_hashstring 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~~grans_obj_monitor~~CalledByGraph proc~grans_obj_monitor grans_obj_monitor interface~grans_obj_monitor grans_obj%grans_obj_Monitor interface~grans_obj_monitor->proc~grans_obj_monitor proc~grans_obj_preparesolver grans_obj_PrepareSolver proc~grans_obj_preparesolver->interface~grans_obj_monitor interface~grans_obj_preparesolver grans_obj%grans_obj_PrepareSolver interface~grans_obj_preparesolver->proc~grans_obj_preparesolver

Source Code

    module subroutine grans_obj_monitor(this)
      !> Analyzes data and posts to monitors.
      implicit none
      class(grans_obj), intent(inout) :: this                                  !! GRANS solver
      ! Work variables
      real(wp) :: maxCFL
      real(wp) :: maxV(3)
      integer  :: nbr
      real(wp) :: buf
      real(wp) :: buf3(3)
      integer  :: n
      real(wp) :: xp(3)
      real(wp) :: vp(3)
      real(wp) :: timing(4)

      ! Monitor RP quantites
      if (this%use_RP) call this%RP%UpdateMonitor

      ! Monitor PP quantites
      if (this%use_PP) call this%PP%UpdateMonitor

      maxV   = 0.0_wp
      maxCFL = 0.0_wp
      nbr    = 0
      xp     = 0.0_wp
      vp     = 0.0_wp
      if (this%use_RP) then
        select type (center =>this%RP%p)
        type is (ResPart_obj)
          do n=1,this%RP%count_
            maxCFL = max(maxCFL,this%timer%dt*norm2(center(n)%v)/center(n)%d)
            maxV(1)= max(maxV(1),abs(center(n)%v(1)))
            maxV(2)= max(maxV(2),abs(center(n)%v(2)))
            maxV(3)= max(maxV(3),abs(center(n)%v(3)))

            xp     = xp + center(n)%p
            vp     = vp + center(n)%v
          end do
        end select

        nbr = nbr + this%RP%count
      end if

      if (this%use_PP) then
        select type (particle =>this%PP%p)
        class is (particle_obj)
          do n=1,this%PP%count_
            maxCFL = max(maxCFL,this%timer%dt*norm2(particle(n)%v)/particle(n)%d)
            maxV(1)= max(maxV(1),abs(particle(n)%v(1)))
            maxV(2)= max(maxV(2),abs(particle(n)%v(2)))
            maxV(3)= max(maxV(3),abs(particle(n)%v(3)))
          end do
         end select

        nbr = nbr + this%PP%count
      end if

      call this%parallel%Max(maxCFL, buf ) ; maxCFL =buf
      call this%parallel%Max(maxV(1),buf ) ; maxV(1)=buf
      call this%parallel%Max(maxV(2),buf ) ; maxV(2)=buf
      call this%parallel%Max(maxV(3),buf ) ; maxV(3)=buf
      call this%parallel%Sum(xp,     buf3) ; xp     =buf3/nbr
      call this%parallel%Sum(vp,     buf3) ; vp     =buf3/nbr

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

      call this%monitors%Set('hypre', 1,this%timer%iter)
      call this%monitors%Set('hypre', 2,this%timer%time)
      call this%monitors%Set('hypre', 3,this%VF_it     )
      call this%monitors%Set('hypre', 4,this%VF_rel    )

      call this%monitors%Set('stats', 1,this%timer%iter)
      call this%monitors%Set('stats', 2,this%timer%time)
      call this%monitors%Set('stats', 3,xp(1)          )
      call this%monitors%Set('stats', 4,xp(2)          )
      call this%monitors%Set('stats', 5,xp(3)          )
      call this%monitors%Set('stats', 6,vp(1)          )
      call this%monitors%Set('stats', 7,vp(2)          )
      call this%monitors%Set('stats', 8,vp(3)          )

      ! Update timing info
      call this%timer%UpdateTiming('Monitor')

      timing(1) = this%timer%GetTiming('Advance')
      timing(2) = this%timer%GetTiming('Output' )
      timing(3) = this%timer%GetTiming('Restart')
      timing(4) = this%timer%GetTiming('Monitor')

      call this%monitors%Set('timing',1,this%timer%iter)
      call this%monitors%Set('timing',2,this%timer%time)
      call this%monitors%Set('timing',3,sum(timing)    )
      call this%monitors%Set('timing',4,timing(1)      )
      call this%monitors%Set('timing',5,timing(2)      )
      call this%monitors%Set('timing',6,timing(3)      )
      call this%monitors%Set('timing',7,timing(4)      )

      call this%monitors%Print()

      ! Reset monitoring variables now that we are done
      this%VF_it  = 0
      this%VF_rel = 0.0_wp

      return
    end subroutine grans_obj_monitor