1 |
heimbach |
1.2 |
C $Header: /u/gcmpack/models/MITgcmUV/pkg/cost/cost_final.F,v 1.1 2001/03/25 22:33:54 heimbach Exp $ |
2 |
heimbach |
1.1 |
|
3 |
|
|
#include "COST_CPPOPTIONS.h" |
4 |
|
|
|
5 |
|
|
|
6 |
|
|
subroutine cost_Final( |
7 |
|
|
I mythid |
8 |
|
|
& ) |
9 |
|
|
|
10 |
|
|
c ================================================================== |
11 |
|
|
c SUBROUTINE cost_Final |
12 |
|
|
c ================================================================== |
13 |
|
|
c |
14 |
|
|
c o Sum of all cost function contributions. |
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 ================================================================== |
24 |
|
|
c SUBROUTINE cost_Final |
25 |
|
|
c ================================================================== |
26 |
|
|
|
27 |
|
|
implicit none |
28 |
|
|
|
29 |
|
|
c == global variables == |
30 |
|
|
|
31 |
|
|
#include "EEPARAMS.h" |
32 |
|
|
#include "SIZE.h" |
33 |
|
|
|
34 |
|
|
#include "cost.h" |
35 |
|
|
#include "ctrl.h" |
36 |
|
|
|
37 |
|
|
c == routine arguments == |
38 |
|
|
|
39 |
|
|
integer mythid |
40 |
|
|
|
41 |
heimbach |
1.2 |
#ifdef ALLOW_COST |
42 |
heimbach |
1.1 |
c == local variables == |
43 |
|
|
|
44 |
|
|
integer bi,bj |
45 |
|
|
integer itlo,ithi |
46 |
|
|
integer jtlo,jthi |
47 |
|
|
|
48 |
|
|
c == end of interface == |
49 |
|
|
|
50 |
|
|
jtlo = mybylo(mythid) |
51 |
|
|
jthi = mybyhi(mythid) |
52 |
|
|
itlo = mybxlo(mythid) |
53 |
|
|
ithi = mybxhi(mythid) |
54 |
|
|
|
55 |
heimbach |
1.2 |
#ifdef ALLOW_COST_TEST |
56 |
|
|
CALL COST_TEST (myThid) |
57 |
heimbach |
1.1 |
#endif |
58 |
|
|
|
59 |
|
|
c-- Sum up all contributions. |
60 |
|
|
do bj = jtlo,jthi |
61 |
|
|
do bi = itlo,ithi |
62 |
|
|
|
63 |
heimbach |
1.2 |
print*,' --> objf_test(bi,bj) =',objf_test(bi,bj) |
64 |
|
|
print*,' --> objf_tracer(bi,bj) =',objf_tracer(bi,bj) |
65 |
heimbach |
1.1 |
|
66 |
|
|
fc = fc |
67 |
heimbach |
1.2 |
& + mult_test * objf_test(bi,bj) |
68 |
|
|
& + mult_tracer * objf_tracer(bi,bj) |
69 |
heimbach |
1.1 |
enddo |
70 |
|
|
enddo |
71 |
|
|
|
72 |
heimbach |
1.2 |
print*,' fc = ', fc |
73 |
heimbach |
1.1 |
|
74 |
|
|
c-- Do global summation. |
75 |
|
|
_GLOBAL_SUM_R8( fc , myThid ) |
76 |
|
|
|
77 |
heimbach |
1.2 |
#endif /* ALLOW_COST */ |
78 |
heimbach |
1.1 |
|
79 |
|
|
return |
80 |
|
|
end |
81 |
|
|
|