1 |
C $Header: /u/gcmpack/models/MITgcmUV/pkg/cost/cost_tile.F,v 1.2 2001/09/28 14:17:49 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( 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 |
|
78 |
C !INPUT/OUTPUT PARAMETERS: |
79 |
C == Routine arguments == |
80 |
C myThid - Thread number for this instance of the routine. |
81 |
integer myThid |
82 |
|
83 |
#ifdef ALLOW_COST |
84 |
|
85 |
C !LOCAL VARIABLES: |
86 |
C == Local variables == |
87 |
integer bi, bj |
88 |
CEOP |
89 |
|
90 |
C-- TAMC need a stmt in front of a HPF directive |
91 |
|
92 |
DO bj=myByLo(myThid),myByHi(myThid) |
93 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
94 |
|
95 |
#ifdef ALLOW_COST_TRACER |
96 |
CALL COST_TRACER( bi, bj, myThid ) |
97 |
#endif |
98 |
|
99 |
ENDDO |
100 |
ENDDO |
101 |
|
102 |
#endif /* ALLOW_COST */ |
103 |
|
104 |
RETURN |
105 |
END |