1 |
c $Header: /u/gcmpack/MITgcm/pkg/exf/exf_readparms.F,v 1.4 2002/12/19 13:44:51 cheisey 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 added "repeatPeriod" for cycling of forcing datasets 19-Dec-2002 |
38 |
c added option EXF_READ_EVAP. menemenlis@jpl.nasa.gov 20-Dec-2002 |
39 |
c |
40 |
c ================================================================== |
41 |
c SUBROUTINE exf_readparms |
42 |
c ================================================================== |
43 |
|
44 |
implicit none |
45 |
|
46 |
c == global variables == |
47 |
|
48 |
#include "EEPARAMS.h" |
49 |
#include "SIZE.h" |
50 |
#include "cal.h" |
51 |
#include "exf.h" |
52 |
#include "exf_param.h" |
53 |
#include "exf_constants.h" |
54 |
|
55 |
c == routine arguments == |
56 |
|
57 |
integer mythid |
58 |
|
59 |
c == local variables == |
60 |
|
61 |
integer i |
62 |
|
63 |
c == external == |
64 |
|
65 |
integer ilnblnk |
66 |
external ilnblnk |
67 |
|
68 |
c == end of interface == |
69 |
|
70 |
c Surface flux data. |
71 |
namelist /exf_nml/ |
72 |
& repeatPeriod, |
73 |
& hfluxstartdate1, hfluxstartdate2, hfluxperiod, |
74 |
& atempstartdate1, atempstartdate2, atempperiod, |
75 |
& aqhstartdate1, aqhstartdate2, aqhperiod, |
76 |
& sfluxstartdate1, sfluxstartdate2, sfluxperiod, |
77 |
& evapstartdate1, evapstartdate2, evapperiod, |
78 |
& precipstartdate1, precipstartdate2, precipperiod, |
79 |
& runoffstartdate1, runoffstartdate2, runoffperiod, |
80 |
& ustressstartdate1, ustressstartdate2, ustressperiod, |
81 |
& vstressstartdate1, vstressstartdate2, vstressperiod, |
82 |
& uwindstartdate1, uwindstartdate2, uwindperiod, |
83 |
& vwindstartdate1, vwindstartdate2, vwindperiod, |
84 |
& swfluxstartdate1, swfluxstartdate2, swfluxperiod, |
85 |
& lwfluxstartdate1, lwfluxstartdate2, lwfluxperiod, |
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 |
& exf_iprec, exf_yftype, |
97 |
& scal_hfl, scal_ust, scal_vst, |
98 |
& scal_swf, scal_sst, scal_sss, |
99 |
& scal_apressure, scal_sfl |
100 |
|
101 |
_BEGIN_MASTER(mythid) |
102 |
|
103 |
c Set default values. |
104 |
|
105 |
c Calendar data. |
106 |
hfluxstartdate1 = 0 |
107 |
hfluxstartdate2 = 0 |
108 |
hfluxperiod = 0.0 _d 0 |
109 |
|
110 |
atempstartdate1 = 0 |
111 |
atempstartdate2 = 0 |
112 |
atempperiod = 0.0 _d 0 |
113 |
|
114 |
aqhstartdate1 = 0 |
115 |
aqhstartdate2 = 0 |
116 |
aqhperiod = 0.0 _d 0 |
117 |
|
118 |
sfluxstartdate1 = 0 |
119 |
sfluxstartdate2 = 0 |
120 |
sfluxperiod = 0.0 _d 0 |
121 |
|
122 |
evapstartdate1 = 0 |
123 |
evapstartdate2 = 0 |
124 |
evapperiod = 0.0 _d 0 |
125 |
|
126 |
precipstartdate1 = 0 |
127 |
precipstartdate2 = 0 |
128 |
precipperiod = 0.0 _d 0 |
129 |
|
130 |
runoffstartdate1 = 0 |
131 |
runoffstartdate2 = 0 |
132 |
runoffperiod = 0.0 _d 0 |
133 |
|
134 |
ustressstartdate1 = 0 |
135 |
ustressstartdate2 = 0 |
136 |
ustressperiod = 0.0 _d 0 |
137 |
|
138 |
vstressstartdate1 = 0 |
139 |
vstressstartdate2 = 0 |
140 |
vstressperiod = 0.0 _d 0 |
141 |
|
142 |
uwindstartdate1 = 0 |
143 |
uwindstartdate2 = 0 |
144 |
uwindperiod = 0.0 _d 0 |
145 |
|
146 |
vwindstartdate1 = 0 |
147 |
vwindstartdate2 = 0 |
148 |
vwindperiod = 0.0 _d 0 |
149 |
|
150 |
swfluxstartdate1 = 0 |
151 |
swfluxstartdate2 = 0 |
152 |
swfluxperiod = 0.0 _d 0 |
153 |
|
154 |
lwfluxstartdate1 = 0 |
155 |
lwfluxstartdate2 = 0 |
156 |
lwfluxperiod = 0.0 _d 0 |
157 |
|
158 |
obcsNstartdate1 = 0 |
159 |
obcsNstartdate2 = 0 |
160 |
obcsNperiod = 0.0 _d 0 |
161 |
|
162 |
obcsSstartdate1 = 0 |
163 |
obcsSstartdate2 = 0 |
164 |
obcsSperiod = 0.0 _d 0 |
165 |
|
166 |
obcsEstartdate1 = 0 |
167 |
obcsEstartdate2 = 0 |
168 |
obcsEperiod = 0.0 _d 0 |
169 |
|
170 |
obcsWstartdate1 = 0 |
171 |
obcsWstartdate2 = 0 |
172 |
obcsWperiod = 0.0 _d 0 |
173 |
|
174 |
apressurestartdate1 = 0 |
175 |
apressurestartdate2 = 0 |
176 |
apressureperiod = 0.0 _d 0 |
177 |
|
178 |
repeatPeriod = 0.0 _d 0 |
179 |
|
180 |
c Data files. |
181 |
hfluxfile = ' ' |
182 |
atempfile = ' ' |
183 |
aqhfile = ' ' |
184 |
evapfile = ' ' |
185 |
precipfile = ' ' |
186 |
sfluxfile = ' ' |
187 |
runofffile = ' ' |
188 |
ustressfile = ' ' |
189 |
vstressfile = ' ' |
190 |
uwindfile = ' ' |
191 |
vwindfile = ' ' |
192 |
swfluxfile = ' ' |
193 |
lwfluxfile = ' ' |
194 |
apressurefile = ' ' |
195 |
|
196 |
c Initialise the date arrays. |
197 |
do i = 1,4 |
198 |
hfluxstartdate(i) = 0 |
199 |
atempstartdate(i) = 0 |
200 |
aqhstartdate(i) = 0 |
201 |
evapstartdate(i) = 0 |
202 |
precipstartdate(i) = 0 |
203 |
sfluxstartdate(i) = 0 |
204 |
runoffstartdate(i) = 0 |
205 |
ustressstartdate(i) = 0 |
206 |
vstressstartdate(i) = 0 |
207 |
uwindstartdate(i) = 0 |
208 |
vwindstartdate(i) = 0 |
209 |
swfluxstartdate(i) = 0 |
210 |
lwfluxstartdate(i) = 0 |
211 |
obcsNstartdate(i) = 0 |
212 |
obcsSstartdate(i) = 0 |
213 |
obcsEstartdate(i) = 0 |
214 |
obcsWstartdate(i) = 0 |
215 |
apressurestartdate(i)= 0 |
216 |
enddo |
217 |
|
218 |
c Initialise file type and field precision |
219 |
exf_iprec = 32 |
220 |
exf_yftype = 'RL' |
221 |
|
222 |
c scaling between exf units and MITgcm units |
223 |
scal_hfl = 1. _d 0 |
224 |
scal_ust = 1. _d 0 |
225 |
scal_vst = 1. _d 0 |
226 |
scal_swf = 1. _d 0 |
227 |
scal_sst = 1. _d 0 |
228 |
scal_sss = 1. _d 0 |
229 |
scal_apressure = 1. _d 0 |
230 |
scal_sfl = 1. _d 0 |
231 |
|
232 |
c Check for the availability of the right calendar version. |
233 |
if ( calendarversion .ne. usescalendarversion ) then |
234 |
print*,' exf_readparms: You are not using the appropriate' |
235 |
print*,' version of the calendar package.' |
236 |
print* |
237 |
print*,' You are using Calendar version: ', calendarversion |
238 |
print*,' Please use Calendar version: ', usescalendarversion |
239 |
stop ' stopped in exf_readparms.' |
240 |
endif |
241 |
|
242 |
c Next, read the forcing data file. |
243 |
call nml_filter( 'data.exf', scrunit1, myThid ) |
244 |
if (scrunit1 .eq. 0) then |
245 |
stop 'exf_readparms: reading namelist failed' |
246 |
end if |
247 |
read( scrunit1, nml = exf_nml ) |
248 |
close( scrunit1 ) |
249 |
|
250 |
c Complete the start date specifications for the forcing |
251 |
c fields to get a complete calendar date array. |
252 |
|
253 |
c check for consistency |
254 |
|
255 |
if (.NOT. |
256 |
& (exf_iprec .EQ. 32 .OR. exf_iprec .EQ. 64) |
257 |
& ) then |
258 |
stop 'stop in exf_readparms: value of exf_iprec not allowed' |
259 |
else if (.NOT. |
260 |
& (exf_yftype .EQ. 'RS' .OR. |
261 |
& exf_yftype .EQ. 'RL') |
262 |
& ) then |
263 |
stop 'stop in exf_readparms: value of exf_yftype not allowed' |
264 |
end if |
265 |
|
266 |
#ifdef EXF_READ_EVAP |
267 |
call cal_FullDate( evapstartdate1, evapstartdate2, |
268 |
& evapstartdate, mythid ) |
269 |
#endif EXF_READ_EVAP |
270 |
|
271 |
#ifdef ALLOW_RUNOFF |
272 |
call cal_FullDate( runoffstartdate1, runoffstartdate2, |
273 |
& runoffstartdate, mythid ) |
274 |
#endif |
275 |
|
276 |
#ifdef ALLOW_BULKFORMULAE |
277 |
|
278 |
#ifdef ALLOW_ATM_TEMP |
279 |
call cal_FullDate( atempstartdate1, atempstartdate2, |
280 |
& atempstartdate, mythid ) |
281 |
call cal_FullDate( aqhstartdate1, aqhstartdate2, |
282 |
& aqhstartdate, mythid ) |
283 |
call cal_FullDate( swfluxstartdate1, swfluxstartdate2, |
284 |
& swfluxstartdate, mythid ) |
285 |
call cal_FullDate( lwfluxstartdate1, lwfluxstartdate2, |
286 |
& lwfluxstartdate, mythid ) |
287 |
call cal_FullDate( precipstartdate1, precipstartdate2, |
288 |
& precipstartdate, mythid ) |
289 |
#else |
290 |
call cal_FullDate( hfluxstartdate1, hfluxstartdate2, |
291 |
& hfluxstartdate, mythid ) |
292 |
call cal_FullDate( sfluxstartdate1, sfluxstartdate2, |
293 |
& sfluxstartdate, mythid ) |
294 |
#ifdef ALLOW_KPP |
295 |
call cal_FullDate( swfluxstartdate1, swfluxstartdate2, |
296 |
& swfluxstartdate, mythid ) |
297 |
#endif |
298 |
|
299 |
#endif |
300 |
|
301 |
#ifdef ALLOW_ATM_WIND |
302 |
call cal_FullDate( uwindstartdate1, uwindstartdate2, |
303 |
& uwindstartdate, mythid ) |
304 |
call cal_FullDate( vwindstartdate1, vwindstartdate2, |
305 |
& vwindstartdate, mythid ) |
306 |
#else |
307 |
call cal_FullDate( ustressstartdate1, ustressstartdate2, |
308 |
& ustressstartdate, mythid ) |
309 |
call cal_FullDate( vstressstartdate1, vstressstartdate2, |
310 |
& vstressstartdate, mythid ) |
311 |
#endif |
312 |
|
313 |
#else |
314 |
call cal_FullDate( hfluxstartdate1, hfluxstartdate2, |
315 |
& hfluxstartdate, mythid ) |
316 |
call cal_FullDate( sfluxstartdate1, sfluxstartdate2, |
317 |
& sfluxstartdate, mythid ) |
318 |
call cal_FullDate( ustressstartdate1, ustressstartdate2, |
319 |
& ustressstartdate, mythid ) |
320 |
call cal_FullDate( vstressstartdate1, vstressstartdate2, |
321 |
& vstressstartdate, mythid ) |
322 |
#ifdef ALLOW_KPP |
323 |
call cal_FullDate( swfluxstartdate1, swfluxstartdate2, |
324 |
& swfluxstartdate, mythid ) |
325 |
#endif |
326 |
|
327 |
#endif |
328 |
|
329 |
#ifdef ALLOW_OBCS |
330 |
#ifdef ALLOW_OBCS_NORTH |
331 |
call cal_FullDate( obcsNstartdate1, obcsNstartdate2, |
332 |
& obcsNstartdate, mythid ) |
333 |
#endif |
334 |
#ifdef ALLOW_OBCS_SOUTH |
335 |
call cal_FullDate( obcsSstartdate1, obcsSstartdate2, |
336 |
& obcsSstartdate, mythid ) |
337 |
#endif |
338 |
#ifdef ALLOW_OBCS_EAST |
339 |
call cal_FullDate( obcsEstartdate1, obcsEstartdate2, |
340 |
& obcsEstartdate, mythid ) |
341 |
#endif |
342 |
#ifdef ALLOW_OBCS_WEST |
343 |
call cal_FullDate( obcsWstartdate1, obcsWstartdate2, |
344 |
& obcsWstartdate, mythid ) |
345 |
#endif |
346 |
#endif |
347 |
|
348 |
#ifdef ATMOSPHERIC_LOADING |
349 |
call cal_FullDate( apressurestartdate1, apressurestartdate2, |
350 |
& apressurestartdate, mythid ) |
351 |
#endif |
352 |
|
353 |
_END_MASTER( mythid ) |
354 |
|
355 |
_BARRIER |
356 |
|
357 |
c-- Summarize the External forcing's setup. |
358 |
call exf_summary( mythid ) |
359 |
|
360 |
|
361 |
c-- set climatology parameters |
362 |
call exf_clim_readparms( mythid ) |
363 |
|
364 |
c-- summarize climatologic forcing configuration |
365 |
call exf_clim_summary( mythid ) |
366 |
|
367 |
end |