/[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.14 - (hide annotations) (download)
Tue Apr 4 14:52:43 2006 UTC (18 years, 2 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint58f_post, checkpoint58d_post, checkpoint58e_post, checkpoint58g_post
Changes since 1.13: +4 -2 lines
Fix ptracers adjoint
o avoid extensive recomputatations
o fix missing re-init. of gptr (missed by TAF)

1 heimbach 1.14 C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_final.F,v 1.13 2005/08/25 16:10:42 heimbach Exp $
2 heimbach 1.1
3 heimbach 1.7 #include "PACKAGES_CONFIG.h"
4 heimbach 1.1 #include "COST_CPPOPTIONS.h"
5    
6 heimbach 1.3 subroutine cost_final( mythid )
7 heimbach 1.1
8     c ==================================================================
9 heimbach 1.3 c SUBROUTINE cost_final
10 heimbach 1.1 c ==================================================================
11     c
12     c o Sum of all cost function contributions.
13     c
14     c started: Christian Eckert eckert@mit.edu 30-Jun-1999
15     c changed: Christian Eckert eckert@mit.edu 25-Feb-2000
16 heimbach 1.7 c heimbach@mit.edu 05-Nov-2003 Modularize cost package
17 heimbach 1.1 c
18     c ==================================================================
19 heimbach 1.3 c SUBROUTINE cost_final
20 heimbach 1.1 c ==================================================================
21    
22     implicit none
23    
24     c == global variables ==
25    
26     #include "EEPARAMS.h"
27     #include "SIZE.h"
28 heimbach 1.5 #include "PARAMS.h"
29 heimbach 1.1
30     #include "cost.h"
31 heimbach 1.14 #ifdef ALLOW_CTRL
32     # include "ctrl.h"
33     #endif
34 heimbach 1.1
35     c == routine arguments ==
36    
37     integer mythid
38    
39 heimbach 1.2 #ifdef ALLOW_COST
40 heimbach 1.1 c == local variables ==
41    
42 heimbach 1.3 integer i,j,k
43 heimbach 1.1 integer bi,bj
44     integer itlo,ithi
45     integer jtlo,jthi
46    
47     c == end of interface ==
48    
49     jtlo = mybylo(mythid)
50     jthi = mybyhi(mythid)
51     itlo = mybxlo(mythid)
52     ithi = mybxhi(mythid)
53    
54 heimbach 1.13 #ifdef ALLOW_SEAICE
55     CALL SEAICE_COST_FINAL (myThid)
56     #endif
57    
58 heimbach 1.7 #if (defined (ALLOW_ECCO))
59     CALL ECCO_COST_FINAL (myThid)
60 heimbach 1.3
61 heimbach 1.7 #elif (defined (ALLOW_COST_VECTOR))
62 heimbach 1.3 CALL COST_VECTOR (myThid)
63    
64 heimbach 1.6 #elif (defined (ALLOW_COST_STATE_FINAL))
65     CALL COST_STATE_FINAL (myThid)
66 heimbach 1.3
67 heimbach 1.8 #endif /* above stuff undef */
68    
69     #ifndef ALLOW_ECCO
70 heimbach 1.3
71 heimbach 1.7 # ifdef ALLOW_COST_TEST
72 heimbach 1.2 CALL COST_TEST (myThid)
73 heimbach 1.7 # endif
74     # ifdef ALLOW_COST_ATLANTIC_HEAT
75 heimbach 1.3 CALL COST_ATLANTIC_HEAT (myThid)
76 heimbach 1.7 # endif
77 heimbach 1.3
78 heimbach 1.1 c-- Sum up all contributions.
79     do bj = jtlo,jthi
80     do bi = itlo,ithi
81    
82 heimbach 1.12 write(standardmessageunit,'(A,D22.15)')
83 heimbach 1.11 & ' --> objf_test(bi,bj) = ', objf_test(bi,bj)
84 heimbach 1.12 write(standardmessageunit,'(A,D22.15)')
85 heimbach 1.11 & ' --> objf_tracer(bi,bj) = ', objf_tracer(bi,bj)
86 heimbach 1.12 write(standardmessageunit,'(A,D22.15)')
87 heimbach 1.11 & ' --> objf_atl(bi,bj) = ', objf_atl(bi,bj)
88 heimbach 1.1
89     fc = fc
90 heimbach 1.2 & + mult_test * objf_test(bi,bj)
91     & + mult_tracer * objf_tracer(bi,bj)
92 heimbach 1.3 & + mult_atl * objf_atl(bi,bj)
93 heimbach 1.1 enddo
94     enddo
95    
96 heimbach 1.12 write(standardmessageunit,'(A,D22.15)') ' local fc = ', fc
97 heimbach 1.1
98     c-- Do global summation.
99     _GLOBAL_SUM_R8( fc , myThid )
100 heimbach 1.3
101 heimbach 1.12 write(standardmessageunit,'(A,D22.15)') ' global fc = ', fc
102 heimbach 1.6
103 heimbach 1.7 #endif /* ALLOW_ECCO */
104 heimbach 1.5
105     c-- set averaging freq. to zero to avoid re-write of
106     c-- averaged fields in reverse checkpointing loops
107 heimbach 1.10 taveFreq = 0.
108     dumpFreq = 0.
109     pChkptFreq = 0.
110     monitorFreq = 0.
111 heimbach 1.1
112 heimbach 1.2 #endif /* ALLOW_COST */
113 heimbach 1.1
114     return
115     end
116    

  ViewVC Help
Powered by ViewVC 1.1.22