1 |
c $Header: /u/gcmpack/MITgcm/pkg/exf/exf_readparms.F,v 1.1.4.9 2003/05/01 00:01:16 dimitri Exp $ |
2 |
|
3 |
#include "EXF_CPPOPTIONS.h" |
4 |
#ifdef ALLOW_OBCS |
5 |
# include "OBCS_OPTIONS.h" |
6 |
#endif |
7 |
|
8 |
subroutine exf_readparms( mythid ) |
9 |
|
10 |
c ================================================================== |
11 |
c SUBROUTINE exf_readparms |
12 |
c ================================================================== |
13 |
c |
14 |
c o This routine initialises the package that calculates external |
15 |
c forcing fields for a given timestep of the MITgcmUV. Parameters |
16 |
c for this package are set in "data.externalforcing". Some additional |
17 |
c precompiler switches have to be specified in "EXF_CPPOPTIONS.h". |
18 |
c |
19 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
20 |
c |
21 |
c changed: Christian Eckert eckert@mit.edu 11-Jan-2000 |
22 |
c - Restructured the code in order to create a package |
23 |
c for the MITgcmUV. |
24 |
c Christian Eckert eckert@mit.edu 12-Feb-2000 |
25 |
c - Changed Routine names (package prefix: exf_) |
26 |
c changed: Patrick Heimbach, heimbach@mit.edu 04-May-2000 |
27 |
c - changed the handling of precip and sflux with respect |
28 |
c to CPP options ALLOW_BULKFORMULAE and ALLOW_ATM_TEMP |
29 |
c changed: Ralf.Giering@FastOpt.de 25-Mai-20000 |
30 |
c - moved relaxation and climatology to extra routines |
31 |
c Patrick Heimbach, heimbach@mit.edu 04-May-2000 |
32 |
c - added obcs parameters |
33 |
c changed: Virginie Thierry, vthierry@ucsd.edu 04-June-2001 |
34 |
c - added new obcs parameters (for each boundaries) |
35 |
c included runoff D. Stammer, Nov. 25, 2001 |
36 |
c included pressure forcing. heimbach@mit.edu 05-Nov-2002 |
37 |
c mods for pkg/seaice: menemenlis@jpl.nasa.gov 20-Dec-2002 |
38 |
c |
39 |
c ================================================================== |
40 |
c SUBROUTINE exf_readparms |
41 |
c ================================================================== |
42 |
|
43 |
implicit none |
44 |
|
45 |
c == global variables == |
46 |
|
47 |
#include "EEPARAMS.h" |
48 |
#include "SIZE.h" |
49 |
#include "cal.h" |
50 |
#include "exf.h" |
51 |
#include "exf_param.h" |
52 |
#include "exf_constants.h" |
53 |
|
54 |
c == routine arguments == |
55 |
|
56 |
integer mythid |
57 |
|
58 |
c == local variables == |
59 |
|
60 |
integer i |
61 |
|
62 |
c == external == |
63 |
|
64 |
integer ilnblnk |
65 |
external ilnblnk |
66 |
|
67 |
c == end of interface == |
68 |
|
69 |
c Surface flux data. |
70 |
namelist /exf_nml/ |
71 |
& hfluxstartdate1, hfluxstartdate2, hfluxperiod, |
72 |
& atempstartdate1, atempstartdate2, atempperiod, |
73 |
& aqhstartdate1, aqhstartdate2, aqhperiod, |
74 |
& sfluxstartdate1, sfluxstartdate2, sfluxperiod, |
75 |
& evapstartdate1, evapstartdate2, evapperiod, |
76 |
& precipstartdate1, precipstartdate2, precipperiod, |
77 |
& runoffstartdate1, runoffstartdate2, runoffperiod, |
78 |
& ustressstartdate1, ustressstartdate2, ustressperiod, |
79 |
& vstressstartdate1, vstressstartdate2, vstressperiod, |
80 |
& uwindstartdate1, uwindstartdate2, uwindperiod, |
81 |
& vwindstartdate1, vwindstartdate2, vwindperiod, |
82 |
& swfluxstartdate1, swfluxstartdate2, swfluxperiod, |
83 |
& lwfluxstartdate1, lwfluxstartdate2, lwfluxperiod, |
84 |
& swdownstartdate1, swdownstartdate2, swdownperiod, |
85 |
& lwdownstartdate1, lwdownstartdate2, lwdownperiod, |
86 |
& obcsNstartdate1, obcsNstartdate2, obcsNperiod, |
87 |
& obcsSstartdate1, obcsSstartdate2, obcsSperiod, |
88 |
& obcsEstartdate1, obcsEstartdate2, obcsEperiod, |
89 |
& obcsWstartdate1, obcsWstartdate2, obcsWperiod, |
90 |
&apressurestartdate1,apressurestartdate2,apressureperiod, |
91 |
& hfluxfile, atempfile, aqhfile, |
92 |
& sfluxfile, precipfile, runofffile, |
93 |
& ustressfile, vstressfile, evapfile, |
94 |
& uwindfile, vwindfile, |
95 |
& swfluxfile, lwfluxfile, apressurefile, |
96 |
& swdownfile, lwdownfile, |
97 |
& exf_iprec, exf_yftype, |
98 |
& exf_inscal_hfl, exf_inscal_ust, exf_inscal_vst, |
99 |
& exf_inscal_swf, exf_inscal_sst, exf_inscal_sss, |
100 |
& exf_inscal_sfl, exf_inscal_runoff,exf_inscal_apressure, |
101 |
& exf_outscal_hfl, exf_outscal_ust,exf_outscal_vst, |
102 |
& exf_outscal_swf, exf_outscal_sst,exf_outscal_sss, |
103 |
& exf_outscal_sfl, exf_outscal_apressure, |
104 |
& EXFwindOnBgrid |
105 |
#ifdef USE_EXF_INTERPOLATION |
106 |
& ,ustress_lon0, ustress_lon_inc, |
107 |
& ustress_lat0, ustress_lat_inc, |
108 |
& ustress_nlon, ustress_nlat, |
109 |
& vstress_lon0, vstress_lon_inc, |
110 |
& vstress_lat0, vstress_lat_inc, |
111 |
& vstress_nlon, vstress_nlat, |
112 |
& hflux_lon0, hflux_lon_inc, |
113 |
& hflux_lat0, hflux_lat_inc, |
114 |
& hflux_nlon, hflux_nlat, |
115 |
& sflux_lon0, sflux_lon_inc, |
116 |
& sflux_lat0, sflux_lat_inc, |
117 |
& sflux_nlon, sflux_nlat, |
118 |
& swflux_lon0, swflux_lon_inc, |
119 |
& swflux_lat0, swflux_lat_inc, |
120 |
& swflux_nlon, swflux_nlat, |
121 |
& runoff_lon0, runoff_lon_inc, |
122 |
& runoff_lat0, runoff_lat_inc, |
123 |
& runoff_nlon, runoff_nlat, |
124 |
& atemp_lon0, atemp_lon_inc, |
125 |
& atemp_lat0, atemp_lat_inc, |
126 |
& atemp_nlon, atemp_nlat, |
127 |
& aqh_lon0, aqh_lon_inc, |
128 |
& aqh_lat0, aqh_lat_inc, |
129 |
& aqh_nlon, aqh_nlat, |
130 |
& evap_lon0, evap_lon_inc, |
131 |
& evap_lat0, evap_lat_inc, |
132 |
& evap_nlon, evap_nlat, |
133 |
& precip_lon0, precip_lon_inc, |
134 |
& precip_lat0, precip_lat_inc, |
135 |
& precip_nlon, precip_nlat, |
136 |
& uwind_lon0, uwind_lon_inc, |
137 |
& uwind_lat0, uwind_lat_inc, |
138 |
& uwind_nlon, uwind_nlat, |
139 |
& vwind_lon0, vwind_lon_inc, |
140 |
& vwind_lat0, vwind_lat_inc, |
141 |
& vwind_nlon, vwind_nlat, |
142 |
& lwflux_lon0, lwflux_lon_inc, |
143 |
& lwflux_lat0, lwflux_lat_inc, |
144 |
& lwflux_nlon, lwflux_nlat, |
145 |
& swdown_lon0, swdown_lon_inc, |
146 |
& swdown_lat0, swdown_lat_inc, |
147 |
& swdown_nlon, swdown_nlat, |
148 |
& lwdown_lon0, lwdown_lon_inc, |
149 |
& lwdown_lat0, lwdown_lat_inc, |
150 |
& lwdown_nlon, lwdown_nlat, |
151 |
& apressure_lon0,apressure_lon_inc, |
152 |
& apressure_lat0,apressure_lat_inc, |
153 |
& apressure_nlon,apressure_nlat |
154 |
#endif |
155 |
|
156 |
_BEGIN_MASTER(mythid) |
157 |
|
158 |
c Set default values. |
159 |
|
160 |
c Calendar data. |
161 |
hfluxstartdate1 = 0 |
162 |
hfluxstartdate2 = 0 |
163 |
hfluxperiod = 0.0 _d 0 |
164 |
|
165 |
atempstartdate1 = 0 |
166 |
atempstartdate2 = 0 |
167 |
atempperiod = 0.0 _d 0 |
168 |
|
169 |
aqhstartdate1 = 0 |
170 |
aqhstartdate2 = 0 |
171 |
aqhperiod = 0.0 _d 0 |
172 |
|
173 |
sfluxstartdate1 = 0 |
174 |
sfluxstartdate2 = 0 |
175 |
sfluxperiod = 0.0 _d 0 |
176 |
|
177 |
evapstartdate1 = 0 |
178 |
evapstartdate2 = 0 |
179 |
evapperiod = 0.0 _d 0 |
180 |
|
181 |
precipstartdate1 = 0 |
182 |
precipstartdate2 = 0 |
183 |
precipperiod = 0.0 _d 0 |
184 |
|
185 |
runoffstartdate1 = 0 |
186 |
runoffstartdate2 = 0 |
187 |
runoffperiod = 0.0 _d 0 |
188 |
|
189 |
ustressstartdate1 = 0 |
190 |
ustressstartdate2 = 0 |
191 |
ustressperiod = 0.0 _d 0 |
192 |
|
193 |
vstressstartdate1 = 0 |
194 |
vstressstartdate2 = 0 |
195 |
vstressperiod = 0.0 _d 0 |
196 |
|
197 |
uwindstartdate1 = 0 |
198 |
uwindstartdate2 = 0 |
199 |
uwindperiod = 0.0 _d 0 |
200 |
|
201 |
vwindstartdate1 = 0 |
202 |
vwindstartdate2 = 0 |
203 |
vwindperiod = 0.0 _d 0 |
204 |
|
205 |
swfluxstartdate1 = 0 |
206 |
swfluxstartdate2 = 0 |
207 |
swfluxperiod = 0.0 _d 0 |
208 |
|
209 |
lwfluxstartdate1 = 0 |
210 |
lwfluxstartdate2 = 0 |
211 |
lwfluxperiod = 0.0 _d 0 |
212 |
|
213 |
swdownstartdate1 = 0 |
214 |
swdownstartdate2 = 0 |
215 |
swdownperiod = 0.0 _d 0 |
216 |
|
217 |
lwdownstartdate1 = 0 |
218 |
lwdownstartdate2 = 0 |
219 |
lwdownperiod = 0.0 _d 0 |
220 |
|
221 |
obcsNstartdate1 = 0 |
222 |
obcsNstartdate2 = 0 |
223 |
obcsNperiod = 0.0 _d 0 |
224 |
|
225 |
obcsSstartdate1 = 0 |
226 |
obcsSstartdate2 = 0 |
227 |
obcsSperiod = 0.0 _d 0 |
228 |
|
229 |
obcsEstartdate1 = 0 |
230 |
obcsEstartdate2 = 0 |
231 |
obcsEperiod = 0.0 _d 0 |
232 |
|
233 |
obcsWstartdate1 = 0 |
234 |
obcsWstartdate2 = 0 |
235 |
obcsWperiod = 0.0 _d 0 |
236 |
|
237 |
apressurestartdate1 = 0 |
238 |
apressurestartdate2 = 0 |
239 |
apressureperiod = 0.0 _d 0 |
240 |
|
241 |
c Data files. |
242 |
hfluxfile = ' ' |
243 |
atempfile = ' ' |
244 |
aqhfile = ' ' |
245 |
evapfile = ' ' |
246 |
precipfile = ' ' |
247 |
sfluxfile = ' ' |
248 |
runofffile = ' ' |
249 |
ustressfile = ' ' |
250 |
vstressfile = ' ' |
251 |
uwindfile = ' ' |
252 |
vwindfile = ' ' |
253 |
swfluxfile = ' ' |
254 |
lwfluxfile = ' ' |
255 |
swdownfile = ' ' |
256 |
lwdownfile = ' ' |
257 |
apressurefile = ' ' |
258 |
|
259 |
c Initialise the date arrays. |
260 |
do i = 1,4 |
261 |
hfluxstartdate(i) = 0 |
262 |
atempstartdate(i) = 0 |
263 |
aqhstartdate(i) = 0 |
264 |
evapstartdate(i) = 0 |
265 |
precipstartdate(i) = 0 |
266 |
sfluxstartdate(i) = 0 |
267 |
runoffstartdate(i) = 0 |
268 |
ustressstartdate(i) = 0 |
269 |
vstressstartdate(i) = 0 |
270 |
uwindstartdate(i) = 0 |
271 |
vwindstartdate(i) = 0 |
272 |
swfluxstartdate(i) = 0 |
273 |
lwfluxstartdate(i) = 0 |
274 |
swdownstartdate(i) = 0 |
275 |
lwdownstartdate(i) = 0 |
276 |
obcsNstartdate(i) = 0 |
277 |
obcsSstartdate(i) = 0 |
278 |
obcsEstartdate(i) = 0 |
279 |
obcsWstartdate(i) = 0 |
280 |
apressurestartdate(i)= 0 |
281 |
enddo |
282 |
|
283 |
c Initialise file type and field precision |
284 |
exf_iprec = 32 |
285 |
exf_yftype = 'RL' |
286 |
|
287 |
c Input scaling factors. |
288 |
exf_inscal_hfl = 1. _d 0 |
289 |
exf_inscal_ust = 1. _d 0 |
290 |
exf_inscal_vst = 1. _d 0 |
291 |
exf_inscal_swf = 1. _d 0 |
292 |
exf_inscal_sst = 1. _d 0 |
293 |
exf_inscal_sss = 1. _d 0 |
294 |
exf_inscal_apressure = 1. _d 0 |
295 |
exf_inscal_sfl = 1. _d 0 |
296 |
cds convert runoff from m/yr to m/s and change sign. |
297 |
exf_inscal_runoff = -1.0/(86400.*365.0) |
298 |
|
299 |
c Output scaling factors. |
300 |
exf_outscal_hfl = 1. _d 0 |
301 |
exf_outscal_ust = 1. _d 0 |
302 |
exf_outscal_vst = 1. _d 0 |
303 |
exf_outscal_swf = 1. _d 0 |
304 |
exf_outscal_sst = 1. _d 0 |
305 |
exf_outscal_sss = 1. _d 0 |
306 |
exf_outscal_apressure= 1. _d 0 |
307 |
exf_outscal_sfl = 1. _d 0 |
308 |
c |
309 |
EXFwindOnBgrid = .FALSE. |
310 |
|
311 |
c Check for the availability of the right calendar version. |
312 |
if ( calendarversion .ne. usescalendarversion ) then |
313 |
print*,' exf_readparms: You are not using the appropriate' |
314 |
print*,' version of the calendar package.' |
315 |
print* |
316 |
print*,' You are using Calendar version: ', calendarversion |
317 |
print*,' Please use Calendar version: ', usescalendarversion |
318 |
stop ' stopped in exf_readparms.' |
319 |
endif |
320 |
|
321 |
c Next, read the forcing data file. |
322 |
call nml_filter( 'data.exf', scrunit1, myThid ) |
323 |
if (scrunit1 .eq. 0) then |
324 |
stop 'exf_readparms: reading namelist failed' |
325 |
end if |
326 |
read( scrunit1, nml = exf_nml ) |
327 |
close( scrunit1 ) |
328 |
|
329 |
c Complete the start date specifications for the forcing |
330 |
c fields to get a complete calendar date array. |
331 |
|
332 |
c check for consistency |
333 |
|
334 |
if (.NOT. |
335 |
& (exf_iprec .EQ. 32 .OR. exf_iprec .EQ. 64) |
336 |
& ) then |
337 |
stop 'stop in exf_readparms: value of exf_iprec not allowed' |
338 |
else if (.NOT. |
339 |
& (exf_yftype .EQ. 'RS' .OR. |
340 |
& exf_yftype .EQ. 'RL') |
341 |
& ) then |
342 |
stop 'stop in exf_readparms: value of exf_yftype not allowed' |
343 |
end if |
344 |
|
345 |
#ifdef ALLOW_ATM_WIND |
346 |
call cal_FullDate( uwindstartdate1, uwindstartdate2, |
347 |
& uwindstartdate , mythid ) |
348 |
call cal_FullDate( vwindstartdate1, vwindstartdate2, |
349 |
& vwindstartdate , mythid ) |
350 |
#else |
351 |
call cal_FullDate( ustressstartdate1, ustressstartdate2, |
352 |
& ustressstartdate , mythid ) |
353 |
call cal_FullDate( vstressstartdate1, vstressstartdate2, |
354 |
& vstressstartdate , mythid ) |
355 |
#endif |
356 |
|
357 |
#ifdef ALLOW_ATM_TEMP |
358 |
call cal_FullDate( atempstartdate1, atempstartdate2, |
359 |
& atempstartdate , mythid ) |
360 |
call cal_FullDate( aqhstartdate1, aqhstartdate2, |
361 |
& aqhstartdate , mythid ) |
362 |
call cal_FullDate( lwfluxstartdate1, lwfluxstartdate2, |
363 |
& lwfluxstartdate , mythid ) |
364 |
call cal_FullDate( precipstartdate1, precipstartdate2, |
365 |
& precipstartdate , mythid ) |
366 |
#else |
367 |
call cal_FullDate( hfluxstartdate1, hfluxstartdate2, |
368 |
& hfluxstartdate , mythid ) |
369 |
call cal_FullDate( sfluxstartdate1, sfluxstartdate2, |
370 |
& sfluxstartdate , mythid ) |
371 |
#endif |
372 |
|
373 |
#if defined(ALLOW_ATM_TEMP) || defined(SHORTWAVE_HEATING) |
374 |
call cal_FullDate( swfluxstartdate1, swfluxstartdate2, |
375 |
& swfluxstartdate , mythid ) |
376 |
#endif |
377 |
|
378 |
#ifdef EXF_READ_EVAP |
379 |
call cal_FullDate( evapstartdate1, evapstartdate2, |
380 |
& evapstartdate , mythid ) |
381 |
#endif |
382 |
|
383 |
#ifdef ALLOW_RUNOFF |
384 |
call cal_FullDate( runoffstartdate1, runoffstartdate2, |
385 |
& runoffstartdate , mythid ) |
386 |
#endif |
387 |
|
388 |
#ifdef ALLOW_DOWNWARD_RADIATION |
389 |
call cal_FullDate( swdownstartdate1, swdownstartdate2, |
390 |
& swdownstartdate , mythid ) |
391 |
call cal_FullDate( lwdownstartdate1, lwdownstartdate2, |
392 |
& lwdownstartdate , mythid ) |
393 |
#endif |
394 |
|
395 |
#ifdef ALLOW_OBCS |
396 |
#ifdef ALLOW_OBCS_NORTH |
397 |
call cal_FullDate( obcsNstartdate1, obcsNstartdate2, |
398 |
& obcsNstartdate , mythid ) |
399 |
#endif |
400 |
#ifdef ALLOW_OBCS_SOUTH |
401 |
call cal_FullDate( obcsSstartdate1, obcsSstartdate2, |
402 |
& obcsSstartdate , mythid ) |
403 |
#endif |
404 |
#ifdef ALLOW_OBCS_EAST |
405 |
call cal_FullDate( obcsEstartdate1, obcsEstartdate2, |
406 |
& obcsEstartdate , mythid ) |
407 |
#endif |
408 |
#ifdef ALLOW_OBCS_WEST |
409 |
call cal_FullDate( obcsWstartdate1, obcsWstartdate2, |
410 |
& obcsWstartdate , mythid ) |
411 |
#endif |
412 |
#endif /* ALLOW_OBCS */ |
413 |
|
414 |
#ifdef ATMOSPHERIC_LOADING |
415 |
call cal_FullDate(apressurestartdate1,apressurestartdate2, |
416 |
& apressurestartdate , mythid ) |
417 |
#endif |
418 |
|
419 |
_END_MASTER( mythid ) |
420 |
|
421 |
_BARRIER |
422 |
|
423 |
c-- Summarize the External forcing's setup. |
424 |
call exf_summary( mythid ) |
425 |
|
426 |
c-- set climatology parameters |
427 |
call exf_clim_readparms( mythid ) |
428 |
|
429 |
c-- summarize climatologic forcing configuration |
430 |
call exf_clim_summary( mythid ) |
431 |
|
432 |
end |