1 |
C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_write_state.F,v 1.6 2004/10/07 01:48:08 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( myIter,myTime,myThid ) |
11 |
|
12 |
C !DESCRIPTION: |
13 |
C Calculates tendancy for passive tracers and integrates forward in |
14 |
C time. |
15 |
|
16 |
C !USES: |
17 |
IMPLICIT NONE |
18 |
#include "SIZE.h" |
19 |
#include "EEPARAMS.h" |
20 |
#include "PARAMS.h" |
21 |
#include "PTRACERS_SIZE.h" |
22 |
#include "PTRACERS.h" |
23 |
|
24 |
C !INPUT PARAMETERS: |
25 |
C myIter :: time-step number |
26 |
C myTime :: model time |
27 |
C myThid :: thread number |
28 |
INTEGER myIter |
29 |
_RL myTime |
30 |
INTEGER myThid |
31 |
CEOP |
32 |
|
33 |
#ifdef ALLOW_PTRACERS |
34 |
|
35 |
C !LOCAL VARIABLES: |
36 |
C iTracer :: loop indices |
37 |
C suff :: character buffer for creating suffix in filename |
38 |
C iRec :: record number |
39 |
INTEGER iTracer |
40 |
CHARACTER*(MAX_LEN_MBUF) suff |
41 |
INTEGER iRec |
42 |
#ifdef ALLOW_MNC |
43 |
INTEGER ii |
44 |
|
45 |
IF (useMNC .AND. PTRACERS_write_mnc) THEN |
46 |
CALL MNC_CW_SET_UDIM('ptracers', -1, myThid) |
47 |
CALL MNC_CW_I_W_S('I','ptracers',0,0,'iter',myIter,myThid) |
48 |
CALL MNC_CW_SET_UDIM('ptracers', 0, myThid) |
49 |
DO ii = 1,PTRACERS_numInUse |
50 |
CALL MNC_CW_RL_W('D','ptracers',0,0,PTRACERS_names(ii), |
51 |
& pTracer(1-OLx,1-OLy,1,1,1,ii),myThid) |
52 |
ENDDO |
53 |
ENDIF |
54 |
#endif /* ALLOW_MNC */ |
55 |
|
56 |
IF (PTRACERS_write_mdsio) THEN |
57 |
|
58 |
C Loop over tracers |
59 |
DO iTracer=1,PTRACERS_numInUse |
60 |
|
61 |
#ifdef MULTIPLE_RECORD_STATE_FILES |
62 |
C Write each snap-shot as a record in a time-history file |
63 |
IF (PTRACERS_useRecords) THEN |
64 |
C Write each passive tracer as a record |
65 |
WRITE(suff,'(A)') 'PTRACERS' |
66 |
iRec = int ( (myCurrentTime-startTime) / dumpFreq +1.5 ) |
67 |
iRec = (iRec-1)*PTRACERS_num + iTracer + 1 |
68 |
ELSE |
69 |
C Write each passive tracer in its own file |
70 |
WRITE(pref,'(A7,I2.2)') 'PTRACER',iTracer |
71 |
iRec = int ( (myCurrentTime-startTime) / dumpFreq +1.5 ) |
72 |
ENDIF |
73 |
#else |
74 |
C Write each snap-shot as a new file with a 10-digit suffix to |
75 |
C indicate time-step number |
76 |
IF (PTRACERS_useRecords) THEN |
77 |
C Write each passive tracer as a record |
78 |
WRITE(suff,'(A,I10.10)') 'PTRACERS',myIter |
79 |
iRec=iTracer |
80 |
ELSE |
81 |
C Write each passive tracer in its own file |
82 |
WRITE(suff,'(A7,I2.2,A1,I10.10)') |
83 |
& 'PTRACER',iTracer,'.',myIter |
84 |
iRec=1 |
85 |
ENDIF |
86 |
#endif /* MULTIPLE_RECORD_STATE_FILES */ |
87 |
|
88 |
CALL WRITE_REC_XYZ_RL(suff, |
89 |
& pTracer(1-Olx,1-Oly,1,1,1,iTracer),iRec,myIter,myThid) |
90 |
|
91 |
C End of tracer loop |
92 |
ENDDO |
93 |
|
94 |
ENDIF |
95 |
#endif /* ALLOW_PTRACERS */ |
96 |
|
97 |
RETURN |
98 |
END |