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