1 |
C |
2 |
C $Header: /u/gcmpack/MITgcm/pkg/exf/exf_getffields.F,v 1.28 2005/07/28 19:52:33 heimbach Exp $ |
3 |
C $Name: $ |
4 |
|
5 |
#include "EXF_OPTIONS.h" |
6 |
|
7 |
subroutine exf_getffields( mycurrenttime, mycurrentiter, mythid ) |
8 |
|
9 |
c ================================================================== |
10 |
c SUBROUTINE exf_getffields |
11 |
c ================================================================== |
12 |
c |
13 |
c o Read-in atmospheric state and/or surface fluxes from files. |
14 |
c |
15 |
c heimbach@mit.edu, 23-May-2003 totally re-structured |
16 |
c 5-Aug-2003: added USE_EXF_INTERPOLATION for arbitrary input grid |
17 |
c |
18 |
c ================================================================== |
19 |
c SUBROUTINE exf_getffields |
20 |
c ================================================================== |
21 |
|
22 |
implicit none |
23 |
|
24 |
c == global variables == |
25 |
|
26 |
#include "EEPARAMS.h" |
27 |
#include "SIZE.h" |
28 |
#include "PARAMS.h" |
29 |
#include "DYNVARS.h" |
30 |
#include "GRID.h" |
31 |
|
32 |
#include "exf_param.h" |
33 |
#include "exf_fields.h" |
34 |
#include "exf_constants.h" |
35 |
|
36 |
#ifdef ALLOW_AUTODIFF |
37 |
# include "ctrl.h" |
38 |
# include "ctrl_dummy.h" |
39 |
#endif |
40 |
|
41 |
c == routine arguments == |
42 |
|
43 |
integer mythid |
44 |
integer mycurrentiter |
45 |
_RL mycurrenttime |
46 |
|
47 |
c == local variables == |
48 |
|
49 |
integer i, j, bi, bj, interp_method |
50 |
parameter(interp_method=1) |
51 |
|
52 |
c == end of interface == |
53 |
|
54 |
c-- read forcing fields from files and temporal interpolation |
55 |
|
56 |
cph-exf-print print *, 'ph-exf --------- ----------------------------------' |
57 |
|
58 |
c Zonal and meridional wind stress. |
59 |
#ifdef USE_EXF_INTERPOLATION |
60 |
call exf_set_uv( |
61 |
& ustressfile, ustressstartdate, ustressperiod, |
62 |
& ustressstartdate1, ustressstartdate2, |
63 |
& exf_inscal_ustress, ustress, ustress0, ustress1, ustressmask, |
64 |
& ustress_lon0, ustress_lon_inc, ustress_lat0, ustress_lat_inc, |
65 |
& ustress_nlon, ustress_nlat, |
66 |
& vstressfile, vstressstartdate, vstressperiod, |
67 |
& vstressstartdate1, vstressstartdate2, |
68 |
& exf_inscal_vstress, vstress, vstress0, vstress1, vstressmask, |
69 |
& vstress_lon0, vstress_lon_inc, vstress_lat0, vstress_lat_inc, |
70 |
& vstress_nlon, vstress_nlat, |
71 |
& mycurrenttime, mycurrentiter, mythid ) |
72 |
#else /* ifndef USE_EXF_INTERPOLATION */ |
73 |
call exf_set_gen( |
74 |
& ustressfile, ustressstartdate, ustressperiod, |
75 |
& ustressstartdate1, ustressstartdate2, |
76 |
& exf_inscal_ustress, |
77 |
& ustress, ustress0, ustress1, ustressmask, |
78 |
& mycurrenttime, mycurrentiter, mythid ) |
79 |
call exf_set_gen( |
80 |
& vstressfile, vstressstartdate, vstressperiod, |
81 |
& ustressstartdate1, ustressstartdate2, |
82 |
& exf_inscal_vstress, |
83 |
& vstress, vstress0, vstress1, vstressmask, |
84 |
& mycurrenttime, mycurrentiter, mythid ) |
85 |
#endif /* USE_EXF_INTERPOLATION */ |
86 |
|
87 |
#ifdef ALLOW_ATM_WIND |
88 |
|
89 |
c Zonal and meridional wind. |
90 |
#ifdef USE_EXF_INTERPOLATION |
91 |
call exf_set_uv( |
92 |
& uwindfile, uwindstartdate, uwindperiod, |
93 |
& uwindstartdate1, uwindstartdate2, |
94 |
& exf_inscal_uwind, uwind, uwind0, uwind1, uwindmask, |
95 |
& uwind_lon0, uwind_lon_inc, uwind_lat0, uwind_lat_inc, |
96 |
& uwind_nlon, uwind_nlat, |
97 |
& vwindfile, vwindstartdate, vwindperiod, |
98 |
& vwindstartdate1, vwindstartdate2, |
99 |
& exf_inscal_vwind, vwind, vwind0, vwind1, vwindmask, |
100 |
& vwind_lon0, vwind_lon_inc, vwind_lat0, vwind_lat_inc, |
101 |
& vwind_nlon, vwind_nlat, |
102 |
& mycurrenttime, mycurrentiter, mythid ) |
103 |
#else /* ifndef USE_EXF_INTERPOLATION */ |
104 |
call exf_set_gen( |
105 |
& uwindfile, uwindstartdate, uwindperiod, |
106 |
& uwindstartdate1, uwindstartdate2, |
107 |
& exf_inscal_uwind, |
108 |
& uwind, uwind0, uwind1, uwindmask, |
109 |
& mycurrenttime, mycurrentiter, mythid ) |
110 |
call exf_set_gen( |
111 |
& vwindfile, vwindstartdate, vwindperiod, |
112 |
& vwindstartdate1, vwindstartdate2, |
113 |
& exf_inscal_vwind, |
114 |
& vwind, vwind0, vwind1, vwindmask, |
115 |
& mycurrenttime, mycurrentiter, mythid ) |
116 |
#endif /* USE_EXF_INTERPOLATION */ |
117 |
|
118 |
#endif /* ALLOW_ATM_WIND */ |
119 |
|
120 |
c Atmospheric heat flux. |
121 |
call exf_set_gen ( |
122 |
& hfluxfile, hfluxstartdate, hfluxperiod, |
123 |
& hfluxstartdate1, hfluxstartdate2, |
124 |
& exf_inscal_hflux, |
125 |
& hflux, hflux0, hflux1, hfluxmask, |
126 |
#ifdef USE_EXF_INTERPOLATION |
127 |
& hflux_lon0, hflux_lon_inc, hflux_lat0, hflux_lat_inc, |
128 |
& hflux_nlon, hflux_nlat, xC, yC, interp_method, |
129 |
#endif |
130 |
& mycurrenttime, mycurrentiter, mythid ) |
131 |
|
132 |
c Salt flux. |
133 |
call exf_set_gen ( |
134 |
& sfluxfile, sfluxstartdate, sfluxperiod, |
135 |
& sfluxstartdate1, sfluxstartdate2, |
136 |
& exf_inscal_sflux, |
137 |
& sflux, sflux0, sflux1, sfluxmask, |
138 |
#ifdef USE_EXF_INTERPOLATION |
139 |
& sflux_lon0, sflux_lon_inc, sflux_lat0, sflux_lat_inc, |
140 |
& sflux_nlon, sflux_nlat, xC, yC, interp_method, |
141 |
#endif |
142 |
& mycurrenttime, mycurrentiter, mythid ) |
143 |
|
144 |
#ifdef ALLOW_ATM_TEMP |
145 |
|
146 |
c Atmospheric temperature. |
147 |
call exf_set_gen( |
148 |
& atempfile, atempstartdate, atempperiod, |
149 |
& atempstartdate1, atempstartdate2, |
150 |
& exf_inscal_atemp, |
151 |
& atemp, atemp0, atemp1, atempmask, |
152 |
#ifdef USE_EXF_INTERPOLATION |
153 |
& atemp_lon0, atemp_lon_inc, atemp_lat0, atemp_lat_inc, |
154 |
& atemp_nlon, atemp_nlat, xC, yC, interp_method, |
155 |
#endif |
156 |
& mycurrenttime, mycurrentiter, mythid ) |
157 |
do bj = mybylo(mythid),mybyhi(mythid) |
158 |
do bi = mybxlo(mythid),mybxhi(mythid) |
159 |
do j = 1,sny |
160 |
do i = 1,snx |
161 |
atemp(i,j,bi,bj) = atemp(i,j,bi,bj) + exf_offset_atemp |
162 |
enddo |
163 |
enddo |
164 |
enddo |
165 |
enddo |
166 |
|
167 |
c Atmospheric humidity. |
168 |
call exf_set_gen( |
169 |
& aqhfile, aqhstartdate, aqhperiod, |
170 |
& aqhstartdate1, aqhstartdate2, |
171 |
& exf_inscal_aqh, |
172 |
& aqh, aqh0, aqh1, aqhmask, |
173 |
#ifdef USE_EXF_INTERPOLATION |
174 |
& aqh_lon0, aqh_lon_inc, aqh_lat0, aqh_lat_inc, |
175 |
& aqh_nlon, aqh_nlat, xC, yC, interp_method, |
176 |
#endif |
177 |
& mycurrenttime, mycurrentiter, mythid ) |
178 |
|
179 |
c Net long wave radiative flux. |
180 |
call exf_set_gen( |
181 |
& lwfluxfile, lwfluxstartdate, lwfluxperiod, |
182 |
& lwfluxstartdate1, lwfluxstartdate2, |
183 |
& exf_inscal_lwflux, |
184 |
& lwflux, lwflux0, lwflux1, lwfluxmask, |
185 |
#ifdef USE_EXF_INTERPOLATION |
186 |
& lwflux_lon0, lwflux_lon_inc, lwflux_lat0, lwflux_lat_inc, |
187 |
& lwflux_nlon, lwflux_nlat, xC, yC, interp_method, |
188 |
#endif |
189 |
& mycurrenttime, mycurrentiter, mythid ) |
190 |
|
191 |
c Precipitation. |
192 |
call exf_set_gen( |
193 |
& precipfile, precipstartdate, precipperiod, |
194 |
& precipstartdate1, precipstartdate2, |
195 |
& exf_inscal_precip, |
196 |
& precip, precip0, precip1, precipmask, |
197 |
#ifdef USE_EXF_INTERPOLATION |
198 |
& precip_lon0, precip_lon_inc, precip_lat0, precip_lat_inc, |
199 |
& precip_nlon, precip_nlat, xC, yC, interp_method, |
200 |
#endif |
201 |
& mycurrenttime, mycurrentiter, mythid ) |
202 |
|
203 |
#endif /* ALLOW_ATM_TEMP */ |
204 |
|
205 |
#if defined(ALLOW_ATM_TEMP) || defined(SHORTWAVE_HEATING) |
206 |
c Net short wave radiative flux. |
207 |
call exf_set_gen ( |
208 |
& swfluxfile, swfluxstartdate, swfluxperiod, |
209 |
& swfluxstartdate1, swfluxstartdate2, |
210 |
& exf_inscal_swflux, |
211 |
& swflux, swflux0, swflux1, swfluxmask, |
212 |
#ifdef USE_EXF_INTERPOLATION |
213 |
& swflux_lon0, swflux_lon_inc, swflux_lat0, swflux_lat_inc, |
214 |
& swflux_nlon, swflux_nlat, xC, yC, interp_method, |
215 |
#endif |
216 |
& mycurrenttime, mycurrentiter, mythid ) |
217 |
#endif |
218 |
|
219 |
#ifdef EXF_READ_EVAP |
220 |
c Evaporation |
221 |
call exf_set_gen ( |
222 |
& evapfile, evapstartdate, evapperiod, |
223 |
& evapstartdate1, evapstartdate2, |
224 |
& exf_inscal_evap, |
225 |
& evap, evap0, evap1, evapmask, |
226 |
#ifdef USE_EXF_INTERPOLATION |
227 |
& evap_lon0, evap_lon_inc, evap_lat0, evap_lat_inc, |
228 |
& evap_nlon, evap_nlat, xC, yC, interp_method, |
229 |
#endif |
230 |
& mycurrenttime, mycurrentiter, mythid ) |
231 |
#endif |
232 |
|
233 |
#ifdef ALLOW_DOWNWARD_RADIATION |
234 |
|
235 |
c Downward shortwave radiation. |
236 |
call exf_set_gen ( |
237 |
& swdownfile, swdownstartdate, swdownperiod, |
238 |
& swdownstartdate1, swdownstartdate2, |
239 |
& exf_inscal_swdown, |
240 |
& swdown, swdown0, swdown1, swdownmask, |
241 |
#ifdef USE_EXF_INTERPOLATION |
242 |
& swdown_lon0, swdown_lon_inc, swdown_lat0, swdown_lat_inc, |
243 |
& swdown_nlon, swdown_nlat, xC, yC, interp_method, |
244 |
#endif |
245 |
& mycurrenttime, mycurrentiter, mythid ) |
246 |
|
247 |
c Downward longwave radiation. |
248 |
call exf_set_gen ( |
249 |
& lwdownfile, lwdownstartdate, lwdownperiod, |
250 |
& lwdownstartdate1, lwdownstartdate2, |
251 |
& exf_inscal_lwdown, |
252 |
& lwdown, lwdown0, lwdown1, lwdownmask, |
253 |
#ifdef USE_EXF_INTERPOLATION |
254 |
& lwdown_lon0, lwdown_lon_inc, lwdown_lat0, lwdown_lat_inc, |
255 |
& lwdown_nlon, lwdown_nlat, xC, yC, interp_method, |
256 |
#endif |
257 |
& mycurrenttime, mycurrentiter, mythid ) |
258 |
|
259 |
#endif |
260 |
|
261 |
#ifdef ATMOSPHERIC_LOADING |
262 |
c Atmos. pressure forcing |
263 |
call exf_set_gen ( |
264 |
& apressurefile, apressurestartdate, apressureperiod, |
265 |
& apressurestartdate1, apressurestartdate2, |
266 |
& exf_inscal_apressure, |
267 |
& apressure, apressure0, apressure1, apressuremask, |
268 |
#ifdef USE_EXF_INTERPOLATION |
269 |
& apressure_lon0, apressure_lon_inc, apressure_lat0, |
270 |
& apressure_lat_inc, apressure_nlon, apressure_nlat, xC, yC, |
271 |
& interp_method, |
272 |
#endif |
273 |
& mycurrenttime, mycurrentiter, mythid ) |
274 |
#endif |
275 |
|
276 |
c-- Control variables for atmos. state |
277 |
|
278 |
#ifdef ALLOW_ATEMP_CONTROL |
279 |
call ctrl_get_gen ( |
280 |
& xx_atemp_file, xx_atempstartdate, xx_atempperiod, |
281 |
& maskc, atemp, xx_atemp0, xx_atemp1, xx_atemp_dummy, |
282 |
& mycurrenttime, mycurrentiter, mythid ) |
283 |
#endif |
284 |
|
285 |
#ifdef ALLOW_AQH_CONTROL |
286 |
call ctrl_get_gen ( |
287 |
& xx_aqh_file, xx_aqhstartdate, xx_aqhperiod, |
288 |
& maskc, aqh, xx_aqh0, xx_aqh1, xx_aqh_dummy, |
289 |
& mycurrenttime, mycurrentiter, mythid ) |
290 |
#endif |
291 |
|
292 |
#ifdef ALLOW_PRECIP_CONTROL |
293 |
call ctrl_get_gen ( |
294 |
& xx_precip_file, xx_precipstartdate, xx_precipperiod, |
295 |
& maskc, precip, xx_precip0, xx_precip1, xx_precip_dummy, |
296 |
& mycurrenttime, mycurrentiter, mythid ) |
297 |
#endif |
298 |
|
299 |
#ifdef ALLOW_SWFLUX_CONTROL |
300 |
call ctrl_get_gen ( |
301 |
& xx_swflux_file, xx_swfluxstartdate, xx_swfluxperiod, |
302 |
& maskc, swflux, xx_swflux0, xx_swflux1, xx_swflux_dummy, |
303 |
& mycurrenttime, mycurrentiter, mythid ) |
304 |
#endif |
305 |
|
306 |
#ifdef ALLOW_SWDOWN_CONTROL |
307 |
call ctrl_get_gen ( |
308 |
& xx_swdown_file, xx_swdownstartdate, xx_swdownperiod, |
309 |
& maskc, swdown, xx_swdown0, xx_swdown1, xx_swdown_dummy, |
310 |
& mycurrenttime, mycurrentiter, mythid ) |
311 |
#endif |
312 |
|
313 |
#ifdef ALLOW_UWIND_CONTROL |
314 |
call ctrl_get_gen ( |
315 |
& xx_uwind_file, xx_uwindstartdate, xx_uwindperiod, |
316 |
& maskc, uwind, xx_uwind0, xx_uwind1, xx_uwind_dummy, |
317 |
& mycurrenttime, mycurrentiter, mythid ) |
318 |
#endif /* ALLOW_UWIND_CONTROL */ |
319 |
|
320 |
#ifdef ALLOW_VWIND_CONTROL |
321 |
call ctrl_get_gen ( |
322 |
& xx_vwind_file, xx_vwindstartdate, xx_vwindperiod, |
323 |
& maskc, vwind, xx_vwind0, xx_vwind1, xx_vwind_dummy, |
324 |
& mycurrenttime, mycurrentiter, mythid ) |
325 |
#endif /* ALLOW_VWIND_CONTROL */ |
326 |
|
327 |
#ifdef ALLOW_LWFLUX_CONTROL |
328 |
call ctrl_get_gen ( |
329 |
NOT YET IMPLEMENTED |
330 |
& mytime, myiter, mythid ) |
331 |
#endif |
332 |
|
333 |
|
334 |
end |