/[MITgcm]/MITgcm/pkg/ctrl/ctrl_set_pack_xyz.F
ViewVC logotype

Contents of /MITgcm/pkg/ctrl/ctrl_set_pack_xyz.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Tue Jun 24 16:07:07 2003 UTC (20 years, 10 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint51k_post, checkpoint51l_post, checkpoint51, checkpoint51f_post, checkpoint51d_post, checkpoint51j_post, checkpoint51l_pre, checkpoint51b_pre, checkpoint51h_pre, branchpoint-genmake2, checkpoint51i_post, checkpoint51b_post, checkpoint51c_post, checkpoint51i_pre, checkpoint51e_post, checkpoint51f_pre, checkpoint51g_post, checkpoint51m_post, checkpoint51a_post
Branch point for: branch-genmake2, tg2-branch
Changes since 1.3: +32 -3 lines
Merging for c51 vs. e34

1
2 #include "CTRL_CPPOPTIONS.h"
3
4
5 subroutine ctrl_set_pack_xyz(
6 & cunit, ivartype, fname, masktype, weighttype,
7 & weightfld, lxxadxx, mythid)
8
9 c ==================================================================
10 c SUBROUTINE ctrl_set_pack_xyz
11 c ==================================================================
12 c
13 c o Compress the control vector such that only ocean points are
14 c written to file.
15 c
16 c o Use a more precise nondimensionalization that depends on (x,y)
17 c Added weighttype to the argument list so that I can geographically
18 c vary the nondimensionalization.
19 c gebbie@mit.edu, 18-Mar-2003
20 c
21 c ==================================================================
22
23 implicit none
24
25 c == global variables ==
26
27 #include "EEPARAMS.h"
28 #include "SIZE.h"
29 #include "PARAMS.h"
30 #include "GRID.h"
31
32 #include "ctrl.h"
33 #include "cost.h"
34
35 #ifdef ALLOW_ECCO_OPTIMIZATION
36 #include "optim.h"
37 #endif
38
39 c == routine arguments ==
40
41 integer cunit
42 integer ivartype
43 character*( 80) fname
44 character* (5) masktype
45 character*( 80) weighttype
46 _RL weightfld( nr,nsx,nsy )
47 logical lxxadxx
48 integer mythid
49
50 c == local variables ==
51
52 #ifndef ALLOW_ECCO_OPTIMIZATION
53 integer optimcycle
54 #endif
55
56 integer bi,bj
57 integer ip,jp
58 integer i,j,k
59 integer ii
60 integer il
61 integer irec
62 integer itlo,ithi
63 integer jtlo,jthi
64 integer jmin,jmax
65 integer imin,imax
66
67 integer cbuffindex
68
69 _RL cbuff ( snx*nsx*npx*sny*nsy*npy )
70 _RL globmsk ( snx,nsx,npx,sny,nsy,npy,nr )
71 _RL globfld3d( snx,nsx,npx,sny,nsy,npy,nr )
72 #ifdef CTRL_PACK_PRECISE
73 _RL weightfld3d( snx,nsx,npx,sny,nsy,npy,nr )
74 #endif
75
76 character*(80) weightname
77
78 c == external ==
79
80 integer ilnblnk
81 external ilnblnk
82
83 c == end of interface ==
84
85 #ifndef ALLOW_ECCO_OPTIMIZATION
86 optimcycle = 0
87 #endif
88
89 jtlo = 1
90 jthi = nsy
91 itlo = 1
92 ithi = nsx
93 jmin = 1
94 jmax = sny
95 imin = 1
96 imax = snx
97
98 c Initialise temporary file
99 do k = 1,nr
100 do jp = 1,nPy
101 do bj = jtlo,jthi
102 do j = jmin,jmax
103 do ip = 1,nPx
104 do bi = itlo,ithi
105 do i = imin,imax
106 globfld3d(i,bi,ip,j,bj,jp,k) = 0. _d 0
107 globmsk (i,bi,ip,j,bj,jp,k) = 0. _d 0
108 enddo
109 enddo
110 enddo
111 enddo
112 enddo
113 enddo
114 enddo
115
116 c-- Only the master thread will do I/O.
117 _BEGIN_MASTER( mythid )
118
119 #ifdef CTRL_PACK_PRECISE
120 il=ilnblnk( weighttype)
121 write(weightname(1:80),'(80a)') ' '
122 write(weightname(1:80),'(a)') weighttype(1:il)
123
124 call MDSREADFIELD_3D_GL(
125 & weightname, ctrlprec, 'RL',
126 & Nr, weightfld3d, 1, mythid)
127 #endif
128
129 call MDSREADFIELD_3D_GL(
130 & masktype, ctrlprec, 'RL',
131 & Nr, globmsk, 1, mythid)
132
133 do irec = 1, ncvarrecs(ivartype)
134
135 call MDSREADFIELD_3D_GL( fname, ctrlprec, 'RL',
136 & Nr, globfld3d, irec, mythid)
137
138 write(cunit) ncvarindex(ivartype)
139 write(cunit) 1
140 write(cunit) 1
141 do k = 1, nr
142 cbuffindex = 0
143 do jp = 1,nPy
144 do bj = jtlo,jthi
145 do j = jmin,jmax
146 do ip = 1,nPx
147 do bi = itlo,ithi
148 do i = imin,imax
149 if (globmsk(i,bi,ip,j,bj,jp,k) .ne. 0. ) then
150 cbuffindex = cbuffindex + 1
151 #ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO
152 if (lxxadxx) then
153 cbuff(cbuffindex) =
154 & globfld3d(i,bi,ip,j,bj,jp,k) *
155 # ifdef CTRL_PACK_PRECISE
156 & sqrt(weightfld3d(i,bi,ip,j,bj,jp,k))
157 # else
158 & sqrt(weightfld(k,bi,bj))
159 # endif
160 else
161 cbuff(cbuffindex) =
162 & globfld3d(i,bi,ip,j,bj,jp,k) /
163 # ifdef CTRL_PACK_PRECISE
164 & sqrt(weightfld3d(i,bi,ip,j,bj,jp,k))
165 # else
166 & sqrt(weightfld(k,bi,bj))
167 # endif
168 endif
169 #else /* ALLOW_NONDIMENSIONAL_CONTROL_IO undef */
170 cbuff(cbuffindex) = globfld3d(i,bi,ip,j,bj,jp,k)
171 #endif /* ALLOW_NONDIMENSIONAL_CONTROL_IO */
172 endif
173 enddo
174 enddo
175 enddo
176 enddo
177 enddo
178 enddo
179 c --> check cbuffindex.
180 if ( cbuffindex .gt. 0) then
181 write(cunit) cbuffindex
182 write(cunit) k
183 write(cunit) (cbuff(ii), ii=1,cbuffindex)
184 endif
185 enddo
186 c
187 c -- end of irec loop --
188 enddo
189
190 _END_MASTER( mythid )
191
192 return
193 end
194

  ViewVC Help
Powered by ViewVC 1.1.22