Index: anches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/DIA/diagap.F90
===================================================================
--- /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/DIA/diagap.F90	(revision 2346)
+++ 	(revision )
@@ -1,267 +1,0 @@
-MODULE diagap
-   !!======================================================================
-   !!                       ***  MODULE  diagap  ***
-   !! Ocean diagnostics : computation of model-data tracer gap
-   !!======================================================================
-   !! History :  OPA  ! 1991-10  (G. Madec)  Original code
-   !!            7.0  ! 1992-07  (M. Imbard)  Add variance and mpp staff
-   !!   NEMO     1.0  ! 2002-07  (G. Madec)  Free form, F90
-   !!----------------------------------------------------------------------
-#if defined key_diagap
-   !!----------------------------------------------------------------------
-   !!   'key_diagap' :                           model-data gap diagnostics
-   !!----------------------------------------------------------------------
-   !!   dia_gap      : model and data level mean temperature and salinity
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE in_out_manager  ! I/O manager
-   USE dtatem          ! ???
-   USE dtasal          ! ???
-   USE dianam          ! build name of file (routine)
-   USE lib_mpp         ! distributed memory computing library
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   dia_gap    ! called in step.F90 module
-
-   LOGICAL, PUBLIC, PARAMETER ::   lk_diagap = .TRUE.   !: model-data diagnostics flag
-
-   !                         !!* Namelist namgap : model-data gap
-   INTEGER ::   nn_gap = 15   ! time step frequency
-   INTEGER ::   nn_prg = 15   ! switch for control print
-
-   INTEGER ::   numgap                      ! logical unit for differences diagnostic
-   INTEGER ::   nhoridg, ndepidg, ndex(1)   ! netcdf files and index common
-
-   REAL(wp) ::   vol                        ! total ocean volume
-
-   REAL(wp), DIMENSION(jpk) ::   volk , volkr   ! level ocean volume and its inverse
-   REAL(wp), DIMENSION(jpk) ::   tdtag, sdtag   ! level mean data temperature & salinity
-   REAL(wp), DIMENSION(jpk) ::   tmodg, smodg   ! level mean model temperature & salinity
-
-   !! * Substitutions
-#  include "domzgr_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-
-CONTAINS
-
-   SUBROUTINE dia_gap( kt )
-      !!----------------------------------------------------------------------
-      !!                ***  ROUTINE dia_gap  ***
-      !!
-      !! ** Purpose :   Compute model and data level mean T and S profiles
-      !!              and output it in numgap (NetCDF or direct access file)
-      !!
-      !! ** Method :   tracers (model) : tn, sn
-      !!               tracers (data)  : t_dta, s_dta
-      !!               difference between model and data tracers
-      !!               variance between model and data tracers
-      !!
-      !! ** Action  :   output in file numgap
-      !!----------------------------------------------------------------------
-      USE ioipsl
-      !!
-      INTEGER, INTENT(in) ::   kt           ! ocean time-step index
-      !!
-      INTEGER ::   ji, jj, jk   ! dummy loop indices
-      INTEGER ::   it, itmod    ! time step indices
-      CHARACTER (len=40) ::   clhstnam
-      CHARACTER (len=40) ::   clop
-      REAL(wp) ::   zbt, zdt    ! temporary scalar
-      REAL(wp) ::   zsto, zout, zmax, zjulian
-      REAL(wp), DIMENSION(jpi) ::   zfoo
-      REAL(wp), DIMENSION(jpj) ::   zloo
-      !!
-      NAMELIST/namgap/ nn_gap, nn_prg
-      !!----------------------------------------------------------------------
-
-      ! 0. initialization
-      ! -----------------
-      zdt = rdt
-      IF( nacc == 1 )   zdt = rdtmin
-
-      IF( kt == nit000 ) THEN
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'dia_gap : level mean model-data gap'
-         IF(lwp) WRITE(numout,*) '~~~~~~~'
-
-         REWIND( numnam )            ! Read diagap parameters in namelist namgap
-         READ( numnam, namgap )
-
-         IF(lwp) WRITE(numout,*) '          time step frequency for gap     nn_gap  = ',nn_gap
-         IF(lwp) WRITE(numout,*) '          switch for control print gap    nn_prg  = ',nn_prg
-
-         ! horizontal slab volume (tmask_i to take into account only interior ocean domain)
-         volk(:) = 0.e0
-         DO jk = 1, jpkm1
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zbt = e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) * tmask_i(ji,jj)
-                  volk(jk) = volk(jk) + tmask(ji,jj,jk) * zbt
-               END DO
-            END DO
-         END DO
-         IF( lk_mpp )   CALL mpp_sum( volk, jpk )   ! sum over the global domain
-
-         volkr(:) = 0.e0
-         DO jk = 1, jpk
-            IF( volk(jk) /= 0.e0 )   volkr(jk) = 1.e0 / volk(jk)
-         END DO
-         IF(lwp) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) '     volume of each horizontal slab (km3) :'
-            DO jk = 1, jpkm1
-               WRITE(numout,9010) jk, volk(jk) * 1.e-9
-            END DO
-         ENDIF
-9010     FORMAT( 9X, 'level ', i3, f15.3 )
-
-         ! basin volume
-         vol = 0.e0
-         DO jk = 1, jpkm1
-            vol = vol + volk(jk)
-         END DO
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) '     basin volume : ',vol*1.e-9, '  km3'
-
-         ! OPEN netcdf file 
-
-         ! Define frequency of output and means
-         zsto = nn_gap * zdt
-         IF( ln_mskland )   THEN   ;   clop = "ave(only(x))"   ! put 1.e+20 on land (very expensive!!)
-         ELSE                      ;   clop = "ave(x)"         ! no use of the mask value (require less cpu time)
-         ENDIF
-         zout = nn_gap * zdt
-         zmax = FLOAT( nitend - nit000 + 1 ) * zdt
-         zfoo(1:jpi) = 0.e0
-         zloo(1:jpj) = 0.e0
-
-         ! Compute julian date from starting date of the run
-
-         CALL ymds2ju( nyear, nmonth, nday, rdt, zjulian )
-         zjulian = zjulian - adatrj   !   set calendar origin to the beginning of the experiment
-
-         CALL dia_nam( clhstnam, nn_gap, 'diagap' )
-         IF(lwp) WRITE(numout,*) 'Name of diagap NETCDF file ', clhstnam
-         ! Horizontal grid : zphi()
-         CALL histbeg( clhstnam, 1, zfoo, 1, zloo,   &
-                       1, 1, 1, 1, nit000-1, zjulian, zdt, nhoridg, numgap, domain_id=nidom )
-         ! Vertical grids : gdept, gdepw
-         CALL histvert( numgap, "deptht", "Vertical T levels",   &
-                         "m", jpk, gdept_0, ndepidg, "down" )
-
-         ! define fields to be stored
-         ! mo(temp/sali)(da/mo/va): mean ocean temperature/salinity data/model/differences
-
-          CALL histdef( numgap, "motempda", "Mean Data Temperature","C",   &
-                        1, 1, nhoridg, jpk, 1, jpk, ndepidg, 32, clop,   &
-                        zsto,zout )
-          CALL histdef(numgap, "mosalida", "Mean Data Salinity","PSU",   &
-                        1, 1, nhoridg, jpk, 1, jpk, ndepidg, 32, clop,   &
-                        zsto,zout )
-          CALL histdef(numgap, "motempmo", "Mean Model Temperature","C",   &
-                        1, 1, nhoridg, jpk, 1, jpk, ndepidg, 32, clop,   &
-                        zsto,zout )
-          CALL histdef(numgap, "mosalimo", "Mean Model Salinity","PSU",   &
-                        1, 1, nhoridg, jpk, 1, jpk, ndepidg, 32, clop,   &
-                        zsto,zout )
-          CALL histend( numgap )
-          ndex(1) = 0
-      ENDIF
-
-
-      ! 1. horizontal averaged
-      ! ----------------------
-
-      itmod = kt - nit000 + 1       ! define time axis
-      it = kt 
-      IF( MOD( itmod, nn_gap ) == 0 ) THEN
-
-         ! initialization
-         tdtag(:) = 0.e0
-         sdtag(:) = 0.e0
-         tmodg(:) = 0.e0
-         smodg(:) = 0.e0
-         
-         !  c a u t i o n  : use of tmask_i : average over the interior domain only
-         
-         ! sum
-         DO jk = 1, jpkm1
-            DO jj = 1, jpj
-              DO ji = 1, jpi
-                zbt = e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) * tmask_i(ji,jj)
-                tdtag(jk) = tdtag(jk) + zbt * t_dta(ji,jj,jk) * volkr(jk)
-                sdtag(jk) = sdtag(jk) + zbt * s_dta(ji,jj,jk) * volkr(jk)
-                tmodg(jk) = tmodg(jk) + zbt * tn  (ji,jj,jk) * volkr(jk)
-                smodg(jk) = smodg(jk) + zbt * sn  (ji,jj,jk) * volkr(jk)
-              END DO  
-            END DO  
-         END DO
-
-         ! 2. Basin averaged
-         ! -----------------
-         DO jk = 1, jpkm1
-            tdtag(jpk) = tdtag(jpk) + tdtag(jk) * volk(jk) / vol
-            sdtag(jpk) = sdtag(jpk) + sdtag(jk) * volk(jk) / vol
-            tmodg(jpk) = tmodg(jpk) + tmodg(jk) * volk(jk) / vol
-            smodg(jpk) = smodg(jpk) + smodg(jk) * volk(jk) / vol
-         END DO  
-          IF( lk_mpp)   CALL mpp_sum( tdtag, jpk )   ! sum over the global domain
-          IF( lk_mpp)   CALL mpp_sum( sdtag, jpk )
-          IF( lk_mpp)   CALL mpp_sum( tmodg, jpk )
-          IF( lk_mpp)   CALL mpp_sum( smodg, jpk )
-
-          ! 3.  Averaged output in file numgap
-          ! ----------------------------======
-          IF( MOD( itmod, nn_prg ) == 0 ) THEN
-              IF(lwp) THEN
-                  WRITE(numout,*) 'dia_gap: time step = ', kt, 'model - data'
-                  WRITE(numout,9300)
-                  DO jk = 1, jpk
-                    WRITE(numout,9310) tdtag(jk), tmodg(jk), tdtag(jk) - tmodg(jk), jk, fsdept(1,1,jk),   &
-                       &               sdtag(jk), smodg(jk), sdtag(jk) - smodg(jk)
-                  END DO  
-              ENDIF
-          ENDIF
-
- 9300     FORMAT('  T-data  T-model    diff.   level  depth    S-data  S-model    diff.' )
- 9310     FORMAT( 3(f8.3,1x),i5,f9.0,2x,3(f8.3,1x) )
-
-          ! Output in file numgap
-
-          ! Netcdf write
-
-          IF (lwp ) THEN   ! Ok even in mpp after the call to mpp_sum
-             CALL histwrite( numgap, "motempda", it, tdtag, jpk, ndex )
-             CALL histwrite( numgap, "mosalida", it, sdtag, jpk, ndex )
-             CALL histwrite( numgap, "motempmo", it, tmodg, jpk, ndex )
-             CALL histwrite( numgap, "mosalimo", it, smodg, jpk, ndex )
-          END IF
-      ENDIF
-
-      ! Closing numgap file
-      IF( kt == nitend ) THEN
-         CALL histclo( numgap )      !   Netcdf file
-      ENDIF 
-      !
-   END SUBROUTINE dia_gap
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Default option :                                       Dummy module
-   !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_diagap = .FALSE.    !: diagap flag
-CONTAINS
-   SUBROUTINE dia_gap( kt )           ! Dummy routine
-      WRITE(*,*) 'dia_gap: You should not have seen this print! error?', kt
-   END SUBROUTINE dia_gap
-#endif
-
-   !!======================================================================
-END MODULE diagap
Index: /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/step.F90
===================================================================
--- /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 2346)
+++ /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 2347)
@@ -165,5 +165,4 @@
       IF( lk_floats  )   CALL flo_stp( kstp )         ! drifting Floats
       IF( lk_diahth  )   CALL dia_hth( kstp )         ! Thermocline depth (20 degres isotherm depth)
-      IF( lk_diagap  )   CALL dia_gap( kstp )         ! basin averaged diagnostics
       IF( lk_diahdy  )   CALL dia_hdy( kstp )         ! dynamical heigh diagnostics
       IF( lk_diafwb  )   CALL dia_fwb( kstp )         ! Fresh water budget diagnostics
Index: /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/step_oce.F90
===================================================================
--- /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/step_oce.F90	(revision 2346)
+++ /branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/step_oce.F90	(revision 2347)
@@ -84,5 +84,4 @@
    USE trdmod           ! momentum/tracers trends   
    USE trdvor           ! vorticity budget                 (trd_vor routine)
-   USE diagap           ! hor. mean model-data gap         (dia_gap routine)
    USE diahdy           ! dynamic height                   (dia_hdy routine)
    USE diaptr           ! poleward transports              (dia_ptr routine)
