/[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.4 - (show annotations) (download)
Sat Nov 1 04:50:02 2003 UTC (20 years, 7 months ago) by edhill
Branch: MAIN
CVS Tags: checkpoint52e_pre, hrcube4, checkpoint52j_post, checkpoint52e_post, hrcube_1, branch-netcdf, checkpoint52d_pre, checkpoint51r_post, checkpoint52k_post, checkpoint52b_pre, checkpoint52a_pre, checkpoint52, checkpoint52d_post, checkpoint52a_post, checkpoint52b_post, checkpoint52f_post, checkpoint52c_post, ecco_c52_e35, checkpoint52i_post, checkpoint52j_pre, checkpoint51t_post, checkpoint52i_pre, checkpoint51u_post, checkpoint52h_pre, checkpoint52f_pre, hrcube_2, hrcube_3, checkpoint51s_post
Branch point for: branch-nonh, netcdf-sm0
Changes since 1.3: +5 -4 lines
 o convert all "INCLUDE_EXTERNAL_FORCING_PACKAGE" defines to the
   more consistent ALLOW_EXF
 o passed all the basic verification tests on shelley

1 C $Header: /u/u3/gcmpack/MITgcm/pkg/ctrl/ctrl_get_gen.F,v 1.3 2003/07/18 21:10:16 heimbach 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 call ctrl_smooth(xx_gen1,genmask)
118 #endif
119 endif
120
121 if (( genfirst ) .or. ( genchanged )) then
122 call exf_SwapFFields( xx_gen0, xx_gen1, mythid )
123
124 call active_read_xy_loc( fnamegen, xx_gen1 , gencount1,
125 & doglobalread, ladinit, optimcycle,
126 & mythid, xx_gen_dummy )
127 #ifdef ALLOW_CTRL_SMOOTH
128 call ctrl_smooth(xx_gen1,genmask)
129 #endif
130 endif
131
132 c-- Add control to model variable.
133 do bj = jtlo,jthi
134 do bi = itlo,ithi
135 c-- Calculate mask for tracer cells (0 => land, 1 => water).
136 k = 1
137 do j = 1,sny
138 do i = 1,snx
139 genfld(i,j,bi,bj) = genfld (i,j,bi,bj)
140 & + genfac *xx_gen0(i,j,bi,bj)
141 & + (1. _d 0 - genfac)*xx_gen1(i,j,bi,bj)
142 genfld(i,j,bi,bj) = genfld(i,j,bi,bj)*genmask(i,j,k,bi,bj)
143 enddo
144 enddo
145 enddo
146 enddo
147
148 #endif /* ALLOW_EXF */
149
150 end
151

  ViewVC Help
Powered by ViewVC 1.1.22