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

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

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


Revision 1.1.2.1 - (hide annotations) (download)
Tue Feb 5 20:23:58 2002 UTC (22 years, 4 months ago) by heimbach
Branch: ecco-branch
CVS Tags: icebear5, icebear4, icebear3, icebear2, ecco_c44_e19, ecco_c44_e18, ecco_c44_e17, ecco_c44_e16, ecco_ice2, ecco_ice1, ecco_c44_e22, ecco_c44_e25, ecco_c44_e23, ecco_c44_e20, ecco_c44_e21, ecco_c44_e26, ecco_c44_e27, ecco_c44_e24, ecco-branch-mod1, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5
Branch point for: c24_e25_ice, icebear
Changes since 1.1: +167 -0 lines
Starting from ecco-branch, replacing packages
cost, ctrl, ecco, obcs by ECCO packages.
Will create tag ecco-branch-mod1 after this modif.

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

  ViewVC Help
Powered by ViewVC 1.1.22