﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
767	Updated CORRELATION algorithm	arango		"The '''CORRELATION''' driver that computes the 4D-Var error covariance normalization coefficients is updated:

* The set-up in '''read_phypar.F''' was cleaned out, so only the input grid and initial conditions NetCDF are processed.  The other input ROMS NetCDF files are ignored since they are not needed.

* The input parameter '''NTIMES''' was overwritten and set to 1 since this driver does not timestep the ROMS kernel.  The computer was running out of memory when '''ADJUST_BOUNDARY''', '''ADJUST_STFLUX''', or '''ADJUST_WSTRESS''' was activated with very large '''NTIMES''' and small '''NOBC''' and '''NSFF'''.

 We have a case with:
 {{{
   NTIMES =  788400
     NOBC == 10
     NSFF == 10

So the internal parameter:

    Nbrec = 1 + ntime(ng)/Nobc(ng) = 78841

resulting in the following array been allocated as:

    t_obc(0:217, 40, 4, 78841, 2, 2)
}}}
 which is huge, and we several similar arrays when '''ADJUST_BOUNDARY''' is activated.  Warnings for such cases were added in '''read_phypar.F'''.  It makes sense to make '''NTIMES=1''' in this driver to avoid such problem in the future.

 * Lots of warnings were added to '''get_state.F''' when the needed NetCDF variable is not founded in the input NetCDF file. For example, to process tangent linear model free-surface we have:
 {{{
!
!  Read in tangent linear free-surface (m).
!
        IF (get_var(idFsur)) THEN
          foundit=find_string(var_name, n_var, TRIM(Vname(1,idFsur)),   &
     &                        varid)
          IF (foundit) THEN
            gtype=var_flag(varid)*r2dvar
            status=nf_fread2d(ng, IDmod, ncname, ncINPid,               &
     &                        Vname(1,idFsur), varid,                   &
     &                        InpRec, gtype, Vsize,                     &
     &                        LBi, UBi, LBj, UBj,                       &
     &                        Fscl, Fmin, Fmax,                         &
# ifdef MASKING
     &                        GRID(ng) % rmask,                         &
# endif
     &                        OCEAN(ng) % tl_zeta(:,:,Tindex))
            IF (FoundError(status, nf90_noerr, __LINE__,                &
     &                     __FILE__)) THEN
              IF (Master) THEN
                WRITE (stdout,60) string, TRIM(Vname(1,idFsur)),        &
     &                            InpRec, TRIM(ncname)
              END IF
              exit_flag=2
              ioerror=status
              RETURN
            ELSE
              IF (Master) THEN
                WRITE (stdout,70) TRIM(Vname(2,idFsur)), Fmin, Fmax
              END IF
            END IF
          ELSE
            IF (Master) THEN
              WRITE (stdout,80) string, TRIM(Vname(1,idFsur)),          &
     &                          TRIM(ncname)
            END IF
            exit_flag=4
            IF (FoundError(exit_flag, nf90_noerr, __LINE__,             &
     &                     __FILE__)) THEN
              RETURN
            END IF
          END IF
        END IF
}}}
 so the new piece of code is after the '''ELSE''' statement if the variable is not found:
 {{{
        IF (get_var(idFsur)) THEN
          ...
          IF (foundit) THEN
            ...
          ELSE
            IF (Master) THEN
              WRITE (stdout,80) string, TRIM(Vname(1,idFsur)),          &
     &                          TRIM(ncname)
            END IF
            exit_flag=4
            IF (FoundError(exit_flag, nf90_noerr, __LINE__,             &
     &                     __FILE__)) THEN
              RETURN
            END IF
          END IF
        END IF
}}}

Many thanks to Andy Moore for reporting some of these issues."	upgrade	closed	major	Release ROMS/TOMS 3.7	Adjoint	3.7	Done		
