/[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.8 - (show annotations) (download)
Wed Dec 1 22:54:02 2004 UTC (19 years, 5 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint56b_post, checkpoint57, checkpoint57a_post, checkpoint56c_post, checkpoint57a_pre
Changes since 1.7: +62 -38 lines
o collect all ptracers output in an new routine (PTRACERS_OUTPUT) that
  is called from DO_THE_MODEL_IO
  - rename PTRACERS_STATV_WRITE to PTRACERS_WRITE_TIMEAVE
  - introduce new parameter PTRACERS_dumpFreq (defaults to dumpFreq)
  - clean up PTRACERS_WRITE_TIMEAVE a little

1 C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_write_state.F,v 1.7 2004/10/10 06:08:50 edhill 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 (
50 & DIFFERENT_MULTIPLE(PTRACERS_dumpFreq,myTime,
51 & myTime-deltaTClock) .OR.
52 & myTime.EQ.endTime .OR.
53 & myTime.EQ.startTime
54 & ) THEN
55
56 C Write to files
57 _BARRIER
58 _BEGIN_MASTER( myThid )
59
60 #ifdef ALLOW_MNC
61 IF (useMNC .AND. PTRACERS_write_mnc) THEN
62 CALL MNC_CW_SET_UDIM('ptracers', -1, myThid)
63 CALL MNC_CW_I_W_S('I','ptracers',0,0,'iter',myIter,myThid)
64 CALL MNC_CW_SET_UDIM('ptracers', 0, myThid)
65 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 ENDDO
69 ENDIF
70 #endif /* ALLOW_MNC */
71
72 IF (PTRACERS_write_mdsio) THEN
73
74 C Loop over tracers
75 DO iTracer=1,PTRACERS_numInUse
76
77 #ifdef MULTIPLE_RECORD_STATE_FILES
78 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 C Write each snap-shot as a new file with a 10-digit suffix to
93 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 #endif /* MULTIPLE_RECORD_STATE_FILES */
105
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 ENDDO
111
112 ENDIF
113
114 _END_MASTER( myThid )
115 _BARRIER
116 C DIFFERENT_MULTIPLE
117 ENDIF
118
119 #endif /* ALLOW_PTRACERS */
120
121 RETURN
122 END

  ViewVC Help
Powered by ViewVC 1.1.22