Analyzes data and posts to monitors.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(grans_obj), | intent(inout) | :: | this |
GRANS solver |
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