1 |
C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_tile.F,v 1.3 2001/09/28 15:56:14 heimbach Exp $ |
2 |
|
3 |
#include "CPP_OPTIONS.h" |
4 |
|
5 |
CBOI |
6 |
C |
7 |
C !TITLE: COST FUNCTION |
8 |
C !AUTHORS: mitgcm developers ( support@mitgcm.org ) |
9 |
C !AFFILIATION: Massachussetts Institute of Technology |
10 |
C !DATE: |
11 |
C !INTRODUCTION: cost function evaluation |
12 |
C \bv |
13 |
c The cost function package is connected to the differntiability |
14 |
c of the code. Differentiability refers to computing the derivative |
15 |
c of a cost function with respect to a set of control variables |
16 |
c (initial state, boundary values, model parameters). |
17 |
c The cost function may be an element of the final state, |
18 |
c a diagonstic thereof, a quantity that is integrated over the |
19 |
c model trajectory, or some model vs. data misfit. |
20 |
c This routine controls the cost function evaluation |
21 |
c at each time step. |
22 |
c Different contributions to the cost function are called from here. |
23 |
c The present package contains the basic handling of the |
24 |
c cost function evaluation along with two prototype cost terms. |
25 |
c The cost package is connected with the mitgcm code as follows: |
26 |
c |
27 |
C !CALLING SEQUENCE: |
28 |
c ... |
29 |
c |-- initialise_fixed |
30 |
c | |
31 |
c |-- packages_readparms |
32 |
c | |
33 |
c |-- cost_readparms |
34 |
c ... |
35 |
c |-- initialise_varia |
36 |
c | |
37 |
c |-- packages_init_variables |
38 |
c | |
39 |
c |-- cost_init |
40 |
c ... |
41 |
c |-- the_main_loop |
42 |
c | |
43 |
c |-- do iloop = 1,nTimeSteps |
44 |
c | forward_step |
45 |
c | cost_tile |
46 |
c | | |
47 |
c | |-- cost_tracer |
48 |
c | |
49 |
c | enddo |
50 |
c | |
51 |
c |-- cost_final |
52 |
C \ev |
53 |
CEOI |
54 |
|
55 |
CBOP |
56 |
C !ROUTINE: THE_MAIN_LOOP |
57 |
C !INTERFACE: |
58 |
subroutine cost_tile( mytime, myiter, myThid ) |
59 |
|
60 |
C !DESCRIPTION: \bv |
61 |
C *================================================================* |
62 |
C | subroutine cost_tile |
63 |
C | o this routine computes is called at each time step to |
64 |
C | accumulate the cost function for the tiles of this processor |
65 |
C *================================================================* |
66 |
C \ev |
67 |
|
68 |
C !USES: |
69 |
implicit none |
70 |
|
71 |
C == Global variables === |
72 |
#include "SIZE.h" |
73 |
#include "EEPARAMS.h" |
74 |
#include "PARAMS.h" |
75 |
#include "DYNVARS.h" |
76 |
#include "GRID.h" |
77 |
#include "cost.h" |
78 |
|
79 |
C !INPUT/OUTPUT PARAMETERS: |
80 |
C == Routine arguments == |
81 |
C myThid - Thread number for this instance of the routine. |
82 |
_RL myTime |
83 |
integer myiter |
84 |
integer myThid |
85 |
|
86 |
#ifdef ALLOW_COST |
87 |
|
88 |
C !LOCAL VARIABLES: |
89 |
C == Local variables == |
90 |
integer bi, bj |
91 |
CEOP |
92 |
|
93 |
C-- TAMC need a stmt in front of a HPF directive |
94 |
|
95 |
DO bj=myByLo(myThid),myByHi(myThid) |
96 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
97 |
|
98 |
#ifdef ALLOW_COST_ATLANTIC_HEAT |
99 |
IF ( myTime .GT. (EndTime - lastinterval) ) |
100 |
& CALL COST_ACCUMULATE_MEAN (myThid) |
101 |
#endif |
102 |
|
103 |
#ifdef ALLOW_COST_TRACER |
104 |
CALL COST_TRACER( bi, bj, myThid ) |
105 |
#endif |
106 |
|
107 |
ENDDO |
108 |
ENDDO |
109 |
|
110 |
#endif /* ALLOW_COST */ |
111 |
|
112 |
RETURN |
113 |
END |