Back to home page

MITgcm

 
 

    


File indexing completed on 2024-03-19 05:10:15 UTC

view on githubraw file Latest commit 720a211d on 2024-03-18 17:10:23 UTC
8f7d13d0c9 Jean*0001 #include "ECCO_OPTIONS.h"
6805a315c1 Gael*0002 #ifdef ALLOW_CTRL
                0003 # include "CTRL_OPTIONS.h"
                0004 #endif
5001c65f45 Patr*0005 
15f6a15ab5 Mart*0006 CBOP
                0007 C     !ROUTINE: COST_OBCS
                0008 C     !INTERFACE:
5001c65f45 Patr*0009       subroutine cost_obcs(
720a211d38 Ou W*0010      I                      myTime, myIter, myThid )
15f6a15ab5 Mart*0011 C     !DESCRIPTION: \bv
5001c65f45 Patr*0012 c     ==================================================================
                0013 c     SUBROUTINE cost_obcs
                0014 c     ==================================================================
                0015 c
9e430ef83d Jean*0016 c     o Evaluate cost function contributions for obcs
5001c65f45 Patr*0017 c
                0018 c     ==================================================================
                0019 c     SUBROUTINE cost_obcs
                0020 c     ==================================================================
15f6a15ab5 Mart*0021 C     \ev
5001c65f45 Patr*0022 
15f6a15ab5 Mart*0023 C     !USES:
5cf4364659 Mart*0024       IMPLICIT NONE
5001c65f45 Patr*0025 
                0026 c     == global variables ==
15f6a15ab5 Mart*0027 #include "SIZE.h"
                0028 #include "EEPARAMS.h"
                0029 
c509d7e04a Gael*0030 #ifdef ALLOW_CAL
                0031 # include "cal.h"
                0032 #endif
                0033 #ifdef ALLOW_CTRL
5cf4364659 Mart*0034 # include "CTRL_SIZE.h"
4d72283393 Mart*0035 # include "CTRL.h"
c509d7e04a Gael*0036 #endif
720a211d38 Ou W*0037 #ifdef ALLOW_OBCS_CONTROL
5cf4364659 Mart*0038 # include "CTRL_OBCS.h"
                0039 #endif
5001c65f45 Patr*0040 
15f6a15ab5 Mart*0041 C     !INPUT/OUTPUT PARAMETERS:
720a211d38 Ou W*0042       _RL     myTime
                0043       integer myIter
                0044       integer myThid
5001c65f45 Patr*0045 
5cf4364659 Mart*0046 #if ( defined ALLOW_CTRL && defined ALLOW_OBCS )
15f6a15ab5 Mart*0047 C     !LOCAL VARIABLES:
                0048       integer startrec
                0049       integer endrec
5cf4364659 Mart*0050       integer ivar
720a211d38 Ou W*0051       integer iobcsN, iobcsS, iobcsE, iobcsW
15f6a15ab5 Mart*0052 CEOP
                0053 
5cf4364659 Mart*0054 C     Find ctrl-indices
720a211d38 Ou W*0055       iobcsN = 0
                0056       iobcsS = 0
                0057       iobcsE = 0
                0058       iobcsW = 0
5cf4364659 Mart*0059       DO ivar = 1, maxcvars
                0060        IF ( ncvargrd(ivar) .EQ. 'm' ) THEN
720a211d38 Ou W*0061         IF ( ncvarindex(ivar) .EQ. 1 ) iobcsN = ivar
                0062         IF ( ncvarindex(ivar) .EQ. 2 ) iobcsS = ivar
                0063         IF ( ncvarindex(ivar) .EQ. 3 ) iobcsE = ivar
                0064         IF ( ncvarindex(ivar) .EQ. 4 ) iobcsW = ivar
5cf4364659 Mart*0065        ENDIF
                0066       ENDDO
                0067 #if ( defined ALLOW_OBCSN_CONTROL && defined ALLOW_OBCSN_COST_CONTRIBUTION )
720a211d38 Ou W*0068       IF ( iobcsN.GT.0 ) THEN
15f6a15ab5 Mart*0069 cgg   North boundary contribution to cost function.
720a211d38 Ou W*0070        startrec = ncvarrecstart(iobcsN)
                0071        endrec   = ncvarrecsend(iobcsN)
                0072        call cost_obcsn( startrec, endrec,
                0073      I                  myTime, myIter, myThid )
                0074       ENDIF
15f6a15ab5 Mart*0075 #endif
5cf4364659 Mart*0076 #if ( defined ALLOW_OBCSS_CONTROL && defined ALLOW_OBCSS_COST_CONTRIBUTION )
720a211d38 Ou W*0077       IF ( iobcsS.GT.0 ) THEN
15f6a15ab5 Mart*0078 cgg   South boundary contribution to cost function.
720a211d38 Ou W*0079        startrec = ncvarrecstart(iobcsS)
                0080        endrec   = ncvarrecsend(iobcsS)
                0081        call cost_obcss( startrec, endrec,
                0082      I                  myTime, myIter, myThid )
                0083       ENDIF
5001c65f45 Patr*0084 #endif
5cf4364659 Mart*0085 #if ( defined ALLOW_OBCSW_CONTROL && defined ALLOW_OBCSW_COST_CONTRIBUTION )
720a211d38 Ou W*0086       IF ( iobcsW.GT.0 ) THEN
15f6a15ab5 Mart*0087 cgg   West boundary contribution to cost function.
720a211d38 Ou W*0088        startrec = ncvarrecstart(iobcsW)
                0089        endrec   = ncvarrecsend(iobcsW)
                0090        call cost_obcsw( startrec, endrec,
                0091      I                  myTime, myIter, myThid )
                0092       ENDIF
15f6a15ab5 Mart*0093 #endif
5cf4364659 Mart*0094 #if ( defined ALLOW_OBCSE_CONTROL && defined ALLOW_OBCSE_COST_CONTRIBUTION )
720a211d38 Ou W*0095       IF ( iobcsE.GT.0 ) THEN
15f6a15ab5 Mart*0096 cgg   East boundary contribution to cost function.
720a211d38 Ou W*0097        startrec = ncvarrecstart(iobcsE)
                0098        endrec   = ncvarrecsend(iobcsE)
                0099        call cost_obcse( startrec, endrec,
                0100      I                  myTime, myIter, myThid )
                0101       ENDIF
5001c65f45 Patr*0102 #endif
                0103 
15f6a15ab5 Mart*0104 #ifdef OBCS_VOLFLUX_COST_CONTRIBUTION
720a211d38 Ou W*0105       IF ( ( iobcsN+iobcsS+iobcsE+iobcsW ) .GT.0 ) THEN
                0106        call cost_obcsvol( startrec, endrec,
                0107      I                    myTime, myIter, myThid )
                0108       ENDIF
5001c65f45 Patr*0109 #endif
                0110 
c509d7e04a Gael*0111 #endif /* ALLOW_CTRL and ALLOW_OBCS */
                0112 
5cf4364659 Mart*0113       RETURN
                0114       END