1 |
|
C $Header$ |
2 |
|
|
3 |
|
#include "COST_CPPOPTIONS.h" |
4 |
|
|
5 |
|
|
6 |
|
subroutine cost_init_fixed( mythid ) |
7 |
|
|
8 |
|
c ================================================================== |
9 |
|
c SUBROUTINE cost_init_fixed |
10 |
|
c ================================================================== |
11 |
|
c |
12 |
|
c o Set contributions to the cost function and the cost function |
13 |
|
c itself to zero. The cost function and the individual contribu- |
14 |
|
c tions are defined in the header file "cost.h". |
15 |
|
c |
16 |
|
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
17 |
|
c |
18 |
|
c changed: Christian Eckert eckert@mit.edu 25-Feb-2000 |
19 |
|
c |
20 |
|
c - Restructured the code in order to create a package |
21 |
|
c for the MITgcmUV. |
22 |
|
c |
23 |
|
c changed: Ralf Giering 18-Jan-2001 |
24 |
|
c |
25 |
|
c - move namelist reading to cost_readparms.F |
26 |
|
c |
27 |
|
c ================================================================== |
28 |
|
c SUBROUTINE cost_init_fixed |
29 |
|
c ================================================================== |
30 |
|
|
31 |
|
implicit none |
32 |
|
|
33 |
|
c == global variables == |
34 |
|
|
35 |
|
#include "EEPARAMS.h" |
36 |
|
#include "SIZE.h" |
37 |
|
#include "GRID.h" |
38 |
|
#include "PARAMS.h" |
39 |
|
|
40 |
|
#include "cal.h" |
41 |
|
#include "cost.h" |
42 |
|
|
43 |
|
c == routine arguments == |
44 |
|
|
45 |
|
integer mythid |
46 |
|
|
47 |
|
c == local variables == |
48 |
|
|
49 |
|
integer tempDate1(4) |
50 |
|
integer tempDate2(4) |
51 |
|
|
52 |
|
logical exst |
53 |
|
|
54 |
|
c == external functions == |
55 |
|
|
56 |
|
integer cal_IntMonths |
57 |
|
external cal_IntMonths |
58 |
|
integer cal_IntDays |
59 |
|
external cal_IntDays |
60 |
|
|
61 |
|
c == end of interface == |
62 |
|
|
63 |
|
#ifdef ALLOW_CALENDAR |
64 |
|
|
65 |
|
c-- The number of monthly and daily averages generated by the |
66 |
|
c-- current model integration. |
67 |
|
nmonsrec = cal_IntMonths( mythid ) |
68 |
|
ndaysrec = cal_IntDays( mythid ) |
69 |
|
|
70 |
|
_BEGIN_MASTER( myThid ) |
71 |
|
|
72 |
|
c-- Get the complete dates of the ... |
73 |
|
c-- ... TMI data. |
74 |
|
call cal_FullDate( tmistartdate1, tmistartdate2, |
75 |
|
& tmistartdate, mythid ) |
76 |
|
c-- ... SST data. |
77 |
|
call cal_FullDate( sststartdate1, sststartdate2, |
78 |
|
& sststartdate, mythid ) |
79 |
|
c-- ... SSS data. |
80 |
|
call cal_FullDate( sssstartdate1, sssstartdate2, |
81 |
|
& sssstartdate, mythid ) |
82 |
|
c-- ... T/P data. |
83 |
|
call cal_FullDate( topexstartdate1, topexstartdate2, |
84 |
|
& topexstartdate, mythid ) |
85 |
|
c-- ... ERS data. |
86 |
|
call cal_FullDate( ersstartdate1, ersstartdate2, |
87 |
|
& ersstartdate, mythid ) |
88 |
|
c-- ... SCAT data. |
89 |
|
call cal_FullDate( scatstartdate1, scatstartdate2, |
90 |
|
& scatxstartdate, mythid ) |
91 |
|
call cal_FullDate( scatstartdate1, scatstartdate2, |
92 |
|
& scatystartdate, mythid ) |
93 |
|
c-- ... ARGO data. |
94 |
|
call cal_FullDate( argotstartdate1, argotstartdate2, |
95 |
|
& argotstartdate, mythid ) |
96 |
|
call cal_FullDate( argosstartdate1, argotstartdate2, |
97 |
|
& argosstartdate, mythid ) |
98 |
|
|
99 |
|
c-- Sea-ice cost function start and stop times in model seconds. |
100 |
|
|
101 |
|
call cal_FullDate ( costIceStart1 , costIceStart2, |
102 |
|
& tempDate1 , mythid ) |
103 |
|
call cal_TimePassed( modelstartdate, tempDate1 , |
104 |
|
& tempDate2 , mythid ) |
105 |
|
call cal_ToSeconds ( tempDate2 , costIceStart , mythid ) |
106 |
|
costIceStart = costIceStart + startTime |
107 |
|
|
108 |
|
call cal_FullDate ( costIceEnd1 , costIceEnd2 , |
109 |
|
& tempDate1 , mythid ) |
110 |
|
call cal_TimePassed( modelstartdate, tempDate1 , |
111 |
|
& tempDate2 , mythid ) |
112 |
|
call cal_ToSeconds ( tempDate2 , costIceEnd , mythid ) |
113 |
|
costIceEnd = costIceEnd + startTime |
114 |
|
|
115 |
|
_END_MASTER( mythid ) |
116 |
|
|
117 |
|
#endif /* ALLOW_CALENDAR */ |
118 |
|
|
119 |
|
c-- Get the weights that are to be used for the individual cost |
120 |
|
c-- function contributions. |
121 |
|
call cost_weights( mythid ) |
122 |
|
|
123 |
|
c-- Initialise adjoint of monthly mean files calculated |
124 |
|
c-- in cost_averagesfields (and their ad...). |
125 |
|
cph( |
126 |
|
cph The following init. shoud not be applied if in the middle |
127 |
|
cph of a divided adjoint run |
128 |
|
cph) |
129 |
|
#ifndef ALLOW_TANGENTLINEAR_RUN |
130 |
|
cph!!! and I think it needs to be seen by TAF |
131 |
|
cph!!! for repeated TLM runs |
132 |
|
cph!!! |
133 |
|
inquire( file='costfinal', exist=exst ) |
134 |
|
if ( .NOT. exst) then |
135 |
|
call cost_init_barfiles( mythid ) |
136 |
|
endif |
137 |
|
#endif |
138 |
|
|
139 |
|
c-- Summarize the cost function's setup. |
140 |
|
_BEGIN_MASTER( mythid ) |
141 |
|
call cost_summary( mythid ) |
142 |
|
_END_MASTER( mythid ) |
143 |
|
|
144 |
|
_BARRIER |
145 |
|
|
146 |
|
end |