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