C
C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_dependent_init.F,v 1.10 2010/04/26 15:58:54 heimbach Exp $
C $Name: $
#include "PACKAGES_CONFIG.h"
#include "COST_CPPOPTIONS.h"
subroutine COST_DEPENDENT_INIT( mythid )
c ==================================================================
c SUBROUTINE cost_dependent_init
c ==================================================================
c
c o Initialise the variable ad cost function part.
c
c started: heimbach@mit.edu 17-Jan-2002
c
c ==================================================================
c SUBROUTINE cost_dependent_init
c ==================================================================
implicit none
c == global variables ==
#include "EEPARAMS.h"
#include "SIZE.h"
#include "cost.h"
#include "adcost.h"
c == routine arguments ==
integer mythid
c == local variables ==
integer i,j,k
integer bi,bj
integer itlo,ithi
integer jtlo,jthi
c == external functions ==
c == end of interface ==
jtlo = mybylo(mythid)
jthi = mybyhi(mythid)
itlo = mybxlo(mythid)
ithi = mybxhi(mythid)
fc = 0. _d 0
#ifdef ALLOW_AUTODIFF
if ( myProcId .EQ. 0 ) then
adfc = 1. _d 0
endif
do bj = jtlo,jthi
do bi = itlo,ithi
#ifdef ALLOW_COST_VECTOR
do i=1,sNx
objf_vector(i,bi,bj) = 0. _d 0
adobjf_vector(i,bi,bj) = 1. _d 0
end
do
#endif
#ifdef ALLOW_COST_STATE_FINAL
do j=1,sNy
do i=1,sNx
do k=1,4*Nr
objf_state_final(i,j,bi,bj,k) = 0. _d 0
enddo
objf_state_final(i,j,bi,bj,4*Nr+1) = 0. _d 0
cph No init. of cost_state_final here,
cph because we need it in ADM*TLM
end
do
end
do
#endif
enddo
enddo
#endif /* ALLOW_AUTODIFF */
return
end