/[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.5 - (show annotations) (download)
Thu Mar 4 19:49:47 2004 UTC (20 years, 3 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint52l_pre, checkpoint52l_post, checkpoint52m_post, hrcube5
Changes since 1.4: +17 -4 lines
Some tricks...

1 C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_get_gen.F,v 1.4 2003/11/01 04:50:02 edhill 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 mytime, myiter, mythid
11 & )
12
13 c ==================================================================
14 c SUBROUTINE ctrl_get_gen
15 c ==================================================================
16 c
17 c o new generic routine for reading time dependent control variables
18 c heimbach@mit.edu 12-Jun-2003
19 c
20 c ==================================================================
21 c SUBROUTINE ctrl_get_gen
22 c ==================================================================
23
24 implicit none
25
26 c == global variables ==
27
28 #include "EEPARAMS.h"
29 #include "SIZE.h"
30 #include "PARAMS.h"
31 #include "GRID.h"
32
33 #include "ctrl.h"
34 #include "ctrl_dummy.h"
35 #include "optim.h"
36 #ifdef ALLOW_EXF
37 # include "exf_fields.h"
38 #endif
39
40 c == routine arguments ==
41
42 character*(MAX_LEN_FNAM) xx_gen_file
43 integer xx_genstartdate(4)
44 _RL xx_genperiod
45 _RL genmask(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy)
46 _RL genfld(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
47 _RL xx_gen0(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
48 _RL xx_gen1(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
49 _RL xx_gen_dummy
50
51 _RL mytime
52 integer myiter
53 integer mythid
54
55 c == local variables ==
56
57 #ifdef ALLOW_EXF
58
59 integer bi,bj
60 integer i,j,k
61 integer itlo,ithi
62 integer jtlo,jthi
63 integer jmin,jmax
64 integer imin,imax
65 integer ilgen
66
67 _RL genfac
68 logical genfirst
69 logical genchanged
70 integer gencount0
71 integer gencount1
72
73 logical doglobalread
74 logical ladinit
75
76 character*(80) fnamegen
77
78 c == external functions ==
79
80 integer ilnblnk
81 external ilnblnk
82
83
84 c == end of interface ==
85
86 jtlo = mybylo(mythid)
87 jthi = mybyhi(mythid)
88 itlo = mybxlo(mythid)
89 ithi = mybxhi(mythid)
90 jmin = 1-oly
91 jmax = sny+oly
92 imin = 1-olx
93 imax = snx+olx
94
95 c-- Now, read the control vector.
96 doglobalread = .false.
97 ladinit = .false.
98
99 if (optimcycle .ge. 0) then
100 ilgen=ilnblnk( xx_gen_file )
101 write(fnamegen(1:80),'(2a,i10.10)')
102 & xx_gen_file(1:ilgen), '.', optimcycle
103 endif
104
105 c-- Get the counters, flags, and the interpolation factor.
106 call ctrl_get_gen_rec(
107 I xx_genstartdate, xx_genperiod,
108 O genfac, genfirst, genchanged,
109 O gencount0,gencount1,
110 I mytime, myiter, mythid )
111
112 if ( genfirst ) then
113 call active_read_xy_loc( fnamegen, xx_gen1, gencount0,
114 & doglobalread, ladinit, optimcycle,
115 & mythid, xx_gen_dummy )
116 #ifdef ALLOW_CTRL_SMOOTH
117 if ( xx_gen_file .EQ. xx_tauu_file .OR.
118 & xx_gen_file .EQ. xx_tauv_file )
119 & call ctrl_smooth(xx_gen1,genmask)
120 #endif
121 endif
122
123 if (( genfirst ) .or. ( genchanged )) then
124 call exf_SwapFFields( xx_gen0, xx_gen1, mythid )
125
126 call active_read_xy_loc( fnamegen, xx_gen1 , gencount1,
127 & doglobalread, ladinit, optimcycle,
128 & mythid, xx_gen_dummy )
129 #ifdef ALLOW_CTRL_SMOOTH
130 if ( xx_gen_file .EQ. xx_tauu_file .OR.
131 & xx_gen_file .EQ. xx_tauv_file )
132 & call ctrl_smooth(xx_gen1,genmask)
133 #endif
134 endif
135
136 c-- Add control to model variable.
137 cph(
138 cph this flag ported from the SIO code (dont know why its here)
139 if ( gencount0 .GT. 2 .AND.
140 & ( xx_gen_file .EQ. xx_tauu_file .OR.
141 & xx_gen_file .EQ. xx_tauv_file ) ) then
142 cph)
143 do bj = jtlo,jthi
144 do bi = itlo,ithi
145 c-- Calculate mask for tracer cells (0 => land, 1 => water).
146 k = 1
147 do j = 1,sny
148 do i = 1,snx
149 genfld(i,j,bi,bj) = genfld (i,j,bi,bj)
150 & + genfac *xx_gen0(i,j,bi,bj)
151 & + (1. _d 0 - genfac)*xx_gen1(i,j,bi,bj)
152 genfld(i,j,bi,bj) = genfld(i,j,bi,bj)*genmask(i,j,k,bi,bj)
153 enddo
154 enddo
155 enddo
156 enddo
157 cph(
158 endif
159 cph)
160
161 #endif /* ALLOW_EXF */
162
163 end
164

  ViewVC Help
Powered by ViewVC 1.1.22