/[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.2 - (show annotations) (download)
Tue May 10 07:49:19 2011 UTC (12 years, 11 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint63, checkpoint62z, checkpoint62y, checkpoint62x
Changes since 1.1: +51 -6 lines
add a cost function term that penalizes the deviation of xx_shifwflx
from the first guess (zero) in analogy to other control variables

1 C $Header: /u/gcmpack/MITgcm/pkg/shelfice/shelfice_cost_final.F,v 1.1 2011/05/09 15:17:12 heimbach Exp $
2 C $Name: $
3
4 #include "SHELFICE_OPTIONS.h"
5
6 subroutine shelfice_cost_final( myThid )
7 C *==========================================================*
8 C | subroutine shelfice_cost_final |
9 C | o final cost evalualtion |
10 C *==========================================================*
11 C | |
12 C *==========================================================*
13 IMPLICIT NONE
14
15 C == Global variables ===
16 #include "SIZE.h"
17 #include "EEPARAMS.h"
18 #include "PARAMS.h"
19 #include "DYNVARS.h"
20 #include "GRID.h"
21 #include "SHELFICE.h"
22 #include "SHELFICE_COST.h"
23
24 #ifdef ALLOW_COST
25 # include "cost.h"
26 # include "optim.h"
27 #endif
28 #if (defined ALLOW_SHIFWFLX_CONTROL && \
29 defined ALLOW_SHIFWFLX_COST_CONTRIBUTION)
30 # include "ctrl.h"
31 #endif
32
33 C == Routine arguments ==
34 C myThid - Thread number for this instance of the routine.
35 integer myThid
36
37 #ifdef ALLOW_COST
38 C === Functions ====
39 LOGICAL MASTER_CPU_THREAD
40 EXTERNAL MASTER_CPU_THREAD
41
42 C == Local variables
43 integer bi, bj
44 integer itlo,ithi
45 integer jtlo,jthi
46 integer ifc
47 character*(25) cfname
48 #ifdef ALLOW_ECCO
49 #if (defined ALLOW_SHIFWFLX_CONTROL && \
50 defined ALLOW_SHIFWFLX_COST_CONTRIBUTION)
51 jtlo = mybylo(mythid)
52 jthi = mybyhi(mythid)
53 itlo = mybxlo(mythid)
54 ithi = mybxhi(mythid)
55 CALL SHELFICE_COST_SHIFWFLX( mythid )
56 #endif /* ALLOW_SHIFWFLX_CONTROL and ALLOW_SHIFWFLX_COST_CONTRIBUTION */
57 #else
58 _RL thetaRef
59 _RL drLoc
60
61 integer i, j, k
62 integer ig, jg
63 integer kp1, klev
64
65 jtlo = mybylo(mythid)
66 jthi = mybyhi(mythid)
67 itlo = mybxlo(mythid)
68 ithi = mybxhi(mythid)
69
70 C-- Calculate cost function on tile of this instance
71 do bj = jtlo,jthi
72 do bi = itlo,ithi
73 ccc do klev = 1, Nr
74 do j=1,sNy
75 do i=1,sNx
76 c--
77 objf_shelfice(bi,bj) = objf_shelfice(bi,bj)
78 & + cMeanSHIforS(i,j,bi,bj)/lastinterval/rhoConstFresh
79 & *_rA(i,j,bi,bj)
80 c--
81 end do
82 end do
83 ccc end do
84 end do
85 end do
86 #endif /* ALLOW_ECCO */
87 do bj = jtlo,jthi
88 do bi = itlo,ithi
89 write(standardmessageunit,'(A,D22.15)')
90 & ' --> objf_shelfice(bi,bj) = ', objf_shelfice(bi,bj)
91 write(standardmessageunit,'(A,D22.15)')
92 & ' --> objf_shifwflx(bi,bj) = ', objf_shifwflx(bi,bj)
93 fc = fc
94 & + mult_shelfice * objf_shelfice(bi,bj)
95 & + mult_shifwflx * objf_shifwflx(bi,bj)
96 enddo
97 enddo
98
99 c-- Each process has calculated the global part for itself.
100 IF ( MASTER_CPU_THREAD(myThid) ) THEN
101
102 ifc = 30
103 WRITE(cfname,'(A,i4.4)') 'costfunction_shelfice',optimcycle
104 OPEN(unit=ifc,file=cfname)
105
106 WRITE(ifc,*) 'fc =', fc
107
108 CLOSE(ifc)
109
110 ENDIF
111 #endif /* ALLOW_COST */
112
113 END

  ViewVC Help
Powered by ViewVC 1.1.22