/[MITgcm]/MITgcm/pkg/cost/cost_tile.F
ViewVC logotype

Contents of /MITgcm/pkg/cost/cost_tile.F

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


Revision 1.21 - (show annotations) (download)
Fri Jun 27 13:56:05 2014 UTC (9 years, 10 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65o, checkpoint64z, HEAD
Changes since 1.20: +2 -2 lines
add an ALLOW_THSICE so this file compiles also when thsice is not
included in packages.conf

1 C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_tile.F,v 1.20 2014/04/04 21:05:31 jmc Exp $
2 C $Name: $
3
4 #include "COST_OPTIONS.h"
5 #ifdef ALLOW_AUTODIFF
6 # include "AUTODIFF_OPTIONS.h"
7 #endif
8
9 CBOI
10 C
11 C !TITLE: COST FUNCTION
12 C !AUTHORS: mitgcm developers ( support@mitgcm.org )
13 C !AFFILIATION: Massachussetts Institute of Technology
14 C !DATE:
15 C !INTRODUCTION: cost function evaluation
16 C \bv
17 c The cost function package is connected to the differntiability
18 c of the code. Differentiability refers to computing the derivative
19 c of a cost function with respect to a set of control variables
20 c (initial state, boundary values, model parameters).
21 c The cost function may be an element of the final state,
22 c a diagonstic thereof, a quantity that is integrated over the
23 c model trajectory, or some model vs. data misfit.
24 c This routine controls the cost function evaluation
25 c at each time step.
26 c Different contributions to the cost function are called from here.
27 c The present package contains the basic handling of the
28 c cost function evaluation along with two prototype cost terms.
29 c The cost package is connected with the mitgcm code as follows:
30 c
31 C !CALLING SEQUENCE:
32 c ...
33 c |-- initialise_fixed
34 c |
35 c |-- packages_readparms
36 c |
37 c |-- cost_readparms
38 c ...
39 c |-- initialise_varia
40 c |
41 c |-- packages_init_variables
42 c |
43 c |-- cost_init
44 c ...
45 c |-- the_main_loop
46 c |
47 c |-- do iloop = 1,nTimeSteps
48 c | forward_step
49 c | cost_tile
50 c | |
51 c | |-- cost_tracer
52 c |
53 c | enddo
54 c |
55 c |-- cost_final
56 C \ev
57 CEOI
58
59 CBOP
60 C !ROUTINE: THE_MAIN_LOOP
61 C !INTERFACE:
62 subroutine cost_tile( mytime, myiter, myThid )
63
64 C !DESCRIPTION: \bv
65 C *================================================================*
66 C | subroutine cost_tile
67 C | o this routine computes is called at each time step to
68 C | accumulate the cost function for the tiles of this processor
69 C *================================================================*
70 C \ev
71
72 C !USES:
73 implicit none
74
75 C == Global variables ===
76 #include "SIZE.h"
77 #include "EEPARAMS.h"
78 #include "PARAMS.h"
79 #include "DYNVARS.h"
80 #include "GRID.h"
81 #include "cost.h"
82 #ifdef ALLOW_AUTODIFF
83 # include "tamc.h"
84 # ifdef ALLOW_PTRACERS
85 # include "PTRACERS_SIZE.h"
86 # include "PTRACERS_FIELDS.h"
87 # endif
88 #endif
89
90 C !INPUT/OUTPUT PARAMETERS:
91 C == Routine arguments ==
92 C myThid - Thread number for this instance of the routine.
93 _RL myTime
94 integer myiter
95 integer myThid
96
97 #ifdef ALLOW_COST
98
99 C !LOCAL VARIABLES:
100 C == Local variables ==
101 integer bi, bj
102 CEOP
103
104 #ifdef ALLOW_AUTODIFF_TAMC
105 CADJ STORE theta = comlev1, key = ikey_dynamics,
106 CADJ & kind = isbyte
107 CADJ STORE uvel, vvel = comlev1, key = ikey_dynamics,
108 CADJ & kind = isbyte
109 # ifdef ALLOW_DEPTH_CONTROL
110 CADJ STORE hfacw, hfacs = comlev1, key = ikey_dynamics,
111 CADJ & kind = isbyte
112 # endif
113 # ifdef ALLOW_PTRACERS
114 # ifdef NONLIN_FRSURF
115 CADJ STORE hFacC = comlev1, key = ikey_dynamics,
116 CADJ & kind = isbyte
117 CADJ STORE ptracer = comlev1, key = ikey_dynamics,
118 CADJ & kind = isbyte
119 # endif
120 # endif
121 #endif
122
123 IF ( myTime .GT. (EndTime - lastinterval) ) THEN
124
125 #if (defined (ALLOW_COST_TEST) || defined (ALLOW_COST_ATLANTIC_HEAT) || defined (ALLOW_COST_TEMP) )
126 CALL COST_ACCUMULATE_MEAN (myThid)
127 #endif
128
129 #ifdef ALLOW_COST_SHELFICE
130 CALL SHELFICE_COST_ACCUMULATE (myThid)
131 #endif
132
133 #if (defined ALLOW_THSICE && defined ALLOW_THSICE_COST_TEST)
134 IF (useThSIce)
135 & CALL THSICE_COST_DRIVER (myTime, myIter, myThid)
136 #endif
137
138 ENDIF
139
140 DO bj=myByLo(myThid),myByHi(myThid)
141 DO bi=myBxLo(myThid),myBxHi(myThid)
142
143 #ifdef ALLOW_COST_TRACER
144 CALL COST_TRACER( bi, bj, myThid )
145 #endif
146
147 #ifdef ALLOW_COST_TRANSPORT
148 CALL COST_TRANSPORT( bi, bj, myTime, myIter, myThid )
149 #endif /* ALLOW_COST_TRANSPORT */
150
151 ENDDO
152 ENDDO
153
154 #endif /* ALLOW_COST */
155
156 RETURN
157 END

  ViewVC Help
Powered by ViewVC 1.1.22