1 |
C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_diagnostics_state.F,v 1.5 2010/01/02 23:42:51 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PTRACERS_OPTIONS.h" |
5 |
|
6 |
CBOP 1 |
7 |
C !ROUTINE: PTRACERS_DIAGNOSTICS_STATE |
8 |
|
9 |
C !INTERFACE: |
10 |
SUBROUTINE PTRACERS_DIAGNOSTICS_STATE(myTime, myIter, myThid) |
11 |
|
12 |
C !DESCRIPTION: |
13 |
C Fill-in the diagnostics array for PTRACERS state variables |
14 |
|
15 |
C !USES: |
16 |
IMPLICIT NONE |
17 |
#include "SIZE.h" |
18 |
#include "EEPARAMS.h" |
19 |
#include "PARAMS.h" |
20 |
#include "GRID.h" |
21 |
#include "DYNVARS.h" |
22 |
#include "PTRACERS_SIZE.h" |
23 |
#include "PTRACERS_PARAMS.h" |
24 |
#include "PTRACERS_FIELDS.h" |
25 |
#ifdef ALLOW_LONGSTEP |
26 |
#include "LONGSTEP.h" |
27 |
#endif |
28 |
|
29 |
C !INPUT PARAMETERS: |
30 |
_RL myTime |
31 |
INTEGER myIter |
32 |
INTEGER myThid |
33 |
CEOP |
34 |
|
35 |
#ifdef ALLOW_DIAGNOSTICS |
36 |
|
37 |
C !LOCAL VARIABLES: |
38 |
LOGICAL DIAGNOSTICS_IS_ON |
39 |
EXTERNAL DIAGNOSTICS_IS_ON |
40 |
_RL dummy(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
41 |
INTEGER i,j,k,bi,bj,iTr |
42 |
CHARACTER*8 diagName |
43 |
INTEGER km1 |
44 |
#ifdef ALLOW_LONGSTEP |
45 |
INTEGER trIter |
46 |
#endif |
47 |
|
48 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
49 |
|
50 |
#ifdef ALLOW_LONGSTEP |
51 |
C fill only once every long time step |
52 |
C have to treat first time step by hand... |
53 |
C trIter=0 when this routine is called the first time |
54 |
IF ( staggerTimeStep ) THEN |
55 |
trIter = myIter-1 |
56 |
ELSE |
57 |
trIter = myIter |
58 |
ENDIF |
59 |
IF ( LS_doTimeStep .OR. trIter.EQ.nIter0 ) THEN |
60 |
#else |
61 |
IF ( .TRUE. ) THEN |
62 |
#endif |
63 |
|
64 |
diagName = ' ' |
65 |
|
66 |
DO iTr = 1,PTRACERS_numInUse |
67 |
|
68 |
diagName = ' ' |
69 |
WRITE(diagName,'(A4,A2)') 'TRAC',PTRACERS_ioLabel(iTr) |
70 |
CALL DIAGNOSTICS_FILL( pTracer(1-Olx,1-Oly,1,1,1,iTr), diagName, |
71 |
& 0,Nr,0,1,1,myThid ) |
72 |
|
73 |
diagName = ' ' |
74 |
WRITE(diagName,'(A5,A2)') 'UTRAC',PTRACERS_ioLabel(iTr) |
75 |
IF ( DIAGNOSTICS_IS_ON(diagName,myThid) ) THEN |
76 |
DO bj = myByLo(myThid), myByHi(myThid) |
77 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
78 |
DO k=1,Nr |
79 |
DO j = 1,sNy |
80 |
DO i = 1,sNx+1 |
81 |
#ifdef ALLOW_LONGSTEP |
82 |
C at first timestep we do not have averaged velocities yet - |
83 |
C use initial velocities instead |
84 |
IF ( trIter.GT.nIter0 ) THEN |
85 |
dummy(i,j,k,bi,bj) = |
86 |
& LS_uVel(i,j,k,bi,bj)*hFacW(i,j,k,bi,bj) * |
87 |
& 0.5 _d 0*( pTracer(i,j,k,bi,bj,iTr) |
88 |
& + pTracer(i-1,j,k,bi,bj,iTr) ) |
89 |
ELSE |
90 |
#else |
91 |
IF (.TRUE.) THEN |
92 |
#endif |
93 |
dummy(i,j,k,bi,bj) = |
94 |
& uVel(i,j,k,bi,bj)*hFacW(i,j,k,bi,bj) * |
95 |
& 0.5 _d 0*( pTracer(i,j,k,bi,bj,iTr) |
96 |
& + pTracer(i-1,j,k,bi,bj,iTr) ) |
97 |
ENDIF |
98 |
ENDDO |
99 |
ENDDO |
100 |
ENDDO |
101 |
ENDDO |
102 |
ENDDO |
103 |
CALL DIAGNOSTICS_FILL( dummy, diagName, 0,Nr,0,1,1,myThid ) |
104 |
ENDIF |
105 |
|
106 |
diagName = ' ' |
107 |
WRITE(diagName,'(A5,A2)') 'VTRAC',PTRACERS_ioLabel(iTr) |
108 |
IF ( DIAGNOSTICS_IS_ON(diagName,myThid) ) THEN |
109 |
DO bj = myByLo(myThid), myByHi(myThid) |
110 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
111 |
DO k=1,Nr |
112 |
DO j = 1,sNy+1 |
113 |
DO i = 1,sNx |
114 |
#ifdef ALLOW_LONGSTEP |
115 |
C at first timestep we do not have averaged velocities yet - |
116 |
C use initial velocities instead |
117 |
IF ( trIter.GT.nIter0 ) THEN |
118 |
dummy(i,j,k,bi,bj) = |
119 |
& LS_vVel(i,j,k,bi,bj)*hFacS(i,j,k,bi,bj) * |
120 |
& 0.5 _d 0*( pTracer(i,j,k,bi,bj,iTr) |
121 |
& + pTracer(i,j-1,k,bi,bj,iTr) ) |
122 |
ELSE |
123 |
#else |
124 |
IF (.TRUE.) THEN |
125 |
#endif |
126 |
dummy(i,j,k,bi,bj) = |
127 |
& vVel(i,j,k,bi,bj)*hFacS(i,j,k,bi,bj) * |
128 |
& 0.5 _d 0*( pTracer(i,j,k,bi,bj,iTr) |
129 |
& + pTracer(i,j-1,k,bi,bj,iTr) ) |
130 |
ENDIF |
131 |
ENDDO |
132 |
ENDDO |
133 |
ENDDO |
134 |
ENDDO |
135 |
ENDDO |
136 |
CALL DIAGNOSTICS_FILL( dummy, diagName, 0,Nr,0,1,1,myThid ) |
137 |
ENDIF |
138 |
|
139 |
diagName = ' ' |
140 |
WRITE(diagName,'(A5,A2)') 'WTRAC',PTRACERS_ioLabel(iTr) |
141 |
IF ( DIAGNOSTICS_IS_ON(diagName,myThid) ) THEN |
142 |
DO bj = myByLo(myThid), myByHi(myThid) |
143 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
144 |
DO k=1,Nr |
145 |
km1 = MAX(k-1,1) |
146 |
DO j = 1,sNy |
147 |
DO i = 1,sNx |
148 |
#ifdef ALLOW_LONGSTEP |
149 |
C at first timestep we do not have averaged velocities yet - |
150 |
C use initial velocities instead |
151 |
IF ( trIter.GT.nIter0 ) THEN |
152 |
dummy(i,j,k,bi,bj) = LS_wVel(i,j,k,bi,bj) * |
153 |
& 0.5 _d 0*( pTracer(i,j,k,bi,bj,iTr) |
154 |
& + pTracer(i,j,km1,bi,bj,iTr) ) |
155 |
ELSE |
156 |
#else |
157 |
IF (.TRUE.) THEN |
158 |
#endif |
159 |
dummy(i,j,k,bi,bj) = wVel(i,j,k,bi,bj) * |
160 |
& 0.5 _d 0*( pTracer(i,j,k,bi,bj,iTr) |
161 |
& + pTracer(i,j,km1,bi,bj,iTr) ) |
162 |
ENDIF |
163 |
ENDDO |
164 |
ENDDO |
165 |
ENDDO |
166 |
ENDDO |
167 |
ENDDO |
168 |
CALL DIAGNOSTICS_FILL( dummy, diagName, 0,Nr,0,1,1,myThid ) |
169 |
ENDIF |
170 |
|
171 |
ENDDO |
172 |
|
173 |
C LS_doTimeStep |
174 |
ENDIF |
175 |
|
176 |
#endif /* ALLOW_DIAGNOSTICS */ |
177 |
|
178 |
RETURN |
179 |
END |
180 |
|
181 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |