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.
trcdib.F in tags/nemo_v1_04/NEMO/TOP_SRC/SMS – NEMO

source: tags/nemo_v1_04/NEMO/TOP_SRC/SMS/trcdib.F @ 280

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

nemo_v1_update_005:RB: update headers for the TOP component.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.4 KB
Line 
1CCC $Header$ 
2CCC  TOP 1.0 , LOCEAN-IPSL (2005) 
3C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
4C ---------------------------------------------------------------------------
5CDIR$ LIST
6      SUBROUTINE trcdib(kt,kindic)
7CCC---------------------------------------------------------------------
8CCC
9CCC                       ROUTINE trcdib
10CCC                     ******************
11CCC
12CCC  Purpose :
13CCC  ---------
14CCC     Specific output of opa: biological fields
15CCC
16CCC     If "key_mpp" or "key_fdir, direct access FORMAT
17CCC
18CCC
19CC   Method :
20CC   -------
21CC
22CC At the beginning of the first time step (nit000), define all
23CC the NETCDF files and fields for passive tracer
24CC
25CC      At each time step call histdef to compute the mean if necessary
26CC Each nwrite time step, output the instantaneous or mean fields
27CC
28CC IF kindic <0, output of fields before the model interruption.
29CC      IF kindic =0, time step loop
30CC      IF kindic >0, output of fields before the time step loop
31CC
32CC
33CC
34CC   Input :
35CC   -----
36CC      argument
37CC              kt              : time step
38CC    kindic      : indicator of abnormal termination
39CC      COMMON
40CC            /comcoh/          : orthogonal curvilinear coordinates
41CC                                and scale factors
42CC            /comask/          : masks, bathymetry
43CC            /cottrc/          : passive tracers fields (before,now
44CC                                  ,after)
45CC            /cimcdf/     : NETCDF variables
46CC
47CC   Output :
48CC   ------
49CC      file
50CC              "histname" files: at least one file for each grid
51CC
52CC
53CC   Workspace :
54CC   ---------
55CC      local
56CC              zphy ()         : 3D aray for printing
57CC              ztra            : total nitrogen
58CC              zder            : derive in nitrogen
59CC
60CC
61CC   EXTERNAL :
62CC   --------
63CC prihre, hist..., dianam
64CC
65CC   MODIFICATIONS:
66CC   --------------
67CC      original  : 95-01  passive tracers  (M. Levy)
68CC      additions : 98-01 (C. Levy) NETCDF format using ioipsl interface
69CC      additions : 99-01 (M.A. Foujols) adapted for passive tracer
70CC      additions : 00-12 (E Kestenare) assign a parameter to name
71CC                                      individual tracers
72CC----------------------------------------------------------------------
73CC parameters and commons
74CC ======================
75      USE ioipsl
76      USE oce_trc
77      USE trp_trc
78      USE in_out_manager
79      USE trc
80      USE sms
81      USE dianam
82      IMPLICIT NONE
83CC----------------------------------------------------------------------
84CC local declarations
85CC ==================
86      INTEGER kt, kindic
87
88#    if defined key_passivetrc && key_trc_diabio
89
90      INTEGER ji, jj, jk, jn, jl
91      LOGICAL clp
92C
93      CHARACTER*40 clhstnam
94      CHARACTER*40 clop
95      CHARACTER*20 cltra, cltrau
96      CHARACTER*80 cltral
97
98      REAL zsto,zout
99      INTEGER iimi, iima, ijmi, ijma, ipk
100      REAL zsec
101
102      REAL ztra,zder,zphy(jpi,jpj,jpk)
103C
104CC----------------------------------------------------------------------
105CC statement functions
106CC ===================
107CDIR$ NOLIST
108#include "domzgr_substitute.h90"
109CDIR$ LIST
110CCC---------------------------------------------------------------------
111CCC  OPA8, LODYC (15/11/96)
112CCC---------------------------------------------------------------------
113C
114C 0. Initialisation
115C -----------------
116C
117C local variable for debugging
118      clp=.false.
119      clp=clp.and.lwp
120C
121C Define frequency of output and means
122C
123#        if defined key_diainstant
124      zsto=nwritebio*rdt
125      clop='inst(only(x))'
126#        else
127      zsto=rdt
128      clop='ave(only(x))'
129#        endif
130      zout=nwritebio*rdt
131C
132C Define indexes of the horizontal output zoom
133      iimi=1
134      iima=jpi
135      ijmi=1
136      ijma=jpj
137c ipk limit storage in depth
138      ipk = jpk
139C
140C
141C 1. Define NETCDF files and fields at beginning of first time step
142C -----------------------------------------------------------------
143C
144      IF(clp)WRITE(numout,*)'trcdib kt=',kt,' kindic ',kindic
145      IF (kt.eq.nit000.and.kindic.eq.1) THEN
146C
147C Define the NETCDF files for biological trends
148C
149          CALL dia_nam(clhstnam,nwrite,'biolog')
150          IF(lwp)WRITE(numout,*)
151     $        " Name of NETCDF file for biological trends ",clhstnam
152C Horizontal grid : glamt and gphit
153          WRITE(numout,*)" indexes of zoom = ",
154     $      iimi, iima, ijmi, ijma
155          WRITE(numout,*)" limit storage in depth = ", ipk
156C
157          CALL histbeg(clhstnam, jpi, glamt, jpj, gphit,
158     $        iimi, iima-iimi+1, ijmi, ijma-ijmi+1,
159     $        nit000-1, djulian, rdt, nhoritb, nitb)
160C Vertical grid for biological trends
161          CALL histvert(nitb, 'deptht', 'Vertical T levels',
162     $        'm', ipk, gdept, ndepitb)
163C
164C Declare all the output fields as NETCDF variables
165C
166C 
167C biological trends
168C
169          DO jn=1,jpdiabio
170            cltra=ctrbio(jn)    ! short title for biological diagnostic
171            cltral=ctrbil(jn)   ! long title for biological diagnostic
172            cltrau=ctrbiu(jn)   ! UNIT for biological diagnostic
173            CALL histdef(nitb, cltra, cltral, cltrau, jpi, jpj, nhoritb,
174     $          ipk, 1, ipk,  ndepitb, 32, clop, zsto, zout)
175          END DO
176C
177C CLOSE netcdf Files
178C         
179          CALL histend(nitb)
180C
181C SOME diagnostics to DO first time
182C
183
184#        if defined key_trc_npzd || defined key_trc_lobster1
185C
186C initial total nitrogen
187C
188          trai=0.
189          DO jn=1,jptra
190            DO jk=1,jpk
191              DO jj=1,jpj
192                DO ji=1,jpi
193                  trai=trai+trn(ji,jj,jk,jn)*fse3t(ji,jj,jk)*tmask(ji,jj
194     $                ,jk) 
195                END DO
196              END DO
197            END DO
198          END DO
199
200          IF (lwp) then
201              WRITE (numout,*) ' *** total nitrogen =  ',trai,
202     $            ' at beginning of run it= ',kt
203          ENDIF
204C
205          DO jk=1,jpk
206            DO jj=1,jpj
207              DO ji=1,jpi
208                zphy(ji,jj,jk)=trn(ji,jj,jk,jpphy)
209              END DO
210            END DO
211          END DO
212C
213          IF (lwp) then
214              WRITE (numout,*) ' -------'
215              WRITE (numout,*) ' phyto'
216              WRITE (numout,*) ' -------'
217              CALL prizre(zphy,jpi,jpj,jpk,62,2,122,20,1,14,1,0.,numout)
218          ENDIF 
219#        endif
220
221      ELSE
222C
223C
224C 2. Start writing data
225C ---------------------
226C
227C biological trends
228C
229          DO jn=1,jpdiabio
230            cltra=ctrbio(jn)  ! short title for biological diagnostic
231            CALL histwrite(nitb, cltra, kt, trbio(:,:,:,jn), ndimt50,
232     $          ndext50) 
233          END DO 
234#        if defined key_trc_npzd || defined key_trc_lobster1
235
236          IF(mod(kt-nit000+1,nwritebio).eq.0) THEN
237C
238C total nitrogen every nwritebio time step
239C
240              ztra=0.
241              DO jn=1,jptra
242                DO jk=1,jpk
243                  DO jj=1,jpj
244                    DO ji=1,jpi
245                      ztra=ztra+trn(ji,jj,jk,jn)*fse3t(ji,jj,jk)
246     $                    *tmask(ji,jj,jk) 
247                    END DO
248                  END DO
249                END DO
250              END DO
251C
252              zder=(ztra-trai)/trai
253              trai=ztra
254              IF (lwp) THEN
255                  WRITE (numout,*)
256                  WRITE (numout,*) ' *** derive in total nitrogen =  ',
257     $                zder,' %',' at it= ',kt
258                  WRITE (numout,*) ' *** total nitrogen =  ',trai,
259     $                ' at it= ',kt
260              ENDIF
261             
262C
263              DO jk=1,jpk
264                DO jj=1,jpj
265                  DO ji=1,jpi
266                    zphy(ji,jj,jk)=trn(ji,jj,jk,jpphy)
267                  END DO
268                END DO
269              END DO
270C
271              IF(lwp) THEN
272                  WRITE (numout,*)
273                  WRITE (numout,*) ' *** trcdib: at it= ',kt
274                  WRITE (numout,*) ' -------'
275                  WRITE (numout,*) ' phyto'
276                  WRITE (numout,*) ' -------'
277                  CALL prizre(zphy,jpi,jpj,jpk,jpj-1,2,jpj-1,20,1,14,1,
278     $                0.,numout) 
279              ENDIF
280
281          ENDIF 
282
283#        endif
284C
285C synchronise FILE
286C
287          IF(lwp .and. mod( kt, nwritebio ).EQ.0) THEN
288             WRITE(numout,*) '**** trcdib : write NetCDF fields'
289             CALL histsync(nitb)
290         ENDIF
291
292      ENDIF
293C
294C 3. Closing all files
295C --------------------
296      IF (kt.EQ.nitend.OR.kindic.LT.0) THEN
297          CALL histclo(nitb)
298      ENDIF
299
300#    else
301C
302C no passive tracers
303C
304#    endif
305
306C
307C 
308      RETURN
309      END
Note: See TracBrowser for help on using the repository browser.