/[MITgcm]/MITgcm/pkg/exf/exf_set_gen.F
ViewVC logotype

Contents of /MITgcm/pkg/exf/exf_set_gen.F

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


Revision 1.5 - (show annotations) (download)
Fri Aug 15 01:42:44 2003 UTC (20 years, 9 months ago) by dimitri
Branch: MAIN
Changes since 1.4: +4 -3 lines
Modified pkg/exf/exf_interp.F in order to specify option
linear or bi-linear via argument rather than CPP option.

1 #include "EXF_CPPOPTIONS.h"
2
3 subroutine exf_set_gen(
4 & genfile, genstartdate, genperiod, exf_inscal_gen,
5 & genfld, gen0, gen1, genmask,
6 #ifdef USE_EXF_INTERPOLATION
7 & gen_lon0, gen_lon_inc, gen_lat0, gen_lat_inc,
8 & gen_nlon, gen_nlat, gen_xout, gen_yout,
9 #endif
10 & mycurrenttime, mycurrentiter, mythid )
11
12 c ==================================================================
13 c SUBROUTINE exf_set_gen
14 c ==================================================================
15 c
16 c o set external forcing gen
17 c
18 c started: Ralf.Giering@FastOpt.de 25-Mai-2000
19 c changed: heimbach@mit.edu 10-Jan-2002
20 c 20-Dec-2002: mods for pkg/seaice, menemenlis@jpl.nasa.gov
21 c heimbach@mit.edu: totally re-organized exf_set_...
22 c replaced all routines by one generic routine
23 c 5-Aug-2003: added USE_EXF_INTERPOLATION for arbitrary
24 c input grid capability
25
26 c ==================================================================
27 c SUBROUTINE exf_set_gen
28 c ==================================================================
29
30 implicit none
31
32 c == global variables ==
33
34 #include "EEPARAMS.h"
35 #include "SIZE.h"
36 #include "GRID.h"
37
38 #include "exf_param.h"
39 #include "exf_constants.h"
40
41 c == routine arguments ==
42
43 integer genstartdate(4)
44 _RL genperiod
45 _RL exf_inscal_gen
46 _RL genfld(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
47 _RL gen0 (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
48 _RL gen1 (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
49 character*1 genmask
50 character*(128) genfile
51 _RL mycurrenttime
52 integer mycurrentiter
53 integer mythid
54 #ifdef USE_EXF_INTERPOLATION
55 c gen_lon_0 ,gen_lat_0 :: longitude and latitude of SouthWest
56 c corner of global input grid
57 c gen_nlon, gen_nlat :: input x-grid and y-grid size
58 c gen_lon_inc :: scalar x-grid increment
59 c gen_lat_inc :: vector y-grid increments
60 c gen_xout, gen_yout :: coordinates for output grid
61 _RL gen_lon0, gen_lon_inc
62 _RL gen_lat0, gen_lat_inc(MAX_LAT_INC)
63 INTEGER gen_nlon, gen_nlat
64 _RS gen_xout (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
65 _RS gen_yout (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
66 #endif
67
68 c == local variables ==
69
70 logical first, changed
71 integer count0, count1
72 _RL fac
73
74 integer bi, bj
75 integer i, j, interp_method
76
77 c == end of interface ==
78
79 if ( genfile .NE. ' ' ) then
80
81 c get record numbers and interpolation factor for gen
82 call exf_GetFFieldRec(
83 I genstartdate, genperiod
84 O , fac, first, changed
85 O , count0, count1
86 I , mycurrenttime, mycurrentiter, mythid
87 & )
88
89 if ( first ) then
90 #ifdef USE_EXF_INTERPOLATION
91 interp_method = 2
92 call exf_interp( genfile, exf_iprec
93 & , gen1, count0, gen_xout, gen_yout
94 & , gen_lon0,gen_lon_inc
95 & , gen_lat0,gen_lat_inc
96 & , gen_nlon,gen_nlat,interp_method,mythid
97 & )
98 #else
99 call mdsreadfield( genfile, exf_iprec, exf_yftype, 1
100 & , gen1, count0, mythid
101 & )
102 #endif
103
104 if (exf_yftype .eq. 'RL') then
105 call exf_filter_rl( gen1, genmask, mythid )
106 else
107 call exf_filter_rs( gen1, genmask, mythid )
108 end if
109 endif
110
111 if (( first ) .or. ( changed )) then
112 call exf_SwapFFields( gen0, gen1, mythid )
113
114 #ifdef USE_EXF_INTERPOLATION
115 call exf_interp( genfile, exf_iprec
116 & , gen1, count1, gen_xout, gen_yout
117 & , gen_lon0,gen_lon_inc
118 & , gen_lat0,gen_lat_inc
119 & , gen_nlon,gen_nlat,interp_method,mythid
120 & )
121 #else
122 call mdsreadfield( genfile, exf_iprec, exf_yftype, 1
123 & , gen1, count1, mythid
124 & )
125 #endif
126
127 if (exf_yftype .eq. 'RL') then
128 call exf_filter_rl( gen1, genmask, mythid )
129 else
130 call exf_filter_rs( gen1, genmask, mythid )
131 end if
132 endif
133
134 c Loop over tiles.
135 do bj = mybylo(mythid),mybyhi(mythid)
136 do bi = mybxlo(mythid),mybxhi(mythid)
137 do j = 1,sny
138 do i = 1,snx
139
140 c Interpolate linearly onto the current time.
141
142 genfld(i,j,bi,bj) = exf_inscal_gen * (
143 & fac * gen0(i,j,bi,bj) +
144 & (exf_one - fac) * gen1(i,j,bi,bj) )
145
146 enddo
147 enddo
148 enddo
149 enddo
150
151 endif
152
153 end
154
155
156
157 subroutine exf_init_gen (
158 & genconst, genfld, gen0, gen1, mythid )
159
160 c ==================================================================
161 c SUBROUTINE exf_init_gen
162 c ==================================================================
163 c
164 c o
165 c
166 c started: Ralf.Giering@FastOpt.de 25-Mai-2000
167 c changed: heimbach@mit.edu 10-Jan-2002
168 c heimbach@mit.edu: totally re-organized exf_set_...
169 c replaced all routines by one generic routine
170 c
171 c ==================================================================
172 c SUBROUTINE exf_init_gen
173 c ==================================================================
174
175 implicit none
176
177 c == global variables ==
178
179 #include "EEPARAMS.h"
180 #include "SIZE.h"
181
182 #include "exf_param.h"
183
184 c == routine arguments ==
185
186 _RL genconst
187 _RL genfld(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
188 _RL gen0 (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
189 _RL gen1 (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
190 integer mythid
191
192 c == local variables ==
193
194 integer bi, bj
195 integer i, j
196
197 c == end of interface ==
198
199 do bj = mybylo(mythid), mybyhi(mythid)
200 do bi = mybxlo(mythid), mybxhi(mythid)
201 do j = 1, sny
202 do i = 1, snx
203 genfld(i,j,bi,bj) = genconst
204 gen0(i,j,bi,bj) = 0. _d 0
205 gen1(i,j,bi,bj) = 0. _d 0
206 enddo
207 enddo
208 enddo
209 enddo
210
211 end

  ViewVC Help
Powered by ViewVC 1.1.22