3 |
#include "COST_CPPOPTIONS.h" |
#include "COST_CPPOPTIONS.h" |
4 |
|
|
5 |
|
|
6 |
subroutine cost_Final( |
subroutine cost_final( mythid ) |
|
I mythid |
|
|
& ) |
|
7 |
|
|
8 |
c ================================================================== |
c ================================================================== |
9 |
c SUBROUTINE cost_Final |
c SUBROUTINE cost_final |
10 |
c ================================================================== |
c ================================================================== |
11 |
c |
c |
12 |
c o Sum of all cost function contributions. |
c o Sum of all cost function contributions. |
19 |
c for the MITgcmUV. |
c for the MITgcmUV. |
20 |
c |
c |
21 |
c ================================================================== |
c ================================================================== |
22 |
c SUBROUTINE cost_Final |
c SUBROUTINE cost_final |
23 |
c ================================================================== |
c ================================================================== |
24 |
|
|
25 |
implicit none |
implicit none |
28 |
|
|
29 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
30 |
#include "SIZE.h" |
#include "SIZE.h" |
31 |
|
#include "PARAMS.h" |
32 |
|
|
33 |
#include "cost.h" |
#include "cost.h" |
34 |
#include "ctrl.h" |
#include "ctrl.h" |
40 |
#ifdef ALLOW_COST |
#ifdef ALLOW_COST |
41 |
c == local variables == |
c == local variables == |
42 |
|
|
43 |
|
integer i,j,k |
44 |
integer bi,bj |
integer bi,bj |
45 |
integer itlo,ithi |
integer itlo,ithi |
46 |
integer jtlo,jthi |
integer jtlo,jthi |
52 |
itlo = mybxlo(mythid) |
itlo = mybxlo(mythid) |
53 |
ithi = mybxhi(mythid) |
ithi = mybxhi(mythid) |
54 |
|
|
55 |
|
#if (defined (ALLOW_COST_VECTOR)) |
56 |
|
|
57 |
|
CALL COST_VECTOR (myThid) |
58 |
|
|
59 |
|
#elif (defined (ALLOW_COST_STATE_FINAL)) |
60 |
|
|
61 |
|
CALL COST_STATE_FINAL (myThid) |
62 |
|
|
63 |
|
#else /* ALLOW_COST_VECTOR undef */ |
64 |
|
|
65 |
#ifdef ALLOW_COST_TEST |
#ifdef ALLOW_COST_TEST |
66 |
CALL COST_TEST (myThid) |
CALL COST_TEST (myThid) |
67 |
#endif |
#endif |
68 |
|
|
69 |
|
#ifdef ALLOW_COST_ATLANTIC_HEAT |
70 |
|
CALL COST_ATLANTIC_HEAT (myThid) |
71 |
|
#endif |
72 |
|
|
73 |
c-- Sum up all contributions. |
c-- Sum up all contributions. |
74 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
75 |
do bi = itlo,ithi |
do bi = itlo,ithi |
76 |
|
|
77 |
print*,' --> objf_test(bi,bj) =',objf_test(bi,bj) |
print*,' --> objf_test(bi,bj) =',objf_test(bi,bj) |
78 |
print*,' --> objf_tracer(bi,bj) =',objf_tracer(bi,bj) |
print*,' --> objf_tracer(bi,bj) =',objf_tracer(bi,bj) |
79 |
|
print*,' --> objf_atl(bi,bj) =',objf_atl(bi,bj) |
80 |
|
|
81 |
fc = fc |
fc = fc |
82 |
& + mult_test * objf_test(bi,bj) |
& + mult_test * objf_test(bi,bj) |
83 |
& + mult_tracer * objf_tracer(bi,bj) |
& + mult_tracer * objf_tracer(bi,bj) |
84 |
|
& + mult_atl * objf_atl(bi,bj) |
85 |
enddo |
enddo |
86 |
enddo |
enddo |
87 |
|
|
88 |
print*,' fc = ', fc |
print*,' local fc = ', fc |
89 |
|
|
90 |
c-- Do global summation. |
c-- Do global summation. |
91 |
_GLOBAL_SUM_R8( fc , myThid ) |
_GLOBAL_SUM_R8( fc , myThid ) |
92 |
|
|
93 |
|
#endif /* ALLOW_COST_VECTOR */ |
94 |
|
|
95 |
|
print*,' global fc = ', fc |
96 |
|
|
97 |
|
c-- set averaging freq. to zero to avoid re-write of |
98 |
|
c-- averaged fields in reverse checkpointing loops |
99 |
|
taveFreq = 0. |
100 |
|
|
101 |
#endif /* ALLOW_COST */ |
#endif /* ALLOW_COST */ |
102 |
|
|
103 |
return |
return |