/[MITgcm]/MITgcm/pkg/ptracers/ptracers_write_state.F
ViewVC logotype

Annotation of /MITgcm/pkg/ptracers/ptracers_write_state.F

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


Revision 1.19 - (hide annotations) (download)
Sat Nov 10 22:09:32 2007 UTC (16 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62c, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62w, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint64, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59k, checkpoint62b, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64f, checkpoint61f, checkpoint61n, checkpoint61q, checkpoint61e, checkpoint61g, checkpoint61d, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.18: +10 -10 lines
use a 2 characters string ioLabel to identify tracers (if more than 99 tracers)

1 jmc 1.19 C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_write_state.F,v 1.18 2007/11/05 18:48:04 jmc Exp $
2 dimitri 1.2 C $Name: $
3 adcroft 1.1
4     #include "PTRACERS_OPTIONS.h"
5    
6     CBOP
7 edhill 1.4 C !ROUTINE: PTRACERS_WRITE_STATE
8 adcroft 1.1
9 edhill 1.4 C !INTERFACE:
10 jmc 1.16 SUBROUTINE PTRACERS_WRITE_STATE(
11 mlosch 1.8 I myIter, myTime, myThid )
12 adcroft 1.1
13 edhill 1.4 C !DESCRIPTION:
14 jmc 1.17 C dump to files current passive tracer state
15 adcroft 1.1
16 edhill 1.4 C !USES:
17 adcroft 1.1 IMPLICIT NONE
18     #include "SIZE.h"
19     #include "EEPARAMS.h"
20 edhill 1.4 #include "PARAMS.h"
21 jmc 1.3 #include "PTRACERS_SIZE.h"
22 jmc 1.18 #include "PTRACERS_PARAMS.h"
23     #include "PTRACERS_FIELDS.h"
24 adcroft 1.1
25 edhill 1.4 C !INPUT PARAMETERS:
26     C myIter :: time-step number
27     C myTime :: model time
28     C myThid :: thread number
29 adcroft 1.1 INTEGER myIter
30     _RL myTime
31     INTEGER myThid
32 edhill 1.4 CEOP
33 adcroft 1.1
34     #ifdef ALLOW_PTRACERS
35    
36 jmc 1.16 C === Functions ====
37     LOGICAL DIFFERENT_MULTIPLE
38     EXTERNAL DIFFERENT_MULTIPLE
39     INTEGER IO_ERRCOUNT
40     EXTERNAL IO_ERRCOUNT
41    
42 edhill 1.4 C !LOCAL VARIABLES:
43     C iTracer :: loop indices
44 jmc 1.19 C pref :: character buffer for creating prefix in filename
45 edhill 1.4 C iRec :: record number
46 adcroft 1.1 INTEGER iTracer
47 jmc 1.19 CHARACTER*(MAX_LEN_FNAM) pref
48 adcroft 1.1 INTEGER iRec
49 jmc 1.16 #ifdef ALLOW_MNC
50 edhill 1.15 CHARACTER*(1) pf
51 jmc 1.16 #endif
52 mlosch 1.8
53 jmc 1.11 IF ( DIFFERENT_MULTIPLE( PTRACERS_dumpFreq, myTime, deltaTClock )
54 jmc 1.14 & .OR. dumpInitAndLast.AND.( myTime.EQ.endTime .OR.
55     & myTime.EQ.startTime )
56 jmc 1.11 & ) THEN
57 jmc 1.16
58     C-- Write to files
59     _BARRIER
60    
61     #ifdef ALLOW_MNC
62 edhill 1.15 IF ( writeBinaryPrec .EQ. precFloat64 ) THEN
63     pf(1:1) = 'D'
64     ELSE
65     pf(1:1) = 'R'
66     ENDIF
67    
68 edhill 1.13 IF ( PTRACERS_snapshot_mnc ) THEN
69 edhill 1.4 CALL MNC_CW_SET_UDIM('ptracers', -1, myThid)
70 edhill 1.12 CALL MNC_CW_RL_W_S('D','ptracers',0,0,'T',myTime,myThid)
71 edhill 1.4 CALL MNC_CW_SET_UDIM('ptracers', 0, myThid)
72 edhill 1.12 CALL MNC_CW_I_W_S('I','ptracers',0,0,'iter',myIter,myThid)
73 mlosch 1.8 DO iTracer = 1,PTRACERS_numInUse
74 edhill 1.15 CALL MNC_CW_RL_W(pf,'ptracers',0,0,PTRACERS_names(iTracer),
75 mlosch 1.8 & pTracer(1-OLx,1-OLy,1,1,1,iTracer),myThid)
76 edhill 1.4 ENDDO
77 mlosch 1.8 ENDIF
78 edhill 1.4 #endif /* ALLOW_MNC */
79    
80 edhill 1.13 IF ( PTRACERS_snapshot_mdsio ) THEN
81 adcroft 1.1
82 edhill 1.4 C Loop over tracers
83     DO iTracer=1,PTRACERS_numInUse
84 adcroft 1.1
85     #ifdef MULTIPLE_RECORD_STATE_FILES
86 mlosch 1.8 C Write each snap-shot as a record in a time-history file
87     IF (PTRACERS_useRecords) THEN
88     C Write each passive tracer as a record
89 jmc 1.19 WRITE(pref,'(A)') 'PTRACERS'
90 jmc 1.16 iRec = 1 + NINT( (myTime-startTime) / PTRACERS_dumpFreq )
91 mlosch 1.8 iRec = (iRec-1)*PTRACERS_num + iTracer + 1
92     ELSE
93     C Write each passive tracer in its own file
94 jmc 1.19 WRITE(pref,'(2A)') 'PTRACER',PTRACERS_ioLabel(iTracer)
95 jmc 1.16 iRec = 1 + NINT( (myTime-startTime) / PTRACERS_dumpFreq )
96 mlosch 1.8 ENDIF
97 jmc 1.16 #else
98 jmc 1.19 C Write each snap-shot as a new file with a 10-digit suffix to
99 mlosch 1.8 C indicate time-step number
100     IF (PTRACERS_useRecords) THEN
101     C Write each passive tracer as a record
102 jmc 1.19 WRITE(pref,'(A,I10.10)') 'PTRACERS.',myIter
103 mlosch 1.8 iRec=iTracer
104     ELSE
105     C Write each passive tracer in its own file
106 jmc 1.19 WRITE(pref,'(3A,I10.10)')
107     & 'PTRACER',PTRACERS_ioLabel(iTracer),'.',myIter
108 mlosch 1.8 iRec=1
109     ENDIF
110 adcroft 1.1 #endif /* MULTIPLE_RECORD_STATE_FILES */
111 jmc 1.16
112 jmc 1.19 CALL WRITE_REC_XYZ_RL(pref,
113 mlosch 1.8 & pTracer(1-Olx,1-Oly,1,1,1,iTracer),iRec,myIter,myThid)
114 jmc 1.16
115 mlosch 1.8 C End of tracer loop
116 edhill 1.4 ENDDO
117 jmc 1.16
118 mlosch 1.8 ENDIF
119    
120     _BARRIER
121 jmc 1.16 C-- Writing to files: end
122 edhill 1.4 ENDIF
123 mlosch 1.8
124 adcroft 1.1 #endif /* ALLOW_PTRACERS */
125    
126     RETURN
127     END

  ViewVC Help
Powered by ViewVC 1.1.22