C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/pkg/ptracers/ptracers_monitor.F,v 1.1 2004/11/28 23:50:59 mlosch Exp $ C $Name: $ #include "PTRACERS_OPTIONS.h" CBOP C !ROUTINE: PTRACERS_MONITOR C !INTERFACE: ========================================================== SUBROUTINE PTRACERS_MONITOR( I myIter, myTime, myThid ) C !DESCRIPTION: C writes out ptracer statistics C !USES: =============================================================== IMPLICIT NONE #include "SIZE.h" #include "EEPARAMS.h" #include "PARAMS.h" #include "DYNVARS.h" #include "GRID.h" #include "PTRACERS_SIZE.h" #include "PTRACERS.h" #ifdef ALLOW_MONITOR #include "MONITOR.h" #endif C !INPUT PARAMETERS: =================================================== C myThid :: thread number C myIter :: current timestep C myTime :: current time INTEGER myIter _RL myTime INTEGER myThid C === Functions ==== LOGICAL DIFFERENT_MULTIPLE EXTERNAL DIFFERENT_MULTIPLE #ifdef ALLOW_PTRACERS #ifdef ALLOW_MONITOR C !LOCAL VARIABLES: ==================================================== C i,j :: loop indices C ip :: ptracer number CHARACTER*(MAX_LEN_MBUF) msgBuf CHARACTER*(MAX_LEN_MBUF) suff _RL dT INTEGER time_as_int integer ip CML integer i,j,k,bi,bj CML _RL tmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) CEOP dT=deltaTclock IF (myIter.LE.nIter0+1.OR.DIFFERENT_MULTIPLE( & PTRACERS_monitorFreq,myTime,myTime-dT)) THEN CML mon_write_stdout = .TRUE. C Ptracers field monitor start _BEGIN_MASTER(myThid) #ifdef ALLOW_USE_MPI IF ( .NOT. useSingleCPUIO .OR. mpiMyId .EQ. 0 ) THEN #endif /* ALLOW_USE_MPI */ IF (monitor_stdio) THEN WRITE(msgBuf,'(2A)') '// ==========================', & '=============================' CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) WRITE(msgBuf,'(A)') & '// Begin MONITOR ptracer field statistics' CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, & SQUEEZE_RIGHT , 1) WRITE(msgBuf,'(2A)') '// ==========================', & '=============================' CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) mon_write_stdout = .TRUE. ENDIF #ifdef ALLOW_USE_MPI ENDIF #endif /* ALLOW_USE_MPI */ _END_MASTER(myThid) IF ( PTRACERS_monitorFreq .NE. monitorFreq ) THEN C repeat printing of time to make grepping easier, default is not C to do this, because the default is to use the same monitorFreq C for ptracers than for the dynamics variables. CALL MON_SET_PREF('trctime',myThid) CALL MON_OUT_I( '_tsnumber', myIter,mon_string_none,myThid) CALL MON_OUT_RL('_secondsf', myTime,mon_string_none,myThid) ENDIF C Print the basic statistics of ptracer variables CALL MON_SET_PREF('trcstat_',myThid) DO ip = 1, PTRACERS_numInUse WRITE(suff,'(A7,I2.2)') 'ptracer',ip CML Do we need a copy of the 6D-array to the 5D-array? CML DO bj = myByLo(myThid), myByHi(myThid) CML DO bi = myBxLo(myThid), myBxHi(myThid) CML DO k=1,Nr CML DO j=1-Oly,sNy+OLy CML DO i=1-Olx,sNx+Olx CML tmp(i,j,k,bi,bj)=ptracer(i,j,k,bi,bj,ip) CML ENDDO CML ENDDO CML ENDDO CML ENDDO CML ENDDO CML CALL MON_PRINTSTATS_RL(Nr,tmp,suff, CML & maskC,hFacC,rA ,drF,myThid) CML It would be nice to avoid the copies. The code below works on CML muliple tiles on one processor, that is, it gives the same results CML as the above code which I leave for now in case something unexpected CML happens on multiple processors. CALL MON_PRINTSTATS_RL( & Nr, ptracer(1-Olx,1-Oly,1,1,1,ip), & suff, maskC,hFacC,rA ,drF,myThid) ENDDO IF (mon_write_stdout) THEN C Ptracers field monitor finish _BEGIN_MASTER(myThid) #ifdef ALLOW_USE_MPI IF ( .NOT. useSingleCPUIO .OR. mpiMyId .EQ. 0 ) THEN #endif /* ALLOW_USE_MPI */ WRITE(msgBuf,'(2A)') '// ==========================', & '=============================' CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) WRITE(msgBuf,'(A)') & '// End MONITOR ptracers field statistics' CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, & SQUEEZE_RIGHT , 1) WRITE(msgBuf,'(2A)') '// ==========================', & '=============================' CALL PRINT_MESSAGE( msgBuf, mon_ioUnit, SQUEEZE_RIGHT , 1) #ifdef ALLOW_USE_MPI ENDIF #endif /* ALLOW_USE_MPI */ mon_write_stdout = .FALSE. _END_MASTER(myThid) ENDIF C endif different multiple ENDIF #endif /* ALLOW_MONITOR */ #endif /* ALLOW_PTRACERS */ RETURN END