1 |
C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_cost_final.F,v 1.6 2005/09/02 22:36:51 heimbach Exp $ |
2 |
|
3 |
#include "SEAICE_OPTIONS.h" |
4 |
|
5 |
|
6 |
subroutine seaice_cost_final( mythid ) |
7 |
|
8 |
c ================================================================== |
9 |
c SUBROUTINE seaice_cost_final |
10 |
c ================================================================== |
11 |
c |
12 |
c ================================================================== |
13 |
c SUBROUTINE seaice_cost_final |
14 |
c ================================================================== |
15 |
|
16 |
implicit none |
17 |
|
18 |
c == global variables == |
19 |
|
20 |
#include "EEPARAMS.h" |
21 |
#include "SIZE.h" |
22 |
#include "PARAMS.h" |
23 |
#include "SEAICE_PARAMS.h" |
24 |
#ifdef ALLOW_COST |
25 |
#include "SEAICE_COST.h" |
26 |
#include "cost.h" |
27 |
#include "ctrl.h" |
28 |
#include "optim.h" |
29 |
#endif |
30 |
|
31 |
c == routine arguments == |
32 |
|
33 |
integer mythid |
34 |
|
35 |
#ifdef ALLOW_COST |
36 |
|
37 |
c == local variables == |
38 |
|
39 |
integer bi,bj |
40 |
integer itlo,ithi |
41 |
integer jtlo,jthi |
42 |
integer ifc |
43 |
integer totnum |
44 |
|
45 |
_RL f_ice |
46 |
_RL f_smrarea |
47 |
|
48 |
_RL no_ice |
49 |
_RL no_smrarea |
50 |
|
51 |
character*23 cfname |
52 |
#ifdef ECCO_VERBOSE |
53 |
character*(MAX_LEN_MBUF) msgbuf |
54 |
#endif |
55 |
|
56 |
c == end of interface == |
57 |
|
58 |
jtlo = mybylo(mythid) |
59 |
jthi = mybyhi(mythid) |
60 |
itlo = mybxlo(mythid) |
61 |
ithi = mybxhi(mythid) |
62 |
|
63 |
ifc = 30 |
64 |
|
65 |
f_ice = 0. _d 0 |
66 |
f_smrarea = 0. _d 0 |
67 |
c |
68 |
no_ice = 0. _d 0 |
69 |
no_smrarea = 0. _d 0 |
70 |
|
71 |
c-- Sum up all contributions. |
72 |
do bj = jtlo,jthi |
73 |
do bi = itlo,ithi |
74 |
|
75 |
fc = fc |
76 |
& + mult_ice * objf_ice(bi,bj) |
77 |
& + mult_smrarea * objf_smrarea(bi,bj) |
78 |
|
79 |
f_ice = f_ice + objf_ice(bi,bj) |
80 |
f_smrarea = f_smrarea + objf_smrarea(bi,bj) |
81 |
|
82 |
no_ice = no_ice + num_ice(bi,bj) |
83 |
no_smrarea = no_smrarea + num_smrarea(bi,bj) |
84 |
|
85 |
enddo |
86 |
enddo |
87 |
|
88 |
c-- Do global summation. |
89 |
_GLOBAL_SUM_R8( fc , myThid ) |
90 |
|
91 |
c-- Do global summation for each part of the cost function |
92 |
|
93 |
_GLOBAL_SUM_R8( f_ice , myThid ) |
94 |
_GLOBAL_SUM_R8( f_smrarea , myThid ) |
95 |
|
96 |
_GLOBAL_SUM_R8( no_ice , myThid ) |
97 |
_GLOBAL_SUM_R8( no_smrarea , myThid ) |
98 |
|
99 |
write(standardmessageunit,'(A,D22.15)') |
100 |
& ' --> f_ice =',f_ice |
101 |
write(standardmessageunit,'(A,D22.15)') |
102 |
& ' --> f_smrarea =',f_smrarea |
103 |
|
104 |
c-- Each process has calculated the global part for itself. |
105 |
_BEGIN_MASTER( mythid ) |
106 |
|
107 |
write(cfname,'(A,i4.4)') 'costfunction_seaice',optimcycle |
108 |
open(unit=ifc,file=cfname) |
109 |
|
110 |
write(ifc,*) 'fc =', fc |
111 |
write(ifc,*) 'f_ice =', f_ice, no_ice |
112 |
write(ifc,*) 'f_smrarea =', f_smrarea, no_smrarea |
113 |
|
114 |
close(ifc) |
115 |
|
116 |
_END_MASTER( mythid ) |
117 |
|
118 |
SEAICE_dumpFreq = 0. |
119 |
SEAICE_taveFreq = 0. |
120 |
|
121 |
#endif |
122 |
|
123 |
end |