1 |
c $Header: /u/gcmpack/MITgcm/pkg/exf/exf_readparms.F,v 1.1.4.6 2003/01/30 05:55:54 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_runoff,exf_outscal_apressure, |
104 |
& EXFwindOnBgrid |
105 |
|
106 |
_BEGIN_MASTER(mythid) |
107 |
|
108 |
c Set default values. |
109 |
|
110 |
c Calendar data. |
111 |
hfluxstartdate1 = 0 |
112 |
hfluxstartdate2 = 0 |
113 |
hfluxperiod = 0.0 _d 0 |
114 |
|
115 |
atempstartdate1 = 0 |
116 |
atempstartdate2 = 0 |
117 |
atempperiod = 0.0 _d 0 |
118 |
|
119 |
aqhstartdate1 = 0 |
120 |
aqhstartdate2 = 0 |
121 |
aqhperiod = 0.0 _d 0 |
122 |
|
123 |
sfluxstartdate1 = 0 |
124 |
sfluxstartdate2 = 0 |
125 |
sfluxperiod = 0.0 _d 0 |
126 |
|
127 |
evapstartdate1 = 0 |
128 |
evapstartdate2 = 0 |
129 |
evapperiod = 0.0 _d 0 |
130 |
|
131 |
precipstartdate1 = 0 |
132 |
precipstartdate2 = 0 |
133 |
precipperiod = 0.0 _d 0 |
134 |
|
135 |
runoffstartdate1 = 0 |
136 |
runoffstartdate2 = 0 |
137 |
runoffperiod = 0.0 _d 0 |
138 |
|
139 |
ustressstartdate1 = 0 |
140 |
ustressstartdate2 = 0 |
141 |
ustressperiod = 0.0 _d 0 |
142 |
|
143 |
vstressstartdate1 = 0 |
144 |
vstressstartdate2 = 0 |
145 |
vstressperiod = 0.0 _d 0 |
146 |
|
147 |
uwindstartdate1 = 0 |
148 |
uwindstartdate2 = 0 |
149 |
uwindperiod = 0.0 _d 0 |
150 |
|
151 |
vwindstartdate1 = 0 |
152 |
vwindstartdate2 = 0 |
153 |
vwindperiod = 0.0 _d 0 |
154 |
|
155 |
swfluxstartdate1 = 0 |
156 |
swfluxstartdate2 = 0 |
157 |
swfluxperiod = 0.0 _d 0 |
158 |
|
159 |
lwfluxstartdate1 = 0 |
160 |
lwfluxstartdate2 = 0 |
161 |
lwfluxperiod = 0.0 _d 0 |
162 |
|
163 |
swdownstartdate1 = 0 |
164 |
swdownstartdate2 = 0 |
165 |
swdownperiod = 0.0 _d 0 |
166 |
|
167 |
lwdownstartdate1 = 0 |
168 |
lwdownstartdate2 = 0 |
169 |
lwdownperiod = 0.0 _d 0 |
170 |
|
171 |
obcsNstartdate1 = 0 |
172 |
obcsNstartdate2 = 0 |
173 |
obcsNperiod = 0.0 _d 0 |
174 |
|
175 |
obcsSstartdate1 = 0 |
176 |
obcsSstartdate2 = 0 |
177 |
obcsSperiod = 0.0 _d 0 |
178 |
|
179 |
obcsEstartdate1 = 0 |
180 |
obcsEstartdate2 = 0 |
181 |
obcsEperiod = 0.0 _d 0 |
182 |
|
183 |
obcsWstartdate1 = 0 |
184 |
obcsWstartdate2 = 0 |
185 |
obcsWperiod = 0.0 _d 0 |
186 |
|
187 |
apressurestartdate1 = 0 |
188 |
apressurestartdate2 = 0 |
189 |
apressureperiod = 0.0 _d 0 |
190 |
|
191 |
c Data files. |
192 |
hfluxfile = ' ' |
193 |
atempfile = ' ' |
194 |
aqhfile = ' ' |
195 |
evapfile = ' ' |
196 |
precipfile = ' ' |
197 |
sfluxfile = ' ' |
198 |
runofffile = ' ' |
199 |
ustressfile = ' ' |
200 |
vstressfile = ' ' |
201 |
uwindfile = ' ' |
202 |
vwindfile = ' ' |
203 |
swfluxfile = ' ' |
204 |
lwfluxfile = ' ' |
205 |
swdownfile = ' ' |
206 |
lwdownfile = ' ' |
207 |
apressurefile = ' ' |
208 |
|
209 |
c Initialise the date arrays. |
210 |
do i = 1,4 |
211 |
hfluxstartdate(i) = 0 |
212 |
atempstartdate(i) = 0 |
213 |
aqhstartdate(i) = 0 |
214 |
evapstartdate(i) = 0 |
215 |
precipstartdate(i) = 0 |
216 |
sfluxstartdate(i) = 0 |
217 |
runoffstartdate(i) = 0 |
218 |
ustressstartdate(i) = 0 |
219 |
vstressstartdate(i) = 0 |
220 |
uwindstartdate(i) = 0 |
221 |
vwindstartdate(i) = 0 |
222 |
swfluxstartdate(i) = 0 |
223 |
lwfluxstartdate(i) = 0 |
224 |
swdownstartdate(i) = 0 |
225 |
lwdownstartdate(i) = 0 |
226 |
obcsNstartdate(i) = 0 |
227 |
obcsSstartdate(i) = 0 |
228 |
obcsEstartdate(i) = 0 |
229 |
obcsWstartdate(i) = 0 |
230 |
apressurestartdate(i)= 0 |
231 |
enddo |
232 |
|
233 |
c Initialise file type and field precision |
234 |
exf_iprec = 32 |
235 |
exf_yftype = 'RL' |
236 |
|
237 |
c Input scaling factors. |
238 |
exf_inscal_hfl = 1. _d 0 |
239 |
exf_inscal_ust = 1. _d 0 |
240 |
exf_inscal_vst = 1. _d 0 |
241 |
exf_inscal_swf = 1. _d 0 |
242 |
exf_inscal_sst = 1. _d 0 |
243 |
exf_inscal_sss = 1. _d 0 |
244 |
exf_inscal_apressure = 1. _d 0 |
245 |
exf_inscal_sfl = 1. _d 0 |
246 |
cds convert runoff from m/yr to m/s and change sign. |
247 |
exf_inscal_runoff = -1.0/(86400.*365.0) |
248 |
|
249 |
c Output scaling factors. |
250 |
exf_outscal_hfl = 1. _d 0 |
251 |
exf_outscal_ust = 1. _d 0 |
252 |
exf_outscal_vst = 1. _d 0 |
253 |
exf_outscal_swf = 1. _d 0 |
254 |
exf_outscal_sst = 1. _d 0 |
255 |
exf_outscal_sss = 1. _d 0 |
256 |
exf_outscal_apressure= 1. _d 0 |
257 |
exf_outscal_sfl = 1. _d 0 |
258 |
exf_outscal_runoff = 1. _d 0 |
259 |
c |
260 |
EXFwindOnBgrid = .FALSE. |
261 |
|
262 |
c Check for the availability of the right calendar version. |
263 |
if ( calendarversion .ne. usescalendarversion ) then |
264 |
print*,' exf_readparms: You are not using the appropriate' |
265 |
print*,' version of the calendar package.' |
266 |
print* |
267 |
print*,' You are using Calendar version: ', calendarversion |
268 |
print*,' Please use Calendar version: ', usescalendarversion |
269 |
stop ' stopped in exf_readparms.' |
270 |
endif |
271 |
|
272 |
c Next, read the forcing data file. |
273 |
call nml_filter( 'data.exf', scrunit1, myThid ) |
274 |
if (scrunit1 .eq. 0) then |
275 |
stop 'exf_readparms: reading namelist failed' |
276 |
end if |
277 |
read( scrunit1, nml = exf_nml ) |
278 |
close( scrunit1 ) |
279 |
|
280 |
c Complete the start date specifications for the forcing |
281 |
c fields to get a complete calendar date array. |
282 |
|
283 |
c check for consistency |
284 |
|
285 |
if (.NOT. |
286 |
& (exf_iprec .EQ. 32 .OR. exf_iprec .EQ. 64) |
287 |
& ) then |
288 |
stop 'stop in exf_readparms: value of exf_iprec not allowed' |
289 |
else if (.NOT. |
290 |
& (exf_yftype .EQ. 'RS' .OR. |
291 |
& exf_yftype .EQ. 'RL') |
292 |
& ) then |
293 |
stop 'stop in exf_readparms: value of exf_yftype not allowed' |
294 |
end if |
295 |
|
296 |
#ifdef ALLOW_ATM_WIND |
297 |
call cal_FullDate( uwindstartdate1, uwindstartdate2, |
298 |
& uwindstartdate , mythid ) |
299 |
call cal_FullDate( vwindstartdate1, vwindstartdate2, |
300 |
& vwindstartdate , mythid ) |
301 |
#else |
302 |
call cal_FullDate( ustressstartdate1, ustressstartdate2, |
303 |
& ustressstartdate , mythid ) |
304 |
call cal_FullDate( vstressstartdate1, vstressstartdate2, |
305 |
& vstressstartdate , mythid ) |
306 |
#endif |
307 |
|
308 |
#ifdef ALLOW_ATM_TEMP |
309 |
call cal_FullDate( atempstartdate1, atempstartdate2, |
310 |
& atempstartdate , mythid ) |
311 |
call cal_FullDate( aqhstartdate1, aqhstartdate2, |
312 |
& aqhstartdate , mythid ) |
313 |
call cal_FullDate( lwfluxstartdate1, lwfluxstartdate2, |
314 |
& lwfluxstartdate , mythid ) |
315 |
call cal_FullDate( precipstartdate1, precipstartdate2, |
316 |
& precipstartdate , mythid ) |
317 |
#else |
318 |
call cal_FullDate( hfluxstartdate1, hfluxstartdate2, |
319 |
& hfluxstartdate , mythid ) |
320 |
call cal_FullDate( sfluxstartdate1, sfluxstartdate2, |
321 |
& sfluxstartdate , mythid ) |
322 |
#endif |
323 |
|
324 |
#if defined(ALLOW_ATM_TEMP) || defined(SHORTWAVE_HEATING) |
325 |
call cal_FullDate( swfluxstartdate1, swfluxstartdate2, |
326 |
& swfluxstartdate , mythid ) |
327 |
#endif |
328 |
|
329 |
#ifdef EXF_READ_EVAP |
330 |
call cal_FullDate( evapstartdate1, evapstartdate2, |
331 |
& evapstartdate , mythid ) |
332 |
#endif EXF_READ_EVAP |
333 |
|
334 |
#ifdef ALLOW_RUNOFF |
335 |
call cal_FullDate( runoffstartdate1, runoffstartdate2, |
336 |
& runoffstartdate , mythid ) |
337 |
#endif |
338 |
|
339 |
#ifdef ALLOW_DOWNWARD_RADIATION |
340 |
call cal_FullDate( swdownstartdate1, swdownstartdate2, |
341 |
& swdownstartdate , mythid ) |
342 |
call cal_FullDate( lwdownstartdate1, lwdownstartdate2, |
343 |
& lwdownstartdate , mythid ) |
344 |
#endif |
345 |
|
346 |
#ifdef ALLOW_OBCS |
347 |
#ifdef ALLOW_OBCS_NORTH |
348 |
call cal_FullDate( obcsNstartdate1, obcsNstartdate2, |
349 |
& obcsNstartdate , mythid ) |
350 |
#endif |
351 |
#ifdef ALLOW_OBCS_SOUTH |
352 |
call cal_FullDate( obcsSstartdate1, obcsSstartdate2, |
353 |
& obcsSstartdate , mythid ) |
354 |
#endif |
355 |
#ifdef ALLOW_OBCS_EAST |
356 |
call cal_FullDate( obcsEstartdate1, obcsEstartdate2, |
357 |
& obcsEstartdate , mythid ) |
358 |
#endif |
359 |
#ifdef ALLOW_OBCS_WEST |
360 |
call cal_FullDate( obcsWstartdate1, obcsWstartdate2, |
361 |
& obcsWstartdate , mythid ) |
362 |
#endif |
363 |
#endif /* ALLOW_OBCS */ |
364 |
|
365 |
#ifdef ATMOSPHERIC_LOADING |
366 |
call cal_FullDate(apressurestartdate1,apressurestartdate2, |
367 |
& apressurestartdate , mythid ) |
368 |
#endif |
369 |
|
370 |
_END_MASTER( mythid ) |
371 |
|
372 |
_BARRIER |
373 |
|
374 |
c-- Summarize the External forcing's setup. |
375 |
call exf_summary( mythid ) |
376 |
|
377 |
c-- set climatology parameters |
378 |
call exf_clim_readparms( mythid ) |
379 |
|
380 |
c-- summarize climatologic forcing configuration |
381 |
call exf_clim_summary( mythid ) |
382 |
|
383 |
end |