| 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 |
c | | |
| 13 |
C *==========================================================* |
| 14 |
|
| 15 |
IMPLICIT NONE |
| 16 |
|
| 17 |
#include "ATMSIZE.h" |
| 18 |
#include "SIZE.h" |
| 19 |
#include "EEPARAMS.h" |
| 20 |
#include "ATM2D_VARS.h" |
| 21 |
|
| 22 |
C !INPUT/OUTPUT PARAMETERS: |
| 23 |
C === Routine arguments === |
| 24 |
C curTime - Simulation time (s) starting from year 0 |
| 25 |
C myThid - Thread no. that called this routine. |
| 26 |
_RL curTime |
| 27 |
INTEGER iloop |
| 28 |
INTEGER aloop |
| 29 |
_RL wght0 |
| 30 |
_RL wght1 |
| 31 |
INTEGER intime0 |
| 32 |
INTEGER intime1 |
| 33 |
LOGICAL ifTime |
| 34 |
INTEGER myThid |
| 35 |
|
| 36 |
|
| 37 |
C !LOCAL VARIABLES |
| 38 |
|
| 39 |
_RL dmonth(0:13) |
| 40 |
DATA dmonth /-1339200.D0, 1339200.D0, 3888000.D0, 6436800.D0, |
| 41 |
& 9072000.D0, 11707200.D0, 14342400.D0, 16977600.D0, |
| 42 |
& 19656000.D0, 22291200.D0, 24926400.D0, 27561600.D0, |
| 43 |
& 30196800.D0, 32875200.D0/ |
| 44 |
C /-15.5D0*86400.D0, 15.5D0*86400.D0, 45.0D0*86400.D0, |
| 45 |
C & 74.5D0*86400.D0, 105.0D0*86400.D0, 135.5D0*86400.D0, |
| 46 |
C & 166.0D0*86400.D0, 196.5D0*86400.D0, 227.5D0*86400.D0, |
| 47 |
C & 258.0D0*86400.D0, 288.5D0*86400.D0, 319.0D0*86400.D0, |
| 48 |
C & 349.5D0*86400.D0, 380.5D0*86400.D0/ |
| 49 |
_RL secYr |
| 50 |
DATA secYr /31536000.D0/ !ignore externForcingCycle from data |
| 51 |
_RL ifcyc ! time in current year, in seconds |
| 52 |
INTEGER mn ! loop counter |
| 53 |
|
| 54 |
iftime=.FALSE. |
| 55 |
ifcyc=mod(curTime,secYr) |
| 56 |
|
| 57 |
DO mn=1,13 |
| 58 |
|
| 59 |
IF ((ifcyc.GT.dmonth(mn-1)).AND.(ifcyc.LE.dmonth(mn))) |
| 60 |
& intime1=mn |
| 61 |
|
| 62 |
ENDDO |
| 63 |
|
| 64 |
C hence if curTime falls exactly mid-month, it is dmonth(intime1) |
| 65 |
C although this should never happen if passed curTime is a mid-step time |
| 66 |
|
| 67 |
intime0=intime1-1 |
| 68 |
wght1=(ifcyc - dmonth(intime0)) / |
| 69 |
& (dmonth(intime1) - dmonth(intime0)) |
| 70 |
wght0= 1. _d 0-wght1 |
| 71 |
|
| 72 |
IF (ifcyc.LE.dmonth(intime0) + dtatmo) ifTime=.TRUE. |
| 73 |
IF ((iloop.EQ.1).AND.(aloop.EQ.1)) ifTime= .TRUE. |
| 74 |
|
| 75 |
IF (intime0.EQ.0) intime0=12 |
| 76 |
IF (intime1.EQ.13) intime1=1 |
| 77 |
|
| 78 |
RETURN |
| 79 |
END |