1 |
C $Header: /u/gcmpack/MITgcm/pkg/grdchk/grdchk_init.F,v 1.2.6.1 2002/05/30 19:55:16 heimbach Exp $ |
2 |
|
3 |
#include "CTRL_CPPOPTIONS.h" |
4 |
|
5 |
|
6 |
subroutine grdchk_init( mythid ) |
7 |
|
8 |
c ================================================================== |
9 |
c SUBROUTINE grdchk_init |
10 |
c ================================================================== |
11 |
c |
12 |
c o Get the location of a given component of the control vector for |
13 |
c the current process. |
14 |
c |
15 |
c started: Christian Eckert eckert@mit.edu 04-Apr-2000 |
16 |
c continued: heimbach@mit.edu: 13-Jun-2001 |
17 |
c |
18 |
c ================================================================== |
19 |
c SUBROUTINE grdchk_init |
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 "ctrl.h" |
30 |
#include "grdchk.h" |
31 |
|
32 |
c == routine arguments == |
33 |
|
34 |
integer mythid |
35 |
|
36 |
#ifdef ALLOW_GRADIENT_CHECK |
37 |
c == local variables == |
38 |
|
39 |
integer bi,bj |
40 |
integer i,j,k |
41 |
integer irec |
42 |
integer itlo,ithi |
43 |
integer jtlo,jthi |
44 |
integer jmin,jmax |
45 |
integer imin,imax |
46 |
|
47 |
integer itest |
48 |
integer icomptest |
49 |
|
50 |
c == end of interface == |
51 |
|
52 |
jtlo = 1 |
53 |
jthi = nsy |
54 |
itlo = 1 |
55 |
ithi = nsx |
56 |
jmin = 1 |
57 |
jmax = sny |
58 |
imin = 1 |
59 |
imax = snx |
60 |
|
61 |
_BEGIN_MASTER( mythid ) |
62 |
|
63 |
c-- Determine the number of components of the given |
64 |
c-- control variable on the current tile. |
65 |
if ( ncvargrd(grdchkvarindex) .eq. 'c' ) then |
66 |
do bj = jtlo,jthi |
67 |
do bi = itlo,ithi |
68 |
do k = 1,ncvarnrmax(grdchkvarindex) |
69 |
nwettile(bi,bj,k) = nwetctile(bi,bj,k) |
70 |
enddo |
71 |
enddo |
72 |
enddo |
73 |
else if ( ncvargrd(grdchkvarindex) .eq. 's' ) then |
74 |
do bj = jtlo,jthi |
75 |
do bi = itlo,ithi |
76 |
do k = 1,ncvarnrmax(grdchkvarindex) |
77 |
nwettile(bi,bj,k) = nwetstile(bi,bj,k) |
78 |
enddo |
79 |
enddo |
80 |
enddo |
81 |
else if ( ncvargrd(grdchkvarindex) .eq. 'w' ) then |
82 |
do bj = jtlo,jthi |
83 |
do bi = itlo,ithi |
84 |
do k = 1,ncvarnrmax(grdchkvarindex) |
85 |
nwettile(bi,bj,k) = nwetwtile(bi,bj,k) |
86 |
enddo |
87 |
enddo |
88 |
enddo |
89 |
else if ( ncvargrd(grdchkvarindex) .eq. 'v' ) then |
90 |
do bj = jtlo,jthi |
91 |
do bi = itlo,ithi |
92 |
do k = 1,ncvarnrmax(grdchkvarindex) |
93 |
nwettile(bi,bj,k) = nwetvtile(bi,bj,k) |
94 |
enddo |
95 |
enddo |
96 |
enddo |
97 |
else |
98 |
ce --> wrong grid specification for the control variable. |
99 |
endif |
100 |
|
101 |
c ---------------------------------------------------------------- |
102 |
|
103 |
c-- Determine the actual and the maximum possible number of |
104 |
c-- components of the given control variable. |
105 |
ncvarcomp = 0 |
106 |
maxncvarcomps = 0 |
107 |
do bj = jtlo,jthi |
108 |
do bi = itlo,ithi |
109 |
do k = 1,ncvarnrmax(grdchkvarindex) |
110 |
ncvarcomp = ncvarcomp + nwettile(bi,bj,k) |
111 |
maxncvarcomps = maxncvarcomps + snx*sny |
112 |
enddo |
113 |
enddo |
114 |
enddo |
115 |
ncvarcomp = ncvarcomp*ncvarrecs(grdchkvarindex) |
116 |
maxncvarcomps = maxncvarcomps*ncvarrecs(grdchkvarindex) |
117 |
|
118 |
_END_MASTER( mythid ) |
119 |
|
120 |
_BARRIER |
121 |
|
122 |
#endif /* ALLOW_GRADIENT_CHECK */ |
123 |
|
124 |
end |
125 |
|