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

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

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


Revision 1.2 - (hide 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: +172 -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 heimbach 1.2
2     #include "CTRL_CPPOPTIONS.h"
3    
4    
5     subroutine ctrl_set_pack_yz(
6     & cunit, ivartype, fname, masktype,
7     & weightfld, lxxadxx, mythid)
8    
9     c ==================================================================
10     c SUBROUTINE ctrl_set_pack_yz
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*( 9) masktype
40     _RL weightfld( nr,nobcs )
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,iobcs
56     integer itlo,ithi
57     integer jtlo,jthi
58     integer jmin,jmax
59     integer imin,imax
60    
61     integer cbuffindex
62     cgg(
63     integer igg
64     _RL gg
65     cgg)
66     _RL cbuff ( nsx*npx*sny*nsy*npy )
67     _RL globmskyz ( nsx,npx,sny,nsy,npy,nr )
68     _RL globfldyz ( nsx,npx,sny,nsy,npy,nr )
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     globfldyz(bi,ip,j,bj,jp,k) = 0. _d 0
98     globmskyz(bi,ip,j,bj,jp,k) = 0. _d 0
99     enddo
100     enddo
101     enddo
102     enddo
103     enddo
104     enddo
105    
106     c-- Only the master thread will do I/O.
107     _BEGIN_MASTER( mythid )
108    
109     do irec = 1, ncvarrecs(ivartype)
110    
111     cgg do iobcs = 1, nobcs
112     cgg Need to solve for what iobcs would have been.
113     gg = (irec-1)/nobcs
114     igg = int(gg)
115     iobcs= irec - igg*nobcs
116    
117     call MDSREADFIELD_YZ_GL(
118     & masktype, ctrlprec, 'RL',
119     & Nr, globmskyz, iobcs, mythid)
120    
121     call MDSREADFIELD_YZ_GL( fname, ctrlprec, 'RL',
122     & nr, globfldyz, irec, mythid)
123    
124     write(cunit) ncvarindex(ivartype)
125     write(cunit) 1
126     write(cunit) 1
127     do k = 1,nr
128     cbuffindex = 0
129     do jp = 1,nPy
130     do bj = jtlo,jthi
131     do ip = 1,nPx
132     do bi = itlo,ithi
133     do j = jmin,jmax
134     if (globmskyz(bi,ip,j,bj,jp,k) .ne. 0. ) then
135     cbuffindex = cbuffindex + 1
136     #ifdef ALLOW_NONDIMENSIONAL_CONTROL_IO
137     if (lxxadxx) then
138     cbuff(cbuffindex) =
139     & globfldyz(bi,ip,j,bj,jp,k) *
140     & sqrt(weightfld(k,iobcs))
141     else
142     cbuff(cbuffindex) =
143     & globfldyz(bi,ip,j,bj,jp,k) /
144     & sqrt(weightfld(k,iobcs))
145     endif
146     #else
147     cbuff(cbuffindex) = globfldyz(bi,ip,j,bj,jp,k)
148     #endif
149     endif
150     enddo
151     enddo
152     enddo
153     enddo
154     enddo
155     c --> check cbuffindex.
156     if ( cbuffindex .gt. 0) then
157     write(cunit) cbuffindex
158     write(cunit) k
159     write(cunit) (cbuff(ii), ii=1,cbuffindex)
160     endif
161     enddo
162     c
163     c -- end of iobcs loop --
164     cgg enddo
165     c -- end of irec loop --
166     enddo
167    
168     _END_MASTER( mythid )
169    
170     return
171     end
172    

  ViewVC Help
Powered by ViewVC 1.1.22