1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "AD_CONFIG.h" |
6 |
#include "COST_CPPOPTIONS.h" |
7 |
|
8 |
subroutine ecco_cost_init_fixed( mythid ) |
9 |
|
10 |
c ================================================================== |
11 |
c SUBROUTINE ecco_cost_init_fixed |
12 |
c ================================================================== |
13 |
c |
14 |
c o Set contributions to the cost function and the cost function |
15 |
c itself to zero. The cost function and the individual contribu- |
16 |
c tions are defined in the header file "ecco_cost.h". |
17 |
c |
18 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
19 |
c |
20 |
c changed: Christian Eckert eckert@mit.edu 25-Feb-2000 |
21 |
c |
22 |
c - Restructured the code in order to create a package |
23 |
c for the MITgcmUV. |
24 |
c |
25 |
c changed: Ralf Giering 18-Jan-2001 |
26 |
c |
27 |
c - move namelist reading to cost_readparms.F |
28 |
c |
29 |
c ================================================================== |
30 |
c SUBROUTINE ecco_cost_init_fixed |
31 |
c ================================================================== |
32 |
|
33 |
implicit none |
34 |
|
35 |
c == global variables == |
36 |
|
37 |
#include "EEPARAMS.h" |
38 |
#include "SIZE.h" |
39 |
#include "GRID.h" |
40 |
#include "PARAMS.h" |
41 |
|
42 |
#ifdef ALLOW_CAL |
43 |
#include "cal.h" |
44 |
#endif |
45 |
#include "ecco_cost.h" |
46 |
|
47 |
c == routine arguments == |
48 |
|
49 |
integer mythid |
50 |
|
51 |
c == local variables == |
52 |
|
53 |
integer tempDate1(4) |
54 |
integer tempDate2(4) |
55 |
integer gwunit |
56 |
integer ilo,ihi |
57 |
integer irec |
58 |
logical exst |
59 |
_RL dummy |
60 |
_RL missingObsFlag |
61 |
PARAMETER ( missingObsFlag = 1. _d 23 ) |
62 |
|
63 |
c == external functions == |
64 |
|
65 |
integer cal_IntYears |
66 |
external cal_IntYears |
67 |
integer cal_IntMonths |
68 |
external cal_IntMonths |
69 |
integer cal_IntDays |
70 |
external cal_IntDays |
71 |
integer ifnblnk |
72 |
external ifnblnk |
73 |
integer ilnblnk |
74 |
external ilnblnk |
75 |
|
76 |
c == end of interface == |
77 |
|
78 |
#ifdef ALLOW_CAL |
79 |
|
80 |
c-- The number of monthly and daily averages generated by the |
81 |
c-- current model integration. |
82 |
nyearsrec = cal_IntYears( mythid ) |
83 |
nmonsrec = cal_IntMonths( mythid ) |
84 |
ndaysrec = cal_IntDays( mythid ) |
85 |
|
86 |
_BEGIN_MASTER( myThid ) |
87 |
|
88 |
c-- Get the complete dates of the ... |
89 |
c-- ... TMI data. |
90 |
call cal_FullDate( tmistartdate1, tmistartdate2, |
91 |
& tmistartdate, mythid ) |
92 |
c-- ... SST data. |
93 |
call cal_FullDate( sststartdate1, sststartdate2, |
94 |
& sststartdate, mythid ) |
95 |
c-- ... SSS data. |
96 |
call cal_FullDate( sssstartdate1, sssstartdate2, |
97 |
& sssstartdate, mythid ) |
98 |
c-- ... BP data. |
99 |
call cal_FullDate( bpstartdate1, bpstartdate2, |
100 |
& bpstartdate, mythid ) |
101 |
c-- ... T/P data. |
102 |
call cal_FullDate( topexstartdate1, topexstartdate2, |
103 |
& topexstartdate, mythid ) |
104 |
c-- ... ERS data. |
105 |
call cal_FullDate( ersstartdate1, ersstartdate2, |
106 |
& ersstartdate, mythid ) |
107 |
c-- ... GFO data. |
108 |
call cal_FullDate( gfostartdate1, gfostartdate2, |
109 |
& gfostartdate, mythid ) |
110 |
c-- ... SCAT data. |
111 |
call cal_FullDate( scatstartdate1, scatstartdate2, |
112 |
& scatxstartdate, mythid ) |
113 |
call cal_FullDate( scatstartdate1, scatstartdate2, |
114 |
& scatystartdate, mythid ) |
115 |
c-- ... ARGO data. |
116 |
call cal_FullDate( argotstartdate1, argotstartdate2, |
117 |
& argotstartdate, mythid ) |
118 |
call cal_FullDate( argosstartdate1, argotstartdate2, |
119 |
& argosstartdate, mythid ) |
120 |
|
121 |
_END_MASTER( mythid ) |
122 |
|
123 |
#endif /* ALLOW_CAL */ |
124 |
|
125 |
c-- Get the weights that are to be used for the individual cost |
126 |
c-- function contributions. |
127 |
call ecco_cost_weights( mythid ) |
128 |
|
129 |
c-- Initialise adjoint of monthly mean files calculated |
130 |
c-- in cost_averagesfields (and their ad...). |
131 |
cph( |
132 |
cph The following init. shoud not be applied if in the middle |
133 |
cph of a divided adjoint run |
134 |
cph) |
135 |
#ifndef ALLOW_TANGENTLINEAR_RUN |
136 |
cph!!! and I think it needs to be seen by TAF |
137 |
cph!!! for repeated TLM runs |
138 |
cph!!! |
139 |
inquire( file='costfinal', exist=exst ) |
140 |
if ( .NOT. exst) then |
141 |
call ecco_cost_init_barfiles( mythid ) |
142 |
endif |
143 |
#endif |
144 |
|
145 |
#ifdef ALLOW_TRANSPORT_COST_CONTRIBUTION |
146 |
_BEGIN_MASTER(myThid) |
147 |
ilo = ifnblnk(costTranspDataFile) |
148 |
ihi = ilnblnk(costTranspDataFile) |
149 |
CALL OPEN_COPY_DATA_FILE( |
150 |
I costTranspDataFile(ilo:ihi), |
151 |
I 'ECCO_COST_INIT_FIXED', |
152 |
O gwunit, |
153 |
I myThid ) |
154 |
do irec = 1, ndaysrec |
155 |
c-- read daily transport time series |
156 |
c-- 1st: transport in m/s |
157 |
c-- 2nd: date in YYYYMMDD |
158 |
c-- 3rd: uncertainty in m/s |
159 |
read(gwunit,*) transpobs(irec), dummy, wtransp(irec) |
160 |
c-- convert std.dev. to weight |
161 |
if ( wtransp(irec) .NE. 0. ) |
162 |
& wtransp(irec) =1./(wtransp(irec)*wtransp(irec)) |
163 |
c-- set weight to zero for missing values |
164 |
if ( transpobs(irec) .EQ. missingObsFlag ) |
165 |
& wtransp(irec) = 0. |
166 |
enddo |
167 |
_END_MASTER(myThid) |
168 |
_BARRIER |
169 |
#endif /* ALLOW_TRANSPORT_COST_CONTRIBUTION */ |
170 |
|
171 |
c-- Summarize the cost function's setup. |
172 |
_BEGIN_MASTER( mythid ) |
173 |
call ecco_cost_summary( mythid ) |
174 |
_END_MASTER( mythid ) |
175 |
|
176 |
_BARRIER |
177 |
|
178 |
end |