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