/[MITgcm]/MITgcm/pkg/cost/cost_final.F
ViewVC logotype

Contents of /MITgcm/pkg/cost/cost_final.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.23 - (show annotations) (download)
Fri Jan 7 12:35:58 2011 UTC (13 years, 4 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint62t, checkpoint62s, checkpoint62r
Changes since 1.22: +17 -6 lines
Add cost function hooks.

1 C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_final.F,v 1.22 2010/05/09 16:23:01 jmc Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "COST_CPPOPTIONS.h"
6
7 subroutine cost_final( mythid )
8
9 c ==================================================================
10 c SUBROUTINE cost_final
11 c ==================================================================
12 c
13 c o Sum of all cost function contributions.
14 c
15 c ==================================================================
16 c SUBROUTINE cost_final
17 c ==================================================================
18
19 implicit none
20
21 c == global variables ==
22
23 #include "EEPARAMS.h"
24 #include "SIZE.h"
25 #include "PARAMS.h"
26
27 #include "cost.h"
28 #ifdef ALLOW_CTRL
29 # include "ctrl.h"
30 #endif
31 #ifdef ALLOW_DIC
32 # include "DIC_COST.h"
33 #endif
34 #ifdef ALLOW_COST_SHELFICE
35 # include "SHELFICE_COST.h"
36 #endif
37
38
39 c == routine arguments ==
40
41 integer mythid
42
43 #ifdef ALLOW_COST
44 c == local variables ==
45
46 integer i,j,k
47 integer bi,bj
48 integer itlo,ithi
49 integer jtlo,jthi
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 ALLOW_SEAICE
59 CALL SEAICE_COST_FINAL (myThid)
60 #endif
61
62 #if (defined (ALLOW_ECCO))
63 CALL ECCO_COST_FINAL (myThid)
64
65 #elif (defined (ALLOW_COST_VECTOR))
66 CALL COST_VECTOR (myThid)
67
68 #elif (defined (ALLOW_COST_STATE_FINAL))
69 CALL COST_STATE_FINAL (myThid)
70
71 #endif /* above stuff undef */
72
73 #ifndef ALLOW_ECCO
74
75 # ifdef ALLOW_COST_TEST
76 CALL COST_TEST (myThid)
77 # endif
78 # ifdef ALLOW_COST_ATLANTIC_HEAT
79 CALL COST_ATLANTIC_HEAT (myThid)
80 # endif
81 #ifdef ALLOW_COST_HFLUXM
82 CALL COST_HFLUX (myThid)
83 #endif
84 #ifdef ALLOW_COST_TEMP
85 CALL COST_TEMP (myThid)
86 #endif
87 #ifdef ALLOW_SHELFICE
88 # ifdef ALLOW_COST_SHELFICE
89 CALL SHELFICE_COST_FINAL (myThid)
90 # endif
91 #endif
92
93 c-- Sum up all contributions.
94 do bj = jtlo,jthi
95 do bi = itlo,ithi
96
97 write(standardmessageunit,'(A,D22.15)')
98 & ' --> objf_test(bi,bj) = ', objf_test(bi,bj)
99 write(standardmessageunit,'(A,D22.15)')
100 & ' --> objf_tracer(bi,bj) = ', objf_tracer(bi,bj)
101 write(standardmessageunit,'(A,D22.15)')
102 & ' --> objf_atl(bi,bj) = ', objf_atl(bi,bj)
103 #ifdef ALLOW_COST_TEMP
104 write(standardmessageunit,'(A,D22.15)')
105 & ' --> objf_temp_tut(bi,bj) = ', objf_temp_tut(bi,bj)
106 #endif
107 #ifdef ALLOW_COST_HFLUXM
108 write(standardmessageunit,'(A,D22.15)')
109 & ' --> objf_hflux_tut(bi,bj) = ', objf_hflux_tut(bi,bj)
110 #endif
111 #ifdef ALLOW_COST_TRANSPORT
112 write(standardmessageunit,'(A,D22.15)')
113 & ' --> objf_transport(bi,bj) = ', objf_transport(bi,bj)
114 #endif
115 #ifdef ALLOW_COST_SHELFICE
116 write(standardmessageunit,'(A,D22.15)')
117 & ' --> objf_shelfice(bi,bj) = ', objf_shelfice(bi,bj)
118 #endif
119
120 fc = fc
121 & + mult_test * objf_test(bi,bj)
122 & + mult_tracer * objf_tracer(bi,bj)
123 & + mult_atl * objf_atl(bi,bj)
124 #ifdef ALLOW_COST_TRANSPORT
125 & + mult_transport * objf_transport(bi,bj)
126 #endif
127 #ifdef ALLOW_COST_TEMP
128 & + mult_temp_tut * objf_temp_tut(bi,bj)
129 #endif
130 #ifdef ALLOW_COST_HFLUXM
131 & + mult_hflux_tut * objf_hflux_tut(bi,bj)
132 #endif
133 #ifdef ALLOW_COST_SHELFICE
134 & + mult_shelfice * objf_shelfice(bi,bj)
135 #endif
136 enddo
137 enddo
138
139 write(standardmessageunit,'(A,D22.15)') ' local fc = ', fc
140
141 c-- Do global summation.
142 _GLOBAL_SUM_RL( fc , myThid )
143
144 #ifdef ALLOW_DIC
145 cph-- quickly for testing
146 fc = totcost
147 #endif
148
149 write(standardmessageunit,'(A,D22.15)') ' global fc = ', fc
150
151 #endif /* ALLOW_ECCO */
152
153 c-- to avoid re-write of output in reverse checkpointing loops,
154 c-- switch off output flag :
155 CALL TURNOFF_MODEL_IO( 0, myThid )
156
157 #endif /* ALLOW_COST */
158
159 return
160 end

  ViewVC Help
Powered by ViewVC 1.1.22