/[MITgcm]/MITgcm/pkg/seaice/seaice_cost_final.F
ViewVC logotype

Contents of /MITgcm/pkg/seaice/seaice_cost_final.F

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


Revision 1.17 - (show annotations) (download)
Wed Nov 6 19:04:36 2013 UTC (10 years, 8 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint65, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65d, checkpoint65e
Changes since 1.16: +59 -88 lines
- add cost to final cost function contribution on a per tile base
- use GLOBAL_SUM_TILES_RL for individual component of the global cost
- do not reset output freq here (done from S/R TURNOFF_MODEL_IO)

1 C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_cost_final.F,v 1.16 2012/11/09 22:15:18 heimbach Exp $
2 C $Name: $
3
4 #include "SEAICE_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: SEAICE_COST_FINAL
8 C !INTERFACE:
9 SUBROUTINE SEAICE_COST_FINAL( myThid )
10
11 C !DESCRIPTION:
12 C *==========================================================*
13 C | SUBROUTINE SEAICE_COST_FINAL
14 C *==========================================================*
15
16 C !USES:
17 IMPLICIT NONE
18
19 C == global variables ==
20 #include "EEPARAMS.h"
21 #include "SIZE.h"
22 #include "PARAMS.h"
23 #include "SEAICE_SIZE.h"
24 #include "SEAICE_PARAMS.h"
25 #ifdef ALLOW_COST
26 #include "SEAICE_COST.h"
27 #include "cost.h"
28 #include "ctrl.h"
29 #include "optim.h"
30 #endif
31
32 C !INPUT/OUTPUT PARAMETERS:
33 INTEGER myThid
34
35 #ifdef ALLOW_COST
36 C ! FUNCTIONS:
37 LOGICAL MASTER_CPU_THREAD
38 EXTERNAL MASTER_CPU_THREAD
39
40 C !LOCAL VARIABLES:
41 INTEGER bi, bj
42 INTEGER ifc
43 _RL f_ice
44 _RL f_smrarea
45 _RL f_smrsst
46 _RL f_smrsss
47 _RL no_ice
48 _RL no_smrarea
49 _RL no_smrsst
50 _RL no_smrsss
51 CHARACTER*23 cfname
52 c CHARACTER*(MAX_LEN_MBUF) msgBuf
53 CEOP
54
55 ifc = 30
56
57 f_ice = 0. _d 0
58 f_smrarea = 0. _d 0
59 f_smrsst = 0. _d 0
60 f_smrsss = 0. _d 0
61
62 no_ice = 0. _d 0
63 no_smrarea = 0. _d 0
64 no_smrsst = 0. _d 0
65 no_smrsss = 0. _d 0
66
67 #ifdef ALLOW_SEAICE_COST_EXPORT
68 CALL SEAICE_COST_EXPORT( myThid )
69 #endif
70
71 C-- Sum up all contributions.
72 DO bj = myByLo(myThid), myByHi(myThid)
73 DO bi = myBxLo(myThid), myBxHi(myThid)
74
75 tile_fc(bi,bj) = tile_fc(bi,bj)
76 & + mult_ice_export * objf_ice_export(bi,bj)
77 & + mult_ice * objf_ice(bi,bj)
78 & + mult_smrarea * objf_smrarea(bi,bj)
79 & + mult_smrsst * objf_smrsst(bi,bj)
80 & + mult_smrsss * objf_smrsss(bi,bj)
81
82 ENDDO
83 ENDDO
84
85 C-- Note: global summation (tile_fc --> fc) is done only in cost_final
86
87 C-- Do global summation for each part of the cost function
88
89 CALL GLOBAL_SUM_TILE_RL( objf_ice, f_ice, myThid )
90 CALL GLOBAL_SUM_TILE_RL( objf_smrarea, f_smrarea, myThid )
91 CALL GLOBAL_SUM_TILE_RL( objf_smrsst, f_smrsst, myThid )
92 CALL GLOBAL_SUM_TILE_RL( objf_smrsss, f_smrsss, myThid )
93
94 CALL GLOBAL_SUM_TILE_RL( num_ice, no_ice, myThid )
95 CALL GLOBAL_SUM_TILE_RL( num_smrarea, no_smrarea, myThid )
96 CALL GLOBAL_SUM_TILE_RL( num_smrsst, no_smrsst, myThid )
97 CALL GLOBAL_SUM_TILE_RL( num_smrsss, no_smrsss, myThid )
98
99 WRITE(standardMessageUnit,'(A,D22.15)')
100 & ' --> f_ice =',f_ice
101 WRITE(standardMessageUnit,'(A,D22.15)')
102 & ' --> f_smrarea =',f_smrarea
103 WRITE(standardMessageUnit,'(A,D22.15)')
104 & ' --> f_smrarea =',f_smrsst
105 WRITE(standardMessageUnit,'(A,D22.15)')
106 & ' --> f_smrarea =',f_smrsss
107
108 C-- Each process has calculated the global part for itself.
109 IF ( MASTER_CPU_THREAD(myThid) ) THEN
110
111 WRITE(cfname,'(A,i4.4)') 'costfunction_seaice',optimcycle
112 OPEN(unit=ifc,file=cfname)
113
114 WRITE(ifc,*) 'fc =', fc
115 WRITE(ifc,*) 'f_ice =', f_ice, no_ice
116 WRITE(ifc,*) 'f_smrarea =', f_smrarea, no_smrarea
117 WRITE(ifc,*) 'f_smrsst =', f_smrsst, no_smrsst
118 WRITE(ifc,*) 'f_smrsss =', f_smrsss, no_smrsss
119
120 CLOSE(ifc)
121
122 ENDIF
123
124 #endif /* ALLOW_COST */
125
126 RETURN
127 END

  ViewVC Help
Powered by ViewVC 1.1.22