1 |
edhill |
1.4 |
C |
2 |
|
|
C $Header: $ |
3 |
|
|
C $Name: $ |
4 |
heimbach |
1.1 |
|
5 |
edhill |
1.4 |
#include "AD_CONFIG.h" |
6 |
heimbach |
1.1 |
#include "COST_CPPOPTIONS.h" |
7 |
|
|
|
8 |
|
|
|
9 |
|
|
subroutine cost_dependent_init( mythid ) |
10 |
|
|
|
11 |
|
|
c ================================================================== |
12 |
|
|
c SUBROUTINE cost_dependent_init |
13 |
|
|
c ================================================================== |
14 |
|
|
c |
15 |
|
|
c o Initialise the variable ad cost function part. |
16 |
|
|
c |
17 |
|
|
c started: heimbach@mit.edu 17-Jan-2002 |
18 |
|
|
c |
19 |
|
|
c ================================================================== |
20 |
|
|
c SUBROUTINE cost_dependent_init |
21 |
|
|
c ================================================================== |
22 |
|
|
|
23 |
|
|
implicit none |
24 |
|
|
|
25 |
|
|
c == global variables == |
26 |
|
|
|
27 |
|
|
#include "EEPARAMS.h" |
28 |
|
|
#include "SIZE.h" |
29 |
|
|
|
30 |
|
|
#include "cost.h" |
31 |
|
|
#include "adcost.h" |
32 |
|
|
|
33 |
|
|
c == routine arguments == |
34 |
|
|
|
35 |
|
|
integer mythid |
36 |
|
|
|
37 |
|
|
c == local variables == |
38 |
|
|
|
39 |
|
|
integer i,j,k |
40 |
|
|
integer bi,bj |
41 |
|
|
integer itlo,ithi |
42 |
|
|
integer jtlo,jthi |
43 |
|
|
|
44 |
|
|
c == external functions == |
45 |
|
|
|
46 |
|
|
c == end of interface == |
47 |
|
|
jtlo = mybylo(mythid) |
48 |
|
|
jthi = mybyhi(mythid) |
49 |
|
|
itlo = mybxlo(mythid) |
50 |
|
|
ithi = mybxhi(mythid) |
51 |
|
|
|
52 |
|
|
fc = 0.0 |
53 |
|
|
|
54 |
|
|
#if ( defined (ALLOW_ADJOINT_RUN) || \ |
55 |
|
|
defined (ALLOW_GRADIENT_CHECK) || \ |
56 |
|
|
defined (ALLOW_ECCO_OPTIMIZATION) ) |
57 |
|
|
|
58 |
|
|
adfc = 1.0 |
59 |
|
|
do bj = jtlo,jthi |
60 |
heimbach |
1.3 |
do bi = itlo,ithi |
61 |
heimbach |
1.1 |
#ifdef ALLOW_COST_VECTOR |
62 |
heimbach |
1.3 |
do i=1,sNx |
63 |
|
|
objf_vector(i,bi,bj) = 0. _d 0 |
64 |
|
|
adobjf_vector(i,bi,bj) = 1. _d 0 |
65 |
|
|
end do |
66 |
|
|
#endif |
67 |
|
|
#ifdef ALLOW_COST_STATE_FINAL |
68 |
|
|
c do k=1,nr |
69 |
|
|
do j=1,sNy |
70 |
heimbach |
1.1 |
do i=1,sNx |
71 |
heimbach |
1.3 |
objf_state_final(i,j,bi,bj) = 0. _d 0 |
72 |
|
|
cph No init. of cost_state_final here, |
73 |
|
|
cph because we need it in ADM*TLM |
74 |
heimbach |
1.1 |
end do |
75 |
heimbach |
1.3 |
end do |
76 |
|
|
c end do |
77 |
heimbach |
1.1 |
#endif |
78 |
|
|
enddo |
79 |
|
|
enddo |
80 |
|
|
|
81 |
|
|
#endif |
82 |
|
|
|
83 |
|
|
return |
84 |
|
|
end |
85 |
|
|
|