2 |
|
|
3 |
#include "CPP_OPTIONS.h" |
#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 |
|
CEOP |
54 |
|
|
55 |
|
CBOP |
56 |
|
C !ROUTINE: THE_MAIN_LOOP |
57 |
|
C !INTERFACE: |
58 |
subroutine cost_tile( myThid ) |
subroutine cost_tile( myThid ) |
59 |
C /==========================================================\ |
|
60 |
C | subroutine cost_tile | |
C !DESCRIPTION: \bv |
61 |
C | o this routine computes the cost function for the tiles | |
C *================================================================* |
62 |
C | of this processor | |
C | subroutine cost_tile |
63 |
C |==========================================================| |
C | o this routine computes is called at each time step to |
64 |
C | | |
C | accumulate the cost function for the tiles of this processor |
65 |
C | Notes | |
C *================================================================* |
66 |
C | ===== | |
C \ev |
67 |
C \==========================================================/ |
|
68 |
|
C !USES: |
69 |
implicit none |
implicit none |
70 |
|
|
71 |
C == Global variables === |
C == Global variables === |
75 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
76 |
#include "GRID.h" |
#include "GRID.h" |
77 |
|
|
78 |
|
C !INPUT/OUTPUT PARAMETERS: |
79 |
C == Routine arguments == |
C == Routine arguments == |
80 |
C myThid - Thread number for this instance of the routine. |
C myThid - Thread number for this instance of the routine. |
81 |
integer myThid |
integer myThid |
82 |
|
|
83 |
#ifdef ALLOW_COST |
#ifdef ALLOW_COST |
84 |
|
|
85 |
|
C !LOCAL VARIABLES: |
86 |
|
C == Local variables == |
87 |
integer bi, bj |
integer bi, bj |
88 |
|
CEOP |
89 |
|
|
90 |
C-- TAMC need a stmt in front of a HPF directive |
C-- TAMC need a stmt in front of a HPF directive |
91 |
|
|