1 | C $Id$ |
---|
2 | CDIR$ LIST |
---|
3 | SUBROUTINE trcdii(kt,kindic) |
---|
4 | CCC--------------------------------------------------------------------- |
---|
5 | CCC |
---|
6 | CCC ROUTINE trcdii |
---|
7 | CCC ****************** |
---|
8 | CCC |
---|
9 | CCC Purpose : |
---|
10 | CCC --------- |
---|
11 | CCC output of passive tracer : additional 2D and 3D arrays |
---|
12 | CCC |
---|
13 | CCC |
---|
14 | CC Method : |
---|
15 | CC ------- |
---|
16 | CC |
---|
17 | CC At the beginning of the first time step (nit000), define all |
---|
18 | CC the NETCDF files and fields for concentration of passive tracer |
---|
19 | CC |
---|
20 | CC At each time step call histdef to compute the mean if necessary |
---|
21 | CC Each nwrite time step, output the instantaneous or mean fields |
---|
22 | CC |
---|
23 | CC IF kindic <0, output of fields before the model interruption. |
---|
24 | CC IF kindic =0, time step loop |
---|
25 | CC IF kindic >0, output of fields before the time step loop |
---|
26 | CC |
---|
27 | CC |
---|
28 | CC |
---|
29 | CC Input : |
---|
30 | CC ----- |
---|
31 | CC argument |
---|
32 | CC kt : time step |
---|
33 | CC kindic : indicator of abnormal termination |
---|
34 | CC COMMON |
---|
35 | CC /comcoh/ : orthogonal curvilinear coordinates |
---|
36 | CC and scale factors |
---|
37 | CC /comask/ : masks, bathymetry |
---|
38 | CC /cottrc/ : passive tracers fields (before,now |
---|
39 | CC ,after) |
---|
40 | CC /citcdf/ : NETCDF variables |
---|
41 | CC |
---|
42 | CC Output : |
---|
43 | CC ------ |
---|
44 | CC file |
---|
45 | CC "clhstnam" files : one for concentration, one for |
---|
46 | CC aditional 2D and 3D arrays |
---|
47 | CC |
---|
48 | CC |
---|
49 | CC Workspace : |
---|
50 | CC --------- |
---|
51 | CC local |
---|
52 | CC |
---|
53 | CC EXTERNAL : |
---|
54 | CC -------- |
---|
55 | CC prihre, hist..., dianam |
---|
56 | CC |
---|
57 | CC MODIFICATIONS: |
---|
58 | CC -------------- |
---|
59 | CC original : 95-01 passive tracers (M. Levy) |
---|
60 | CC additions : 98-01 (C. Levy) NETCDF format using ioipsl interface |
---|
61 | CC additions : 99-01 (M.A. Foujols) adapted for passive tracer |
---|
62 | CC additions : 99-09 (M.A. Foujols) split into three parts |
---|
63 | CC---------------------------------------------------------------------- |
---|
64 | CC parameters and commons |
---|
65 | CC ====================== |
---|
66 | USE ioipsl |
---|
67 | CDIR$ NOLIST |
---|
68 | USE oce_trc |
---|
69 | USE trc |
---|
70 | USE dianam ! build name of file (routine) |
---|
71 | CDIR$ LIST |
---|
72 | CC---------------------------------------------------------------------- |
---|
73 | CC local declarations |
---|
74 | CC ================== |
---|
75 | INTEGER kt, kindic |
---|
76 | |
---|
77 | # if defined key_passivetrc && defined key_trc_diaadd |
---|
78 | |
---|
79 | INTEGER jn |
---|
80 | LOGICAL clp |
---|
81 | C |
---|
82 | CHARACTER*40 clhstnam |
---|
83 | CHARACTER*40 clop |
---|
84 | CHARACTER*20 cltra, cltrau |
---|
85 | CHARACTER*80 cltral |
---|
86 | |
---|
87 | REAL zsto, zout |
---|
88 | INTEGER iimi, iima, ijmi, ijma, ipk |
---|
89 | C |
---|
90 | CC---------------------------------------------------------------------- |
---|
91 | CCC--------------------------------------------------------------------- |
---|
92 | CCC OPA8, LODYC (15/11/96) |
---|
93 | CCC--------------------------------------------------------------------- |
---|
94 | C |
---|
95 | C 0. Initialisation |
---|
96 | C ----------------- |
---|
97 | C |
---|
98 | C |
---|
99 | C local variable for debugging |
---|
100 | clp=.true. |
---|
101 | clp=clp.and.lwp |
---|
102 | C |
---|
103 | C Define frequency of output and means |
---|
104 | C |
---|
105 | # if defined key_diainstant |
---|
106 | zsto=nwriteadd*rdt |
---|
107 | clop='inst(only(x))' |
---|
108 | # else |
---|
109 | zsto=rdt |
---|
110 | clop='ave(only(x))' |
---|
111 | # endif |
---|
112 | zout=nwriteadd*rdt |
---|
113 | C |
---|
114 | C Define indexes of the horizontal output zoom |
---|
115 | iimi=1 |
---|
116 | iima=jpi |
---|
117 | ijmi=1 |
---|
118 | ijma=jpj |
---|
119 | c ipk limit storage in depth |
---|
120 | ipk = jpk |
---|
121 | C |
---|
122 | C |
---|
123 | C 1. Define NETCDF files and fields at beginning of first time step |
---|
124 | C ----------------------------------------------------------------- |
---|
125 | C |
---|
126 | IF(clp)WRITE(numout,*)'trcdii kt=',kt,' kindic ',kindic |
---|
127 | IF (kt.eq.nit000.and.kindic.eq.1) THEN |
---|
128 | |
---|
129 | C |
---|
130 | C Define the NETCDF files for additional arrays : 2D or 3D |
---|
131 | C |
---|
132 | C Define the T grid file for tracer auxiliary files |
---|
133 | C |
---|
134 | CALL dia_nam(clhstnam,nwrite,'diad_T') |
---|
135 | IF(lwp)WRITE(numout,*)" Name of NETCDF file ", |
---|
136 | $ clhstnam |
---|
137 | C Define a netcdf FILE for 2d and 3d arrays |
---|
138 | CALL histbeg(clhstnam, jpi, glamt, jpj, gphit, |
---|
139 | $ iimi, iima-iimi+1, ijmi, ijma-ijmi+1, |
---|
140 | $ nit000-1, djulian, rdt, nhoritd, nitd) |
---|
141 | C Vertical grid for 2d and 3d arrays |
---|
142 | CALL histvert(nitd, 'deptht', 'Vertical T levels', |
---|
143 | $ 'm', ipk, gdept, ndepitd) |
---|
144 | C |
---|
145 | C Declare all the output fields as NETCDF variables |
---|
146 | C |
---|
147 | C more 3D horizontal arrays |
---|
148 | C |
---|
149 | DO jn=1,jpdia3d |
---|
150 | cltra=ctrc3d(jn) ! short title for 3D diagnostic |
---|
151 | cltral=ctrc3l(jn) ! long title for 3D diagnostic |
---|
152 | cltrau=ctrc3u(jn) ! UNIT for 3D diagnostic |
---|
153 | CALL histdef(nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd, |
---|
154 | $ ipk, 1, ipk, ndepitd, 32, clop, zsto, zout) |
---|
155 | END DO |
---|
156 | |
---|
157 | C |
---|
158 | C more 2D horizontal arrays |
---|
159 | C |
---|
160 | DO jn=1,jpdia2d |
---|
161 | cltra=ctrc2d(jn) ! short title for 2D diagnostic |
---|
162 | cltral=ctrc2l(jn) ! long title for 2D diagnostic |
---|
163 | cltrau=ctrc2u(jn) ! UNIT for 2D diagnostic |
---|
164 | CALL histdef(nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd, |
---|
165 | $ 1, 1, 1, -99, 32, clop, zsto, zout) |
---|
166 | END DO |
---|
167 | |
---|
168 | C |
---|
169 | C TODO: more 2D vertical sections arrays : I or J indice fixed |
---|
170 | C |
---|
171 | |
---|
172 | C |
---|
173 | C CLOSE netcdf Files |
---|
174 | C |
---|
175 | CALL histend(nitd) |
---|
176 | C |
---|
177 | C SOME diagnostics to DO first time |
---|
178 | C |
---|
179 | |
---|
180 | ELSE |
---|
181 | C |
---|
182 | C |
---|
183 | C 2. Start writing data |
---|
184 | C --------------------- |
---|
185 | C |
---|
186 | C more 3D horizontal arrays |
---|
187 | C |
---|
188 | DO jn=1,jpdia3d |
---|
189 | cltra=ctrc3d(jn) ! short title for 3D diagnostic |
---|
190 | CALL histwrite(nitd, cltra, kt, trc3d(:,:,:,jn), ndimt50 |
---|
191 | $ ,ndext50) |
---|
192 | END DO |
---|
193 | |
---|
194 | C |
---|
195 | C more 2D horizontal arrays |
---|
196 | C |
---|
197 | DO jn=1,jpdia2d |
---|
198 | cltra=ctrc2d(jn) ! short title for 2D diagnostic |
---|
199 | CALL histwrite(nitd, cltra, kt, trc2d(:,:,jn), ndimt51 |
---|
200 | $ ,ndext51) |
---|
201 | END DO |
---|
202 | |
---|
203 | C |
---|
204 | C synchronise FILE |
---|
205 | C |
---|
206 | IF(lwp .and. mod( kt, nwriteadd ).EQ.0) THEN |
---|
207 | WRITE(numout,*) |
---|
208 | $ '**** trcdii : write NetCDF aditional arrays' |
---|
209 | CALL histsync(nitd) |
---|
210 | ENDIF |
---|
211 | ENDIF |
---|
212 | C |
---|
213 | C 3. Closing all files |
---|
214 | C -------------------- |
---|
215 | IF (kt.EQ.nitend.OR.kindic.LT.0) THEN |
---|
216 | CALL histclo(nitd) |
---|
217 | ENDIF |
---|
218 | |
---|
219 | # else |
---|
220 | C |
---|
221 | C no passive tracers |
---|
222 | C |
---|
223 | # endif |
---|
224 | |
---|
225 | C |
---|
226 | C |
---|
227 | RETURN |
---|
228 | END |
---|