/[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.25 - (show annotations) (download)
Mon May 9 09:02:54 2011 UTC (13 years, 1 month ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint62x
Changes since 1.24: +5 -12 lines
move shelfice_cost_final up before the ecco_cost_final in analogy to
seaice_cost_final
move other shelfice related stuff and I/O out of this routine into
shelfice_cost_final
remove unused variables (i,j,k)

1 C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_final.F,v 1.24 2011/03/15 16:06:09 mlosch 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 bi,bj
47 integer itlo,ithi
48 integer jtlo,jthi
49
50 c == end of interface ==
51
52 jtlo = mybylo(mythid)
53 jthi = mybyhi(mythid)
54 itlo = mybxlo(mythid)
55 ithi = mybxhi(mythid)
56
57 #ifdef ALLOW_SEAICE
58 CALL SEAICE_COST_FINAL (myThid)
59 #endif
60
61 #ifdef ALLOW_SHELFICE
62 CALL SHELFICE_COST_FINAL (myThid)
63 #endif
64
65 #if (defined (ALLOW_ECCO))
66 CALL ECCO_COST_FINAL (myThid)
67
68 #elif (defined (ALLOW_COST_VECTOR))
69 CALL COST_VECTOR (myThid)
70
71 #elif (defined (ALLOW_COST_STATE_FINAL))
72 CALL COST_STATE_FINAL (myThid)
73
74 #endif /* above stuff undef */
75
76 #ifndef ALLOW_ECCO
77
78 # ifdef ALLOW_COST_TEST
79 CALL COST_TEST (myThid)
80 # endif
81 # ifdef ALLOW_COST_ATLANTIC_HEAT
82 CALL COST_ATLANTIC_HEAT (myThid)
83 # endif
84 #ifdef ALLOW_COST_HFLUXM
85 CALL COST_HFLUX (myThid)
86 #endif
87 #ifdef ALLOW_COST_TEMP
88 CALL COST_TEMP (myThid)
89 #endif
90
91 c-- Sum up all contributions.
92 do bj = jtlo,jthi
93 do bi = itlo,ithi
94
95 write(standardmessageunit,'(A,D22.15)')
96 & ' --> objf_test(bi,bj) = ', objf_test(bi,bj)
97 write(standardmessageunit,'(A,D22.15)')
98 & ' --> objf_tracer(bi,bj) = ', objf_tracer(bi,bj)
99 write(standardmessageunit,'(A,D22.15)')
100 & ' --> objf_atl(bi,bj) = ', objf_atl(bi,bj)
101 #ifdef ALLOW_COST_TEMP
102 write(standardmessageunit,'(A,D22.15)')
103 & ' --> objf_temp_tut(bi,bj) = ', objf_temp_tut(bi,bj)
104 #endif
105 #ifdef ALLOW_COST_HFLUXM
106 write(standardmessageunit,'(A,D22.15)')
107 & ' --> objf_hflux_tut(bi,bj) = ', objf_hflux_tut(bi,bj)
108 #endif
109 #ifdef ALLOW_COST_TRANSPORT
110 write(standardmessageunit,'(A,D22.15)')
111 & ' --> objf_transport(bi,bj) = ', objf_transport(bi,bj)
112 #endif
113
114 fc = fc
115 & + mult_test * objf_test(bi,bj)
116 & + mult_tracer * objf_tracer(bi,bj)
117 & + mult_atl * objf_atl(bi,bj)
118 #ifdef ALLOW_COST_TRANSPORT
119 & + mult_transport * objf_transport(bi,bj)
120 #endif
121 #ifdef ALLOW_COST_TEMP
122 & + mult_temp_tut * objf_temp_tut(bi,bj)
123 #endif
124 #ifdef ALLOW_COST_HFLUXM
125 & + mult_hflux_tut * objf_hflux_tut(bi,bj)
126 #endif
127 enddo
128 enddo
129
130 write(standardmessageunit,'(A,D22.15)') ' local fc = ', fc
131
132 c-- Do global summation.
133 _GLOBAL_SUM_RL( fc , myThid )
134
135 #ifdef ALLOW_DIC
136 cph-- quickly for testing
137 fc = totcost
138 #endif
139
140 write(standardmessageunit,'(A,D22.15)') ' global fc = ', fc
141
142 #endif /* ALLOW_ECCO */
143
144 c-- to avoid re-write of output in reverse checkpointing loops,
145 c-- switch off output flag :
146 CALL TURNOFF_MODEL_IO( 0, myThid )
147
148 #endif /* ALLOW_COST */
149
150 return
151 end

  ViewVC Help
Powered by ViewVC 1.1.22