New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
trcdii.F in trunk/NEMO/TOP_SRC – NEMO

source: trunk/NEMO/TOP_SRC/trcdii.F @ 186

Last change on this file since 186 was 186, checked in by opalod, 19 years ago

CL + CE : NEMO TRC_SRC start

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.0 KB
Line 
1C $Id$
2CDIR$ LIST
3      SUBROUTINE trcdii(kt,kindic)
4CCC---------------------------------------------------------------------
5CCC
6CCC                       ROUTINE trcdii
7CCC                     ******************
8CCC
9CCC  Purpose :
10CCC  ---------
11CCC     output of passive tracer : additional 2D and 3D arrays
12CCC
13CCC
14CC   Method :
15CC   -------
16CC
17CC At the beginning of the first time step (nit000), define all
18CC the NETCDF files and fields for concentration of passive tracer
19CC
20CC      At each time step call histdef to compute the mean if necessary
21CC Each nwrite time step, output the instantaneous or mean fields
22CC
23CC IF kindic <0, output of fields before the model interruption.
24CC      IF kindic =0, time step loop
25CC      IF kindic >0, output of fields before the time step loop
26CC
27CC
28CC
29CC   Input :
30CC   -----
31CC      argument
32CC              kt              : time step
33CC    kindic      : indicator of abnormal termination
34CC      COMMON
35CC            /comcoh/          : orthogonal curvilinear coordinates
36CC                                and scale factors
37CC            /comask/          : masks, bathymetry
38CC            /cottrc/          : passive tracers fields (before,now
39CC                                  ,after)
40CC            /citcdf/     : NETCDF variables
41CC
42CC   Output :
43CC   ------
44CC      file
45CC              "clhstnam" files : one for concentration, one for
46CC                                 aditional 2D and 3D arrays
47CC
48CC
49CC   Workspace :
50CC   ---------
51CC      local
52CC
53CC   EXTERNAL :
54CC   --------
55CC prihre, hist..., dianam
56CC
57CC   MODIFICATIONS:
58CC   --------------
59CC      original  : 95-01  passive tracers  (M. Levy)
60CC      additions : 98-01 (C. Levy) NETCDF format using ioipsl interface
61CC      additions : 99-01 (M.A. Foujols) adapted for passive tracer
62CC      additions : 99-09 (M.A. Foujols) split into three parts
63CC----------------------------------------------------------------------
64CC parameters and commons
65CC ======================
66      USE ioipsl
67CDIR$ NOLIST
68      USE oce_trc
69      USE trc
70      USE dianam    ! build name of file (routine)
71CDIR$ LIST
72CC----------------------------------------------------------------------
73CC local declarations
74CC ==================
75      INTEGER kt, kindic
76
77#    if defined key_passivetrc && defined key_trc_diaadd
78
79      INTEGER jn
80      LOGICAL clp
81C
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
89C
90CC----------------------------------------------------------------------
91CCC---------------------------------------------------------------------
92CCC  OPA8, LODYC (15/11/96)
93CCC---------------------------------------------------------------------
94C
95C 0. Initialisation
96C -----------------
97C
98C
99C local variable for debugging
100      clp=.true.
101      clp=clp.and.lwp
102C
103C Define frequency of output and means
104C
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
113C
114C Define indexes of the horizontal output zoom
115      iimi=1
116      iima=jpi
117      ijmi=1
118      ijma=jpj
119c ipk limit storage in depth
120      ipk = jpk
121C
122C
123C 1. Define NETCDF files and fields at beginning of first time step
124C -----------------------------------------------------------------
125C
126      IF(clp)WRITE(numout,*)'trcdii kt=',kt,' kindic ',kindic
127      IF (kt.eq.nit000.and.kindic.eq.1) THEN
128       
129C
130C Define the NETCDF files for additional arrays : 2D or 3D
131C
132C Define the T grid file for tracer auxiliary files
133C
134          CALL dia_nam(clhstnam,nwrite,'diad_T')
135          IF(lwp)WRITE(numout,*)" Name of NETCDF file ",
136     $        clhstnam
137C 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)
141C Vertical grid for 2d and 3d arrays
142          CALL histvert(nitd, 'deptht', 'Vertical T levels',
143     $        'm', ipk, gdept, ndepitd)
144C
145C Declare all the output fields as NETCDF variables
146C
147C more 3D horizontal arrays
148C
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         
157C
158C more 2D horizontal arrays
159C
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         
168C
169C TODO: more 2D vertical sections arrays : I or J indice fixed 
170C
171
172C
173C CLOSE netcdf Files
174C         
175          CALL histend(nitd)
176C
177C SOME diagnostics to DO first time
178C
179
180      ELSE
181C
182C
183C 2. Start writing data
184C ---------------------
185C
186C more 3D horizontal arrays
187C
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
194C
195C more 2D horizontal arrays
196C
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
203C
204C synchronise FILE 
205C
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
212C
213C 3. Closing all files
214C --------------------
215      IF (kt.EQ.nitend.OR.kindic.LT.0) THEN
216          CALL histclo(nitd)
217      ENDIF
218
219#    else
220C
221C no passive tracers
222C
223#    endif
224
225C
226C 
227      RETURN
228      END
Note: See TracBrowser for help on using the repository browser.