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

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

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


Revision 1.11 - (show annotations) (download)
Sun May 15 03:06:01 2005 UTC (19 years ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57h_done
Changes since 1.10: +7 -10 lines
remove "baseTime" (no used) from arg. list of DIFF_BASE_MULTIPLE
and rename it: DIFFERENT_MULTIPLE

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

  ViewVC Help
Powered by ViewVC 1.1.22