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

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

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


Revision 1.2 - (show annotations) (download)
Sat Jul 13 02:47:32 2002 UTC (21 years, 10 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint47e_post, checkpoint46l_post, checkpoint46g_pre, checkpoint47c_post, checkpoint50c_post, c49_ctrl, checkpoint46f_post, checkpoint48e_post, checkpoint50c_pre, checkpoint46b_post, checkpoint48i_post, checkpoint46l_pre, checkpoint50, checkpoint50d_post, checkpoint50b_pre, checkpoint48b_post, checkpoint48c_pre, checkpoint47d_pre, checkpoint47a_post, checkpoint48d_pre, checkpoint47i_post, checkpoint47d_post, checkpoint46d_pre, checkpoint48d_post, checkpoint48f_post, checkpoint46j_pre, checkpoint48h_post, checkpoint46a_post, checkpoint47g_post, checkpoint46j_post, checkpoint46k_post, checkpoint48a_post, checkpoint50f_post, checkpoint50a_post, checkpoint50f_pre, checkpoint47j_post, branch-exfmods-tag, checkpoint46e_pre, checkpoint48c_post, checkpoint46b_pre, checkpoint46c_pre, checkpoint46, checkpoint47b_post, checkpoint46h_pre, checkpoint46m_post, checkpoint46a_pre, checkpoint50g_post, checkpoint46g_post, checkpoint50h_post, checkpoint50e_pre, checkpoint50i_post, checkpoint47f_post, checkpoint50e_post, checkpoint46i_post, checkpoint46c_post, checkpoint50d_pre, checkpoint46e_post, checkpoint47, checkpoint48, checkpoint49, checkpoint46h_post, checkpoint48g_post, checkpoint47h_post, checkpoint46d_post, checkpoint50b_post
Branch point for: branch-exfmods-curt
Changes since 1.1: +177 -0 lines
Merging new ctrl package from release1_p5:
o new ctrl package
  - adopted from ECCO environment to enable optimization
  - added Eliassen Palm fluxes to controls

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

  ViewVC Help
Powered by ViewVC 1.1.22