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