1 |
C $Header: /u/gcmpack/development/heimbach/div/c34_adj/pkg/cost/cost_final.F,v 1.1.1.1 2001/02/13 17:55:14 heimbach Exp $ |
2 |
|
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 |
c == local variables == |
42 |
|
43 |
integer bi,bj |
44 |
integer itlo,ithi |
45 |
integer jtlo,jthi |
46 |
|
47 |
#ifdef ECCO_VERBOSE |
48 |
character*(MAX_LEN_MBUF) msgbuf |
49 |
#endif |
50 |
|
51 |
c == end of interface == |
52 |
|
53 |
jtlo = mybylo(mythid) |
54 |
jthi = mybyhi(mythid) |
55 |
itlo = mybxlo(mythid) |
56 |
ithi = mybxhi(mythid) |
57 |
|
58 |
#ifdef ECCO_VERBOSE |
59 |
write(msgbuf,'(a)') ' ' |
60 |
call print_message( msgbuf, standardmessageunit, |
61 |
& SQUEEZE_RIGHT , mythid) |
62 |
write(msgbuf,'(a)') ' ' |
63 |
call print_message( msgbuf, standardmessageunit, |
64 |
& SQUEEZE_RIGHT , mythid) |
65 |
write(msgbuf,'(a)') |
66 |
& ' cost_Final: Evaluating the final cost function.' |
67 |
call print_message( msgbuf, standardmessageunit, |
68 |
& SQUEEZE_RIGHT , mythid) |
69 |
write(msgbuf,'(a)') ' ' |
70 |
call print_message( msgbuf, standardmessageunit, |
71 |
& SQUEEZE_RIGHT , mythid) |
72 |
#endif |
73 |
|
74 |
c-- Sum up all contributions. |
75 |
do bj = jtlo,jthi |
76 |
do bi = itlo,ithi |
77 |
|
78 |
print*,' --> objf_temp(bi,bj) =',objf_temp(bi,bj) |
79 |
print*,' --> objf_salt(bi,bj) =',objf_salt(bi,bj) |
80 |
print*,' --> objf_tauu(bi,bj) =',objf_tauu(bi,bj) |
81 |
print*,' --> objf_tauv(bi,bj) =',objf_tauv(bi,bj) |
82 |
print*,' --> objf_hflux(bi,bj) =',objf_hflux(bi,bj) |
83 |
print*,' --> objf_sflux(bi,bj) =',objf_sflux(bi,bj) |
84 |
print*,' --> objf_sst(bi,bj) =',objf_sst(bi,bj) |
85 |
print*,' --> objf_h(bi,bj) =',objf_h(bi,bj) |
86 |
print*,' --> objf_atl(bi,bj) =',objf_atl(bi,bj) |
87 |
print*,' --> objf_ctdt(bi,bj) =',objf_ctdt(bi,bj) |
88 |
print*,' --> objf_ctds(bi,bj) =',objf_ctds(bi,bj) |
89 |
print*,' --> objf_test(bi,bj) =',objf_test(bi,bj) |
90 |
|
91 |
fc = fc |
92 |
& + mult_temp * objf_temp(bi,bj) |
93 |
& + mult_salt * objf_salt(bi,bj) |
94 |
& + mult_tauu * objf_tauu(bi,bj) |
95 |
& + mult_tauv * objf_tauv(bi,bj) |
96 |
& + mult_hq * objf_hflux(bi,bj) |
97 |
& + mult_hs * objf_sflux(bi,bj) |
98 |
& + mult_sst * objf_sst(bi,bj) |
99 |
& + mult_h * objf_h(bi,bj) |
100 |
& + mult_atl * objf_atl(bi,bj) |
101 |
& + mult_ctdt * objf_ctdt(bi,bj) |
102 |
& + mult_ctds * objf_ctds(bi,bj) |
103 |
& + mult_test * objf_test(bi,bj) |
104 |
enddo |
105 |
enddo |
106 |
|
107 |
|
108 |
c-- Do global summation. |
109 |
_GLOBAL_SUM_R8( fc , myThid ) |
110 |
|
111 |
c-- Each process has calculated the global part for itself. |
112 |
_BEGIN_MASTER( mythid ) |
113 |
fc = fc + mult_hmean*objf_hmean |
114 |
_END_MASTER( mythid ) |
115 |
print*,' --> fc =',fc |
116 |
|
117 |
#ifdef ECCO_VERBOSE |
118 |
write(msgbuf,'(a,D22.15)') |
119 |
& ' cost_Final: final cost function = ',fc |
120 |
call print_message( msgbuf, standardmessageunit, |
121 |
& SQUEEZE_RIGHT , mythid) |
122 |
write(msgbuf,'(a)') ' ' |
123 |
call print_message( msgbuf, standardmessageunit, |
124 |
& SQUEEZE_RIGHT , mythid) |
125 |
write(msgbuf,'(a)') |
126 |
& ' cost function evaluation finished.' |
127 |
call print_message( msgbuf, standardmessageunit, |
128 |
& SQUEEZE_RIGHT , mythid) |
129 |
write(msgbuf,'(a)') ' ' |
130 |
call print_message( msgbuf, standardmessageunit, |
131 |
& SQUEEZE_RIGHT , mythid) |
132 |
#endif |
133 |
|
134 |
return |
135 |
end |
136 |
|