/[MITgcm]/MITgcm/pkg/diagnostics/diagstats_ini_io.F
ViewVC logotype

Annotation of /MITgcm/pkg/diagnostics/diagstats_ini_io.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Fri May 20 07:28:52 2005 UTC (18 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57i_post
Add new capability: compute & write Global/Regional & per level statistics

1 jmc 1.1 C $Header: $
2     C $Name: $
3    
4     #include "DIAG_OPTIONS.h"
5    
6     CBOP
7     C !ROUTINE: DIAGSTATS_INI_IO
8     C !INTERFACE:
9     SUBROUTINE DIAGSTATS_INI_IO( myThid )
10    
11     C !DESCRIPTION: \bv
12     C *==================================================================
13     C | S/R DIAGSTATS_INI_IO
14     C | o set I/O unit for ASCII output file
15     C *==================================================================
16     C \ev
17    
18     C !USES:
19     IMPLICIT NONE
20    
21     C == Global variables ===
22     #include "SIZE.h"
23     #include "EEPARAMS.h"
24     #include "EESUPPORT.h"
25     #include "PARAMS.h"
26     #include "DIAGNOSTICS_SIZE.h"
27     #include "DIAGNOSTICS.h"
28    
29     C !INPUT/OUTPUT PARAMETERS:
30     C == Routine arguments ==
31     C myThid - Thread number for this instance of the routine.
32     INTEGER myThid
33     CEOP
34    
35     C !LOCAL VARIABLES:
36     C == Local variables ==
37     INTEGER m, n, j, iL, nUnit
38     CHARACTER*(MAX_LEN_FNAM) dataFName
39     CHARACTER*(MAX_LEN_MBUF) msgBuf
40     INTEGER ILNBLNK
41     EXTERNAL ILNBLNK
42    
43     _BEGIN_MASTER( myThid)
44    
45     #ifdef ALLOW_USE_MPI
46     IF ( diagSt_Ascii .AND. mpiMyId.EQ.0 ) THEN
47     #else
48     IF ( diagSt_Ascii ) THEN
49     #endif
50    
51     DO n=1,diagSt_nbLists
52    
53     C- get a free unit number as the I/O channel for this routine
54     CALL MDSFINDUNIT( nUnit, myThid )
55     diagSt_ioUnit(n) = nUnit
56    
57     iL = ILNBLNK(diagSt_Fname(n))
58     WRITE(dataFName,'(2A,I10.10,A)')
59     & diagSt_Fname(n)(1:iL), '.', nIter0, '.txt'
60     OPEN( nUnit, FILE=dataFName, STATUS='unknown' )
61    
62     WRITE(msgBuf,'(4A,I6)') 'DIAGSTATS_INI_IO: ',
63     & 'open file: ',dataFName(1:iL+15), ' , unit=', nUnit
64     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
65     & SQUEEZE_RIGHT , myThid)
66    
67     C- write a kind of header:
68     WRITE(nUnit,'(2A)') '# header of file: ',
69     & diagSt_Fname(n)(1:iL)
70     WRITE(nUnit,'(A,F17.6)') '# frequency (s): ', diagSt_freq(n)
71     WRITE(nUnit,'(A,F17.6)') '# phase (s) : ', diagSt_phase(n)
72     WRITE(msgBuf,'(A)') '# Regions : '
73     iL = 17
74     DO j=0,nRegions
75     IF (diagSt_region(j,n).GE.1 .AND.iL+3.LE.MAX_LEN_MBUF) THEN
76     WRITE(msgBuf,'(A,I3)') msgBuf(1:iL),j
77     iL = iL+3
78     ENDIF
79     ENDDO
80     WRITE(nUnit,'(2A)') msgBuf(1:iL)
81     DO j=1,diagSt_nbFlds(n),10
82     WRITE(nUnit,'(A,20A)') '# Fields :',
83     & (' ', diagSt_Flds(m,n), m=j,MIN(diagSt_nbFlds(n),j+9) )
84     ENDDO
85     WRITE(nUnit,'(2A)') '# end of header ----------------------',
86     & '--------------------------------------'
87     WRITE(nUnit,'(A)') ' '
88    
89     ENDDO
90    
91     ENDIF
92    
93     _END_MASTER( myThid )
94    
95     RETURN
96     END

  ViewVC Help
Powered by ViewVC 1.1.22