/[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.10 - (hide annotations) (download)
Wed Apr 6 18:45:48 2005 UTC (19 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57g_pre, checkpoint57g_post, checkpoint57f_post, checkpoint57h_pre, checkpoint57h_post
Changes since 1.9: +6 -6 lines
use baseTime as time origin ; DIFF_BASE_MULTIPLE replaces DIFFERENT_MULTIPLE

1 jmc 1.10 C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_write_state.F,v 1.9 2004/12/18 02:18:56 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.10 LOGICAL DIFF_BASE_MULTIPLE
45     EXTERNAL DIFF_BASE_MULTIPLE
46 mlosch 1.8 INTEGER IO_ERRCOUNT
47     EXTERNAL IO_ERRCOUNT
48    
49     IF (
50 jmc 1.10 & DIFF_BASE_MULTIPLE(baseTime,PTRACERS_dumpFreq,
51     & myTime,deltaTClock) .OR.
52 mlosch 1.8 & myTime.EQ.endTime .OR.
53     & myTime.EQ.startTime
54     & ) THEN
55    
56     C Write to files
57     _BARRIER
58     _BEGIN_MASTER( myThid )
59    
60 edhill 1.4 #ifdef ALLOW_MNC
61 mlosch 1.8 IF (useMNC .AND. PTRACERS_write_mnc) THEN
62 edhill 1.4 CALL MNC_CW_SET_UDIM('ptracers', -1, myThid)
63 edhill 1.9 CALL MNC_CW_I_W_S('I','ptracers',0,0,'T',myIter,myThid)
64 edhill 1.4 CALL MNC_CW_SET_UDIM('ptracers', 0, myThid)
65 mlosch 1.8 DO iTracer = 1,PTRACERS_numInUse
66     CALL MNC_CW_RL_W('D','ptracers',0,0,PTRACERS_names(iTracer),
67     & pTracer(1-OLx,1-OLy,1,1,1,iTracer),myThid)
68 edhill 1.4 ENDDO
69 mlosch 1.8 ENDIF
70 edhill 1.4 #endif /* ALLOW_MNC */
71    
72 mlosch 1.8 IF (PTRACERS_write_mdsio) THEN
73 adcroft 1.1
74 edhill 1.4 C Loop over tracers
75     DO iTracer=1,PTRACERS_numInUse
76 adcroft 1.1
77     #ifdef MULTIPLE_RECORD_STATE_FILES
78 mlosch 1.8 C Write each snap-shot as a record in a time-history file
79     IF (PTRACERS_useRecords) THEN
80     C Write each passive tracer as a record
81     WRITE(suff,'(A)') 'PTRACERS'
82     iRec = int ( (myCurrentTime-startTime)
83     & / PTRACERS_dumpFreq + 1.5 )
84     iRec = (iRec-1)*PTRACERS_num + iTracer + 1
85     ELSE
86     C Write each passive tracer in its own file
87     WRITE(pref,'(A7,I2.2)') 'PTRACER',iTracer
88     iRec = int ( (myCurrentTime-startTime)
89     & / PTRACERS_dumpFreq + 1.5 )
90     ENDIF
91     #else
92 edhill 1.4 C Write each snap-shot as a new file with a 10-digit suffix to
93 mlosch 1.8 C indicate time-step number
94     IF (PTRACERS_useRecords) THEN
95     C Write each passive tracer as a record
96     WRITE(suff,'(A,I10.10)') 'PTRACERS',myIter
97     iRec=iTracer
98     ELSE
99     C Write each passive tracer in its own file
100     WRITE(suff,'(A7,I2.2,A1,I10.10)')
101     & 'PTRACER',iTracer,'.',myIter
102     iRec=1
103     ENDIF
104 adcroft 1.1 #endif /* MULTIPLE_RECORD_STATE_FILES */
105 mlosch 1.8
106     CALL WRITE_REC_XYZ_RL(suff,
107     & pTracer(1-Olx,1-Oly,1,1,1,iTracer),iRec,myIter,myThid)
108    
109     C End of tracer loop
110 edhill 1.4 ENDDO
111    
112 mlosch 1.8 ENDIF
113    
114     _END_MASTER( myThid )
115     _BARRIER
116 jmc 1.10 C DIFF_BASE_MULTIPLE
117 edhill 1.4 ENDIF
118 mlosch 1.8
119 adcroft 1.1 #endif /* ALLOW_PTRACERS */
120    
121     RETURN
122     END

  ViewVC Help
Powered by ViewVC 1.1.22