/[MITgcm]/MITgcm/pkg/atm2d/init_atm2d.F
ViewVC logotype

Contents of /MITgcm/pkg/atm2d/init_atm2d.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download)
Mon Oct 8 23:48:28 2007 UTC (16 years, 8 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint59i, checkpoint59j
Changes since 1.4: +20 -17 lines
add missing cvs $Header:$ or $Name:$

1 C $Header: $
2 C $Name: $
3
4 #include "ctrparam.h"
5 #include "ATM2D_OPTIONS.h"
6
7 C !INTERFACE:
8 SUBROUTINE INIT_ATM2D(dtatm, dtocn, dtcouple, myThid )
9 C *==========================================================*
10 C | INIT_1DTO2D |
11 C | This initialization routine should be run after the |
12 c | the ocean grid/pickup have been read in. |
13 c | |
14 c | Note: grid variable indices bi,bj are hard-coded 1,1 |
15 c | This should work if coupler or atmos/coupler on one |
16 c | machine. |
17 c | |
18 C *==========================================================*
19 c
20 IMPLICIT NONE
21
22 C === Global Atmosphere Variables ===
23 #include "ATMSIZE.h"
24 #include "AGRID.h"
25
26 C === Global Ocean Variables ===
27 #include "SIZE.h"
28 #include "EEPARAMS.h"
29 #include "PARAMS.h"
30 #include "GRID.h"
31
32 C === Global SeaIce Parameters ===
33 #include "THSICE_PARAMS.h"
34
35 C === Atmos/Ocean/Seaice Interface Variables ===
36 #include "ATM2D_VARS.h"
37
38
39 C !INPUT/OUTPUT PARAMETERS:
40 C === Routine arguments ===
41 C dtatm, dtocn, dtcouple - Timesteps from couple.nml (hours)
42 C myThid - Thread no. that called this routine.
43 INTEGER dtatm, dtocn, dtcouple
44 INTEGER myThid
45
46 C LOCAL VARIABLES:
47 INTEGER i,j,jj
48 INTEGER ib, ibj1, ibj2 ! runoff band loop counters
49 INTEGER j_atm, mn
50 INTEGER dUnit
51 _RL end1, end2, enda1, enda2, enda3 !used to compute grid conv areas
52 _RL totrun_b(sNy) ! total file "runoff" in runoff bands
53 _RL a1,a2
54 _RS atm_dyG(jm0) ! southern point/(boundary) of atmos grid
55 DATA atm_dyG/2.0,44*4.0,2.0/ ! grid spacing for atmosphere
56
57 dtatmo = dtatm * 3600.
58 dtocno = dtocn * 3600.
59 dtcouplo= dtcouple * 3600.
60
61 C override data.ice seaice time step parms
62 C these will need to change if coupling procedure changed
63 thSice_deltaT = dtcouplo
64 thsIce_dtTemp = dtatmo
65 ocean_deltaT = dtcouplo
66
67 CJRS This next check - only kill it if not MPI?
68 IF (dtocno.NE.dTtracerLev(1)) THEN
69 PRINT *,'Ocean tracer timestep differs between coupler '
70 PRINT *,'and the ocean data file'
71 STOP
72 ENDIF
73
74 c Assuming the atmospheric grid array not passed, do this:
75 atm_yG(1)=-90.0
76 DO j_atm=2,jm0
77 atm_yG(j_atm)=atm_yG(j_atm-1)+atm_dyG(j_atm-1)
78 atm_yC(j_atm-1)=(atm_yG(j_atm-1)+atm_yG(j_atm))/2.0
79 ENDDO
80 atm_yC(jm0)=atm_yG(jm0)+atm_dyG(jm0)/2.0
81
82 c end atmos grid initialization
83
84 atm_oc_ind(1)=2
85 atm_oc_wgt(1)=1. _d 0
86 atm_oc_frac1(1)= (sin(yG(1,2,1,1)*deg2rad) -
87 & sin(yG(1,1,1,1)*deg2rad))/
88 & (sin(atm_yG(3)*deg2rad)-sin(atm_yG(1)*deg2rad))
89 atm_oc_frac2(1)= 0. _d 0 ! assumes ocean(1) fits in atm(1)
90 atm_oc_ind(sNy)=jm0-1
91 atm_oc_wgt(sNy)=1. _d 0
92 atm_oc_frac1(sNy)= (sin((yG(1,sNy,1,1) +
93 & dyG(1,sNy,1,1)/6.37D6/deg2rad)*deg2rad)-
94 & sin(yG(1,sNy,1,1)*deg2rad))/
95 & (sin((atm_yG(jm0)+atm_dyG(jm0))*deg2rad)-
96 & sin(atm_yG(jm0-1)*deg2rad))
97 atm_oc_frac2(sNy)= 0. _d 0 ! assumes ocean(1) fits in atm(1)
98
99 endwgt1 = sin(atm_yG(2)*deg2rad) !hard-coded that the atmos
100 endwgt2 = sin(atm_yG(3)*deg2rad) - endwgt1 !grid is same in NH and SH
101 endwgt1 = endwgt1 + 1. _d 0 !and goes 90S to 90N
102 rsumwgt = 1. _d 0/(endwgt1 + endwgt2)
103
104 atm_yG(2)=atm_yG(1) ! grid now combined atm end points
105 atm_yG(jm0)=90. _d 0
106
107 DO j=2, sNy-1
108
109 DO jj=2,jm0-1
110 IF ((yG(1,j,1,1).GE.atm_yG(jj)).AND.
111 & (yG(1,j,1,1).LT.atm_yG(jj+1))) j_atm=jj
112 ENDDO
113
114 atm_oc_ind(j)=j_atm
115 end1= sin(yG(1,j,1,1) *deg2rad)
116 end2= sin(yG(1,j+1,1,1) *deg2rad)
117 enda1 = sin(atm_yG(j_atm) *deg2rad)
118 enda2 = sin(atm_yG(j_atm+1) *deg2rad)
119 IF ( yG(1,j+1,1,1) .GT. atm_yG(j_atm+1) ) THEN
120 enda3 = sin(atm_yG(j_atm+2) *deg2rad)
121 atm_oc_wgt(j)=(enda2-end1)/ (end2-end1)
122 atm_oc_frac1(j)= (enda2-end1) / (enda2 - enda1)
123 atm_oc_frac2(j)= (end2 - enda2) / (enda3 - enda2)
124 ELSE
125 atm_oc_wgt(j)=1. _d 0
126 atm_oc_frac1(j)= (end2-end1)/ (enda2-enda1)
127 atm_oc_frac2(j)=0. _d 0
128 ENDIF
129 ENDDO
130 c
131 c find land fraction
132 c
133 DO j_atm=1,jm0
134 cflan(j_atm)=0. _d 0
135 ocnArea(j_atm)=0. _d 0
136 ENDDO
137
138 DO j=1,sNy
139 DO i=1,sNx
140 IF (maskC(i,j,1,1,1).EQ.1.) THEN
141 ocnArea(atm_oc_ind(j))=ocnArea(atm_oc_ind(j)) +
142 & rA(i,j,1,1)*atm_oc_wgt(j)
143 IF (atm_oc_wgt(j).LT.1.d0) THEN
144 ocnArea(atm_oc_ind(j)+1)=ocnArea(atm_oc_ind(j)+1) +
145 & rA(i,j,1,1)*(1.d0-atm_oc_wgt(j))
146 ENDIF
147 ENDIF
148 ENDDO
149 ENDDO
150
151 DO j_atm=3,jm0-2
152 cflan(j_atm)=1. _d 0 - ocnArea(j_atm) /
153 & (2. _d 0 * PI * 6.37 _d 6 * 6.37 _d 6 *
154 & (sin(atm_yG(j_atm+1)*deg2rad) - sin(atm_yG(j_atm)*deg2rad)))
155 if (cflan(j_atm).LT.1. _d -14) cflan(j_atm)=0. _d 0
156 ENDDO
157
158 C deal with the combined atmos grid end cells...
159 cflan(2)= 1. _d 0 - ocnArea(2) /
160 & (2. _d 0*PI*6.37 _d 6*6.37 _d 6*
161 & (sin(atm_yG(3)*deg2rad)+1. _d 0))
162 IF (cflan(2).LT.1. _d -14) cflan(2)=0. _d 0
163 cflan(1)=cflan(2)
164 cflan(jm0-1)= 1.d0 - ocnArea(jm0-1) /
165 & (2. _d 0*PI*6.37 _d 6*6.37 _d 6*
166 & (1. _d 0-sin(atm_yG(jm0-1)*deg2rad)))
167 IF (cflan(jm0-1).LT.1. _d -14) cflan(jm0-1)=0. _d 0
168 cflan(jm0)=cflan(jm0-1)
169
170 PRINT *,'Land fractions on atmospheric grid: '
171 PRINT *, cflan
172 PRINT *,'Lookup grid index, weights:'
173 PRINT *, atm_oc_ind,atm_oc_wgt
174 C PRINT *,'Lookup fraction 1 of atmos grid:'
175 C PRINT *, atm_oc_frac1
176 C PRINT *,'Lookup fraction 2 of atmos grid:'
177 C PRINT *, atm_oc_frac2
178
179 c
180 c read in mean 1D atmos wind files -- store in memory
181 c
182 DO j_atm=1,jm0
183 DO mn=1,nForcingPer
184 atau(j_atm,mn)=0. _d 0
185 atav(j_atm,mn)=0. _d 0
186 awind(j_atm,mn)=0. _d 0
187 ENDDO
188 ENDDO
189
190 CALL MDSFINDUNIT( dUnit, myThid )
191
192 IF ( atmosTauuFile .NE. ' ' ) THEN
193 OPEN(dUnit, FILE=atmosTauuFile,STATUS='old',
194 & ACCESS='direct', RECL=8*jm0*nForcingPer,
195 & FORM='unformatted')
196 READ(dUnit,REC=1), atau
197 CLOSE(dUnit)
198 ENDIF
199
200 IF ( atmosTauvFile .NE. ' ' ) THEN
201 OPEN(dUnit, FILE=atmosTauvFile, STATUS='old',
202 & ACCESS='direct', RECL=8*jm0*nForcingPer,
203 & FORM='unformatted')
204 READ(dUnit, REC=1), atav
205 CLOSE(dUnit)
206 ENDIF
207
208 IF ( atmosWindFile .NE. ' ' ) THEN
209 OPEN(dUnit, FILE=atmosWindFile, STATUS='old',
210 & ACCESS='direct', RECL=8*jm0*nForcingPer,
211 & FORM='unformatted')
212 READ(dUnit, REC=1), awind
213 CLOSE(dUnit)
214 ENDIF
215
216 C The polar data point values for winds are effectively N/A given the
217 C pole issue... although they are read in here, they are never used in
218 C any calculations, as the polar ocean points access the data at atmos
219 C 2 and jm0-1 points.
220
221
222 c read in runoff data
223 c to put runoff into specific grid cells
224 c
225 IF ( runoffMapFile .NE. ' ' ) THEN
226 CALL READ_FLD_XY_RL( runoffMapFile, ' ',
227 & runoffVal, 0, myThid )
228 ELSE
229 DO j=1,sNy
230 DO i=1,sNx
231 if ( (maskC(i,j,1,1,1).EQ.1.) .AND.
232 & ( (maskC(i-1,j,1,1,1).EQ.0.).OR.
233 & (maskC(i+1,j,1,1,1).EQ.0.).OR.
234 & (maskC(i,j-1,1,1,1).EQ.0.).OR.
235 & (maskC(i,j+1,1,1,1).EQ.0.).OR.
236 & (maskC(i+1,j+1,1,1,1).EQ.0.).OR.
237 & (maskC(i-1,j-1,1,1,1).EQ.0.).OR.
238 & (maskC(i+1,j-1,1,1,1).EQ.0.).OR.
239 & (maskC(i-1,j+1,1,1,1).EQ.0.) ) ) THEN
240 runoffVal(i,j)=1. _d 0
241 ENDIF
242 ENDDO
243 ENDDO
244 ENDIF
245
246 DO ib=1,numBands
247 ibj1=1
248 if (ib.GT.1) ibj1= rband(ib-1)+1
249 ibj2=sNy
250 if (ib.LT.numBands) ibj2= rband(ib)
251 totrun_b(ib)=0.d0
252 DO j=ibj1,ibj2
253 DO i=1,sNx
254 totrun_b(ib)=totrun_b(ib)+runoffVal(i,j)*maskC(i,j,1,1,1)
255 ENDDO
256 ENDDO
257 DO j=ibj1,ibj2
258 runIndex(j)= ib ! for lookup of rband as fn. of latitude
259 DO i=1,sNx
260 runoffVal(i,j)=runoffVal(i,j)*maskC(i,j,1,1,1)/totrun_b(ib)
261 ENDDO
262 ENDDO
263 ENDDO
264
265 CALL INIT_SUMVARS(myThid)
266
267 C Initialize 1D diagnostic variables
268 DO j_atm=1,jm0
269 DO mn=1,nForcingPer
270 sum_tauu_ta(j_atm,mn)= 0. _d 0
271 sum_tauv_ta(j_atm,mn)= 0. _d 0
272 sum_wsocean_ta(j_atm,mn)= 0. _d 0
273 sum_ps4ocean_ta(j_atm,mn)= 0. _d 0
274 ENDDO
275 ENDDO
276
277 C Initialize 2D diagnostic variables
278 DO i=1-OLx,sNx+OLx
279 DO j=1-OLy,sNy+OLy
280 DO mn=1,nForcingPer
281 qnet_atm_ta(i,j,mn)= 0. _d 0
282 evap_atm_ta(i,j,mn)= 0. _d 0
283 precip_atm_ta(i,j,mn)= 0. _d 0
284 runoff_atm_ta(i,j,mn)= 0. _d 0
285 sum_qrel_ta(i,j,mn)= 0. _d 0
286 sum_frel_ta(i,j,mn)= 0. _d 0
287 sum_iceMask_ta(i,j,mn)= 0. _d 0
288 sum_iceHeight_ta(i,j,mn)= 0. _d 0
289 sum_iceTime_ta(i,j,mn)= 0. _d 0
290 sum_oceMxLT_ta(i,j,mn)= 0. _d 0
291 sum_oceMxLS_ta(i,j,mn)= 0. _d 0
292 ENDDO
293 qnet_atm(i,j)= 0. _d 0
294 evap_atm(i,j)= 0. _d 0
295 precip_atm(i,j)= 0. _d 0
296 runoff_atm(i,j)= 0. _d 0
297 sum_qrel(i,j)= 0. _d 0
298 sum_frel(i,j)= 0. _d 0
299 sum_iceMask(i,j)= 0. _d 0
300 sum_iceHeight(i,j)= 0. _d 0
301 sum_iceTime(i,j)= 0. _d 0
302 sum_oceMxLT(i,j)= 0. _d 0
303 sum_oceMxLS(i,j)= 0. _d 0
304 ENDDO
305 ENDDO
306
307 C Initialize year-end diags and max/min seaice variables
308 SHice_min = 1. _d 18
309 NHice_min = 1. _d 18
310 SHice_max = 0. _d 0
311 NHice_max = 0. _d 0
312 sst_tave= 0. _d 0
313 sss_tave= 0. _d 0
314 HF2ocn_tave= 0. _d 0
315 FW2ocn_tave= 0. _d 0
316 CO2flx_tave= 0. _d 0
317 OPEN(25,FILE='resocean.dat',STATUS='replace')
318 CLOSE(25)
319
320 C Initialize following for safety and/or cold start
321 DO i=1-OLx,sNx+OLx
322 DO j=1-OLy,sNy+OLy
323 pass_runoff(i,j)= 0. _d 0
324 pass_qnet(i,j)= 0. _d 0
325 pass_evap(i,j)= 0. _d 0
326 pass_precip(i,j)= 0. _d 0
327 pass_fu(i,j)= 0. _d 0
328 pass_fv(i,j)= 0. _d 0
329 pass_wspeed(i,j)= 0. _d 0
330 pass_solarnet(i,j)= 0. _d 0
331 pass_slp(i,j)= 0. _d 0
332 pass_siceLoad(i,j)= 0. _d 0
333 pass_pCO2(i,j)= 0. _d 0
334 pass_prcAtm(i,j)= 0. _d 0
335 sFluxFromIce(i,j)= 0. _d 0
336 ENDDO
337 ENDDO
338
339 C Initialize following (if ocn carbon not passed)
340 DO i=1,sNx
341 DO j=1,sNy
342 oFluxCO2(i,j) = 0. _d 0
343 ENDDO
344 ENDDO
345
346 RETURN
347 END
348

  ViewVC Help
Powered by ViewVC 1.1.22