/[MITgcm]/MITgcm_contrib/many_tracers/new_code/ptracers_write_state.F
ViewVC logotype

Contents of /MITgcm_contrib/many_tracers/new_code/ptracers_write_state.F

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


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Thu Jun 15 02:23:54 2006 UTC (18 years ago) by cnh
Branch: initial, MAIN
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
Initial checkin

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

  ViewVC Help
Powered by ViewVC 1.1.22