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

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

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


Revision 1.11 - (show annotations) (download)
Mon Apr 16 23:34:33 2007 UTC (17 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint59a, checkpoint59
Changes since 1.10: +2 -2 lines
move EXF header files from lower_case.h to UPPER_CASE.h ;

1 C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_get_gen.F,v 1.10 2006/03/29 22:07:34 gforget Exp $
2 C $Name: $
3
4 #include "CTRL_CPPOPTIONS.h"
5
6
7 subroutine ctrl_get_gen(
8 I xx_gen_file, xx_genstartdate, xx_genperiod,
9 I genmask, genfld, xx_gen0, xx_gen1, xx_gen_dummy,
10 I xx_gen_remo_intercept, xx_gen_remo_slope,
11 I mytime, myiter, mythid
12 & )
13
14 c ==================================================================
15 c SUBROUTINE ctrl_get_gen
16 c ==================================================================
17 c
18 c o new generic routine for reading time dependent control variables
19 c heimbach@mit.edu 12-Jun-2003
20 c
21 c ==================================================================
22 c SUBROUTINE ctrl_get_gen
23 c ==================================================================
24
25 implicit none
26
27 c == global variables ==
28
29 #include "EEPARAMS.h"
30 #include "SIZE.h"
31 #include "PARAMS.h"
32 #include "GRID.h"
33
34 #include "ctrl.h"
35 #include "ctrl_dummy.h"
36 #include "optim.h"
37 #ifdef ALLOW_EXF
38 # include "EXF_FIELDS.h"
39 #endif
40
41 c == routine arguments ==
42
43 character*(MAX_LEN_FNAM) xx_gen_file
44 integer xx_genstartdate(4)
45 _RL xx_genperiod
46 _RL genmask(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy)
47 _RL genfld(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
48 _RL xx_gen0(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
49 _RL xx_gen1(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
50 _RL xx_gen_dummy
51 _RL xx_gen_remo_intercept
52 _RL xx_gen_remo_slope
53
54 _RL mytime
55 integer myiter
56 integer mythid
57
58 c == local variables ==
59
60 #ifdef ALLOW_EXF
61
62 integer bi,bj
63 integer i,j,k
64 integer itlo,ithi
65 integer jtlo,jthi
66 integer jmin,jmax
67 integer imin,imax
68 integer ilgen
69
70 _RL gensign
71 _RL genfac
72 logical doCtrlUpdate
73 logical genfirst
74 logical genchanged
75 integer gencount0
76 integer gencount1
77
78 logical doglobalread
79 logical ladinit
80
81 character*(80) fnamegen
82
83 c == external functions ==
84
85 integer ilnblnk
86 external ilnblnk
87
88
89 c == end of interface ==
90
91 jtlo = mybylo(mythid)
92 jthi = mybyhi(mythid)
93 itlo = mybxlo(mythid)
94 ithi = mybxhi(mythid)
95 jmin = 1-oly
96 jmax = sny+oly
97 imin = 1-olx
98 imax = snx+olx
99
100 c-- Now, read the control vector.
101 doglobalread = .false.
102 ladinit = .false.
103
104 if (optimcycle .ge. 0) then
105 ilgen=ilnblnk( xx_gen_file )
106 write(fnamegen(1:80),'(2a,i10.10)')
107 & xx_gen_file(1:ilgen), '.', optimcycle
108 endif
109
110 # ifdef ALLOW_CAL
111 if ( xx_genperiod .EQ. 0 ) then
112 c record numbers are assumed 1 to 12 corresponding to
113 c Jan. through Dec.
114 call cal_GetMonthsRec(
115 O genfac, genfirst, genchanged,
116 O gencount0, gencount1,
117 I mytime, myiter, mythid
118 & )
119 else
120 c-- Get the counters, flags, and the interpolation factor.
121 call ctrl_get_gen_rec(
122 I xx_genstartdate, xx_genperiod,
123 O genfac, genfirst, genchanged,
124 O gencount0,gencount1,
125 I mytime, myiter, mythid )
126 endif
127 # else
128 c-- Get the counters, flags, and the interpolation factor.
129 call ctrl_get_gen_rec(
130 I xx_genstartdate, xx_genperiod,
131 O genfac, genfirst, genchanged,
132 O gencount0,gencount1,
133 I mytime, myiter, mythid )
134 # endif
135
136 if ( genfirst ) then
137 call active_read_xy_loc( fnamegen, xx_gen1, gencount0,
138 & doglobalread, ladinit, optimcycle,
139 & mythid, xx_gen_dummy )
140 #ifdef ALLOW_CTRL_SMOOTH
141 if ( xx_gen_file .EQ. xx_tauu_file .OR.
142 & xx_gen_file .EQ. xx_tauv_file )
143 & call ctrl_smooth(xx_gen1,genmask)
144 #endif
145 endif
146
147 if (( genfirst ) .or. ( genchanged )) then
148 call exf_SwapFFields( xx_gen0, xx_gen1, mythid )
149
150 call active_read_xy_loc( fnamegen, xx_gen1 , gencount1,
151 & doglobalread, ladinit, optimcycle,
152 & mythid, xx_gen_dummy )
153 #ifdef ALLOW_CTRL_SMOOTH
154 if ( xx_gen_file .EQ. xx_tauu_file .OR.
155 & xx_gen_file .EQ. xx_tauv_file )
156 & call ctrl_smooth(xx_gen1,genmask)
157 #endif
158 endif
159
160 c-- Add control to model variable.
161 cph(
162 cph this flag ported from the SIO code
163 cph Initial wind stress adjustments are too vigorous.
164 if ( gencount0 .LE. 2 .AND.
165 & ( xx_gen_file .EQ. xx_tauu_file .OR.
166 & xx_gen_file .EQ. xx_tauv_file ) .AND.
167 & ( xx_genperiod .NE. 0 ) ) then
168 doCtrlUpdate = .FALSE.
169 else
170 doCtrlUpdate = .TRUE.
171 endif
172 if ( xx_gen_file .EQ. xx_tauu_file .OR.
173 & xx_gen_file .EQ. xx_tauv_file ) then
174 gensign = -1.
175 else
176 gensign = 1.
177 endif
178 c
179 cph since the above is ECCO specific, we undo it here:
180 cph doCtrlUpdate = .TRUE.
181 c
182 if ( doCtrlUpdate ) then
183 cph)
184 do bj = jtlo,jthi
185 do bi = itlo,ithi
186 c-- Calculate mask for tracer cells (0 => land, 1 => water).
187 k = 1
188 do j = 1,sny
189 do i = 1,snx
190 genfld(i,j,bi,bj) = genfld (i,j,bi,bj)
191 & + gensign*genfac *xx_gen0(i,j,bi,bj)
192 & + gensign*(1. _d 0 - genfac)*xx_gen1(i,j,bi,bj)
193 genfld(i,j,bi,bj) =
194 & genmask(i,j,k,bi,bj)*( genfld (i,j,bi,bj) -
195 & ( xx_gen_remo_intercept +
196 & xx_gen_remo_slope*(mytime-starttime) ) )
197 enddo
198 enddo
199 enddo
200 enddo
201 cph(
202 endif
203 cph)
204
205 #endif /* ALLOW_EXF */
206
207 end
208

  ViewVC Help
Powered by ViewVC 1.1.22