1 |
heimbach |
1.1 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/ecco_cost_initvaria.F,v 1.7 2005/08/06 11:02:01 heimbach Exp $ |
2 |
|
|
|
3 |
|
|
#include "AD_CONFIG.h" |
4 |
|
|
#include "SEAICE_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
subroutine seaice_cost_init_varia( mythid ) |
7 |
|
|
|
8 |
|
|
c ================================================================== |
9 |
|
|
c SUBROUTINE seaice_cost_init_varia |
10 |
|
|
c ================================================================== |
11 |
|
|
c |
12 |
|
|
c o Initialise the variable cost function part. |
13 |
|
|
c added sea-ice term: menemenlis@jpl.nasa.gov 26-Feb-2003 |
14 |
|
|
c |
15 |
|
|
c ================================================================== |
16 |
|
|
c SUBROUTINE seaice_cost_init_varia |
17 |
|
|
c ================================================================== |
18 |
|
|
|
19 |
|
|
implicit none |
20 |
|
|
|
21 |
|
|
c == global variables == |
22 |
|
|
|
23 |
|
|
#include "EEPARAMS.h" |
24 |
|
|
#include "SIZE.h" |
25 |
|
|
#include "GRID.h" |
26 |
|
|
#include "SEAICE_COST.h" |
27 |
|
|
|
28 |
|
|
c == routine arguments == |
29 |
|
|
|
30 |
|
|
integer mythid |
31 |
|
|
|
32 |
|
|
c == local variables == |
33 |
|
|
|
34 |
|
|
integer bi,bj |
35 |
|
|
integer itlo,ithi |
36 |
|
|
integer jtlo,jthi |
37 |
|
|
integer imin, imax |
38 |
|
|
integer jmin, jmax |
39 |
|
|
integer i,j,k |
40 |
|
|
|
41 |
|
|
logical exst |
42 |
|
|
|
43 |
|
|
c == external functions == |
44 |
|
|
|
45 |
|
|
c == end of interface == |
46 |
|
|
jtlo = mybylo(mythid) |
47 |
|
|
jthi = mybyhi(mythid) |
48 |
|
|
itlo = mybxlo(mythid) |
49 |
|
|
ithi = mybxhi(mythid) |
50 |
|
|
jmin = 1-OLy |
51 |
|
|
jmax = sny+OLy |
52 |
|
|
imin = 1-OLx |
53 |
|
|
imax = snx+OLy |
54 |
|
|
|
55 |
|
|
c-- Initialise adjoint of monthly mean files calculated |
56 |
|
|
c-- in cost_averagesfields (and their ad...). |
57 |
|
|
cph call cost_averagesinit( mythid ) |
58 |
|
|
_BARRIER |
59 |
|
|
|
60 |
|
|
#ifndef ALLOW_TANGENTLINEAR_RUN |
61 |
|
|
cph( |
62 |
|
|
cph The following init. shoud not be applied if in the middle |
63 |
|
|
cph of a divided adjoint run |
64 |
|
|
cph) |
65 |
|
|
c inquire( file='costfinal', exist=exst ) |
66 |
|
|
c if ( .NOT. exst) then |
67 |
|
|
c call ecco_cost_init_barfiles( mythid ) |
68 |
|
|
c endif |
69 |
|
|
#endif |
70 |
|
|
|
71 |
|
|
c-- Initialize the tiled cost function contributions. |
72 |
|
|
do bj = jtlo,jthi |
73 |
|
|
do bi = itlo,ithi |
74 |
|
|
objf_ice(bi,bj) = 0. _d 0 |
75 |
|
|
c |
76 |
|
|
num_ice(bi,bj) = 0. _d 0 |
77 |
|
|
enddo |
78 |
|
|
enddo |
79 |
|
|
|
80 |
|
|
k = 1 |
81 |
|
|
do bj = jtlo,jthi |
82 |
|
|
do bi = itlo,ithi |
83 |
|
|
do j = jmin,jmax |
84 |
|
|
do i = imin,imax |
85 |
|
|
#ifdef ALLOW_TMI_SST_COST_CONTRIBUTION |
86 |
|
|
c if (_hFacC(i,j,k,bi,bj) .eq. 0.) then |
87 |
|
|
c tmimask(i,j,bi,bj) = 0. _d 0 |
88 |
|
|
c else |
89 |
|
|
c tmimask(i,j,bi,bj) = 1. _d 0 |
90 |
|
|
c endif |
91 |
|
|
c tmidat(i,j,bi,bj) = 0. _d 0 |
92 |
|
|
#endif |
93 |
|
|
enddo |
94 |
|
|
enddo |
95 |
|
|
enddo |
96 |
|
|
enddo |
97 |
|
|
|
98 |
|
|
_BARRIER |
99 |
|
|
|
100 |
|
|
return |
101 |
|
|
end |
102 |
|
|
|