1 | C $Header$ |
---|
2 | CDIR$ LIST |
---|
3 | SUBROUTINE trcdit(kt,kindic) |
---|
4 | CCC--------------------------------------------------------------------- |
---|
5 | CCC |
---|
6 | CCC ROUTINE trcdit |
---|
7 | CCC ****************** |
---|
8 | CCC |
---|
9 | CCC Purpose : |
---|
10 | CCC --------- |
---|
11 | CCC Standard output of passive tracer : concentration fields |
---|
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 |
---|
46 | CC |
---|
47 | CC |
---|
48 | CC Workspace : |
---|
49 | CC --------- |
---|
50 | CC local |
---|
51 | CC |
---|
52 | CC EXTERNAL : |
---|
53 | CC -------- |
---|
54 | CC prihre, hist..., dianam |
---|
55 | CC |
---|
56 | CC MODIFICATIONS: |
---|
57 | CC -------------- |
---|
58 | CC original : 95-01 passive tracers (M. Levy) |
---|
59 | CC additions : 98-01 (C. Levy) NETCDF format using ioipsl interface |
---|
60 | CC additions : 99-01 (M.A. Foujols) adapted for passive tracer |
---|
61 | CC additions : 99-09 (M.A. Foujols) split into three parts |
---|
62 | CC---------------------------------------------------------------------- |
---|
63 | CC parameters and commons |
---|
64 | CC ====================== |
---|
65 | USE ioipsl |
---|
66 | CDIR$ NOLIST |
---|
67 | USE oce_trc |
---|
68 | USE trc |
---|
69 | USE dianam ! build name of file (routine) |
---|
70 | IMPLICIT NONE |
---|
71 | CDIR$ LIST |
---|
72 | CC---------------------------------------------------------------------- |
---|
73 | CC local declarations |
---|
74 | CC ================== |
---|
75 | INTEGER kt, kindic |
---|
76 | REAL xjulian |
---|
77 | |
---|
78 | # if defined key_passivetrc |
---|
79 | |
---|
80 | INTEGER jn |
---|
81 | LOGICAL clp |
---|
82 | C |
---|
83 | CHARACTER*40 clhstnam |
---|
84 | CHARACTER*40 clop |
---|
85 | CHARACTER*20 cltra, cltrau |
---|
86 | CHARACTER*80 cltral |
---|
87 | |
---|
88 | REAL zsto, zout, zsec |
---|
89 | INTEGER iyear,imonth,iday,iimi, iima, ijmi, ijma, ipk |
---|
90 | C |
---|
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=.false. |
---|
101 | clp=clp.and.lwp |
---|
102 | C |
---|
103 | C Define frequency of output and means |
---|
104 | C |
---|
105 | # if defined key_diainstant |
---|
106 | zsto=nwritetrc*rdt |
---|
107 | clop='inst(only(x))' |
---|
108 | # else |
---|
109 | zsto=rdt |
---|
110 | clop='ave(only(x))' |
---|
111 | # endif |
---|
112 | zout=nwritetrc*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 | |
---|
122 | C |
---|
123 | C |
---|
124 | C 1. Define NETCDF files and fields at beginning of first time step |
---|
125 | C ----------------------------------------------------------------- |
---|
126 | C |
---|
127 | IF(clp)WRITE(numout,*)'trcdit kt=',kt,' kindic ',kindic |
---|
128 | IF (kt.eq.nit000.and.kindic.eq.1) THEN |
---|
129 | |
---|
130 | WRITE(numout,*)" indexes of zoom = ", |
---|
131 | $ iimi, iima, ijmi, ijma |
---|
132 | WRITE(numout,*)" limit storage in depth = ", ipk |
---|
133 | c |
---|
134 | c choose calendar for ioipsl |
---|
135 | c |
---|
136 | IF (nleapy .eq. 1) THEN |
---|
137 | CALL ioconf_calendar('gregorian') |
---|
138 | ELSE IF (nleapy .eq. 0) THEN |
---|
139 | CALL ioconf_calendar('noleap') |
---|
140 | ELSE IF (nleapy .eq. 30) THEN |
---|
141 | CALL ioconf_calendar('360d') |
---|
142 | ENDIF |
---|
143 | C |
---|
144 | C Compute julian date from starting date of the run |
---|
145 | C |
---|
146 | iyear = ijulian/10000 |
---|
147 | imonth = ijulian/100 - iyear*100 |
---|
148 | iday = ijulian - imonth*100 - iyear*10000 |
---|
149 | iyear = ijulian/10000 |
---|
150 | zsec=0. |
---|
151 | CALL ymds2ju(iyear,imonth,iday,zsec,xjulian) |
---|
152 | |
---|
153 | iyear = ndastp/10000 |
---|
154 | imonth = ndastp/100 - iyear*100 |
---|
155 | iday = ndastp - imonth*100 - iyear*10000 |
---|
156 | iyear = ndastp/10000 |
---|
157 | zsec=0. |
---|
158 | CALL ymds2ju(iyear,imonth,iday,zsec,djulian) |
---|
159 | write(0,*) iyear,imonth,iday,zsec,djulian |
---|
160 | IF(lwp)WRITE(numout,*)' ' |
---|
161 | IF(lwp)WRITE(numout,*)' Date 0 used :',nit000 |
---|
162 | $ ,' YEAR ',iyear,' MONTH ',imonth,' DAY ',iday |
---|
163 | $ ,'Julian day : ',djulian |
---|
164 | $ ,'XJulian day : ',xjulian |
---|
165 | C |
---|
166 | C Define the NETCDF files for passive tracer concentration |
---|
167 | C |
---|
168 | CALL dia_nam(clhstnam,nwrite,'ptrc_T') |
---|
169 | |
---|
170 | IF(lwp)WRITE(numout,*)" Name of NETCDF file ", |
---|
171 | $ clhstnam |
---|
172 | C Horizontal grid : glamt and gphit |
---|
173 | C |
---|
174 | CALL histbeg(clhstnam, jpi, glamt, jpj, gphit, |
---|
175 | $ iimi, iima-iimi+1, ijmi, ijma-ijmi+1, |
---|
176 | c $ nit000-1, xjulian, rdt, nhorit5, nit5) |
---|
177 | $ nit000-1, djulian, rdt, nhorit5, nit5) |
---|
178 | C Vertical grid for tracer : gdept |
---|
179 | CALL histvert(nit5, 'deptht', 'Vertical T levels', |
---|
180 | $ 'm', ipk, gdept, ndepit5) |
---|
181 | |
---|
182 | C Index of ocean points in 3D and 2D (surface) |
---|
183 | CALL wheneq(jpi*jpj*ipk,tmask,1,1.,ndext50,ndimt50) |
---|
184 | CALL wheneq(jpi*jpj,tmask,1,1.,ndext51,ndimt51) |
---|
185 | C |
---|
186 | C Declare all the output fields as NETCDF variables |
---|
187 | C |
---|
188 | C tracer concentrations |
---|
189 | C |
---|
190 | DO jn=1,jptra |
---|
191 | cltra=ctrcnm(jn) ! short title for tracer |
---|
192 | cltral=ctrcnl(jn) ! long title for tracer |
---|
193 | cltrau=ctrcun(jn) ! UNIT for tracer |
---|
194 | CALL histdef(nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5, |
---|
195 | $ ipk, 1, ipk, ndepit5, 32, clop, zsto, zout) |
---|
196 | END DO |
---|
197 | C |
---|
198 | C CLOSE netcdf Files |
---|
199 | C |
---|
200 | CALL histend(nit5) |
---|
201 | C |
---|
202 | C SOME diagnostics to DO first time |
---|
203 | C |
---|
204 | ELSE |
---|
205 | C |
---|
206 | C |
---|
207 | C 2. Start writing data |
---|
208 | C --------------------- |
---|
209 | C |
---|
210 | C tracer concentrations |
---|
211 | C |
---|
212 | DO jn=1,jptra |
---|
213 | cltra=ctrcnm(jn) ! short title for tracer |
---|
214 | CALL histwrite(nit5, cltra, kt,trn(:,:,:,jn), ndimt50, |
---|
215 | $ ndext50) |
---|
216 | END DO |
---|
217 | C |
---|
218 | C synchronise FILE |
---|
219 | C |
---|
220 | IF(lwp .and. mod( kt, nwritetrc ).EQ.0) THEN |
---|
221 | WRITE(numout,*) |
---|
222 | $ '**** trcdit : write NetCDF passive tracer concentration' |
---|
223 | CALL histsync(nit5) |
---|
224 | ENDIF |
---|
225 | ENDIF |
---|
226 | C |
---|
227 | C 3. Closing all files |
---|
228 | C -------------------- |
---|
229 | IF (kt.EQ.nitend.OR.kindic.LT.0) THEN |
---|
230 | CALL histclo(nit5) |
---|
231 | ENDIF |
---|
232 | |
---|
233 | # else |
---|
234 | C |
---|
235 | C no passive tracers |
---|
236 | C |
---|
237 | # endif |
---|
238 | |
---|
239 | C |
---|
240 | C |
---|
241 | RETURN |
---|
242 | END |
---|