/[MITgcm]/MITgcm/pkg/shelfice/shelfice_cost_final.F
ViewVC logotype

Contents of /MITgcm/pkg/shelfice/shelfice_cost_final.F

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


Revision 1.9 - (show annotations) (download)
Tue Sep 9 22:59:55 2014 UTC (11 years, 4 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, HEAD
Changes since 1.8: +7 -1 lines
- Include explicitly COST_OPTIONS.h & CTRL_OPTIONS.h (in case we don't
   use ECCO_CPPOPTIONS.h)

1 C $Header: /u/gcmpack/MITgcm/pkg/shelfice/shelfice_cost_final.F,v 1.8 2014/04/04 19:34:00 jmc Exp $
2 C $Name: $
3
4 #include "SHELFICE_OPTIONS.h"
5 #ifdef ALLOW_COST
6 # include "COST_OPTIONS.h"
7 #endif
8 #ifdef ALLOW_CTRL
9 # include "CTRL_OPTIONS.h"
10 #endif
11
12 CBOP
13 C !ROUTINE: SHELFICE_COST_FINAL
14 C !INTERFACE:
15 SUBROUTINE SHELFICE_COST_FINAL( myThid )
16
17 C !DESCRIPTION:
18 C *==========================================================*
19 C | subroutine shelfice_cost_final |
20 C | o final cost evalualtion |
21 C *==========================================================*
22
23 C !USES:
24 IMPLICIT NONE
25
26 C == Global variables ===
27 #include "SIZE.h"
28 #include "EEPARAMS.h"
29 #include "PARAMS.h"
30 #include "DYNVARS.h"
31 #include "GRID.h"
32 #include "SHELFICE.h"
33 #include "SHELFICE_COST.h"
34
35 #ifdef ALLOW_COST
36 # include "cost.h"
37 # include "optim.h"
38 #endif
39 #if (defined ALLOW_SHIFWFLX_CONTROL && \
40 defined ALLOW_SHIFWFLX_COST_CONTRIBUTION)
41 # include "ctrl.h"
42 #endif
43
44 C !INPUT/OUTPUT PARAMETERS:
45 C myThid :: Thread number for this instance of the routine.
46 INTEGER myThid
47
48 #ifdef ALLOW_COST
49 C ! FUNCTIONS:
50 LOGICAL MASTER_CPU_THREAD
51 EXTERNAL MASTER_CPU_THREAD
52
53 C !LOCAL VARIABLES:
54 INTEGER bi, bj
55 INTEGER ifc
56 CHARACTER*(25) cfname
57
58 _RL f_shelfice
59 _RL f_shifwflx
60 cML _RL no_shelfice
61 _RL no_shifwflx
62
63 #ifndef ALLOW_ECCO
64 INTEGER i, j
65 #endif
66 CEOP
67
68 f_shelfice = 0. _d 0
69 f_shifwflx = 0. _d 0
70 cML no_shelfice= 0. _d 0
71 no_shifwflx= 0. _d 0
72
73 #ifdef ALLOW_ECCO
74 #if (defined ALLOW_SHIFWFLX_CONTROL && \
75 defined ALLOW_SHIFWFLX_COST_CONTRIBUTION)
76 CALL SHELFICE_COST_SHIFWFLX( myThid )
77 #endif /* ALLOW_SHIFWFLX_CONTROL and ALLOW_SHIFWFLX_COST_CONTRIBUTION */
78 #else
79 C-- Calculate cost function on tile of this instance
80 DO bj = myByLo(myThid), myByHi(myThid)
81 DO bi = myBxLo(myThid), myBxHi(myThid)
82 ccc do klev = 1, Nr
83 DO j=1,sNy
84 DO i=1,sNx
85
86 objf_shelfice(bi,bj) = objf_shelfice(bi,bj)
87 & + cMeanSHIforS(i,j,bi,bj)/lastinterval/rhoConstFresh
88 & *_rA(i,j,bi,bj)
89
90 ENDDO
91 ENDDO
92 ccc end do
93 ENDDO
94 ENDDO
95 #endif /* ALLOW_ECCO */
96
97 C-- Sum up all contributions.
98 DO bj = myByLo(myThid), myByHi(myThid)
99 DO bi = myBxLo(myThid), myBxHi(myThid)
100 write(standardmessageunit,'(A,D22.15)')
101 & ' --> objf_shelfice(bi,bj) = ', objf_shelfice(bi,bj)
102 write(standardmessageunit,'(A,D22.15)')
103 & ' --> objf_shifwflx(bi,bj) = ', objf_shifwflx(bi,bj)
104 tile_fc(bi,bj) = tile_fc(bi,bj)
105 & + mult_shelfice * objf_shelfice(bi,bj)
106 & + mult_shifwflx * objf_shifwflx(bi,bj)
107
108 ENDDO
109 ENDDO
110
111 CALL GLOBAL_SUM_TILE_RL( objf_shelfice, f_shelfice, myThid )
112 CALL GLOBAL_SUM_TILE_RL( objf_shifwflx, f_shifwflx, myThid )
113 cML CALL GLOBAL_SUM_TILE_RL( num_shelfice, no_shelfice, myThid )
114 CALL GLOBAL_SUM_TILE_RL( num_shifwflx, no_shifwflx, myThid )
115
116 # ifndef ALLOW_OPENAD
117 C-- Each process has calculated the global part for itself.
118 IF ( MASTER_CPU_THREAD(myThid) ) THEN
119
120 ifc = 30
121 WRITE(cfname,'(A,i4.4)') 'costfunction_shelfice',optimcycle
122 OPEN(unit=ifc,file=cfname)
123
124 WRITE(ifc,*) 'fc =', fc
125 cML WRITE(ifc,*) 'f_shelfice =', f_shelfice, no_shelfice
126 WRITE(ifc,*) 'f_shelfice =', f_shelfice
127 WRITE(ifc,*) 'f_shifwflx =', f_shifwflx, no_shifwflx
128
129 CLOSE(ifc)
130
131 ENDIF
132 # endif /* ALLOW_OPENAD */
133
134 #endif /* ALLOW_COST */
135
136 RETURN
137 END

  ViewVC Help
Powered by ViewVC 1.1.22