1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "COST_CPPOPTIONS.h" |
5 |
|
6 |
subroutine cost_averagesinit( mythid ) |
7 |
|
8 |
c ================================================================== |
9 |
c SUBROUTINE cost_averagesinit |
10 |
c ================================================================== |
11 |
c |
12 |
c o Set average fields for temperature, salinity, surface pressure, |
13 |
c and averaging counters to zero. The average fields are declared |
14 |
c in the header file ecco_cost.h. |
15 |
c |
16 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
17 |
c |
18 |
c changed: Christian Eckert eckert@mit.edu 11-Feb-2000 |
19 |
c |
20 |
c - Restructured the code in order to create a package |
21 |
c for the MITgcmUV. |
22 |
c |
23 |
c ================================================================== |
24 |
c SUBROUTINE cost_averagesinit |
25 |
c ================================================================== |
26 |
|
27 |
implicit none |
28 |
|
29 |
c == global variables == |
30 |
|
31 |
#include "EEPARAMS.h" |
32 |
#include "SIZE.h" |
33 |
|
34 |
#include "ecco_cost.h" |
35 |
#include "ctrl_dummy.h" |
36 |
#ifdef ALLOW_SEAICE |
37 |
# include "SEAICE_COST.h" |
38 |
#endif |
39 |
|
40 |
c == routine arguments == |
41 |
|
42 |
integer mythid |
43 |
|
44 |
c == local variables == |
45 |
|
46 |
integer bi,bj |
47 |
integer i,j,k |
48 |
integer itlo,ithi |
49 |
integer jtlo,jthi |
50 |
integer jmin,jmax |
51 |
integer imin,imax |
52 |
integer irec |
53 |
|
54 |
c == end of interface == |
55 |
|
56 |
c-- Set the loop ranges. |
57 |
jtlo = mybylo(mythid) |
58 |
jthi = mybyhi(mythid) |
59 |
itlo = mybxlo(mythid) |
60 |
ithi = mybxhi(mythid) |
61 |
jmin = 1 |
62 |
jmax = sny |
63 |
imin = 1 |
64 |
imax = snx |
65 |
|
66 |
do bj = jtlo,jthi |
67 |
do bi = itlo,ithi |
68 |
|
69 |
#ifdef ALLOW_SSH_COST_CONTRIBUTION |
70 |
c-- Initialise surface pressure average. |
71 |
do j = jmin,jmax |
72 |
do i = imin,imax |
73 |
psbar(i,j,bi,bj) = 0. _d 0 |
74 |
enddo |
75 |
enddo |
76 |
|
77 |
xx_psbar_mean_dummy = 0. _d 0 |
78 |
#endif |
79 |
|
80 |
#ifdef ALLOW_BP_COST_CONTRIBUTION |
81 |
c-- Initialise surface pressure average. |
82 |
do j = jmin,jmax |
83 |
do i = imin,imax |
84 |
bpbar(i,j,bi,bj) = 0. _d 0 |
85 |
enddo |
86 |
enddo |
87 |
|
88 |
xx_bpbar_mean_dummy = 0. _d 0 |
89 |
#endif |
90 |
|
91 |
#if (defined (ALLOW_THETA_COST_CONTRIBUTION) || \ |
92 |
defined (ALLOW_CTDT_COST_CONTRIBUTION) || \ |
93 |
defined (ALLOW_XBT_COST_CONTRIBUTION) || \ |
94 |
defined (ALLOW_DRIFT_COST_CONTRIBUTION) || \ |
95 |
defined (ALLOW_OBCS_COST_CONTRIBUTION)) |
96 |
c-- Initialise temperature average (3d). |
97 |
do k = 1,nr |
98 |
do j = jmin,jmax |
99 |
do i = imin,imax |
100 |
tbar(i,j,k,bi,bj) = 0. _d 0 |
101 |
enddo |
102 |
enddo |
103 |
enddo |
104 |
xx_tbar_mean_dummy = 0. _d 0 |
105 |
nnztbar = nr |
106 |
#else |
107 |
#ifdef ALLOW_SST_COST_CONTRIBUTION |
108 |
c-- Initialise temperature average (2d). |
109 |
k = 1 |
110 |
do j = jmin,jmax |
111 |
do i = imin,imax |
112 |
tbar(i,j,bi,bj) = 0. _d 0 |
113 |
enddo |
114 |
enddo |
115 |
xx_tbar_mean_dummy = 0. _d 0 |
116 |
nnztbar = 1 |
117 |
#endif |
118 |
#endif |
119 |
|
120 |
#if (defined (ALLOW_SALT_COST_CONTRIBUTION) || \ |
121 |
defined (ALLOW_CTDS_COST_CONTRIBUTION) || \ |
122 |
defined (ALLOW_DRIFT_COST_CONTRIBUTION) || \ |
123 |
defined (ALLOW_OBCS_COST_CONTRIBUTION)) |
124 |
c-- Initialise salt average. |
125 |
do k = 1,nr |
126 |
do j = jmin,jmax |
127 |
do i = imin,imax |
128 |
sbar(i,j,k,bi,bj) = 0. _d 0 |
129 |
enddo |
130 |
enddo |
131 |
enddo |
132 |
xx_sbar_mean_dummy = 0. _d 0 |
133 |
nnzsbar = nr |
134 |
#else |
135 |
#ifdef ALLOW_SSS_COST_CONTRIBUTION |
136 |
c-- Initialise salinity average (2d). |
137 |
k = 1 |
138 |
do j = jmin,jmax |
139 |
do i = imin,imax |
140 |
sbar(i,j,bi,bj) = 0. _d 0 |
141 |
enddo |
142 |
enddo |
143 |
xx_sbar_mean_dummy = 0. _d 0 |
144 |
nnzsbar = 1 |
145 |
#endif |
146 |
#endif |
147 |
|
148 |
#if (defined (ALLOW_DRIFTER_COST_CONTRIBUTION) || \ |
149 |
defined (ALLOW_OBCS_COST_CONTRIBUTION)) |
150 |
c-- Initialise uvel, vvel average. |
151 |
do k = 1,nr |
152 |
do j = jmin,jmax |
153 |
do i = imin,imax |
154 |
ubar(i,j,k,bi,bj) = 0. _d 0 |
155 |
vbar(i,j,k,bi,bj) = 0. _d 0 |
156 |
enddo |
157 |
enddo |
158 |
enddo |
159 |
xx_ubar_mean_dummy = 0. _d 0 |
160 |
xx_vbar_mean_dummy = 0. _d 0 |
161 |
#endif |
162 |
|
163 |
#ifdef ALLOW_DRIFTW_COST_CONTRIBUTION |
164 |
c-- Initialise uvel, vvel average. |
165 |
do k = 1,nr |
166 |
do j = jmin,jmax |
167 |
do i = imin,imax |
168 |
wbar(i,j,k,bi,bj) = 0. _d 0 |
169 |
enddo |
170 |
enddo |
171 |
enddo |
172 |
xx_wbar_mean_dummy = 0. _d 0 |
173 |
#endif |
174 |
|
175 |
#ifdef ALLOW_SCAT_COST_CONTRIBUTION |
176 |
c-- Initialise salinity average (2d). |
177 |
do j = jmin,jmax |
178 |
do i = imin,imax |
179 |
tauxbar(i,j,bi,bj) = 0. _d 0 |
180 |
tauybar(i,j,bi,bj) = 0. _d 0 |
181 |
enddo |
182 |
enddo |
183 |
xx_taux_mean_dummy = 0. _d 0 |
184 |
xx_tauy_mean_dummy = 0. _d 0 |
185 |
#endif |
186 |
|
187 |
#ifdef ALLOW_MEAN_HFLUX_COST_CONTRIBUTION |
188 |
c-- Initialise salinity average (2d). |
189 |
do j = jmin,jmax |
190 |
do i = imin,imax |
191 |
hfluxbar(i,j,bi,bj) = 0. _d 0 |
192 |
enddo |
193 |
enddo |
194 |
xx_hflux_mean_dummy = 0. _d 0 |
195 |
#endif |
196 |
|
197 |
#ifdef ALLOW_MEAN_SFLUX_COST_CONTRIBUTION |
198 |
c-- Initialise salinity average (2d). |
199 |
do j = jmin,jmax |
200 |
do i = imin,imax |
201 |
sfluxbar(i,j,bi,bj) = 0. _d 0 |
202 |
enddo |
203 |
enddo |
204 |
xx_sflux_mean_dummy = 0. _d 0 |
205 |
#endif |
206 |
|
207 |
#ifdef ALLOW_SEAICE |
208 |
|
209 |
# ifdef ALLOW_SEAICE_COST_SMR_AREA |
210 |
c-- Initialise salinity average (2d). |
211 |
do j = jmin,jmax |
212 |
do i = imin,imax |
213 |
smrareabar(i,j,bi,bj) = 0. _d 0 |
214 |
enddo |
215 |
enddo |
216 |
xx_smrareabar_mean_dummy = 0. _d 0 |
217 |
# endif |
218 |
|
219 |
#endif |
220 |
|
221 |
#ifdef ALLOW_TRANSPORT_COST_CONTRIBUTION |
222 |
do irec = 1, ndaysrec |
223 |
transpbar(irec,bi,bj) = 0. _d 0 |
224 |
enddo |
225 |
#endif |
226 |
|
227 |
enddo |
228 |
enddo |
229 |
|
230 |
return |
231 |
end |
232 |
|