1 |
C $Header: /u/gcmpack/MITgcm/pkg/exf/exf_getffields.F,v 1.34 2006/12/11 16:19:19 dimitri Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "EXF_OPTIONS.h" |
5 |
|
6 |
subroutine exf_getffields( mytime, myiter, mythid ) |
7 |
|
8 |
c ================================================================== |
9 |
c SUBROUTINE exf_getffields |
10 |
c ================================================================== |
11 |
c |
12 |
c o Read-in atmospheric state and/or surface fluxes from files. |
13 |
c |
14 |
c heimbach@mit.edu, 23-May-2003 totally re-structured |
15 |
c 5-Aug-2003: added USE_EXF_INTERPOLATION for arbitrary input grid |
16 |
c |
17 |
c ================================================================== |
18 |
c SUBROUTINE exf_getffields |
19 |
c ================================================================== |
20 |
|
21 |
implicit none |
22 |
|
23 |
c == global variables == |
24 |
|
25 |
#include "EEPARAMS.h" |
26 |
#include "SIZE.h" |
27 |
#include "PARAMS.h" |
28 |
#include "DYNVARS.h" |
29 |
#include "GRID.h" |
30 |
|
31 |
#include "EXF_PARAM.h" |
32 |
#include "EXF_FIELDS.h" |
33 |
#include "EXF_CONSTANTS.h" |
34 |
|
35 |
#ifdef ALLOW_AUTODIFF |
36 |
# include "ctrl.h" |
37 |
# include "ctrl_dummy.h" |
38 |
#endif |
39 |
|
40 |
c == routine arguments == |
41 |
|
42 |
integer mythid |
43 |
integer myiter |
44 |
_RL mytime |
45 |
|
46 |
c == local variables == |
47 |
|
48 |
integer i, j, bi, bj, interp_method |
49 |
parameter(interp_method=1) |
50 |
|
51 |
c == end of interface == |
52 |
|
53 |
c-- read forcing fields from files and temporal interpolation |
54 |
|
55 |
c Zonal and meridional wind stress. |
56 |
#ifdef USE_EXF_INTERPOLATION |
57 |
call exf_set_uv( |
58 |
& ustressfile, ustressstartdate, ustressperiod, |
59 |
& ustressstartdate1, ustressstartdate2, |
60 |
& exf_inscal_ustress, ustress, ustress0, ustress1, ustressmask, |
61 |
& ustress_lon0, ustress_lon_inc, ustress_lat0, ustress_lat_inc, |
62 |
& ustress_nlon, ustress_nlat, |
63 |
& ustress_exfremo_intercept, ustress_exfremo_slope, |
64 |
& vstressfile, vstressstartdate, vstressperiod, |
65 |
& vstressstartdate1, vstressstartdate2, |
66 |
& exf_inscal_vstress, vstress, vstress0, vstress1, vstressmask, |
67 |
& vstress_lon0, vstress_lon_inc, vstress_lat0, vstress_lat_inc, |
68 |
& vstress_nlon, vstress_nlat, |
69 |
& vstress_exfremo_intercept, vstress_exfremo_slope, |
70 |
& mytime, myiter, mythid ) |
71 |
#else /* ifndef USE_EXF_INTERPOLATION */ |
72 |
call exf_set_gen( |
73 |
& ustressfile, ustressstartdate, ustressperiod, |
74 |
& ustressstartdate1, ustressstartdate2, |
75 |
& exf_inscal_ustress, |
76 |
& ustress_exfremo_intercept, ustress_exfremo_slope, |
77 |
& ustress, ustress0, ustress1, ustressmask, |
78 |
& mytime, myiter, mythid ) |
79 |
call exf_set_gen( |
80 |
& vstressfile, vstressstartdate, vstressperiod, |
81 |
& ustressstartdate1, ustressstartdate2, |
82 |
& exf_inscal_vstress, |
83 |
& vstress_exfremo_intercept, vstress_exfremo_slope, |
84 |
& vstress, vstress0, vstress1, vstressmask, |
85 |
& mytime, myiter, mythid ) |
86 |
#endif /* USE_EXF_INTERPOLATION */ |
87 |
|
88 |
c-- wind speed |
89 |
call exf_set_gen( |
90 |
& wspeedfile, wspeedstartdate, wspeedperiod, |
91 |
& wspeedstartdate1, wspeedstartdate2, |
92 |
& exf_inscal_wspeed, |
93 |
& wspeed_exfremo_intercept, wspeed_exfremo_slope, |
94 |
& wspeed, wspeed0, wspeed1, wspeedmask, |
95 |
#ifdef USE_EXF_INTERPOLATION |
96 |
& wspeed_lon0, wspeed_lon_inc, |
97 |
& wspeed_lat0, wspeed_lat_inc, |
98 |
& wspeed_nlon, wspeed_nlat, xC, yC, interp_method, |
99 |
#endif |
100 |
& mytime, myiter, mythid ) |
101 |
|
102 |
#ifdef ALLOW_ATM_WIND |
103 |
|
104 |
c Zonal and meridional wind. |
105 |
#ifdef USE_EXF_INTERPOLATION |
106 |
call exf_set_uv( |
107 |
& uwindfile, uwindstartdate, uwindperiod, |
108 |
& uwindstartdate1, uwindstartdate2, |
109 |
& exf_inscal_uwind, uwind, uwind0, uwind1, uwindmask, |
110 |
& uwind_lon0, uwind_lon_inc, uwind_lat0, uwind_lat_inc, |
111 |
& uwind_nlon, uwind_nlat, |
112 |
& uwind_exfremo_intercept, uwind_exfremo_slope, |
113 |
& vwindfile, vwindstartdate, vwindperiod, |
114 |
& vwindstartdate1, vwindstartdate2, |
115 |
& exf_inscal_vwind, vwind, vwind0, vwind1, vwindmask, |
116 |
& vwind_lon0, vwind_lon_inc, vwind_lat0, vwind_lat_inc, |
117 |
& vwind_nlon, vwind_nlat, |
118 |
& vwind_exfremo_intercept, vwind_exfremo_slope, |
119 |
& mytime, myiter, mythid ) |
120 |
#else /* ifndef USE_EXF_INTERPOLATION */ |
121 |
call exf_set_gen( |
122 |
& uwindfile, uwindstartdate, uwindperiod, |
123 |
& uwindstartdate1, uwindstartdate2, |
124 |
& exf_inscal_uwind, |
125 |
& uwind_exfremo_intercept, uwind_exfremo_slope, |
126 |
& uwind, uwind0, uwind1, uwindmask, |
127 |
& mytime, myiter, mythid ) |
128 |
call exf_set_gen( |
129 |
& vwindfile, vwindstartdate, vwindperiod, |
130 |
& vwindstartdate1, vwindstartdate2, |
131 |
& exf_inscal_vwind, |
132 |
& vwind_exfremo_intercept, vwind_exfremo_slope, |
133 |
& vwind, vwind0, vwind1, vwindmask, |
134 |
& mytime, myiter, mythid ) |
135 |
#endif /* USE_EXF_INTERPOLATION */ |
136 |
|
137 |
#endif /* ALLOW_ATM_WIND */ |
138 |
|
139 |
c Atmospheric heat flux. |
140 |
call exf_set_gen ( |
141 |
& hfluxfile, hfluxstartdate, hfluxperiod, |
142 |
& hfluxstartdate1, hfluxstartdate2, |
143 |
& exf_inscal_hflux, |
144 |
& hflux_exfremo_intercept, hflux_exfremo_slope, |
145 |
& hflux, hflux0, hflux1, hfluxmask, |
146 |
#ifdef USE_EXF_INTERPOLATION |
147 |
& hflux_lon0, hflux_lon_inc, hflux_lat0, hflux_lat_inc, |
148 |
& hflux_nlon, hflux_nlat, xC, yC, interp_method, |
149 |
#endif |
150 |
& mytime, myiter, mythid ) |
151 |
|
152 |
c Salt flux. |
153 |
call exf_set_gen ( |
154 |
& sfluxfile, sfluxstartdate, sfluxperiod, |
155 |
& sfluxstartdate1, sfluxstartdate2, |
156 |
& exf_inscal_sflux, |
157 |
& sflux_exfremo_intercept, sflux_exfremo_slope, |
158 |
& sflux, sflux0, sflux1, sfluxmask, |
159 |
#ifdef USE_EXF_INTERPOLATION |
160 |
& sflux_lon0, sflux_lon_inc, sflux_lat0, sflux_lat_inc, |
161 |
& sflux_nlon, sflux_nlat, xC, yC, interp_method, |
162 |
#endif |
163 |
& mytime, myiter, mythid ) |
164 |
|
165 |
#ifdef ALLOW_ATM_TEMP |
166 |
|
167 |
c Atmospheric temperature. |
168 |
call exf_set_gen( |
169 |
& atempfile, atempstartdate, atempperiod, |
170 |
& atempstartdate1, atempstartdate2, |
171 |
& exf_inscal_atemp, |
172 |
& atemp_exfremo_intercept, atemp_exfremo_slope, |
173 |
& atemp, atemp0, atemp1, atempmask, |
174 |
#ifdef USE_EXF_INTERPOLATION |
175 |
& atemp_lon0, atemp_lon_inc, atemp_lat0, atemp_lat_inc, |
176 |
& atemp_nlon, atemp_nlat, xC, yC, interp_method, |
177 |
#endif |
178 |
& mytime, myiter, mythid ) |
179 |
do bj = mybylo(mythid),mybyhi(mythid) |
180 |
do bi = mybxlo(mythid),mybxhi(mythid) |
181 |
do j = 1,sny |
182 |
do i = 1,snx |
183 |
atemp(i,j,bi,bj) = atemp(i,j,bi,bj) + exf_offset_atemp |
184 |
enddo |
185 |
enddo |
186 |
enddo |
187 |
enddo |
188 |
|
189 |
c Atmospheric humidity. |
190 |
call exf_set_gen( |
191 |
& aqhfile, aqhstartdate, aqhperiod, |
192 |
& aqhstartdate1, aqhstartdate2, |
193 |
& exf_inscal_aqh, |
194 |
& aqh_exfremo_intercept, aqh_exfremo_slope, |
195 |
& aqh, aqh0, aqh1, aqhmask, |
196 |
#ifdef USE_EXF_INTERPOLATION |
197 |
& aqh_lon0, aqh_lon_inc, aqh_lat0, aqh_lat_inc, |
198 |
& aqh_nlon, aqh_nlat, xC, yC, interp_method, |
199 |
#endif |
200 |
& mytime, myiter, mythid ) |
201 |
|
202 |
c Net long wave radiative flux. |
203 |
call exf_set_gen( |
204 |
& lwfluxfile, lwfluxstartdate, lwfluxperiod, |
205 |
& lwfluxstartdate1, lwfluxstartdate2, |
206 |
& exf_inscal_lwflux, |
207 |
& lwflux_exfremo_intercept, lwflux_exfremo_slope, |
208 |
& lwflux, lwflux0, lwflux1, lwfluxmask, |
209 |
#ifdef USE_EXF_INTERPOLATION |
210 |
& lwflux_lon0, lwflux_lon_inc, lwflux_lat0, lwflux_lat_inc, |
211 |
& lwflux_nlon, lwflux_nlat, xC, yC, interp_method, |
212 |
#endif |
213 |
& mytime, myiter, mythid ) |
214 |
|
215 |
c Precipitation. |
216 |
call exf_set_gen( |
217 |
& precipfile, precipstartdate, precipperiod, |
218 |
& precipstartdate1, precipstartdate2, |
219 |
& exf_inscal_precip, |
220 |
& precip_exfremo_intercept, precip_exfremo_slope, |
221 |
& precip, precip0, precip1, precipmask, |
222 |
#ifdef USE_EXF_INTERPOLATION |
223 |
& precip_lon0, precip_lon_inc, precip_lat0, precip_lat_inc, |
224 |
& precip_nlon, precip_nlat, xC, yC, interp_method, |
225 |
#endif |
226 |
& mytime, myiter, mythid ) |
227 |
|
228 |
c Snow. |
229 |
call exf_set_gen( |
230 |
& snowprecipfile, snowprecipstartdate, snowprecipperiod, |
231 |
& snowprecipstartdate1, snowprecipstartdate2, |
232 |
& exf_inscal_snowprecip, |
233 |
& snowprecip_exfremo_intercept, snowprecip_exfremo_slope, |
234 |
& snowprecip, snowprecip0, snowprecip1, snowprecipmask, |
235 |
#ifdef USE_EXF_INTERPOLATION |
236 |
& snowprecip_lon0, snowprecip_lon_inc, |
237 |
& snowprecip_lat0, snowprecip_lat_inc, |
238 |
& snowprecip_nlon, snowprecip_nlat, xC, yC, interp_method, |
239 |
#endif |
240 |
& mytime, myiter, mythid ) |
241 |
|
242 |
#endif /* ALLOW_ATM_TEMP */ |
243 |
|
244 |
#if defined(ALLOW_ATM_TEMP) || defined(SHORTWAVE_HEATING) |
245 |
c Net short wave radiative flux. |
246 |
call exf_set_gen ( |
247 |
& swfluxfile, swfluxstartdate, swfluxperiod, |
248 |
& swfluxstartdate1, swfluxstartdate2, |
249 |
& exf_inscal_swflux, |
250 |
& swflux_exfremo_intercept, swflux_exfremo_slope, |
251 |
& swflux, swflux0, swflux1, swfluxmask, |
252 |
#ifdef USE_EXF_INTERPOLATION |
253 |
& swflux_lon0, swflux_lon_inc, swflux_lat0, swflux_lat_inc, |
254 |
& swflux_nlon, swflux_nlat, xC, yC, interp_method, |
255 |
#endif |
256 |
& mytime, myiter, mythid ) |
257 |
#endif |
258 |
|
259 |
#ifdef EXF_READ_EVAP |
260 |
c Evaporation |
261 |
call exf_set_gen ( |
262 |
& evapfile, evapstartdate, evapperiod, |
263 |
& evapstartdate1, evapstartdate2, |
264 |
& exf_inscal_evap, |
265 |
& evap_exfremo_intercept, evap_exfremo_slope, |
266 |
& evap, evap0, evap1, evapmask, |
267 |
#ifdef USE_EXF_INTERPOLATION |
268 |
& evap_lon0, evap_lon_inc, evap_lat0, evap_lat_inc, |
269 |
& evap_nlon, evap_nlat, xC, yC, interp_method, |
270 |
#endif |
271 |
& mytime, myiter, mythid ) |
272 |
#endif |
273 |
|
274 |
#ifdef ALLOW_DOWNWARD_RADIATION |
275 |
|
276 |
c Downward shortwave radiation. |
277 |
call exf_set_gen ( |
278 |
& swdownfile, swdownstartdate, swdownperiod, |
279 |
& swdownstartdate1, swdownstartdate2, |
280 |
& exf_inscal_swdown, |
281 |
& swdown_exfremo_intercept, swdown_exfremo_slope, |
282 |
& swdown, swdown0, swdown1, swdownmask, |
283 |
#ifdef USE_EXF_INTERPOLATION |
284 |
& swdown_lon0, swdown_lon_inc, swdown_lat0, swdown_lat_inc, |
285 |
& swdown_nlon, swdown_nlat, xC, yC, interp_method, |
286 |
#endif |
287 |
& mytime, myiter, mythid ) |
288 |
|
289 |
c Downward longwave radiation. |
290 |
call exf_set_gen ( |
291 |
& lwdownfile, lwdownstartdate, lwdownperiod, |
292 |
& lwdownstartdate1, lwdownstartdate2, |
293 |
& exf_inscal_lwdown, |
294 |
& lwdown_exfremo_intercept, lwdown_exfremo_slope, |
295 |
& lwdown, lwdown0, lwdown1, lwdownmask, |
296 |
#ifdef USE_EXF_INTERPOLATION |
297 |
& lwdown_lon0, lwdown_lon_inc, lwdown_lat0, lwdown_lat_inc, |
298 |
& lwdown_nlon, lwdown_nlat, xC, yC, interp_method, |
299 |
#endif |
300 |
& mytime, myiter, mythid ) |
301 |
|
302 |
#endif |
303 |
|
304 |
#ifdef ATMOSPHERIC_LOADING |
305 |
c Atmos. pressure forcing |
306 |
call exf_set_gen ( |
307 |
& apressurefile, apressurestartdate, apressureperiod, |
308 |
& apressurestartdate1, apressurestartdate2, |
309 |
& exf_inscal_apressure, |
310 |
& apressure_exfremo_intercept, apressure_exfremo_slope, |
311 |
& apressure, apressure0, apressure1, apressuremask, |
312 |
#ifdef USE_EXF_INTERPOLATION |
313 |
& apressure_lon0, apressure_lon_inc, apressure_lat0, |
314 |
& apressure_lat_inc, apressure_nlon, apressure_nlat, xC, yC, |
315 |
& interp_method, |
316 |
#endif |
317 |
& mytime, myiter, mythid ) |
318 |
#endif |
319 |
|
320 |
#if (defined (ALLOW_RUNOFF) || defined (ALLOW_SEAICE)) |
321 |
c Runoff |
322 |
call exf_set_gen ( |
323 |
& runofffile, runoffstartdate, runoffperiod, |
324 |
& runoffstartdate1, runoffstartdate2, |
325 |
& exf_inscal_runoff, |
326 |
& runoff_exfremo_intercept, runoff_exfremo_slope, |
327 |
& runoff, runoff0, runoff1, runoffmask, |
328 |
#ifdef USE_EXF_INTERPOLATION |
329 |
& runoff_lon0, runoff_lon_inc, runoff_lat0, |
330 |
& runoff_lat_inc, runoff_nlon, runoff_nlat, xC, yC, |
331 |
& interp_method, |
332 |
#endif |
333 |
& mytime, myiter, mythid ) |
334 |
#endif |
335 |
|
336 |
c-- Control variables for atmos. state |
337 |
|
338 |
#ifdef ALLOW_ATEMP_CONTROL |
339 |
call ctrl_get_gen ( |
340 |
& xx_atemp_file, xx_atempstartdate, xx_atempperiod, |
341 |
& maskc, atemp, xx_atemp0, xx_atemp1, xx_atemp_dummy, |
342 |
& xx_atemp_remo_intercept, xx_atemp_remo_slope, |
343 |
& mytime, myiter, mythid ) |
344 |
#endif |
345 |
|
346 |
#ifdef ALLOW_AQH_CONTROL |
347 |
call ctrl_get_gen ( |
348 |
& xx_aqh_file, xx_aqhstartdate, xx_aqhperiod, |
349 |
& maskc, aqh, xx_aqh0, xx_aqh1, xx_aqh_dummy, |
350 |
& xx_aqh_remo_intercept, xx_aqh_remo_slope, |
351 |
& mytime, myiter, mythid ) |
352 |
#endif |
353 |
|
354 |
#ifdef ALLOW_PRECIP_CONTROL |
355 |
call ctrl_get_gen ( |
356 |
& xx_precip_file, xx_precipstartdate, xx_precipperiod, |
357 |
& maskc, precip, xx_precip0, xx_precip1, xx_precip_dummy, |
358 |
& xx_precip_remo_intercept, xx_precip_remo_slope, |
359 |
& mytime, myiter, mythid ) |
360 |
#endif |
361 |
|
362 |
#ifdef ALLOW_SWFLUX_CONTROL |
363 |
call ctrl_get_gen ( |
364 |
& xx_swflux_file, xx_swfluxstartdate, xx_swfluxperiod, |
365 |
& maskc, swflux, xx_swflux0, xx_swflux1, xx_swflux_dummy, |
366 |
& xx_swflux_remo_intercept, xx_swflux_remo_slope, |
367 |
& mytime, myiter, mythid ) |
368 |
#endif |
369 |
|
370 |
#ifdef ALLOW_SWDOWN_CONTROL |
371 |
call ctrl_get_gen ( |
372 |
& xx_swdown_file, xx_swdownstartdate, xx_swdownperiod, |
373 |
& maskc, swdown, xx_swdown0, xx_swdown1, xx_swdown_dummy, |
374 |
& xx_swdown_remo_intercept, xx_swdown_remo_slope, |
375 |
& mytime, myiter, mythid ) |
376 |
#endif |
377 |
|
378 |
#ifdef ALLOW_LWFLUX_CONTROL |
379 |
call ctrl_get_gen ( |
380 |
& xx_lwflux_file, xx_lwfluxstartdate, xx_lwfluxperiod, |
381 |
& maskc, lwflux, xx_lwflux0, xx_lwflux1, xx_lwflux_dummy, |
382 |
& xx_lwflux_remo_intercept, xx_lwflux_remo_slope, |
383 |
& mytime, myiter, mythid ) |
384 |
#endif |
385 |
|
386 |
#ifdef ALLOW_LWDOWN_CONTROL |
387 |
call ctrl_get_gen ( |
388 |
& xx_lwdown_file, xx_lwdownstartdate, xx_lwdownperiod, |
389 |
& maskc, lwdown, xx_lwdown0, xx_lwdown1, xx_lwdown_dummy, |
390 |
& xx_lwdown_remo_intercept, xx_lwdown_remo_slope, |
391 |
& mytime, myiter, mythid ) |
392 |
#endif |
393 |
|
394 |
#ifdef ALLOW_EVAP_CONTROL |
395 |
call ctrl_get_gen ( |
396 |
& xx_evap_file, xx_evapstartdate, xx_evapperiod, |
397 |
& maskc, evap, xx_evap0, xx_evap1, xx_evap_dummy, |
398 |
& xx_evap_remo_intercept, xx_evap_remo_slope, |
399 |
& mytime, myiter, mythid ) |
400 |
#endif |
401 |
|
402 |
#ifdef ALLOW_SNOWPRECIP_CONTROL |
403 |
call ctrl_get_gen ( |
404 |
& xx_snowprecip_file, xx_snowprecipstartdate, |
405 |
& xx_snowprecipperiod, |
406 |
& maskc, snowprecip, xx_snowprecip0, xx_snowprecip1, |
407 |
& xx_snowprecip_dummy, |
408 |
& xx_snowprecip_remo_intercept, xx_snowprecip_remo_slope, |
409 |
& mytime, myiter, mythid ) |
410 |
#endif |
411 |
|
412 |
#ifdef ALLOW_APRESSURE_CONTROL |
413 |
call ctrl_get_gen ( |
414 |
& xx_apressure_file, xx_apressurestartdate, |
415 |
& xx_apressureperiod, |
416 |
& maskc, apressure, xx_apressure0, xx_apressure1, |
417 |
& xx_apressure_dummy, |
418 |
& xx_apressure_remo_intercept, xx_apressure_remo_slope, |
419 |
& mytime, myiter, mythid ) |
420 |
#endif |
421 |
|
422 |
#ifdef ALLOW_UWIND_CONTROL |
423 |
call ctrl_get_gen ( |
424 |
& xx_uwind_file, xx_uwindstartdate, xx_uwindperiod, |
425 |
& maskc, uwind, xx_uwind0, xx_uwind1, xx_uwind_dummy, |
426 |
& xx_uwind_remo_intercept, xx_uwind_remo_slope, |
427 |
& mytime, myiter, mythid ) |
428 |
#endif /* ALLOW_UWIND_CONTROL */ |
429 |
|
430 |
#ifdef ALLOW_VWIND_CONTROL |
431 |
call ctrl_get_gen ( |
432 |
& xx_vwind_file, xx_vwindstartdate, xx_vwindperiod, |
433 |
& maskc, vwind, xx_vwind0, xx_vwind1, xx_vwind_dummy, |
434 |
& xx_vwind_remo_intercept, xx_vwind_remo_slope, |
435 |
& mytime, myiter, mythid ) |
436 |
#endif /* ALLOW_VWIND_CONTROL */ |
437 |
|
438 |
cdm transferred from exf_init_runoff.F |
439 |
cdm functionality needs to be checked before turning on |
440 |
cdm #ifdef ALLOW_RUNOFF_CONTROL |
441 |
cdm call ctrl_get_gen ( |
442 |
cdm & xx_runoff_file, xx_runoffstartdate, xx_runoffperiod, |
443 |
cdm & maskc, runoff, xx_runoff0, xx_runoff1, xx_runoff_dummy, |
444 |
cdm & xx_runoff_remo_intercept, xx_runoff_remo_slope, |
445 |
cdm & 0., 0., mythid ) |
446 |
cdm #endif |
447 |
|
448 |
end |