Back to home page

MITgcm

 
 

    


File indexing completed on 2022-08-15 05:09:19 UTC

view on githubraw file Latest commit cf705a6c on 2022-08-14 22:40:32 UTC
8f7d13d0c9 Jean*0001 #include "ECCO_OPTIONS.h"
5001c65f45 Patr*0002 
3ad0d94cb0 Patr*0003       subroutine cost_averagesfields( mytime, mythid )
5001c65f45 Patr*0004 
                0005 c     ==================================================================
3ad0d94cb0 Patr*0006 c     SUBROUTINE cost_averagesfields
5001c65f45 Patr*0007 c     ==================================================================
                0008 c
                0009 c     o Compute time averages of etaN, theta, and salt. The counters
                0010 c       are explicitly calculated instead of being incremented. This
                0011 c       reduces dependencies. The latter is useful for the adjoint code
                0012 c       generation.
                0013 c
                0014 c     started: Christian Eckert eckert@mit.edu 30-Jun-1999
                0015 c
                0016 c     changed: Christian Eckert eckert@mit.edu 24-Feb-2000
                0017 c
                0018 c              - Restructured the code in order to create a package
                0019 c                for the MITgcmUV.
                0020 c
                0021 c     ==================================================================
3ad0d94cb0 Patr*0022 c     SUBROUTINE cost_averagesfields
5001c65f45 Patr*0023 c     ==================================================================
                0024 
                0025       implicit none
                0026 
                0027 c     == global variables ==
                0028 
                0029 #include "EEPARAMS.h"
                0030 #include "SIZE.h"
                0031 #include "PARAMS.h"
                0032 
cf705a6c8e Mart*0033 #include "ECCO_SIZE.h"
                0034 #include "ECCO.h"
5001c65f45 Patr*0035 
                0036 c     == routine arguments ==
                0037 
                0038       _RL     mytime
                0039       integer mythid
                0040 
                0041 c     == local variables ==
                0042 
                0043       integer myiter
e7d9258ace Gael*0044       integer k
5001c65f45 Patr*0045       logical first
                0046       logical startofday
                0047       logical startofmonth
706976e7e4 Patr*0048       logical startofyear
5001c65f45 Patr*0049       logical inday
                0050       logical inmonth
706976e7e4 Patr*0051       logical inyear
5001c65f45 Patr*0052       logical last
                0053       logical endofday
                0054       logical endofmonth
706976e7e4 Patr*0055       logical endofyear
8c157ed454 Patr*0056 #ifdef ALLOW_GENCOST_CONTRIBUTION
                0057       logical startofgen(NGENCOST)
                0058       logical endofgen(NGENCOST)
                0059       logical ingen(NGENCOST)
70d5ee1f54 Gael*0060       integer sum1gen(NGENCOST)
                0061       integer genrec(NGENCOST)
5cce2b5d76 Gael*0062       integer kk
8c157ed454 Patr*0063 #endif
d534937279 Matt*0064 
5001c65f45 Patr*0065 c     == external functions ==
                0066 
                0067 c     == end of interface ==
                0068 
                0069       myiter = niter0 + INT((mytime-starttime)/deltaTClock+0.5)
951926fb9b Jean*0070 
5001c65f45 Patr*0071 c--   Get the time flags and record numbers for the time averaging.
                0072 
cc9899cf30 Patr*0073 #ifdef ALLOW_DEBUG
566bb73e6e Jean*0074       IF ( debugMode ) CALL DEBUG_CALL('cost_averagesflags',myThid)
cc9899cf30 Patr*0075 #endif
3ad0d94cb0 Patr*0076       call cost_averagesflags(
706976e7e4 Patr*0077      I                    myiter,     mytime,       mythid,
951926fb9b Jean*0078      O                    first,      last,
706976e7e4 Patr*0079      O                    startofday, startofmonth, startofyear,
                0080      O                    inday,      inmonth,      inyear,
                0081      O                    endofday,   endofmonth,   endofyear,
                0082      O                    sum1day,    dayrec,
                0083      O                    sum1mon,    monrec,
                0084      O                    sum1year,   yearrec
3ad0d94cb0 Patr*0085      &                  )
5001c65f45 Patr*0086 
8c157ed454 Patr*0087 #ifdef ALLOW_GENCOST_CONTRIBUTION
                0088       call cost_gencost_assignperiod(
                0089      I                    startofday, startofmonth, startofyear,
                0090      I                    inday,      inmonth,      inyear,
                0091      I                    endofday,   endofmonth,   endofyear,
                0092      O                    startofgen, endofgen,     ingen,
                0093      O                    sum1gen,    genrec,
e7d9258ace Gael*0094      I                    myiter, mythid )
8c157ed454 Patr*0095       call cost_gencost_customize( mythid )
5001c65f45 Patr*0096 
e7db56ba12 Gael*0097       do k = 1, NGENCOST
9eaee0f935 Gael*0098       if ( (using_gencost(k)).AND.(.NOT.gencost_barskip(k)) ) then
5cce2b5d76 Gael*0099       if ( .NOT.gencost_is3d(k) ) then
                0100         call cost_averagesgeneric(
                0101      &       gencost_barfile(k),
                0102      &       gencost_barfld(1-Olx,1-Oly,1,1,k),
                0103      &       gencost_modfld(1-Olx,1-Oly,1,1,k),
                0104      &       gencost_dummy(k),
                0105      &       first, last,
                0106      &       startofgen(k), endofgen(k), ingen(k),
                0107      &       sum1gen(k), genrec(k), 1, mythid )
                0108 #ifdef ALLOW_GENCOST3D
                0109       else
                0110         kk=gencost_pointer3d(k)
fce41e6d01 An T*0111         call cost_averagesgeneric(
                0112      &     gencost_barfile(k),
                0113      &     gencost_bar3d(1-Olx,1-Oly,1,1,1,kk),
                0114      &     gencost_mod3d(1-Olx,1-Oly,1,1,1,kk),
                0115      &     gencost_dummy(k),
                0116      &     first, last,
                0117      &     startofgen(k), endofgen(k), ingen(k),
                0118      &     sum1gen(k), genrec(k), nr, mythid )
5cce2b5d76 Gael*0119 #endif
                0120       endif
                0121 
d181f9168b Gael*0122       endif
8c157ed454 Patr*0123       end do
                0124 #endif /* ALLOW_GENCOST_CONTRIBUTION */
                0125 
cc9899cf30 Patr*0126 #ifdef ALLOW_DEBUG
566bb73e6e Jean*0127       IF ( debugMode ) CALL DEBUG_LEAVE('cost_averagesfields',myThid)
cc9899cf30 Patr*0128 #endif
                0129 
5001c65f45 Patr*0130       return
                0131       end