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