/[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.14 - (hide annotations) (download)
Wed Aug 24 23:23:34 2005 UTC (18 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57s_post, checkpoint57r_post
Changes since 1.13: +3 -3 lines
write Initial state & Final state if "dumpInitAndLast=T"

1 jmc 1.14 C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_write_state.F,v 1.13 2005/07/30 00:58:41 edhill 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 mlosch 1.8 SUBROUTINE PTRACERS_WRITE_STATE(
11     I myIter, myTime, myThid )
12 adcroft 1.1
13 edhill 1.4 C !DESCRIPTION:
14     C Calculates tendancy for passive tracers and integrates forward in
15     C time.
16 adcroft 1.1
17 edhill 1.4 C !USES:
18 adcroft 1.1 IMPLICIT NONE
19     #include "SIZE.h"
20     #include "EEPARAMS.h"
21 edhill 1.4 #include "PARAMS.h"
22 jmc 1.3 #include "PTRACERS_SIZE.h"
23 adcroft 1.1 #include "PTRACERS.h"
24    
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 edhill 1.4 C !LOCAL VARIABLES:
37     C iTracer :: loop indices
38     C suff :: character buffer for creating suffix in filename
39     C iRec :: record number
40 adcroft 1.1 INTEGER iTracer
41     CHARACTER*(MAX_LEN_MBUF) suff
42     INTEGER iRec
43 mlosch 1.8
44 jmc 1.11 LOGICAL DIFFERENT_MULTIPLE
45     EXTERNAL DIFFERENT_MULTIPLE
46 mlosch 1.8 INTEGER IO_ERRCOUNT
47     EXTERNAL IO_ERRCOUNT
48    
49 jmc 1.11 IF ( DIFFERENT_MULTIPLE( PTRACERS_dumpFreq, myTime, deltaTClock )
50 jmc 1.14 & .OR. dumpInitAndLast.AND.( myTime.EQ.endTime .OR.
51     & myTime.EQ.startTime )
52 jmc 1.11 & ) THEN
53 mlosch 1.8
54     C Write to files
55     _BARRIER
56     _BEGIN_MASTER( myThid )
57    
58 edhill 1.4 #ifdef ALLOW_MNC
59 edhill 1.13 IF ( PTRACERS_snapshot_mnc ) THEN
60 edhill 1.4 CALL MNC_CW_SET_UDIM('ptracers', -1, myThid)
61 edhill 1.12 CALL MNC_CW_RL_W_S('D','ptracers',0,0,'T',myTime,myThid)
62 edhill 1.4 CALL MNC_CW_SET_UDIM('ptracers', 0, myThid)
63 edhill 1.12 CALL MNC_CW_I_W_S('I','ptracers',0,0,'iter',myIter,myThid)
64 mlosch 1.8 DO iTracer = 1,PTRACERS_numInUse
65     CALL MNC_CW_RL_W('D','ptracers',0,0,PTRACERS_names(iTracer),
66     & pTracer(1-OLx,1-OLy,1,1,1,iTracer),myThid)
67 edhill 1.4 ENDDO
68 mlosch 1.8 ENDIF
69 edhill 1.4 #endif /* ALLOW_MNC */
70    
71 edhill 1.13 IF ( PTRACERS_snapshot_mdsio ) THEN
72 adcroft 1.1
73 edhill 1.4 C Loop over tracers
74     DO iTracer=1,PTRACERS_numInUse
75 adcroft 1.1
76     #ifdef MULTIPLE_RECORD_STATE_FILES
77 mlosch 1.8 C Write each snap-shot as a record in a time-history file
78     IF (PTRACERS_useRecords) THEN
79     C Write each passive tracer as a record
80     WRITE(suff,'(A)') 'PTRACERS'
81     iRec = int ( (myCurrentTime-startTime)
82     & / PTRACERS_dumpFreq + 1.5 )
83     iRec = (iRec-1)*PTRACERS_num + iTracer + 1
84     ELSE
85     C Write each passive tracer in its own file
86     WRITE(pref,'(A7,I2.2)') 'PTRACER',iTracer
87     iRec = int ( (myCurrentTime-startTime)
88     & / PTRACERS_dumpFreq + 1.5 )
89     ENDIF
90     #else
91 edhill 1.4 C Write each snap-shot as a new file with a 10-digit suffix to
92 mlosch 1.8 C indicate time-step number
93     IF (PTRACERS_useRecords) THEN
94     C Write each passive tracer as a record
95     WRITE(suff,'(A,I10.10)') 'PTRACERS',myIter
96     iRec=iTracer
97     ELSE
98     C Write each passive tracer in its own file
99     WRITE(suff,'(A7,I2.2,A1,I10.10)')
100     & 'PTRACER',iTracer,'.',myIter
101     iRec=1
102     ENDIF
103 adcroft 1.1 #endif /* MULTIPLE_RECORD_STATE_FILES */
104 mlosch 1.8
105     CALL WRITE_REC_XYZ_RL(suff,
106     & pTracer(1-Olx,1-Oly,1,1,1,iTracer),iRec,myIter,myThid)
107    
108     C End of tracer loop
109 edhill 1.4 ENDDO
110    
111 mlosch 1.8 ENDIF
112    
113     _END_MASTER( myThid )
114     _BARRIER
115 edhill 1.4 ENDIF
116 mlosch 1.8
117 adcroft 1.1 #endif /* ALLOW_PTRACERS */
118    
119     RETURN
120     END

  ViewVC Help
Powered by ViewVC 1.1.22