1 |
C $Header: /u/gcmpack/MITgcm/pkg/grdchk/grdchk_init.F,v 1.13 2014/04/04 21:39:56 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "GRDCHK_OPTIONS.h" |
5 |
#ifdef ALLOW_CTRL |
6 |
# include "CTRL_OPTIONS.h" |
7 |
#endif |
8 |
|
9 |
subroutine grdchk_init( mythid ) |
10 |
|
11 |
c ================================================================== |
12 |
c SUBROUTINE grdchk_init |
13 |
c ================================================================== |
14 |
c |
15 |
c o Get the location of a given component of the control vector for |
16 |
c the current process. |
17 |
c |
18 |
c started: Christian Eckert eckert@mit.edu 04-Apr-2000 |
19 |
c continued: heimbach@mit.edu: 13-Jun-2001 |
20 |
c |
21 |
c ================================================================== |
22 |
c SUBROUTINE grdchk_init |
23 |
c ================================================================== |
24 |
|
25 |
implicit none |
26 |
|
27 |
c == global variables == |
28 |
|
29 |
#include "EEPARAMS.h" |
30 |
#include "SIZE.h" |
31 |
#include "GRID.h" |
32 |
#include "ctrl.h" |
33 |
#include "CTRL_OBCS.h" |
34 |
#include "grdchk.h" |
35 |
|
36 |
c == routine arguments == |
37 |
|
38 |
integer mythid |
39 |
|
40 |
#ifdef ALLOW_GRDCHK |
41 |
c == local variables == |
42 |
|
43 |
integer bi,bj |
44 |
integer i,j,k |
45 |
integer irec |
46 |
integer itlo,ithi |
47 |
integer jtlo,jthi |
48 |
integer jmin,jmax |
49 |
integer imin,imax |
50 |
|
51 |
integer itest,iobcs |
52 |
integer icomptest |
53 |
|
54 |
c == end of interface == |
55 |
|
56 |
jtlo = 1 |
57 |
jthi = nsy |
58 |
itlo = 1 |
59 |
ithi = nsx |
60 |
jmin = 1 |
61 |
jmax = sny |
62 |
imin = 1 |
63 |
imax = snx |
64 |
|
65 |
_BEGIN_MASTER( mythid ) |
66 |
|
67 |
c-- initialise |
68 |
do bj = jtlo,jthi |
69 |
do bi = itlo,ithi |
70 |
do k = 1,ncvarnrmax(grdchkvarindex) |
71 |
do iobcs = 1, nobcs |
72 |
nwettile(bi,bj,k,iobcs) = 0 |
73 |
enddo |
74 |
enddo |
75 |
enddo |
76 |
enddo |
77 |
|
78 |
c-- Determine the number of components of the given |
79 |
c-- control variable on the current tile. |
80 |
if ( ncvargrd(grdchkvarindex) .eq. 'c' ) then |
81 |
do bj = jtlo,jthi |
82 |
do bi = itlo,ithi |
83 |
do k = 1,ncvarnrmax(grdchkvarindex) |
84 |
nwettile(bi,bj,k,1) = nwetctile(bi,bj,k) |
85 |
enddo |
86 |
enddo |
87 |
enddo |
88 |
else if ( ncvargrd(grdchkvarindex) .eq. 's' ) then |
89 |
do bj = jtlo,jthi |
90 |
do bi = itlo,ithi |
91 |
do k = 1,ncvarnrmax(grdchkvarindex) |
92 |
nwettile(bi,bj,k,1) = nwetstile(bi,bj,k) |
93 |
enddo |
94 |
enddo |
95 |
enddo |
96 |
else if ( ncvargrd(grdchkvarindex) .eq. 'w' ) then |
97 |
do bj = jtlo,jthi |
98 |
do bi = itlo,ithi |
99 |
do k = 1,ncvarnrmax(grdchkvarindex) |
100 |
nwettile(bi,bj,k,1) = nwetwtile(bi,bj,k) |
101 |
enddo |
102 |
enddo |
103 |
enddo |
104 |
else if ( ncvargrd(grdchkvarindex) .eq. 'v' ) then |
105 |
do bj = jtlo,jthi |
106 |
do bi = itlo,ithi |
107 |
do k = 1,ncvarnrmax(grdchkvarindex) |
108 |
nwettile(bi,bj,k,1) = nwetvtile(bi,bj,k) |
109 |
enddo |
110 |
enddo |
111 |
enddo |
112 |
#ifdef ALLOW_SHIFWFLX_CONTROL |
113 |
else if ( ncvargrd(grdchkvarindex) .eq. 'i' ) then |
114 |
do bj = jtlo,jthi |
115 |
do bi = itlo,ithi |
116 |
do k = 1,ncvarnrmax(grdchkvarindex) |
117 |
nwettile(bi,bj,k,1) = nwetitile(bi,bj,k) |
118 |
enddo |
119 |
enddo |
120 |
enddo |
121 |
#endif /* ALLOW_SHIFWFLX_CONTROL */ |
122 |
else if ( ncvargrd(grdchkvarindex) .eq. 'm' ) then |
123 |
do bj = jtlo,jthi |
124 |
do bi = itlo,ithi |
125 |
do k = 1,ncvarnrmax(grdchkvarindex) |
126 |
do iobcs = 1, nobcs |
127 |
if ( grdchkvarindex .eq. 11 ) then |
128 |
#ifdef ALLOW_OBCSN_CONTROL |
129 |
nwettile(bi,bj,k,iobcs) = |
130 |
& nwetobcsn(bi,bj,k,iobcs) |
131 |
#endif |
132 |
else if ( grdchkvarindex .eq. 12 ) then |
133 |
#ifdef ALLOW_OBCSS_CONTROL |
134 |
nwettile(bi,bj,k,iobcs) = |
135 |
& nwetobcss(bi,bj,k,iobcs) |
136 |
#endif |
137 |
else if ( grdchkvarindex .eq. 13 ) then |
138 |
#ifdef ALLOW_OBCSW_CONTROL |
139 |
nwettile(bi,bj,k,iobcs) = |
140 |
& nwetobcsw(bi,bj,k,iobcs) |
141 |
#endif |
142 |
else if ( grdchkvarindex .eq. 14 ) then |
143 |
#ifdef ALLOW_OBCSE_CONTROL |
144 |
nwettile(bi,bj,k,iobcs) = |
145 |
& nwetobcse(bi,bj,k,iobcs) |
146 |
#endif |
147 |
endif |
148 |
enddo |
149 |
enddo |
150 |
enddo |
151 |
enddo |
152 |
else |
153 |
ce --> wrong grid specification for the control variable. |
154 |
endif |
155 |
|
156 |
c-- get mask file for obcs |
157 |
#ifdef ALLOW_OBCS_CONTROL |
158 |
call grdchk_get_obcs_mask ( mythid ) |
159 |
#endif |
160 |
|
161 |
c ---------------------------------------------------------------- |
162 |
|
163 |
c-- Determine the actual and the maximum possible number of |
164 |
c-- components of the given control variable. |
165 |
ncvarcomp = 0 |
166 |
maxncvarcomps = 0 |
167 |
do bj = jtlo,jthi |
168 |
do bi = itlo,ithi |
169 |
do k = 1,ncvarnrmax(grdchkvarindex) |
170 |
do iobcs = 1, nobcs |
171 |
ncvarcomp = ncvarcomp + nwettile(bi,bj,k,iobcs) |
172 |
maxncvarcomps = maxncvarcomps + |
173 |
& ncvarxmax(grdchkvarindex)* |
174 |
& ncvarymax(grdchkvarindex) |
175 |
enddo |
176 |
enddo |
177 |
enddo |
178 |
enddo |
179 |
ncvarcomp = ncvarcomp*ncvarrecs(grdchkvarindex) |
180 |
maxncvarcomps = maxncvarcomps*ncvarrecs(grdchkvarindex) |
181 |
|
182 |
do bj = jtlo,jthi |
183 |
do bi = itlo,ithi |
184 |
iwetsum(bi,bj,0) = 0 |
185 |
do k = 1,ncvarnrmax(grdchkvarindex) |
186 |
iwetsum(bi,bj,k) = iwetsum(bi,bj,k-1) + |
187 |
& nwettile(bi,bj,k,1) |
188 |
enddo |
189 |
enddo |
190 |
enddo |
191 |
|
192 |
_END_MASTER( mythid ) |
193 |
|
194 |
_BARRIER |
195 |
|
196 |
#endif /* ALLOW_GRDCHK */ |
197 |
|
198 |
return |
199 |
end |