1 |
C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_cost_init_fixed.F,v 1.6 2012/04/19 23:00:01 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "SEAICE_OPTIONS.h" |
5 |
#include "AD_CONFIG.h" |
6 |
|
7 |
subroutine seaice_cost_init_fixed( mythid ) |
8 |
|
9 |
C ================================================================== |
10 |
C SUBROUTINE seaice_cost_init_fixed |
11 |
C ================================================================== |
12 |
C |
13 |
C o Set contributions to the cost function and the cost function |
14 |
C itself to zero. The cost function and the individual contribu- |
15 |
C tions are defined in the header file "SEAICE_COST.h". |
16 |
C |
17 |
C ================================================================== |
18 |
C SUBROUTINE seaice_cost_init_fixed |
19 |
C ================================================================== |
20 |
|
21 |
implicit none |
22 |
|
23 |
C == global variables == |
24 |
#include "EEPARAMS.h" |
25 |
#include "SIZE.h" |
26 |
#include "GRID.h" |
27 |
#include "PARAMS.h" |
28 |
#ifdef ALLOW_COST |
29 |
# include "SEAICE_COST.h" |
30 |
#endif |
31 |
#ifdef ALLOW_CAL |
32 |
# include "cal.h" |
33 |
#endif |
34 |
|
35 |
C == routine arguments == |
36 |
integer mythid |
37 |
|
38 |
#ifdef ALLOW_COST |
39 |
#ifdef ALLOW_COST_ICE |
40 |
|
41 |
C == local variables == |
42 |
integer tempDate1(4) |
43 |
integer tempDate2(4) |
44 |
logical exst |
45 |
|
46 |
C == external functions == |
47 |
c#ifdef ALLOW_CAL |
48 |
c integer cal_IntMonths |
49 |
c external cal_IntMonths |
50 |
c integer cal_IntDays |
51 |
c external cal_IntDays |
52 |
c#endif |
53 |
|
54 |
C == end of interface == |
55 |
|
56 |
#ifdef ALLOW_CAL |
57 |
|
58 |
_BEGIN_MASTER( myThid ) |
59 |
|
60 |
C-- Sea-ice cost function start and stop times in model seconds. |
61 |
call cal_FullDate ( costIceStart1 , costIceStart2, |
62 |
& tempDate1 , mythid ) |
63 |
call cal_TimePassed( modelStartDate, tempDate1 , |
64 |
& tempDate2 , mythid ) |
65 |
call cal_ToSeconds ( tempDate2 , costIceStart , mythid ) |
66 |
costIceStart = costIceStart + startTime |
67 |
|
68 |
if ( costIceEnd1.EQ.0 ) then |
69 |
C- use "modelEndDate" as default value for costIceEnd |
70 |
costIceEnd1 = modelEndDate(1) |
71 |
costIceEnd2 = modelEndDate(2) |
72 |
endif |
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_ICE */ |
111 |
#endif /* ALLOW_COST */ |
112 |
|
113 |
RETURN |
114 |
END |