/[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.20 - (show annotations) (download)
Thu Oct 15 05:21:50 2009 UTC (14 years, 7 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint62c, checkpoint62a, checkpoint62e, checkpoint62d, checkpoint62, checkpoint62b, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.19: +10 -1 lines
Revert to fc as dependent var also for dic

1 C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_final.F,v 1.19 2009/04/28 18:08:13 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 started: Christian Eckert eckert@mit.edu 30-Jun-1999
16 c changed: Christian Eckert eckert@mit.edu 25-Feb-2000
17 c heimbach@mit.edu 05-Nov-2003 Modularize cost package
18 c
19 c ==================================================================
20 c SUBROUTINE cost_final
21 c ==================================================================
22
23 implicit none
24
25 c == global variables ==
26
27 #include "EEPARAMS.h"
28 #include "SIZE.h"
29 #include "PARAMS.h"
30
31 #include "cost.h"
32 #ifdef ALLOW_CTRL
33 # include "ctrl.h"
34 #endif
35 #ifdef ALLOW_DIC
36 cph-- quickly for testing
37 # include "DIC_COST.h"
38 #endif
39
40 c == routine arguments ==
41
42 integer mythid
43
44 #ifdef ALLOW_COST
45 c == local variables ==
46
47 integer i,j,k
48 integer bi,bj
49 integer itlo,ithi
50 integer jtlo,jthi
51
52 c == end of interface ==
53
54 jtlo = mybylo(mythid)
55 jthi = mybyhi(mythid)
56 itlo = mybxlo(mythid)
57 ithi = mybxhi(mythid)
58
59 #ifdef ALLOW_SEAICE
60 CALL SEAICE_COST_FINAL (myThid)
61 #endif
62
63 #if (defined (ALLOW_ECCO))
64 CALL ECCO_COST_FINAL (myThid)
65
66 #elif (defined (ALLOW_COST_VECTOR))
67 CALL COST_VECTOR (myThid)
68
69 #elif (defined (ALLOW_COST_STATE_FINAL))
70 CALL COST_STATE_FINAL (myThid)
71
72 #endif /* above stuff undef */
73
74 #ifndef ALLOW_ECCO
75
76 # ifdef ALLOW_COST_TEST
77 CALL COST_TEST (myThid)
78 # endif
79 # ifdef ALLOW_COST_ATLANTIC_HEAT
80 CALL COST_ATLANTIC_HEAT (myThid)
81 # endif
82 #ifdef ALLOW_COST_HFLUXM
83 CALL COST_HFLUX (myThid)
84 #endif
85 #ifdef ALLOW_COST_TEMP
86 CALL COST_TEMP (myThid)
87 #endif
88
89 c-- Sum up all contributions.
90 do bj = jtlo,jthi
91 do bi = itlo,ithi
92
93 write(standardmessageunit,'(A,D22.15)')
94 & ' --> objf_test(bi,bj) = ', objf_test(bi,bj)
95 write(standardmessageunit,'(A,D22.15)')
96 & ' --> objf_tracer(bi,bj) = ', objf_tracer(bi,bj)
97 write(standardmessageunit,'(A,D22.15)')
98 & ' --> objf_atl(bi,bj) = ', objf_atl(bi,bj)
99 #ifdef ALLOW_COST_TEMP
100 write(standardmessageunit,'(A,D22.15)')
101 & ' --> objf_temp_tut(bi,bj) = ', objf_temp_tut(bi,bj)
102 #endif
103 #ifdef ALLOW_COST_HFLUXM
104 write(standardmessageunit,'(A,D22.15)')
105 & ' --> objf_hflux_tut(bi,bj) = ', objf_hflux_tut(bi,bj)
106 #endif
107 #ifdef ALLOW_COST_TRANSPORT
108 write(standardmessageunit,'(A,D22.15)')
109 & ' --> objf_transport(bi,bj) = ', objf_transport(bi,bj)
110 #endif
111
112 fc = fc
113 & + mult_test * objf_test(bi,bj)
114 & + mult_tracer * objf_tracer(bi,bj)
115 & + mult_atl * objf_atl(bi,bj)
116 #ifdef ALLOW_COST_TRANSPORT
117 & + mult_transport * objf_transport(bi,bj)
118 #endif
119 #ifdef ALLOW_COST_TEMP
120 & + mult_temp_tut * objf_temp_tut(bi,bj)
121 #endif
122 #ifdef ALLOW_COST_HFLUXM
123 & + mult_hflux_tut * objf_hflux_tut(bi,bj)
124 #endif
125 enddo
126 enddo
127
128 write(standardmessageunit,'(A,D22.15)') ' local fc = ', fc
129
130 c-- Do global summation.
131 _GLOBAL_SUM_RL( fc , myThid )
132
133 #ifdef ALLOW_DIC
134 cph-- quickly for testing
135 fc = totcost
136 #endif
137
138 write(standardmessageunit,'(A,D22.15)') ' global fc = ', fc
139
140 #endif /* ALLOW_ECCO */
141
142 c-- set averaging freq. to zero to avoid re-write of
143 c-- averaged fields in reverse checkpointing loops
144 taveFreq = 0.
145 dumpFreq = 0.
146 pChkptFreq = 0.
147 monitorFreq = 0.
148
149 #endif /* ALLOW_COST */
150
151 return
152 end
153

  ViewVC Help
Powered by ViewVC 1.1.22