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