| 1 |
jscott |
1.1 |
#include "ctrparam.h" |
| 2 |
|
|
#include "ATM2D_OPTIONS.h" |
| 3 |
|
|
C |
| 4 |
|
|
SUBROUTINE CALC_FILELOAD( curTime, iloop, aloop, |
| 5 |
|
|
& wght0, wght1, |
| 6 |
|
|
& intime0, intime1, |
| 7 |
|
|
& ifTime, myThid) |
| 8 |
|
|
|
| 9 |
|
|
C *==========================================================* |
| 10 |
|
|
C | Determines weights to be used for external files. | |
| 11 |
|
|
C *==========================================================* |
| 12 |
|
|
|
| 13 |
|
|
IMPLICIT NONE |
| 14 |
|
|
|
| 15 |
|
|
#include "ATMSIZE.h" |
| 16 |
|
|
#include "SIZE.h" |
| 17 |
|
|
#include "EEPARAMS.h" |
| 18 |
|
|
#include "ATM2D_VARS.h" |
| 19 |
|
|
|
| 20 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
| 21 |
|
|
C === Routine arguments === |
| 22 |
|
|
C curTime - Simulation time (s) starting from year 0 |
| 23 |
jscott |
1.3 |
C iloop - loop counter for main loop (coupled periods) |
| 24 |
|
|
C aloop - loop counter for atm time steps (within a coupled per.) |
| 25 |
|
|
C wght0, wght1 - weights of the two months to average |
| 26 |
|
|
C intime0 - first of the two month to average |
| 27 |
|
|
C intime1 - latter of the two months to average |
| 28 |
|
|
C iftime - return true if time to do a file re-load |
| 29 |
jscott |
1.1 |
C myThid - Thread no. that called this routine. |
| 30 |
|
|
_RL curTime |
| 31 |
|
|
INTEGER iloop |
| 32 |
|
|
INTEGER aloop |
| 33 |
|
|
_RL wght0 |
| 34 |
|
|
_RL wght1 |
| 35 |
|
|
INTEGER intime0 |
| 36 |
|
|
INTEGER intime1 |
| 37 |
|
|
LOGICAL ifTime |
| 38 |
|
|
INTEGER myThid |
| 39 |
|
|
|
| 40 |
|
|
|
| 41 |
|
|
C !LOCAL VARIABLES |
| 42 |
|
|
|
| 43 |
|
|
_RL dmonth(0:13) |
| 44 |
|
|
DATA dmonth /-1339200.D0, 1339200.D0, 3888000.D0, 6436800.D0, |
| 45 |
|
|
& 9072000.D0, 11707200.D0, 14342400.D0, 16977600.D0, |
| 46 |
|
|
& 19656000.D0, 22291200.D0, 24926400.D0, 27561600.D0, |
| 47 |
|
|
& 30196800.D0, 32875200.D0/ |
| 48 |
|
|
C /-15.5D0*86400.D0, 15.5D0*86400.D0, 45.0D0*86400.D0, |
| 49 |
|
|
C & 74.5D0*86400.D0, 105.0D0*86400.D0, 135.5D0*86400.D0, |
| 50 |
|
|
C & 166.0D0*86400.D0, 196.5D0*86400.D0, 227.5D0*86400.D0, |
| 51 |
|
|
C & 258.0D0*86400.D0, 288.5D0*86400.D0, 319.0D0*86400.D0, |
| 52 |
|
|
C & 349.5D0*86400.D0, 380.5D0*86400.D0/ |
| 53 |
|
|
_RL secYr |
| 54 |
|
|
DATA secYr /31536000.D0/ !ignore externForcingCycle from data |
| 55 |
|
|
_RL ifcyc ! time in current year, in seconds |
| 56 |
jscott |
1.3 |
INTEGER mn ! loop counter |
| 57 |
jscott |
1.1 |
|
| 58 |
|
|
iftime=.FALSE. |
| 59 |
|
|
ifcyc=mod(curTime,secYr) |
| 60 |
|
|
|
| 61 |
|
|
DO mn=1,13 |
| 62 |
|
|
|
| 63 |
|
|
IF ((ifcyc.GT.dmonth(mn-1)).AND.(ifcyc.LE.dmonth(mn))) |
| 64 |
|
|
& intime1=mn |
| 65 |
|
|
|
| 66 |
|
|
ENDDO |
| 67 |
|
|
|
| 68 |
|
|
C hence if curTime falls exactly mid-month, it is dmonth(intime1) |
| 69 |
|
|
C although this should never happen if passed curTime is a mid-step time |
| 70 |
|
|
|
| 71 |
|
|
intime0=intime1-1 |
| 72 |
|
|
wght1=(ifcyc - dmonth(intime0)) / |
| 73 |
|
|
& (dmonth(intime1) - dmonth(intime0)) |
| 74 |
jscott |
1.2 |
wght0= 1. _d 0-wght1 |
| 75 |
jscott |
1.1 |
|
| 76 |
|
|
IF (ifcyc.LE.dmonth(intime0) + dtatmo) ifTime=.TRUE. |
| 77 |
|
|
IF ((iloop.EQ.1).AND.(aloop.EQ.1)) ifTime= .TRUE. |
| 78 |
|
|
|
| 79 |
|
|
IF (intime0.EQ.0) intime0=12 |
| 80 |
|
|
IF (intime1.EQ.13) intime1=1 |
| 81 |
|
|
|
| 82 |
|
|
RETURN |
| 83 |
|
|
END |