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