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

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

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


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

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

  ViewVC Help
Powered by ViewVC 1.1.22