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