CCC $Header$ CCC TOP 1.0 , LOCEAN-IPSL (2005) C This software is governed by CeCILL licence see modipsl/doc/NEMO_CeCILL.txt C --------------------------------------------------------------------------- CDIR$ LIST SUBROUTINE trcdii(kt,kindic) CCC--------------------------------------------------------------------- CCC CCC ROUTINE trcdii CCC ****************** CCC CCC Purpose : CCC --------- CCC output of passive tracer : additional 2D and 3D arrays CCC CCC CC Method : CC ------- CC CC At the beginning of the first time step (nit000), define all CC the NETCDF files and fields for concentration of passive tracer CC CC At each time step call histdef to compute the mean if necessary CC Each nwrite time step, output the instantaneous or mean fields CC CC IF kindic <0, output of fields before the model interruption. CC IF kindic =0, time step loop CC IF kindic >0, output of fields before the time step loop CC CC CC CC Input : CC ----- CC argument CC kt : time step CC kindic : indicator of abnormal termination CC COMMON CC /comcoh/ : orthogonal curvilinear coordinates CC and scale factors CC /comask/ : masks, bathymetry CC /cottrc/ : passive tracers fields (before,now CC ,after) CC /citcdf/ : NETCDF variables CC CC Output : CC ------ CC file CC "clhstnam" files : one for concentration, one for CC aditional 2D and 3D arrays CC CC CC Workspace : CC --------- CC local CC CC EXTERNAL : CC -------- CC prihre, hist..., dianam CC CC MODIFICATIONS: CC -------------- CC original : 95-01 passive tracers (M. Levy) CC additions : 98-01 (C. Levy) NETCDF format using ioipsl interface CC additions : 99-01 (M.A. Foujols) adapted for passive tracer CC additions : 99-09 (M.A. Foujols) split into three parts CC---------------------------------------------------------------------- CC parameters and commons CC ====================== USE ioipsl CDIR$ NOLIST USE oce_trc USE trc USE dianam ! build name of file (routine) CDIR$ LIST CC---------------------------------------------------------------------- CC local declarations CC ================== INTEGER kt, kindic # if defined key_passivetrc && defined key_trc_diaadd INTEGER jn LOGICAL clp C CHARACTER*40 clhstnam CHARACTER*40 clop CHARACTER*20 cltra, cltrau CHARACTER*80 cltral REAL zsto, zout INTEGER iimi, iima, ijmi, ijma, ipk C CC---------------------------------------------------------------------- C C 0. Initialisation C ----------------- C C C local variable for debugging clp=.true. clp=clp.and.lwp C C Define frequency of output and means C # if defined key_diainstant zsto=nwriteadd*rdt clop='inst(only(x))' # else zsto=rdt clop='ave(only(x))' # endif zout=nwriteadd*rdt C C Define indexes of the horizontal output zoom iimi=1 iima=jpi ijmi=1 ijma=jpj c ipk limit storage in depth ipk = jpk C C C 1. Define NETCDF files and fields at beginning of first time step C ----------------------------------------------------------------- C IF(clp)WRITE(numout,*)'trcdii kt=',kt,' kindic ',kindic IF (kt.eq.nit000.and.kindic.eq.1) THEN C C Define the NETCDF files for additional arrays : 2D or 3D C C Define the T grid file for tracer auxiliary files C CALL dia_nam(clhstnam,nwrite,'diad_T') IF(lwp)WRITE(numout,*)" Name of NETCDF file ", $ clhstnam C Define a netcdf FILE for 2d and 3d arrays CALL histbeg(clhstnam, jpi, glamt, jpj, gphit, $ iimi, iima-iimi+1, ijmi, ijma-ijmi+1, $ nit000-1, djulian, rdt, nhoritd, nitd) C Vertical grid for 2d and 3d arrays CALL histvert(nitd, 'deptht', 'Vertical T levels', $ 'm', ipk, gdept, ndepitd) C C Declare all the output fields as NETCDF variables C C more 3D horizontal arrays C DO jn=1,jpdia3d cltra=ctrc3d(jn) ! short title for 3D diagnostic cltral=ctrc3l(jn) ! long title for 3D diagnostic cltrau=ctrc3u(jn) ! UNIT for 3D diagnostic CALL histdef(nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd, $ ipk, 1, ipk, ndepitd, 32, clop, zsto, zout) END DO C C more 2D horizontal arrays C DO jn=1,jpdia2d cltra=ctrc2d(jn) ! short title for 2D diagnostic cltral=ctrc2l(jn) ! long title for 2D diagnostic cltrau=ctrc2u(jn) ! UNIT for 2D diagnostic CALL histdef(nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd, $ 1, 1, 1, -99, 32, clop, zsto, zout) END DO C C TODO: more 2D vertical sections arrays : I or J indice fixed C C C CLOSE netcdf Files C CALL histend(nitd) C C SOME diagnostics to DO first time C ELSE C C C 2. Start writing data C --------------------- C C more 3D horizontal arrays C DO jn=1,jpdia3d cltra=ctrc3d(jn) ! short title for 3D diagnostic CALL histwrite(nitd, cltra, kt, trc3d(:,:,:,jn), ndimt50 $ ,ndext50) END DO C C more 2D horizontal arrays C DO jn=1,jpdia2d cltra=ctrc2d(jn) ! short title for 2D diagnostic CALL histwrite(nitd, cltra, kt, trc2d(:,:,jn), ndimt51 $ ,ndext51) END DO C C synchronise FILE C IF(lwp .and. mod( kt, nwriteadd ).EQ.0) THEN WRITE(numout,*) $ '**** trcdii : write NetCDF aditional arrays' CALL histsync(nitd) ENDIF ENDIF C C 3. Closing all files C -------------------- IF (kt.EQ.nitend.OR.kindic.LT.0) THEN CALL histclo(nitd) ENDIF # else C C no passive tracers C # endif C C RETURN END