C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_obcs.F,v 1.7 2012/08/10 19:45:26 jmc Exp $
C $Name:  $

#include "ECCO_OPTIONS.h"

CBOP
C     !ROUTINE: COST_OBCS
C     !INTERFACE:
      subroutine COST_OBCS(
     I                     myiter,
     I                     mytime,
     I                     mythid
     &                   )
C     !DESCRIPTION: \bv
c     ==================================================================
c     SUBROUTINE cost_obcs
c     ==================================================================
c
c     o Evaluate cost function contributions for obcs
c
c     ==================================================================
c     SUBROUTINE cost_obcs
c     ==================================================================
C     \ev

C     !USES:
      implicit none

c     == global variables ==
#include "SIZE.h"
#include "EEPARAMS.h"

#include "cal.h"
#include "ctrl.h"

C     !INPUT/OUTPUT PARAMETERS:
c     == routine arguments ==

      integer myiter
      _RL     mytime
      integer mythid

C     !LOCAL VARIABLES:
c     == local variables ==
      integer startrec
      integer endrec

c     == end of interface ==
CEOP

#ifdef  ALLOW_OBCSN_COST_CONTRIBUTION
#ifdef  ALLOW_OBCSN_CONTROL
cgg   North boundary contribution to cost function.
      startrec = ncvarrecstart(11 )
      endrec   = ncvarrecsend(11 )
      call COST_OBCSN ( myiter, mytime,
     &                   startrec,endrec, mythid )
#endif
#endif
#ifdef  ALLOW_OBCSS_COST_CONTRIBUTION
#ifdef  ALLOW_OBCSS_CONTROL
cgg   South boundary contribution to cost function.
      startrec = ncvarrecstart(12 )
      endrec   = ncvarrecsend(12 )
      call COST_OBCSS ( myiter, mytime,
     &                   startrec,endrec, mythid )
#endif
#endif
#ifdef ALLOW_OBCSW_COST_CONTRIBUTION
#ifdef ALLOW_OBCSW_CONTROL
cgg   West boundary contribution to cost function.
      startrec = ncvarrecstart(13 )
      endrec   = ncvarrecsend(13 )
      call COST_OBCSW ( myiter, mytime,
     &                   startrec,endrec, mythid )
#endif
#endif
#ifdef     ALLOW_OBCSE_COST_CONTRIBUTION
#ifdef     ALLOW_OBCSE_CONTROL
cgg   East boundary contribution to cost function.
      startrec = ncvarrecstart(14 )
      endrec   = ncvarrecsend(14 )
      call COST_OBCSE ( myiter, mytime,
     &                  startrec,endrec, mythid )
#endif
#endif

#ifdef OBCS_VOLFLUX_COST_CONTRIBUTION
      call COST_OBCSVOL ( myiter,mytime,
     &                    startrec, endrec, mythid)
#endif

      end