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

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

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


Revision 1.2 - (show annotations) (download)
Wed Jun 29 23:07:34 2005 UTC (18 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57t_post, checkpoint57o_post, checkpoint57m_post, checkpoint57s_post, checkpoint57k_post, checkpoint57y_post, checkpoint57y_pre, checkpoint57v_post, checkpoint57r_post, checkpoint58, checkpoint57x_post, checkpoint57n_post, checkpoint57w_post, checkpoint57p_post, checkpint57u_post, checkpoint58a_post, checkpoint57q_post, checkpoint57z_post, checkpoint57j_post, checkpoint57l_post
Changes since 1.1: +4 -3 lines
fix for pgf compiler (cannot handle internal write to a string of char. of
 a part of the same string)

1 C $Header: /u/gcmpack/MITgcm/pkg/diagnostics/diagstats_ini_io.F,v 1.1 2005/05/20 07:28:52 jmc Exp $
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, tmpBuf
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 tmpBuf(1:iL) = msgBuf(1:iL)
77 WRITE(msgBuf,'(A,I3)') tmpBuf(1:iL),j
78 iL = iL+3
79 ENDIF
80 ENDDO
81 WRITE(nUnit,'(2A)') msgBuf(1:iL)
82 DO j=1,diagSt_nbFlds(n),10
83 WRITE(nUnit,'(A,20A)') '# Fields :',
84 & (' ', diagSt_Flds(m,n), m=j,MIN(diagSt_nbFlds(n),j+9) )
85 ENDDO
86 WRITE(nUnit,'(2A)') '# end of header ----------------------',
87 & '--------------------------------------'
88 WRITE(nUnit,'(A)') ' '
89
90 ENDDO
91
92 ENDIF
93
94 _END_MASTER( myThid )
95
96 RETURN
97 END

  ViewVC Help
Powered by ViewVC 1.1.22