1 |
dimitri |
1.9 |
C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_get_forcing.F,v 1.8 2004/12/27 20:34:11 dimitri Exp $ |
2 |
edhill |
1.6 |
C $Name: $ |
3 |
heimbach |
1.2 |
|
4 |
|
|
#include "SEAICE_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CStartOfInterface |
7 |
|
|
SUBROUTINE SEAICE_GET_FORCING( myTime, myIter, myThid ) |
8 |
|
|
C /==========================================================\ |
9 |
|
|
C | SUBROUTINE SEAICE_GET_FORCING | |
10 |
dimitri |
1.4 |
C | o Load atmospheric state and runoff. | |
11 |
heimbach |
1.2 |
C |==========================================================| |
12 |
|
|
C \==========================================================/ |
13 |
|
|
IMPLICIT NONE |
14 |
|
|
|
15 |
|
|
C === Global variables === |
16 |
|
|
#include "SIZE.h" |
17 |
|
|
#include "EEPARAMS.h" |
18 |
|
|
#include "PARAMS.h" |
19 |
|
|
#include "FFIELDS.h" |
20 |
|
|
#include "SEAICE_PARAMS.h" |
21 |
|
|
#include "SEAICE_FFIELDS.h" |
22 |
|
|
|
23 |
|
|
C === Routine arguments === |
24 |
|
|
C myTime - Simulation time |
25 |
|
|
C myIter - Simulation timestep number |
26 |
|
|
C myThid - Thread no. that called this routine. |
27 |
|
|
_RL myTime |
28 |
|
|
INTEGER myIter |
29 |
|
|
INTEGER myThid |
30 |
|
|
CEndOfInterface |
31 |
|
|
|
32 |
|
|
INTEGER ILNBLNK |
33 |
|
|
EXTERNAL ILNBLNK |
34 |
|
|
|
35 |
dimitri |
1.4 |
#ifndef SEAICE_EXTERNAL_FORCING |
36 |
heimbach |
1.2 |
|
37 |
|
|
C === Local arrays === |
38 |
|
|
COMMON /TDFIELDS_FLAGS/ |
39 |
|
|
& wind0_is_first, flux0_is_first, |
40 |
|
|
& SSS0_is_first, SST0_is_first |
41 |
|
|
LOGICAL wind0_is_first, flux0_is_first, |
42 |
|
|
& SSS0_is_first, SST0_is_first |
43 |
|
|
|
44 |
|
|
C === Local variables === |
45 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
46 |
|
|
INTEGER bi,bj,i,j,iRec,iEnd |
47 |
|
|
_RL aWghtWind,bWghtWind,aWghtFlux,bWghtFlux, |
48 |
|
|
& aWghtSSS,bWghtSSS,aWghtSST,bWghtSST |
49 |
|
|
_RS initValue |
50 |
dimitri |
1.5 |
_RL year, seconds, YearTime, four |
51 |
heimbach |
1.2 |
INTEGER CurrentYear, CurrentYear2 |
52 |
|
|
logical done |
53 |
|
|
CHARACTER*(MAX_LEN_MBUF) fName |
54 |
|
|
|
55 |
|
|
C-- Compute CurrentYear and YearTime |
56 |
dimitri |
1.5 |
four = 4.0 |
57 |
heimbach |
1.2 |
YearTime = myTime |
58 |
|
|
done = .false. |
59 |
|
|
do year = StartingYear, EndingYear |
60 |
|
|
if( .not. done ) then |
61 |
dimitri |
1.5 |
if( mod(year,four) .eq. 0. ) then |
62 |
heimbach |
1.2 |
seconds = 366.*24.*60.*60. |
63 |
|
|
else |
64 |
|
|
seconds = 365.*24.*60.*60. |
65 |
|
|
endif |
66 |
|
|
if( YearTime-seconds .ge. 0. ) then |
67 |
|
|
YearTime = YearTime-seconds |
68 |
|
|
else |
69 |
|
|
CurrentYear = year |
70 |
|
|
done = .true. |
71 |
|
|
endif |
72 |
|
|
endif |
73 |
|
|
enddo |
74 |
|
|
if( CurrentYear.ge.2000 ) then |
75 |
|
|
CurrentYear2 = CurrentYear-2000 |
76 |
|
|
else |
77 |
|
|
CurrentYear2 = CurrentYear-1900 |
78 |
|
|
endif |
79 |
|
|
|
80 |
|
|
C-- Check to see whether myTime is outside available forcing data |
81 |
|
|
IF( CurrentYear.gt. EndingYear .or. |
82 |
|
|
& YearTime .lt. WindForcingStart .or. |
83 |
|
|
& YearTime .gt. WindForcingEnd .or. |
84 |
|
|
& YearTime .lt. FluxForcingStart .or. |
85 |
|
|
& YearTime .gt. FluxForcingEnd .or. |
86 |
|
|
& YearTime .lt. SSTforcingStart .or. |
87 |
|
|
& YearTime .gt. SSTforcingEnd .or. |
88 |
|
|
& YearTime .lt. SSSforcingStart .or. |
89 |
|
|
& YearTime .gt. SSSforcingEnd ) THEN |
90 |
|
|
WRITE(msgBuf,'(A)') 'No Available Forcing Data' |
91 |
|
|
CALL PRINT_ERROR( msgBuf , 1) |
92 |
|
|
STOP 'ABNORMAL END: S/R SEAICE_GET_FORCING' |
93 |
|
|
ENDIF |
94 |
|
|
|
95 |
|
|
C-- First call requires that we initialize everything for safety |
96 |
|
|
IF ( myIter .EQ. nIter0 ) THEN |
97 |
dimitri |
1.3 |
initValue = ZERO |
98 |
dimitri |
1.4 |
CALL INIT_ARRAY_RS( uwind0 , initValue, myThid ) |
99 |
|
|
CALL INIT_ARRAY_RS( uwind1 , initValue, myThid ) |
100 |
|
|
CALL INIT_ARRAY_RS( vwind0 , initValue, myThid ) |
101 |
|
|
CALL INIT_ARRAY_RS( vwind1 , initValue, myThid ) |
102 |
dimitri |
1.3 |
initValue = 283. _d 0 |
103 |
dimitri |
1.4 |
CALL INIT_ARRAY_RS( atemp0 , initValue, myThid ) |
104 |
|
|
CALL INIT_ARRAY_RS( atemp1 , initValue, myThid ) |
105 |
dimitri |
1.3 |
initValue = 0.005 _d 0 |
106 |
dimitri |
1.4 |
CALL INIT_ARRAY_RS( aqh0 , initValue, myThid ) |
107 |
|
|
CALL INIT_ARRAY_RS( aqh1 , initValue, myThid ) |
108 |
dimitri |
1.3 |
initValue = 300. _d 0 |
109 |
dimitri |
1.5 |
CALL INIT_ARRAY_RS( lwdown0 , initValue, myThid ) |
110 |
|
|
CALL INIT_ARRAY_RS( lwdown1 , initValue, myThid ) |
111 |
dimitri |
1.3 |
initValue = 200. _d 0 |
112 |
dimitri |
1.5 |
CALL INIT_ARRAY_RS( swdown0 , initValue, myThid ) |
113 |
|
|
CALL INIT_ARRAY_RS( swdown1 , initValue, myThid ) |
114 |
dimitri |
1.3 |
initValue = ZERO |
115 |
dimitri |
1.4 |
CALL INIT_ARRAY_RS( precip0 , initValue, myThid ) |
116 |
|
|
CALL INIT_ARRAY_RS( precip1 , initValue, myThid ) |
117 |
|
|
CALL INIT_ARRAY_RS( evap0 , initValue, myThid ) |
118 |
|
|
CALL INIT_ARRAY_RS( evap1 , initValue, myThid ) |
119 |
|
|
CALL INIT_ARRAY_RS( runoff0 , initValue, myThid ) |
120 |
|
|
CALL INIT_ARRAY_RS( runoff1 , initValue, myThid ) |
121 |
dimitri |
1.3 |
initValue = 35. _d 0 |
122 |
dimitri |
1.4 |
CALL INIT_ARRAY_RS( SSSsi0 , initValue, myThid ) |
123 |
|
|
CALL INIT_ARRAY_RS( SSSsi1 , initValue, myThid ) |
124 |
dimitri |
1.3 |
initValue = 10. _d 0 |
125 |
dimitri |
1.4 |
CALL INIT_ARRAY_RS( SSTsi0 , initValue, myThid ) |
126 |
|
|
CALL INIT_ARRAY_RS( SSTsi1 , initValue, myThid ) |
127 |
heimbach |
1.2 |
|
128 |
|
|
wind0_is_first = .TRUE. |
129 |
|
|
flux0_is_first = .TRUE. |
130 |
|
|
SSS0_is_first = .TRUE. |
131 |
|
|
SST0_is_first = .TRUE. |
132 |
|
|
|
133 |
|
|
_BEGIN_MASTER(myThid) |
134 |
|
|
write(0,*) |
135 |
|
|
& 'S/R SEAICE_GET_FORCING: initialize',myTime,myIter |
136 |
|
|
|
137 |
|
|
iRec = int((YearTime-WindForcingStart)/WindForcingPeriod) + 1 |
138 |
dimitri |
1.4 |
IF ( uwindFile .NE. ' ' ) THEN |
139 |
|
|
iEnd = ILNBLNK( uwindFile ) - 2 |
140 |
|
|
WRITE(fName,'(A,I2.2)') uwindFile(1:iEnd), CurrentYear2 |
141 |
|
|
CALL READ_REC_XY_RS( fName,uwind0,iRec ,myIter,myThid ) |
142 |
|
|
CALL READ_REC_XY_RS( fName,uwind1,iRec+1,myIter,myThid ) |
143 |
|
|
ENDIF |
144 |
|
|
IF ( vwindFile .NE. ' ' ) THEN |
145 |
|
|
iEnd = ILNBLNK( vwindFile ) - 2 |
146 |
|
|
WRITE(fName,'(A,I2.2)') vwindFile(1:iEnd), CurrentYear2 |
147 |
|
|
CALL READ_REC_XY_RS( fName,vwind0,iRec ,myIter,myThid ) |
148 |
|
|
CALL READ_REC_XY_RS( fName,vwind1,iRec+1,myIter,myThid ) |
149 |
heimbach |
1.2 |
ENDIF |
150 |
|
|
|
151 |
|
|
iRec = int((YearTime-FluxForcingStart)/FluxForcingPeriod) + 1 |
152 |
dimitri |
1.4 |
IF ( atempFile .NE. ' ' ) THEN |
153 |
|
|
iEnd = ILNBLNK( atempFile ) - 4 |
154 |
|
|
WRITE(fName,'(A,I4.4)') atempFile(1:iEnd), CurrentYear |
155 |
|
|
CALL READ_REC_XY_RS( fName,atemp0,iRec ,myIter,myThid ) |
156 |
|
|
CALL READ_REC_XY_RS( fName,atemp1,iRec+1,myIter,myThid ) |
157 |
|
|
ENDIF |
158 |
|
|
IF ( aqhFile .NE. ' ' ) THEN |
159 |
|
|
iEnd = ILNBLNK( aqhFile ) - 4 |
160 |
|
|
WRITE(fName,'(A,I4.4)') aqhFile(1:iEnd), CurrentYear |
161 |
|
|
CALL READ_REC_XY_RS( fName,aqh0,iRec ,myIter,myThid ) |
162 |
|
|
CALL READ_REC_XY_RS( fName,aqh1,iRec+1,myIter,myThid ) |
163 |
|
|
ENDIF |
164 |
dimitri |
1.5 |
IF ( lwdownFile .NE. ' ' ) THEN |
165 |
|
|
iEnd = ILNBLNK( lwdownFile ) - 4 |
166 |
|
|
WRITE(fName,'(A,I4.4)') lwdownFile(1:iEnd), CurrentYear |
167 |
|
|
CALL READ_REC_XY_RS( fName,lwdown0,iRec ,myIter,myThid ) |
168 |
|
|
CALL READ_REC_XY_RS( fName,lwdown1,iRec+1,myIter,myThid ) |
169 |
|
|
ENDIF |
170 |
|
|
IF ( swdownFile .NE. ' ' ) THEN |
171 |
|
|
iEnd = ILNBLNK( swdownFile ) - 4 |
172 |
|
|
WRITE(fName,'(A,I4.4)') swdownFile(1:iEnd), CurrentYear |
173 |
|
|
CALL READ_REC_XY_RS( fName,swdown0,iRec ,myIter,myThid ) |
174 |
|
|
CALL READ_REC_XY_RS( fName,swdown1,iRec+1,myIter,myThid ) |
175 |
dimitri |
1.4 |
ENDIF |
176 |
|
|
IF ( precipFile .NE. ' ' ) THEN |
177 |
|
|
iEnd = ILNBLNK( precipFile ) - 4 |
178 |
|
|
WRITE(fName,'(A,I4.4)') precipFile(1:iEnd), CurrentYear |
179 |
|
|
CALL READ_REC_XY_RS( fName,precip0,iRec ,myIter,myThid ) |
180 |
|
|
CALL READ_REC_XY_RS( fName,precip1,iRec+1,myIter,myThid ) |
181 |
heimbach |
1.2 |
ENDIF |
182 |
|
|
IF ( evapFile .NE. ' ' ) THEN |
183 |
|
|
iEnd = ILNBLNK( evapFile ) - 4 |
184 |
|
|
WRITE(fName,'(A,I4.4)') evapFile(1:iEnd), CurrentYear |
185 |
|
|
CALL READ_REC_XY_RS( fName,evap0,iRec ,myIter,myThid ) |
186 |
|
|
CALL READ_REC_XY_RS( fName,evap1,iRec+1,myIter,myThid ) |
187 |
|
|
ENDIF |
188 |
|
|
IF ( runoffFile .NE. ' ' ) THEN |
189 |
|
|
iEnd = ILNBLNK( runoffFile ) - 4 |
190 |
|
|
WRITE(fName,'(A,I4.4)') runoffFile(1:iEnd), CurrentYear |
191 |
|
|
CALL READ_REC_XY_RS( fName,runoff0,iRec ,myIter,myThid ) |
192 |
|
|
CALL READ_REC_XY_RS( fName,runoff1,iRec+1,myIter,myThid ) |
193 |
|
|
ENDIF |
194 |
|
|
|
195 |
|
|
iRec = int((YearTime-SSTforcingStart)/SSTforcingPeriod) + 1 |
196 |
|
|
IF ( thetaClimFile .NE. ' ' ) THEN |
197 |
|
|
iEnd = ILNBLNK( thetaClimFile ) - 2 |
198 |
|
|
WRITE(fName,'(A,I2.2)') thetaClimFile(1:iEnd), CurrentYear2 |
199 |
|
|
CALL READ_REC_XY_RS( fName,SSTsi0,iRec ,myIter,myThid ) |
200 |
|
|
CALL READ_REC_XY_RS( fName,SSTsi1,iRec+1,myIter,myThid ) |
201 |
|
|
ENDIF |
202 |
|
|
|
203 |
|
|
iRec = int((YearTime-SSSforcingStart)/SSSforcingPeriod) + 1 |
204 |
|
|
IF ( saltClimFile .NE. ' ' ) THEN |
205 |
|
|
CALL READ_REC_XY_RS( saltClimFile,SSSsi0,iRec ,myIter,myThid ) |
206 |
|
|
CALL READ_REC_XY_RS( saltClimFile,SSSsi1,iRec+1,myIter,myThid ) |
207 |
|
|
ENDIF |
208 |
|
|
|
209 |
|
|
_END_MASTER(myThid) |
210 |
|
|
|
211 |
dimitri |
1.7 |
CALL EXCH_UV_XY_RS(uwind0, vwind0, .TRUE., myThid) |
212 |
|
|
CALL EXCH_UV_XY_RS(uwind1, vwind1, .TRUE., myThid) |
213 |
dimitri |
1.4 |
_EXCH_XY_R4( atemp0, myThid ) |
214 |
|
|
_EXCH_XY_R4( atemp1, myThid ) |
215 |
|
|
_EXCH_XY_R4( aqh0, myThid ) |
216 |
|
|
_EXCH_XY_R4( aqh1, myThid ) |
217 |
dimitri |
1.5 |
_EXCH_XY_R4( lwdown0, myThid ) |
218 |
|
|
_EXCH_XY_R4( lwdown1, myThid ) |
219 |
|
|
_EXCH_XY_R4( swdown0, myThid ) |
220 |
|
|
_EXCH_XY_R4( swdown1, myThid ) |
221 |
dimitri |
1.4 |
_EXCH_XY_R4( precip0, myThid ) |
222 |
|
|
_EXCH_XY_R4( precip1, myThid ) |
223 |
|
|
_EXCH_XY_R4( evap0, myThid ) |
224 |
|
|
_EXCH_XY_R4( evap1, myThid ) |
225 |
|
|
_EXCH_XY_R4( runoff0, myThid ) |
226 |
|
|
_EXCH_XY_R4( runoff1, myThid ) |
227 |
|
|
_EXCH_XY_R4( SSTsi0, myThid ) |
228 |
|
|
_EXCH_XY_R4( SSTsi1, myThid ) |
229 |
|
|
_EXCH_XY_R4( SSSsi0, myThid ) |
230 |
|
|
_EXCH_XY_R4( SSSsi1, myThid ) |
231 |
heimbach |
1.2 |
|
232 |
|
|
ENDIF |
233 |
|
|
|
234 |
|
|
C-- Now calculate whether if it is time to update wind speed arrays |
235 |
|
|
iRec = int((YearTime-WindForcingStart)/WindForcingPeriod) + 2 |
236 |
|
|
aWghtWind = mod(YearTime-WindForcingStart,WindForcingPeriod) / |
237 |
|
|
& WindForcingPeriod |
238 |
dimitri |
1.3 |
bWghtWind=ONE-aWghtWind |
239 |
heimbach |
1.2 |
IF ( aWghtWind .EQ. 0 ) THEN |
240 |
|
|
_BEGIN_MASTER(myThid) |
241 |
|
|
write(0,*) |
242 |
|
|
& 'S/R SEAICE_GET_FORCING: reading winds',myTime,myIter |
243 |
dimitri |
1.4 |
IF ( uwindFile .NE. ' ' ) THEN |
244 |
|
|
iEnd = ILNBLNK( uwindFile ) - 2 |
245 |
|
|
WRITE(fName,'(A,I2.2)') uwindFile(1:iEnd), CurrentYear2 |
246 |
heimbach |
1.2 |
IF (wind0_is_first) THEN |
247 |
dimitri |
1.4 |
CALL READ_REC_XY_RS( fName,uwind0,iRec,myIter,myThid ) |
248 |
heimbach |
1.2 |
ELSE |
249 |
dimitri |
1.4 |
CALL READ_REC_XY_RS( fName,uwind1,iRec,myIter,myThid ) |
250 |
heimbach |
1.2 |
ENDIF |
251 |
|
|
ENDIF |
252 |
dimitri |
1.4 |
IF ( vwindFile .NE. ' ' ) THEN |
253 |
|
|
iEnd = ILNBLNK( vwindFile ) - 2 |
254 |
|
|
WRITE(fName,'(A,I2.2)') vwindFile(1:iEnd), CurrentYear2 |
255 |
heimbach |
1.2 |
IF (wind0_is_first) THEN |
256 |
dimitri |
1.4 |
CALL READ_REC_XY_RS( fName,vwind0,iRec,myIter,myThid ) |
257 |
heimbach |
1.2 |
ELSE |
258 |
dimitri |
1.4 |
CALL READ_REC_XY_RS( fName,vwind1,iRec,myIter,myThid ) |
259 |
heimbach |
1.2 |
ENDIF |
260 |
|
|
ENDIF |
261 |
|
|
_END_MASTER(myThid) |
262 |
|
|
IF (wind0_is_first) THEN |
263 |
dimitri |
1.7 |
CALL EXCH_UV_XY_RS(uwind0, vwind0, .TRUE., myThid) |
264 |
heimbach |
1.2 |
wind0_is_first=.FALSE. |
265 |
|
|
ELSE |
266 |
dimitri |
1.7 |
CALL EXCH_UV_XY_RS(uwind1, vwind1, .TRUE., myThid) |
267 |
heimbach |
1.2 |
wind0_is_first=.TRUE. |
268 |
|
|
ENDIF |
269 |
|
|
ENDIF |
270 |
|
|
|
271 |
|
|
C-- Now calculate whether if it is time to update heat and freshwater flux |
272 |
|
|
iRec = int((YearTime-FluxForcingStart)/FluxForcingPeriod) + 2 |
273 |
|
|
aWghtFlux = mod(YearTime-FluxForcingStart,FluxForcingPeriod) / |
274 |
|
|
& FluxForcingPeriod |
275 |
dimitri |
1.3 |
bWghtFlux=ONE-aWghtFlux |
276 |
heimbach |
1.2 |
IF ( aWghtFlux .EQ. 0 ) THEN |
277 |
|
|
_BEGIN_MASTER(myThid) |
278 |
|
|
write(0,*) |
279 |
|
|
& 'S/R SEAICE_GET_FORCING: reading fluxes',myTime,myIter |
280 |
dimitri |
1.4 |
IF ( atempFile .NE. ' ' ) THEN |
281 |
|
|
iEnd = ILNBLNK( atempFile ) - 4 |
282 |
|
|
WRITE(fName,'(A,I4.4)') atempFile(1:iEnd), CurrentYear |
283 |
heimbach |
1.2 |
IF (flux0_is_first) THEN |
284 |
dimitri |
1.4 |
CALL READ_REC_XY_RS( fName,atemp0,iRec,myIter,myThid ) |
285 |
heimbach |
1.2 |
ELSE |
286 |
dimitri |
1.4 |
CALL READ_REC_XY_RS( fName,atemp1,iRec,myIter,myThid ) |
287 |
heimbach |
1.2 |
ENDIF |
288 |
|
|
ENDIF |
289 |
dimitri |
1.4 |
IF ( aqhFile .NE. ' ' ) THEN |
290 |
|
|
iEnd = ILNBLNK( aqhFile ) - 4 |
291 |
|
|
WRITE(fName,'(A,I4.4)') aqhFile(1:iEnd), CurrentYear |
292 |
heimbach |
1.2 |
IF (flux0_is_first) THEN |
293 |
dimitri |
1.4 |
CALL READ_REC_XY_RS( fName,aqh0,iRec,myIter,myThid ) |
294 |
heimbach |
1.2 |
ELSE |
295 |
dimitri |
1.4 |
CALL READ_REC_XY_RS( fName,aqh1,iRec,myIter,myThid ) |
296 |
heimbach |
1.2 |
ENDIF |
297 |
|
|
ENDIF |
298 |
dimitri |
1.5 |
IF ( lwdownFile .NE. ' ' ) THEN |
299 |
|
|
iEnd = ILNBLNK( lwdownFile ) - 4 |
300 |
|
|
WRITE(fName,'(A,I4.4)') lwdownFile(1:iEnd), CurrentYear |
301 |
heimbach |
1.2 |
IF (flux0_is_first) THEN |
302 |
dimitri |
1.5 |
CALL READ_REC_XY_RS( fName,lwdown0,iRec,myIter,myThid ) |
303 |
heimbach |
1.2 |
ELSE |
304 |
dimitri |
1.5 |
CALL READ_REC_XY_RS( fName,lwdown1,iRec,myIter,myThid ) |
305 |
heimbach |
1.2 |
ENDIF |
306 |
|
|
ENDIF |
307 |
dimitri |
1.5 |
IF ( swdownFile .NE. ' ' ) THEN |
308 |
|
|
iEnd = ILNBLNK( swdownFile ) - 4 |
309 |
|
|
WRITE(fName,'(A,I4.4)') swdownFile(1:iEnd), CurrentYear |
310 |
heimbach |
1.2 |
IF (flux0_is_first) THEN |
311 |
dimitri |
1.5 |
CALL READ_REC_XY_RS( fName,swdown0,iRec,myIter,myThid ) |
312 |
heimbach |
1.2 |
ELSE |
313 |
dimitri |
1.5 |
CALL READ_REC_XY_RS( fName,swdown1,iRec,myIter,myThid ) |
314 |
heimbach |
1.2 |
ENDIF |
315 |
|
|
ENDIF |
316 |
dimitri |
1.4 |
IF ( precipFile .NE. ' ' ) THEN |
317 |
|
|
iEnd = ILNBLNK( precipFile ) - 4 |
318 |
|
|
WRITE(fName,'(A,I4.4)') precipFile(1:iEnd), CurrentYear |
319 |
heimbach |
1.2 |
IF (flux0_is_first) THEN |
320 |
dimitri |
1.4 |
CALL READ_REC_XY_RS( fName,precip0,iRec,myIter,myThid ) |
321 |
heimbach |
1.2 |
ELSE |
322 |
dimitri |
1.4 |
CALL READ_REC_XY_RS( fName,precip1,iRec,myIter,myThid ) |
323 |
heimbach |
1.2 |
ENDIF |
324 |
|
|
ENDIF |
325 |
|
|
IF ( evapFile .NE. ' ' ) THEN |
326 |
|
|
iEnd = ILNBLNK( evapFile ) - 4 |
327 |
|
|
WRITE(fName,'(A,I4.4)') evapFile(1:iEnd), CurrentYear |
328 |
|
|
IF (flux0_is_first) THEN |
329 |
|
|
CALL READ_REC_XY_RS( fName,evap0,iRec,myIter,myThid ) |
330 |
|
|
ELSE |
331 |
|
|
CALL READ_REC_XY_RS( fName,evap1,iRec,myIter,myThid ) |
332 |
|
|
ENDIF |
333 |
|
|
ENDIF |
334 |
|
|
IF ( runoffFile .NE. ' ' ) THEN |
335 |
|
|
iEnd = ILNBLNK( runoffFile ) - 4 |
336 |
|
|
WRITE(fName,'(A,I4.4)') runoffFile(1:iEnd), CurrentYear |
337 |
|
|
IF (flux0_is_first) THEN |
338 |
|
|
CALL READ_REC_XY_RS( fName,runoff0,iRec,myIter,myThid ) |
339 |
|
|
ELSE |
340 |
|
|
CALL READ_REC_XY_RS( fName,runoff1,iRec,myIter,myThid ) |
341 |
|
|
ENDIF |
342 |
|
|
ENDIF |
343 |
|
|
_END_MASTER(myThid) |
344 |
|
|
IF (flux0_is_first) THEN |
345 |
dimitri |
1.4 |
_EXCH_XY_R4(atemp0, myThid ) |
346 |
|
|
_EXCH_XY_R4(aqh0, myThid ) |
347 |
dimitri |
1.5 |
_EXCH_XY_R4(lwdown0, myThid ) |
348 |
|
|
_EXCH_XY_R4(swdown0, myThid ) |
349 |
dimitri |
1.4 |
_EXCH_XY_R4(precip0, myThid ) |
350 |
|
|
_EXCH_XY_R4(evap0, myThid ) |
351 |
|
|
_EXCH_XY_R4(runoff0, myThid ) |
352 |
heimbach |
1.2 |
flux0_is_first=.FALSE. |
353 |
|
|
ELSE |
354 |
dimitri |
1.4 |
_EXCH_XY_R4(atemp1, myThid ) |
355 |
|
|
_EXCH_XY_R4(aqh1, myThid ) |
356 |
dimitri |
1.5 |
_EXCH_XY_R4(lwdown1, myThid ) |
357 |
|
|
_EXCH_XY_R4(swdown1, myThid ) |
358 |
dimitri |
1.4 |
_EXCH_XY_R4(precip1, myThid ) |
359 |
|
|
_EXCH_XY_R4(evap1, myThid ) |
360 |
|
|
_EXCH_XY_R4(runoff1, myThid ) |
361 |
heimbach |
1.2 |
flux0_is_first=.TRUE. |
362 |
|
|
ENDIF |
363 |
|
|
ENDIF |
364 |
|
|
|
365 |
|
|
C-- Now calculate whether if it is time to update SST array |
366 |
|
|
iRec = int((YearTime-SSTforcingStart)/SSTforcingPeriod) + 2 |
367 |
|
|
aWghtSST = mod(YearTime-SSTforcingStart,SSTforcingPeriod) / |
368 |
|
|
& SSTforcingPeriod |
369 |
dimitri |
1.3 |
bWghtSST=ONE-aWghtSST |
370 |
heimbach |
1.2 |
IF ( aWghtSST .EQ. 0 .AND. thetaClimFile .NE. ' ' ) THEN |
371 |
|
|
_BEGIN_MASTER(myThid) |
372 |
dimitri |
1.3 |
write(0,*) 'S/R SEAICE_GET_FORCING: reading SST',myTime,myIter |
373 |
heimbach |
1.2 |
iEnd = ILNBLNK( thetaClimFile ) - 2 |
374 |
|
|
WRITE(fName,'(A,I2.2)') thetaClimFile(1:iEnd), CurrentYear2 |
375 |
|
|
IF (SST0_is_first) THEN |
376 |
|
|
CALL READ_REC_XY_RS( fName,SSTsi0,iRec,myIter,myThid ) |
377 |
|
|
ELSE |
378 |
|
|
CALL READ_REC_XY_RS( fName,SSTsi1,iRec,myIter,myThid ) |
379 |
|
|
ENDIF |
380 |
|
|
_END_MASTER(myThid) |
381 |
|
|
IF (SST0_is_first) THEN |
382 |
|
|
_EXCH_XY_R4( SSTsi0, myThid ) |
383 |
|
|
SST0_is_first=.FALSE. |
384 |
|
|
ELSE |
385 |
|
|
_EXCH_XY_R4( SSTsi1, myThid ) |
386 |
|
|
SST0_is_first=.TRUE. |
387 |
|
|
ENDIF |
388 |
|
|
ENDIF |
389 |
|
|
|
390 |
|
|
C-- Now calculate whether if it is time to update SSS array |
391 |
|
|
iRec = int((YearTime-SSSforcingStart)/SSSforcingPeriod) + 2 |
392 |
|
|
aWghtSSS = mod(YearTime-SSSforcingStart,SSSforcingPeriod) / |
393 |
|
|
& SSSforcingPeriod |
394 |
dimitri |
1.3 |
bWghtSSS=ONE-aWghtSSS |
395 |
heimbach |
1.2 |
IF ( aWghtSSS .EQ. 0 .AND. saltClimFile .NE. ' ') THEN |
396 |
|
|
_BEGIN_MASTER(myThid) |
397 |
dimitri |
1.3 |
write(0,*) 'S/R SEAICE_GET_FORCING: reading SSS',myTime,myIter |
398 |
heimbach |
1.2 |
IF (SSS0_is_first) THEN |
399 |
|
|
CALL READ_REC_XY_RS( saltClimFile,SSSsi0,iRec,myIter,myThid ) |
400 |
|
|
ELSE |
401 |
|
|
CALL READ_REC_XY_RS( saltClimFile,SSSsi1,iRec,myIter,myThid ) |
402 |
|
|
ENDIF |
403 |
|
|
_END_MASTER(myThid) |
404 |
|
|
IF (SSS0_is_first) THEN |
405 |
|
|
_EXCH_XY_R4( SSSsi0, myThid ) |
406 |
|
|
SSS0_is_first=.FALSE. |
407 |
|
|
ELSE |
408 |
|
|
_EXCH_XY_R4( SSSsi1, myThid ) |
409 |
|
|
SSS0_is_first=.TRUE. |
410 |
|
|
ENDIF |
411 |
|
|
ENDIF |
412 |
|
|
|
413 |
|
|
C-- Time interpolation of wind forcing variables. |
414 |
|
|
IF (wind0_is_first) THEN |
415 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
416 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
417 |
|
|
DO j=1-Oly,sNy+Oly |
418 |
|
|
DO i=1-Olx,sNx+Olx |
419 |
dimitri |
1.4 |
uwind(i,j,bi,bj) = bWghtWind * uwind0(i,j,bi,bj) + |
420 |
|
|
& aWghtWind * uwind1(i,j,bi,bj) |
421 |
|
|
vwind(i,j,bi,bj) = bWghtWind * vwind0(i,j,bi,bj) + |
422 |
|
|
& aWghtWind * vwind1(i,j,bi,bj) |
423 |
heimbach |
1.2 |
ENDDO |
424 |
|
|
ENDDO |
425 |
|
|
ENDDO |
426 |
|
|
ENDDO |
427 |
|
|
ELSE |
428 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
429 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
430 |
|
|
DO j=1-Oly,sNy+Oly |
431 |
|
|
DO i=1-Olx,sNx+Olx |
432 |
dimitri |
1.4 |
uwind(i,j,bi,bj) = aWghtWind * uwind0(i,j,bi,bj) + |
433 |
|
|
& bWghtWind * uwind1(i,j,bi,bj) |
434 |
|
|
vwind(i,j,bi,bj) = aWghtWind * vwind0(i,j,bi,bj) + |
435 |
|
|
& bWghtWind * vwind1(i,j,bi,bj) |
436 |
heimbach |
1.2 |
ENDDO |
437 |
|
|
ENDDO |
438 |
|
|
ENDDO |
439 |
|
|
ENDDO |
440 |
|
|
ENDIF |
441 |
|
|
|
442 |
|
|
C-- Time interpolation of flux forcing variables. |
443 |
|
|
IF (flux0_is_first) THEN |
444 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
445 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
446 |
|
|
DO j=1-Oly,sNy+Oly |
447 |
|
|
DO i=1-Olx,sNx+Olx |
448 |
dimitri |
1.4 |
atemp(i,j,bi,bj) = bWghtFlux * atemp0(i,j,bi,bj) + |
449 |
|
|
& aWghtFlux * atemp1(i,j,bi,bj) |
450 |
|
|
aqh(i,j,bi,bj) = bWghtFlux * aqh0(i,j,bi,bj) + |
451 |
|
|
& aWghtFlux * aqh1(i,j,bi,bj) |
452 |
dimitri |
1.5 |
lwdown(i,j,bi,bj) = bWghtFlux * lwdown0(i,j,bi,bj) + |
453 |
|
|
& aWghtFlux * lwdown1(i,j,bi,bj) |
454 |
|
|
swdown(i,j,bi,bj) = bWghtFlux * swdown0(i,j,bi,bj) + |
455 |
|
|
& aWghtFlux * swdown1(i,j,bi,bj) |
456 |
dimitri |
1.4 |
precip(i,j,bi,bj) = bWghtFlux * precip0(i,j,bi,bj) + |
457 |
|
|
& aWghtFlux * precip1(i,j,bi,bj) |
458 |
|
|
evap(i,j,bi,bj) = bWghtFlux * evap0(i,j,bi,bj) + |
459 |
|
|
& aWghtFlux * evap1(i,j,bi,bj) |
460 |
|
|
runoff(i,j,bi,bj) = bWghtFlux * runoff0(i,j,bi,bj) + |
461 |
|
|
& aWghtFlux * runoff1(i,j,bi,bj) |
462 |
heimbach |
1.2 |
ENDDO |
463 |
|
|
ENDDO |
464 |
|
|
ENDDO |
465 |
|
|
ENDDO |
466 |
|
|
ELSE |
467 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
468 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
469 |
|
|
DO j=1-Oly,sNy+Oly |
470 |
|
|
DO i=1-Olx,sNx+Olx |
471 |
dimitri |
1.4 |
atemp(i,j,bi,bj) = aWghtFlux * atemp0(i,j,bi,bj) + |
472 |
|
|
& bWghtFlux * atemp1(i,j,bi,bj) |
473 |
|
|
aqh(i,j,bi,bj) = aWghtFlux * aqh0(i,j,bi,bj) + |
474 |
|
|
& bWghtFlux * aqh1(i,j,bi,bj) |
475 |
dimitri |
1.5 |
lwdown(i,j,bi,bj) = aWghtFlux * lwdown0(i,j,bi,bj) + |
476 |
|
|
& bWghtFlux * lwdown1(i,j,bi,bj) |
477 |
|
|
swdown(i,j,bi,bj) = aWghtFlux * swdown0(i,j,bi,bj) + |
478 |
|
|
& bWghtFlux * swdown1(i,j,bi,bj) |
479 |
dimitri |
1.4 |
precip(i,j,bi,bj) = aWghtFlux * precip0(i,j,bi,bj) + |
480 |
|
|
& bWghtFlux * precip1(i,j,bi,bj) |
481 |
|
|
evap(i,j,bi,bj) = aWghtFlux * evap0(i,j,bi,bj) + |
482 |
|
|
& bWghtFlux * evap1(i,j,bi,bj) |
483 |
|
|
runoff(i,j,bi,bj) = aWghtFlux * runoff0(i,j,bi,bj) + |
484 |
|
|
& bWghtFlux * runoff1(i,j,bi,bj) |
485 |
heimbach |
1.2 |
ENDDO |
486 |
|
|
ENDDO |
487 |
|
|
ENDDO |
488 |
|
|
ENDDO |
489 |
|
|
ENDIF |
490 |
|
|
|
491 |
|
|
C-- Time interpolation of SSS forcing variables. |
492 |
|
|
IF (SSS0_is_first) THEN |
493 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
494 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
495 |
|
|
DO j=1-Oly,sNy+Oly |
496 |
|
|
DO i=1-Olx,sNx+Olx |
497 |
|
|
SSS(i,j,bi,bj) = bWghtSSS * SSSsi0(i,j,bi,bj) + |
498 |
|
|
& aWghtSSS * SSSsi1(i,j,bi,bj) |
499 |
|
|
ENDDO |
500 |
|
|
ENDDO |
501 |
|
|
ENDDO |
502 |
|
|
ENDDO |
503 |
|
|
ELSE |
504 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
505 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
506 |
|
|
DO j=1-Oly,sNy+Oly |
507 |
|
|
DO i=1-Olx,sNx+Olx |
508 |
|
|
SSS(i,j,bi,bj) = aWghtSSS * SSSsi0(i,j,bi,bj) + |
509 |
|
|
& bWghtSSS * SSSsi1(i,j,bi,bj) |
510 |
|
|
ENDDO |
511 |
|
|
ENDDO |
512 |
|
|
ENDDO |
513 |
|
|
ENDDO |
514 |
|
|
ENDIF |
515 |
|
|
|
516 |
|
|
C-- Time interpolation of SST forcing variables. |
517 |
|
|
IF (SST0_is_first) THEN |
518 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
519 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
520 |
|
|
DO j=1-Oly,sNy+Oly |
521 |
|
|
DO i=1-Olx,sNx+Olx |
522 |
|
|
SST(i,j,bi,bj) = bWghtSST * SSTsi0(i,j,bi,bj) + |
523 |
|
|
& aWghtSST * SSTsi1(i,j,bi,bj) |
524 |
|
|
ENDDO |
525 |
|
|
ENDDO |
526 |
|
|
ENDDO |
527 |
|
|
ENDDO |
528 |
|
|
ELSE |
529 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
530 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
531 |
|
|
DO j=1-Oly,sNy+Oly |
532 |
|
|
DO i=1-Olx,sNx+Olx |
533 |
|
|
SST(i,j,bi,bj) = aWghtSST * SSTsi0(i,j,bi,bj) + |
534 |
|
|
& bWghtSST * SSTsi1(i,j,bi,bj) |
535 |
|
|
ENDDO |
536 |
|
|
ENDDO |
537 |
|
|
ENDDO |
538 |
|
|
ENDDO |
539 |
|
|
ENDIF |
540 |
|
|
|
541 |
dimitri |
1.5 |
#endif /* SEAICE_EXTERNAL_FORCING */ |
542 |
heimbach |
1.2 |
|
543 |
|
|
RETURN |
544 |
|
|
END |
545 |
|
|
|
546 |
|
|
|
547 |
|
|
C======================================================================= |
548 |
|
|
|
549 |
|
|
SUBROUTINE INIT_ARRAY_RS( arr, initValue, myThid ) |
550 |
|
|
C This routine sets the RS array arr to initValue |
551 |
|
|
IMPLICIT NONE |
552 |
|
|
C === Global variables === |
553 |
|
|
#include "SIZE.h" |
554 |
|
|
#include "EEPARAMS.h" |
555 |
|
|
C === Arguments === |
556 |
|
|
_RS arr (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
557 |
|
|
_RS initValue |
558 |
|
|
INTEGER myThid |
559 |
|
|
|
560 |
dimitri |
1.4 |
#ifndef SEAICE_EXTERNAL_FORCING |
561 |
heimbach |
1.2 |
|
562 |
|
|
C === Local variables === |
563 |
|
|
INTEGER i,j,bi,bj |
564 |
|
|
C |
565 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
566 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
567 |
|
|
DO j = 1-Oly,sNy+Oly |
568 |
|
|
DO i = 1-Olx,sNx+Olx |
569 |
|
|
arr(i,j,bi,bj) = initValue |
570 |
|
|
ENDDO |
571 |
|
|
ENDDO |
572 |
|
|
ENDDO |
573 |
|
|
ENDDO |
574 |
|
|
|
575 |
dimitri |
1.5 |
#endif /* SEAICE_EXTERNAL_FORCING */ |
576 |
heimbach |
1.2 |
|
577 |
|
|
RETURN |
578 |
|
|
END |