1 |
C $Header$ |
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
|
#include "PACKAGES_CONFIG.h" |
5 |
#include "COST_CPPOPTIONS.h" |
#include "COST_CPPOPTIONS.h" |
6 |
|
|
|
|
|
7 |
subroutine cost_final( mythid ) |
subroutine cost_final( mythid ) |
8 |
|
|
9 |
c ================================================================== |
c ================================================================== |
13 |
c o Sum of all cost function contributions. |
c o Sum of all cost function contributions. |
14 |
c |
c |
15 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
|
c |
|
16 |
c changed: Christian Eckert eckert@mit.edu 25-Feb-2000 |
c changed: Christian Eckert eckert@mit.edu 25-Feb-2000 |
17 |
c |
c heimbach@mit.edu 05-Nov-2003 Modularize cost package |
|
c - Restructured the code in order to create a package |
|
|
c for the MITgcmUV. |
|
18 |
c |
c |
19 |
c ================================================================== |
c ================================================================== |
20 |
c SUBROUTINE cost_final |
c SUBROUTINE cost_final |
29 |
#include "PARAMS.h" |
#include "PARAMS.h" |
30 |
|
|
31 |
#include "cost.h" |
#include "cost.h" |
32 |
#include "ctrl.h" |
#ifdef ALLOW_CTRL |
33 |
|
# include "ctrl.h" |
34 |
|
#endif |
35 |
|
|
36 |
c == routine arguments == |
c == routine arguments == |
37 |
|
|
52 |
itlo = mybxlo(mythid) |
itlo = mybxlo(mythid) |
53 |
ithi = mybxhi(mythid) |
ithi = mybxhi(mythid) |
54 |
|
|
55 |
#if (defined (ALLOW_COST_VECTOR)) |
#ifdef ALLOW_SEAICE |
56 |
|
CALL SEAICE_COST_FINAL (myThid) |
57 |
|
#endif |
58 |
|
|
59 |
|
#if (defined (ALLOW_ECCO)) |
60 |
|
CALL ECCO_COST_FINAL (myThid) |
61 |
|
|
62 |
|
#elif (defined (ALLOW_COST_VECTOR)) |
63 |
CALL COST_VECTOR (myThid) |
CALL COST_VECTOR (myThid) |
64 |
|
|
65 |
#elif (defined (ALLOW_COST_STATE_FINAL)) |
#elif (defined (ALLOW_COST_STATE_FINAL)) |
|
|
|
66 |
CALL COST_STATE_FINAL (myThid) |
CALL COST_STATE_FINAL (myThid) |
67 |
|
|
68 |
#else /* ALLOW_COST_VECTOR undef */ |
#endif /* above stuff undef */ |
69 |
|
|
70 |
#ifdef ALLOW_COST_TEST |
#ifndef ALLOW_ECCO |
|
CALL COST_TEST (myThid) |
|
|
#endif |
|
71 |
|
|
72 |
#ifdef ALLOW_COST_ATLANTIC_HEAT |
# ifdef ALLOW_COST_TEST |
73 |
|
CALL COST_TEST (myThid) |
74 |
|
# endif |
75 |
|
# ifdef ALLOW_COST_ATLANTIC_HEAT |
76 |
CALL COST_ATLANTIC_HEAT (myThid) |
CALL COST_ATLANTIC_HEAT (myThid) |
77 |
|
# endif |
78 |
|
#ifdef ALLOW_COST_HFLUXM |
79 |
|
CALL COST_HFLUX (myThid) |
80 |
|
#endif |
81 |
|
#ifdef ALLOW_COST_TEMP |
82 |
|
CALL COST_TEMP (myThid) |
83 |
#endif |
#endif |
84 |
|
|
85 |
c-- Sum up all contributions. |
c-- Sum up all contributions. |
86 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
87 |
do bi = itlo,ithi |
do bi = itlo,ithi |
88 |
|
|
89 |
print*,' --> objf_test(bi,bj) =',objf_test(bi,bj) |
write(standardmessageunit,'(A,D22.15)') |
90 |
print*,' --> objf_tracer(bi,bj) =',objf_tracer(bi,bj) |
& ' --> objf_test(bi,bj) = ', objf_test(bi,bj) |
91 |
print*,' --> objf_atl(bi,bj) =',objf_atl(bi,bj) |
write(standardmessageunit,'(A,D22.15)') |
92 |
|
& ' --> objf_tracer(bi,bj) = ', objf_tracer(bi,bj) |
93 |
|
write(standardmessageunit,'(A,D22.15)') |
94 |
|
& ' --> objf_atl(bi,bj) = ', objf_atl(bi,bj) |
95 |
|
#ifdef ALLOW_COST_TEMP |
96 |
|
write(standardmessageunit,'(A,D22.15)') |
97 |
|
& ' --> objf_temp_tut(bi,bj) = ', objf_temp_tut(bi,bj) |
98 |
|
#endif |
99 |
|
#ifdef ALLOW_COST_HFLUXM |
100 |
|
write(standardmessageunit,'(A,D22.15)') |
101 |
|
& ' --> objf_hflux_tut(bi,bj) = ', objf_hflux_tut(bi,bj) |
102 |
|
#endif |
103 |
|
#ifdef ALLOW_COST_TRANSPORT |
104 |
|
write(standardmessageunit,'(A,D22.15)') |
105 |
|
& ' --> objf_transport(bi,bj) = ', objf_transport(bi,bj) |
106 |
|
#endif |
107 |
|
|
108 |
fc = fc |
fc = fc |
109 |
& + mult_test * objf_test(bi,bj) |
& + mult_test * objf_test(bi,bj) |
110 |
& + mult_tracer * objf_tracer(bi,bj) |
& + mult_tracer * objf_tracer(bi,bj) |
111 |
& + mult_atl * objf_atl(bi,bj) |
& + mult_atl * objf_atl(bi,bj) |
112 |
|
#ifdef ALLOW_COST_TRANSPORT |
113 |
|
& + mult_transport * objf_transport(bi,bj) |
114 |
|
#endif |
115 |
|
#ifdef ALLOW_COST_TEMP |
116 |
|
& + mult_temp_tut * objf_temp_tut(bi,bj) |
117 |
|
#endif |
118 |
|
#ifdef ALLOW_COST_HFLUXM |
119 |
|
& + mult_hflux_tut * objf_hflux_tut(bi,bj) |
120 |
|
#endif |
121 |
enddo |
enddo |
122 |
enddo |
enddo |
123 |
|
|
124 |
print*,' local fc = ', fc |
write(standardmessageunit,'(A,D22.15)') ' local fc = ', fc |
125 |
|
|
126 |
c-- Do global summation. |
c-- Do global summation. |
127 |
_GLOBAL_SUM_R8( fc , myThid ) |
_GLOBAL_SUM_R8( fc , myThid ) |
128 |
|
|
129 |
#endif /* ALLOW_COST_VECTOR */ |
write(standardmessageunit,'(A,D22.15)') ' global fc = ', fc |
130 |
|
|
131 |
print*,' global fc = ', fc |
#endif /* ALLOW_ECCO */ |
132 |
|
|
133 |
c-- set averaging freq. to zero to avoid re-write of |
c-- set averaging freq. to zero to avoid re-write of |
134 |
c-- averaged fields in reverse checkpointing loops |
c-- averaged fields in reverse checkpointing loops |
135 |
taveFreq = 0. |
taveFreq = 0. |
136 |
|
dumpFreq = 0. |
137 |
|
pChkptFreq = 0. |
138 |
|
monitorFreq = 0. |
139 |
|
|
140 |
#endif /* ALLOW_COST */ |
#endif /* ALLOW_COST */ |
141 |
|
|