1 |
gforget |
1.13 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_gencost_assignperiod.F,v 1.12 2014/10/22 13:28:27 gforget Exp $ |
2 |
heimbach |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
jmc |
1.7 |
#include "ECCO_OPTIONS.h" |
5 |
heimbach |
1.1 |
|
6 |
|
|
subroutine cost_gencost_assignperiod( |
7 |
|
|
I startofday, startofmonth, startofyear, |
8 |
|
|
I inday, inmonth, inyear, |
9 |
|
|
I endofday, endofmonth, endofyear, |
10 |
|
|
O startofgen, endofgen, ingen, |
11 |
|
|
O sum1gen, genrec, |
12 |
gforget |
1.12 |
I myiter, mythid ) |
13 |
heimbach |
1.1 |
|
14 |
|
|
c ================================================================== |
15 |
|
|
c SUBROUTINE cost_gencost_assignperiod |
16 |
|
|
c ================================================================== |
17 |
|
|
|
18 |
|
|
implicit none |
19 |
|
|
|
20 |
|
|
c == global variables == |
21 |
|
|
|
22 |
|
|
#include "EEPARAMS.h" |
23 |
|
|
#include "SIZE.h" |
24 |
|
|
#include "PARAMS.h" |
25 |
gforget |
1.11 |
#ifdef ALLOW_ECCO |
26 |
|
|
# include "ecco.h" |
27 |
|
|
#endif |
28 |
heimbach |
1.1 |
|
29 |
|
|
c == routine arguments == |
30 |
|
|
|
31 |
|
|
logical startofday |
32 |
|
|
logical startofmonth |
33 |
|
|
logical startofyear |
34 |
|
|
logical inday |
35 |
|
|
logical inmonth |
36 |
|
|
logical inyear |
37 |
|
|
logical endofday |
38 |
|
|
logical endofmonth |
39 |
|
|
logical endofyear |
40 |
|
|
logical startofgen(NGENCOST) |
41 |
|
|
logical endofgen(NGENCOST) |
42 |
|
|
logical ingen(NGENCOST) |
43 |
heimbach |
1.2 |
integer sum1gen(NGENCOST) |
44 |
|
|
integer genrec(NGENCOST) |
45 |
heimbach |
1.1 |
|
46 |
gforget |
1.12 |
integer myiter, mythid |
47 |
heimbach |
1.1 |
|
48 |
|
|
#ifdef ALLOW_GENCOST_CONTRIBUTION |
49 |
|
|
c == local variables == |
50 |
|
|
|
51 |
gforget |
1.9 |
integer k |
52 |
heimbach |
1.1 |
|
53 |
|
|
c == end of interface == |
54 |
|
|
|
55 |
gforget |
1.9 |
do k = 1, NGENCOST |
56 |
gforget |
1.11 |
if ( (using_gencost(k)).AND.( (gencost_flag(k).GE.1).OR. |
57 |
|
|
& (gencost_avgperiod(k).NE.' ') ) ) then |
58 |
gforget |
1.9 |
if ( gencost_avgperiod(k) .EQ. 'day' .OR. |
59 |
|
|
& gencost_avgperiod(k) .EQ. 'DAY' ) then |
60 |
|
|
startofgen(k) = startofday |
61 |
|
|
endofgen(k) = endofday |
62 |
|
|
ingen(k) = inday |
63 |
|
|
sum1gen(k) = sum1day |
64 |
|
|
genrec(k) = dayrec |
65 |
|
|
else if ( gencost_avgperiod(k) .EQ. 'month' .OR. |
66 |
|
|
& gencost_avgperiod(k) .EQ. 'MONTH' ) then |
67 |
|
|
startofgen(k) = startofmonth |
68 |
|
|
endofgen(k) = endofmonth |
69 |
|
|
ingen(k) = inmonth |
70 |
|
|
sum1gen(k) = sum1mon |
71 |
|
|
genrec(k) = monrec |
72 |
|
|
else if ( gencost_avgperiod(k) .EQ. 'year' .OR. |
73 |
|
|
& gencost_avgperiod(k) .EQ. 'YEAR' ) then |
74 |
|
|
startofgen(k) = startofyear |
75 |
|
|
endofgen(k) = endofyear |
76 |
|
|
ingen(k) = inyear |
77 |
|
|
sum1gen(k) = sum1year |
78 |
|
|
genrec(k) = yearrec |
79 |
gforget |
1.12 |
else if ( gencost_avgperiod(k) .EQ. 'step' .OR. |
80 |
|
|
& gencost_avgperiod(k) .EQ. 'STEP' ) then |
81 |
|
|
startofgen(k) = .TRUE. |
82 |
|
|
endofgen(k) = .TRUE. |
83 |
|
|
ingen(k) = .TRUE. |
84 |
|
|
sum1gen(k) = 1 |
85 |
|
|
genrec(k) = 1+ myiter - niter0 |
86 |
gforget |
1.13 |
else if ( gencost_avgperiod(k) .EQ. 'const' .OR. |
87 |
|
|
& gencost_avgperiod(k) .EQ. 'CONST' ) then |
88 |
|
|
startofgen(k) = .TRUE. |
89 |
|
|
endofgen(k) = (myiter.EQ.niter0) |
90 |
|
|
ingen(k) = (myiter.EQ.niter0) |
91 |
|
|
sum1gen(k) = 1 |
92 |
|
|
genrec(k) = 1 |
93 |
|
|
print*,'gf-const ',startofgen(k),myiter,niter0 |
94 |
heimbach |
1.1 |
else |
95 |
|
|
STOP 'gencost_avgperiod wrongly specified' |
96 |
|
|
end if |
97 |
heimbach |
1.4 |
end if |
98 |
heimbach |
1.1 |
end do |
99 |
jmc |
1.7 |
|
100 |
heimbach |
1.1 |
#endif /* ALLOW_GENCOST_CONTRIBUTION */ |
101 |
|
|
|
102 |
|
|
end |