1 |
C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_cost_init_fixed.F,v 1.4 2007/10/09 00:10:13 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "AD_CONFIG.h" |
6 |
#include "SEAICE_OPTIONS.h" |
7 |
|
8 |
subroutine seaice_cost_init_fixed( mythid ) |
9 |
|
10 |
c ================================================================== |
11 |
c SUBROUTINE seaice_cost_init_fixed |
12 |
c ================================================================== |
13 |
c |
14 |
c o Set contributions to the cost function and the cost function |
15 |
c itself to zero. The cost function and the individual contribu- |
16 |
c tions are defined in the header file "SEAICE_COST.h". |
17 |
c |
18 |
c ================================================================== |
19 |
c SUBROUTINE seaice_cost_init_fixed |
20 |
c ================================================================== |
21 |
|
22 |
implicit none |
23 |
|
24 |
c == global variables == |
25 |
|
26 |
#include "EEPARAMS.h" |
27 |
#include "SIZE.h" |
28 |
#include "GRID.h" |
29 |
#include "PARAMS.h" |
30 |
#ifdef ALLOW_COST |
31 |
# include "SEAICE_COST.h" |
32 |
#endif |
33 |
#ifdef ALLOW_CAL |
34 |
# include "cal.h" |
35 |
#endif |
36 |
|
37 |
c == routine arguments == |
38 |
|
39 |
integer mythid |
40 |
|
41 |
#ifdef ALLOW_COST |
42 |
c == local variables == |
43 |
|
44 |
integer tempDate1(4) |
45 |
integer tempDate2(4) |
46 |
|
47 |
logical exst |
48 |
|
49 |
c == external functions == |
50 |
|
51 |
#ifdef ALLOW_CAL |
52 |
integer cal_IntMonths |
53 |
external cal_IntMonths |
54 |
integer cal_IntDays |
55 |
external cal_IntDays |
56 |
#endif |
57 |
|
58 |
c == end of interface == |
59 |
|
60 |
#ifdef ALLOW_CAL |
61 |
|
62 |
_BEGIN_MASTER( myThid ) |
63 |
|
64 |
c-- Sea-ice cost function start and stop times in model seconds. |
65 |
c |
66 |
call cal_FullDate ( costIceStart1 , costIceStart2, |
67 |
& tempDate1 , mythid ) |
68 |
call cal_TimePassed( modelstartdate, tempDate1 , |
69 |
& tempDate2 , mythid ) |
70 |
call cal_ToSeconds ( tempDate2 , costIceStart , mythid ) |
71 |
costIceStart = costIceStart + startTime |
72 |
c |
73 |
call cal_FullDate ( costIceEnd1 , costIceEnd2 , |
74 |
& tempDate1 , mythid ) |
75 |
call cal_TimePassed( modelstartdate, tempDate1 , |
76 |
& tempDate2 , mythid ) |
77 |
call cal_ToSeconds ( tempDate2 , costIceEnd , mythid ) |
78 |
costIceEnd = costIceEnd + startTime |
79 |
c-- |
80 |
if ( smrareadatfile .ne. ' ' ) |
81 |
& call cal_FullDate( smrareastartdate1, smrareastartdate2, |
82 |
& smrareastartdate, mythid ) |
83 |
|
84 |
_END_MASTER( mythid ) |
85 |
|
86 |
#endif /* ALLOW_CAL */ |
87 |
|
88 |
c-- Get the weights that are to be used for the individual cost |
89 |
c-- function contributions. |
90 |
call seaice_cost_weights( mythid ) |
91 |
|
92 |
c-- Initialise adjoint of monthly mean files calculated |
93 |
c-- in cost_averagesfields (and their ad...). |
94 |
cph( |
95 |
cph The following init. shoud not be applied if in the middle |
96 |
cph of a divided adjoint run |
97 |
cph) |
98 |
#ifndef ALLOW_TANGENTLINEAR_RUN |
99 |
cph!!! and I think it needs to be seen by TAF |
100 |
cph!!! for repeated TLM runs |
101 |
cph!!! |
102 |
inquire( file='costfinal', exist=exst ) |
103 |
if ( .NOT. exst) then |
104 |
cph call seaice_cost_init_barfiles( mythid ) |
105 |
endif |
106 |
#endif |
107 |
|
108 |
_BARRIER |
109 |
|
110 |
#endif /* ALLOW_COST */ |
111 |
|
112 |
end |