Back to home page

darwin3

 
 

    


File indexing completed on 2024-12-17 18:32:25 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
09a6f3668a Jeff*0001 #include "ctrparam.h"
                0002 #include "ATM2D_OPTIONS.h"
                0003 C
                0004       SUBROUTINE CALC_FILELOAD( curTime, iloop, aloop,
                0005      &                        wght0, wght1,
                0006      &                        intime0, intime1,
                0007      &                        ifTime, myThid)
                0008 
                0009 C     *==========================================================*
                0010 C     | Determines weights to be used for external files.        |
                0011 C     *==========================================================*
                0012 
                0013       IMPLICIT NONE
                0014 
                0015 #include "ATMSIZE.h"
                0016 #include "SIZE.h"
                0017 #include "EEPARAMS.h"
                0018 #include "ATM2D_VARS.h"
                0019 
                0020 C     !INPUT/OUTPUT PARAMETERS:
                0021 C     === Routine arguments ===
                0022 C     curTime - Simulation time (s) starting from year 0
                0023 C     iloop - loop counter for main loop (coupled periods)
                0024 C     aloop - loop counter for atm time steps (within a coupled per.)
                0025 C     wght0, wght1 - weights of the two months to average
                0026 C     intime0 - first of the two month to average
                0027 C     intime1 - latter of the two months to average
                0028 C     iftime - return true if time to do a file re-load
                0029 C     myThid - Thread no. that called this routine.
9274434acc Jean*0030       _RL  curTime
09a6f3668a Jeff*0031       INTEGER iloop
                0032       INTEGER aloop
                0033       _RL  wght0
                0034       _RL  wght1
                0035       INTEGER intime0
                0036       INTEGER intime1
                0037       LOGICAL ifTime
                0038       INTEGER myThid
                0039 
                0040 
                0041 C     !LOCAL VARIABLES
                0042 
                0043       _RL  dmonth(0:13)
                0044       DATA dmonth /-1339200.D0, 1339200.D0, 3888000.D0, 6436800.D0,
                0045      &          9072000.D0, 11707200.D0, 14342400.D0, 16977600.D0,
                0046      &         19656000.D0, 22291200.D0, 24926400.D0, 27561600.D0,
                0047      &         30196800.D0, 32875200.D0/
                0048 C               /-15.5D0*86400.D0, 15.5D0*86400.D0, 45.0D0*86400.D0,
                0049 C     &           74.5D0*86400.D0, 105.0D0*86400.D0, 135.5D0*86400.D0,
                0050 C     &          166.0D0*86400.D0, 196.5D0*86400.D0, 227.5D0*86400.D0,
                0051 C     &          258.0D0*86400.D0, 288.5D0*86400.D0, 319.0D0*86400.D0,
                0052 C     &          349.5D0*86400.D0, 380.5D0*86400.D0/
                0053       _RL secYr
                0054       DATA secYr /31536000.D0/   !ignore externForcingCycle from data
                0055       _RL  ifcyc     ! time in current year, in seconds
                0056       INTEGER mn     ! loop counter
                0057 
                0058       iftime=.FALSE.
                0059       ifcyc=mod(curTime,secYr)
9274434acc Jean*0060 
09a6f3668a Jeff*0061       DO mn=1,13
                0062 
9274434acc Jean*0063         IF ((ifcyc.GT.dmonth(mn-1)).AND.(ifcyc.LE.dmonth(mn)))
09a6f3668a Jeff*0064      &      intime1=mn
                0065 
                0066       ENDDO
                0067 
                0068 C     hence if curTime falls exactly mid-month, it is dmonth(intime1)
                0069 C     although this should never happen if passed curTime is a mid-step time
9274434acc Jean*0070 
09a6f3668a Jeff*0071       intime0=intime1-1
9274434acc Jean*0072       wght1=(ifcyc - dmonth(intime0)) /
09a6f3668a Jeff*0073      &     (dmonth(intime1) - dmonth(intime0))
                0074       wght0= 1. _d 0-wght1
                0075 
                0076       IF (ifcyc.LE.dmonth(intime0) + dtatmo) ifTime=.TRUE.
                0077       IF ((iloop.EQ.1).AND.(aloop.EQ.1)) ifTime= .TRUE.
                0078 
                0079       IF (intime0.EQ.0) intime0=12
                0080       IF (intime1.EQ.13) intime1=1
9274434acc Jean*0081 
09a6f3668a Jeff*0082       RETURN
                0083       END