1 |
C |
2 |
C $Header: /usr/local/gcmpack/MITgcm/pkg/exf/exf_getffields.F,v 1.21 2003/12/16 23:28:40 dimitri 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 |
51 |
|
52 |
c == end of interface == |
53 |
|
54 |
c-- read forcing fields from files and temporal interpolation |
55 |
|
56 |
c Zonal and meridional wind stress. |
57 |
#ifdef USE_EXF_INTERPOLATION |
58 |
call exf_set_uv( |
59 |
& ustressfile, ustressstartdate, ustressperiod, |
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 |
& vstressfile, vstressstartdate, vstressperiod, |
64 |
& exf_inscal_vstress, vstress, vstress0, vstress1, vstressmask, |
65 |
& vstress_lon0, vstress_lon_inc, vstress_lat0, vstress_lat_inc, |
66 |
& vstress_nlon, vstress_nlat, |
67 |
& mycurrenttime, mycurrentiter, mythid ) |
68 |
#else /* ifndef USE_EXF_INTERPOLATION */ |
69 |
call exf_set_gen( |
70 |
& ustressfile, ustressstartdate, ustressperiod, |
71 |
& exf_inscal_ustress, |
72 |
& ustress, ustress0, ustress1, ustressmask, |
73 |
& mycurrenttime, mycurrentiter, mythid ) |
74 |
call exf_set_gen( |
75 |
& vstressfile, vstressstartdate, vstressperiod, |
76 |
& exf_inscal_vstress, |
77 |
& vstress, vstress0, vstress1, vstressmask, |
78 |
& mycurrenttime, mycurrentiter, mythid ) |
79 |
#endif /* USE_EXF_INTERPOLATION */ |
80 |
|
81 |
#ifdef ALLOW_ATM_WIND |
82 |
|
83 |
c Zonal and meridional wind. |
84 |
#ifdef USE_EXF_INTERPOLATION |
85 |
call exf_set_uv( |
86 |
& uwindfile, uwindstartdate, uwindperiod, |
87 |
& exf_inscal_uwind, uwind, uwind0, uwind1, uwindmask, |
88 |
& uwind_lon0, uwind_lon_inc, uwind_lat0, uwind_lat_inc, |
89 |
& uwind_nlon, uwind_nlat, |
90 |
& vwindfile, vwindstartdate, vwindperiod, |
91 |
& exf_inscal_vwind, vwind, vwind0, vwind1, vwindmask, |
92 |
& vwind_lon0, vwind_lon_inc, vwind_lat0, vwind_lat_inc, |
93 |
& vwind_nlon, vwind_nlat, |
94 |
& mycurrenttime, mycurrentiter, mythid ) |
95 |
#else /* ifndef USE_EXF_INTERPOLATION */ |
96 |
call exf_set_gen( |
97 |
& uwindfile, uwindstartdate, uwindperiod, |
98 |
& exf_inscal_uwind, |
99 |
& uwind, uwind0, uwind1, uwindmask, |
100 |
& mycurrenttime, mycurrentiter, mythid ) |
101 |
call exf_set_gen( |
102 |
& vwindfile, vwindstartdate, vwindperiod, |
103 |
& exf_inscal_vwind, |
104 |
& vwind, vwind0, vwind1, vwindmask, |
105 |
& mycurrenttime, mycurrentiter, mythid ) |
106 |
#endif /* USE_EXF_INTERPOLATION */ |
107 |
|
108 |
#ifdef ALLOW_UWIND_CONTROL |
109 |
call ctrl_get_gen ( |
110 |
& xx_uwind_file, xx_uwindstartdate, xx_uwindperiod, |
111 |
& maskw, uwind, xx_uwind0, xx_uwind1, xx_uwind_dummy, |
112 |
& mycurrenttime, mycurrentiter, mythid ) |
113 |
#endif /* ALLOW_UWIND_CONTROL */ |
114 |
|
115 |
#ifdef ALLOW_VWIND_CONTROL |
116 |
call ctrl_get_gen ( |
117 |
& xx_vwind_file, xx_vwindstartdate, xx_vwindperiod, |
118 |
& masks, vwind, xx_vwind0, xx_vwind1, xx_vwind_dummy, |
119 |
& mycurrenttime, mycurrentiter, mythid ) |
120 |
#endif /* ALLOW_VWIND_CONTROL */ |
121 |
|
122 |
#endif /* ALLOW_ATM_WIND */ |
123 |
|
124 |
c Atmospheric heat flux. |
125 |
call exf_set_gen ( |
126 |
& hfluxfile, hfluxstartdate, hfluxperiod, exf_inscal_hflux, |
127 |
& hflux, hflux0, hflux1, hfluxmask, |
128 |
#ifdef USE_EXF_INTERPOLATION |
129 |
& hflux_lon0, hflux_lon_inc, hflux_lat0, hflux_lat_inc, |
130 |
& hflux_nlon, hflux_nlat, xC, yC, |
131 |
#endif |
132 |
& mycurrenttime, mycurrentiter, mythid ) |
133 |
|
134 |
c Salt flux. |
135 |
call exf_set_gen ( |
136 |
& sfluxfile, sfluxstartdate, sfluxperiod, 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, |
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 |
& exf_inscal_atemp, |
150 |
& atemp, atemp0, atemp1, atempmask, |
151 |
#ifdef USE_EXF_INTERPOLATION |
152 |
& atemp_lon0, atemp_lon_inc, atemp_lat0, atemp_lat_inc, |
153 |
& atemp_nlon, atemp_nlat, xC, yC, |
154 |
#endif |
155 |
& mycurrenttime, mycurrentiter, mythid ) |
156 |
do bj = mybylo(mythid),mybyhi(mythid) |
157 |
do bi = mybxlo(mythid),mybxhi(mythid) |
158 |
do j = 1,sny |
159 |
do i = 1,snx |
160 |
atemp(i,j,bi,bj) = atemp(i,j,bi,bj) + exf_offset_atemp |
161 |
enddo |
162 |
enddo |
163 |
enddo |
164 |
enddo |
165 |
|
166 |
c Atmospheric humidity. |
167 |
call exf_set_gen( |
168 |
& aqhfile, aqhstartdate, aqhperiod, |
169 |
& exf_inscal_aqh, |
170 |
& aqh, aqh0, aqh1, aqhmask, |
171 |
#ifdef USE_EXF_INTERPOLATION |
172 |
& aqh_lon0, aqh_lon_inc, aqh_lat0, aqh_lat_inc, |
173 |
& aqh_nlon, aqh_nlat, xC, yC, |
174 |
#endif |
175 |
& mycurrenttime, mycurrentiter, mythid ) |
176 |
|
177 |
c Net long wave radiative flux. |
178 |
call exf_set_gen( |
179 |
& lwfluxfile, lwfluxstartdate, lwfluxperiod, |
180 |
& exf_inscal_lwflux, |
181 |
& lwflux, lwflux0, lwflux1, lwfluxmask, |
182 |
#ifdef USE_EXF_INTERPOLATION |
183 |
& lwflux_lon0, lwflux_lon_inc, lwflux_lat0, lwflux_lat_inc, |
184 |
& lwflux_nlon, lwflux_nlat, xC, yC, |
185 |
#endif |
186 |
& mycurrenttime, mycurrentiter, mythid ) |
187 |
|
188 |
c Precipitation. |
189 |
call exf_set_gen( |
190 |
& precipfile, precipstartdate, precipperiod, |
191 |
& exf_inscal_precip, |
192 |
& precip, precip0, precip1, precipmask, |
193 |
#ifdef USE_EXF_INTERPOLATION |
194 |
& precip_lon0, precip_lon_inc, precip_lat0, precip_lat_inc, |
195 |
& precip_nlon, precip_nlat, xC, yC, |
196 |
#endif |
197 |
& mycurrenttime, mycurrentiter, mythid ) |
198 |
|
199 |
#ifdef ALLOW_ATEMP_CONTROL |
200 |
call ctrl_get_gen ( |
201 |
& xx_atemp_file, xx_atempstartdate, xx_atempperiod, |
202 |
& maskc, atemp, xx_atemp0, xx_atemp1, xx_atemp_dummy, |
203 |
& mycurrenttime, mycurrentiter, mythid ) |
204 |
#endif |
205 |
|
206 |
#ifdef ALLOW_AQH_CONTROL |
207 |
call ctrl_get_gen ( |
208 |
& xx_aqh_file, xx_aqhstartdate, xx_aqhperiod, |
209 |
& maskc, aqh, xx_aqh0, xx_aqh1, xx_aqh_dummy, |
210 |
& mycurrenttime, mycurrentiter, mythid ) |
211 |
#endif |
212 |
|
213 |
#endif /* ALLOW_ATM_TEMP */ |
214 |
|
215 |
#if defined(ALLOW_ATM_TEMP) || defined(SHORTWAVE_HEATING) |
216 |
c Net short wave radiative flux. |
217 |
call exf_set_gen ( |
218 |
& swfluxfile, swfluxstartdate, swfluxperiod, exf_inscal_swflux, |
219 |
& swflux, swflux0, swflux1, swfluxmask, |
220 |
#ifdef USE_EXF_INTERPOLATION |
221 |
& swflux_lon0, swflux_lon_inc, swflux_lat0, swflux_lat_inc, |
222 |
& swflux_nlon, swflux_nlat, xC, yC, |
223 |
#endif |
224 |
& mycurrenttime, mycurrentiter, mythid ) |
225 |
#endif |
226 |
|
227 |
#ifdef EXF_READ_EVAP |
228 |
c Evaporation |
229 |
call exf_set_gen ( |
230 |
& evapfile, evapstartdate, evapperiod, exf_inscal_evap, |
231 |
& evap, evap0, evap1, evapmask, |
232 |
#ifdef USE_EXF_INTERPOLATION |
233 |
& evap_lon0, evap_lon_inc, evap_lat0, evap_lat_inc, |
234 |
& evap_nlon, evap_nlat, xC, yC, |
235 |
#endif |
236 |
& mycurrenttime, mycurrentiter, mythid ) |
237 |
#endif |
238 |
|
239 |
#ifdef ALLOW_DOWNWARD_RADIATION |
240 |
|
241 |
c Downward shortwave radiation. |
242 |
call exf_set_gen ( |
243 |
& swdownfile, swdownstartdate, swdownperiod, exf_inscal_swdown, |
244 |
& swdown, swdown0, swdown1, swdownmask, |
245 |
#ifdef USE_EXF_INTERPOLATION |
246 |
& swdown_lon0, swdown_lon_inc, swdown_lat0, swdown_lat_inc, |
247 |
& swdown_nlon, swdown_nlat, xC, yC, |
248 |
#endif |
249 |
& mycurrenttime, mycurrentiter, mythid ) |
250 |
|
251 |
c Downward longwave radiation. |
252 |
call exf_set_gen ( |
253 |
& lwdownfile, lwdownstartdate, lwdownperiod, exf_inscal_lwdown, |
254 |
& lwdown, lwdown0, lwdown1, lwdownmask, |
255 |
#ifdef USE_EXF_INTERPOLATION |
256 |
& lwdown_lon0, lwdown_lon_inc, lwdown_lat0, lwdown_lat_inc, |
257 |
& lwdown_nlon, lwdown_nlat, xC, yC, |
258 |
#endif |
259 |
& mycurrenttime, mycurrentiter, mythid ) |
260 |
|
261 |
#endif |
262 |
|
263 |
#ifdef ATMOSPHERIC_LOADING |
264 |
c Atmos. pressure forcing |
265 |
call exf_set_gen ( |
266 |
& apressurefile, apressurestartdate, apressureperiod, |
267 |
& exf_inscal_apressure, |
268 |
& apressure, apressure0, apressure1, apressuremask, |
269 |
#ifdef USE_EXF_INTERPOLATION |
270 |
& apressure_lon0, apressure_lon_inc, apressure_lat0, |
271 |
& apressure_lat_inc, apressure_nlon, apressure_nlat, xC, yC, |
272 |
#endif |
273 |
& mycurrenttime, mycurrentiter, mythid ) |
274 |
#endif |
275 |
|
276 |
end |