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 trcdit(kt,kindic) CCC--------------------------------------------------------------------- CCC CCC ROUTINE trcdit CCC ****************** CCC CCC Purpose : CCC --------- CCC Standard output of passive tracer : concentration fields 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 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) IMPLICIT NONE CDIR$ LIST CC---------------------------------------------------------------------- CC local declarations CC ================== INTEGER kt, kindic REAL xjulian # if defined key_passivetrc INTEGER jn LOGICAL clp C CHARACTER*40 clhstnam CHARACTER*40 clop CHARACTER*20 cltra, cltrau CHARACTER*80 cltral REAL zsto, zout, zsec INTEGER iyear,imonth,iday,iimi, iima, ijmi, ijma, ipk C C C 0. Initialisation C ----------------- C C C local variable for debugging clp=.false. clp=clp.and.lwp C C Define frequency of output and means C # if defined key_diainstant zsto=nwritetrc*rdt clop='inst(only(x))' # else zsto=rdt clop='ave(only(x))' # endif zout=nwritetrc*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,*)'trcdit kt=',kt,' kindic ',kindic IF (kt.eq.nit000.and.kindic.eq.1) THEN WRITE(numout,*)" indexes of zoom = ", $ iimi, iima, ijmi, ijma WRITE(numout,*)" limit storage in depth = ", ipk c c choose calendar for ioipsl c IF (nleapy .eq. 1) THEN CALL ioconf_calendar('gregorian') ELSE IF (nleapy .eq. 0) THEN CALL ioconf_calendar('noleap') ELSE IF (nleapy .eq. 30) THEN CALL ioconf_calendar('360d') ENDIF C C Compute julian date from starting date of the run C iyear = ijulian/10000 imonth = ijulian/100 - iyear*100 iday = ijulian - imonth*100 - iyear*10000 iyear = ijulian/10000 zsec=0. CALL ymds2ju(iyear,imonth,iday,zsec,xjulian) iyear = ndastp/10000 imonth = ndastp/100 - iyear*100 iday = ndastp - imonth*100 - iyear*10000 iyear = ndastp/10000 zsec=0. CALL ymds2ju(iyear,imonth,iday,zsec,djulian) write(0,*) iyear,imonth,iday,zsec,djulian IF(lwp)WRITE(numout,*)' ' IF(lwp)WRITE(numout,*)' Date 0 used :',nit000 $ ,' YEAR ',iyear,' MONTH ',imonth,' DAY ',iday $ ,'Julian day : ',djulian $ ,'XJulian day : ',xjulian C C Define the NETCDF files for passive tracer concentration C CALL dia_nam(clhstnam,nwrite,'ptrc_T') IF(lwp)WRITE(numout,*)" Name of NETCDF file ", $ clhstnam C Horizontal grid : glamt and gphit C CALL histbeg(clhstnam, jpi, glamt, jpj, gphit, $ iimi, iima-iimi+1, ijmi, ijma-ijmi+1, c $ nit000-1, xjulian, rdt, nhorit5, nit5) $ nit000-1, djulian, rdt, nhorit5, nit5) C Vertical grid for tracer : gdept CALL histvert(nit5, 'deptht', 'Vertical T levels', $ 'm', ipk, gdept, ndepit5) C Index of ocean points in 3D and 2D (surface) CALL wheneq(jpi*jpj*ipk,tmask,1,1.,ndext50,ndimt50) CALL wheneq(jpi*jpj,tmask,1,1.,ndext51,ndimt51) C C Declare all the output fields as NETCDF variables C C tracer concentrations C DO jn=1,jptra cltra=ctrcnm(jn) ! short title for tracer cltral=ctrcnl(jn) ! long title for tracer cltrau=ctrcun(jn) ! UNIT for tracer CALL histdef(nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5, $ ipk, 1, ipk, ndepit5, 32, clop, zsto, zout) END DO C C CLOSE netcdf Files C CALL histend(nit5) C C SOME diagnostics to DO first time C ELSE C C C 2. Start writing data C --------------------- C C tracer concentrations C DO jn=1,jptra cltra=ctrcnm(jn) ! short title for tracer CALL histwrite(nit5, cltra, kt,trn(:,:,:,jn), ndimt50, $ ndext50) END DO C C synchronise FILE C IF(lwp .and. mod( kt, nwritetrc ).EQ.0) THEN WRITE(numout,*) $ '**** trcdit : write NetCDF passive tracer concentration' CALL histsync(nit5) ENDIF ENDIF C C 3. Closing all files C -------------------- IF (kt.EQ.nitend.OR.kindic.LT.0) THEN CALL histclo(nit5) ENDIF # else C C no passive tracers C # endif C C RETURN END