-
Notifications
You must be signed in to change notification settings - Fork 237
/
ecco_cost_init_varia.F
103 lines (87 loc) · 2.38 KB
/
ecco_cost_init_varia.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "ECCO_OPTIONS.h"
#include "AD_CONFIG.h"
#ifdef ALLOW_CTRL
# include "CTRL_OPTIONS.h"
#endif
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
CBOP
C !ROUTINE: ECCO_COST_INIT_VARIA
C !INTERFACE:
SUBROUTINE ECCO_COST_INIT_VARIA( myThid )
C !DESCRIPTION:
c o Initialise the variable cost function part.
C !USES:
IMPLICIT NONE
C == Global variables ===
#include "EEPARAMS.h"
#include "SIZE.h"
#include "GRID.h"
#include "ECCO_SIZE.h"
#include "ECCO.h"
#ifdef ALLOW_CTRL
# include "CTRL_OBCS.h"
#endif
#ifdef ALLOW_COST
# include "cost.h"
#endif
C !INPUT/OUTPUT PARAMETERS:
INTEGER myThid
C !LOCAL VARIABLES:
INTEGER bi, bj
INTEGER i, j, k
C LOGICAL exst
CEOP
C-- Initialise adjoint of monthly mean files calculated
C-- in cost_averagesfields (and their ad...).
CALL COST_AVERAGESINIT( myThid )
_BARRIER
#ifndef ALLOW_TANGENTLINEAR_RUN
cph(
cph The following init. shoud not be applied if in the middle
cph of a divided adjoint run
cph)
c INQUIRE( FILE='costfinal', EXIST=exst )
c IF ( .NOT. exst) THEN
c CALL ECCO_COST_INIT_BARFILES( myThid )
c ENDIF
#endif
C-- Initialize the tiled cost function contributions.
DO bj = myByLo(myThid), myByHi(myThid)
DO bi = myBxLo(myThid), myBxHi(myThid)
#ifdef ALLOW_GENCOST_CONTRIBUTION
DO k=1,NGENCOST
objf_gencost(bi,bj,k) = 0. _d 0
num_gencost(bi,bj,k) = 0. _d 0
ENDDO
#endif
#if (defined (ALLOW_CTRL) && defined (ALLOW_OBCS))
objf_obcsn(bi,bj) = 0. _d 0
objf_obcss(bi,bj) = 0. _d 0
objf_obcsw(bi,bj) = 0. _d 0
objf_obcse(bi,bj) = 0. _d 0
objf_ageos(bi,bj) = 0. _d 0
num_obcsn(bi,bj) = 0. _d 0
num_obcss(bi,bj) = 0. _d 0
num_obcsw(bi,bj) = 0. _d 0
num_obcse(bi,bj) = 0. _d 0
num_ageos(bi,bj) = 0. _d 0
#endif
ENDDO
ENDDO
_BEGIN_MASTER( myThid )
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
frame(i,j) = 1. _d 0
ENDDO
ENDDO
_END_MASTER( myThid )
C-- Initialise the "global" parts of the cost function.
#if (defined (ALLOW_CTRL) && defined (ALLOW_OBCS))
_BEGIN_MASTER( myThid )
objf_obcsvol = 0. _d 0
num_obcsvol = 0. _d 0
_END_MASTER( myThid )
#endif
_BARRIER
RETURN
END