nodyn_allocs.inc

References to this file elsewhere.
1 !STARTOFREGISTRYGENERATEDINCLUDE 'inc/nodyn_allocs.inc'
2 !
3 ! WARNING This file is generated automatically by use_registry
4 ! using the data base in the file named Registry.
5 ! Do not edit.  Your changes to this file will be lost.
6 !
7 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
8 ALLOCATE(grid%lu_index(sm31:em31,sm32:em32),STAT=ierr)
9  if (ierr.ne.0) then
10  CALL wrf_error_fatal ( &
11 'frame/module_domain.f: Failed to allocate grid%lu_index(sm31:em31,sm32:em32). ')
12  endif
13 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%lu_index=initial_data_value
14 IF(.NOT.inter_domain)THEN
15 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
16 ALLOCATE(grid%lu_mask(sm31:em31,sm32:em32),STAT=ierr)
17  if (ierr.ne.0) then
18  CALL wrf_error_fatal ( &
19 'frame/module_domain.f: Failed to allocate grid%lu_mask(sm31:em31,sm32:em32). ')
20  endif
21 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%lu_mask=initial_data_value
22 ELSE
23 ALLOCATE(grid%lu_mask(1,1),STAT=ierr)
24  if (ierr.ne.0) then
25  CALL wrf_error_fatal ( &
26 'frame/module_domain.f: Failed to allocate grid%lu_mask(1,1).  ')
27  endif
28 ENDIF
29 IF(IAND(1,tl).NE.0)THEN
30 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
31 ALLOCATE(grid%a_u_1(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
32  if (ierr.ne.0) then
33  CALL wrf_error_fatal ( &
34 'frame/module_domain.f: Failed to allocate grid%a_u_1(sm31:em31,sm32:em32,sm33:em33). ')
35  endif
36 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_u_1=initial_data_value
37 ELSE
38 ALLOCATE(grid%a_u_1(1,1,1),STAT=ierr)
39  if (ierr.ne.0) then
40  CALL wrf_error_fatal ( &
41 'frame/module_domain.f: Failed to allocate grid%a_u_1(1,1,1).  ')
42  endif
43 ENDIF
44 IF(IAND(2,tl).NE.0)THEN
45 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
46 ALLOCATE(grid%a_u_2(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
47  if (ierr.ne.0) then
48  CALL wrf_error_fatal ( &
49 'frame/module_domain.f: Failed to allocate grid%a_u_2(sm31:em31,sm32:em32,sm33:em33). ')
50  endif
51 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_u_2=initial_data_value
52 ELSE
53 ALLOCATE(grid%a_u_2(1,1,1),STAT=ierr)
54  if (ierr.ne.0) then
55  CALL wrf_error_fatal ( &
56 'frame/module_domain.f: Failed to allocate grid%a_u_2(1,1,1).  ')
57  endif
58 ENDIF
59 IF(.NOT.inter_domain)THEN
60 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
61 ALLOCATE(grid%a_u_bxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
62  if (ierr.ne.0) then
63  CALL wrf_error_fatal ( &
64 'frame/module_domain.f: Failed to allocate grid%a_u_bxs(sm32:em32,sm33:em33,spec_bdy_width). ')
65  endif
66 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_u_bxs=initial_data_value
67 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
68 ALLOCATE(grid%a_u_bxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
69  if (ierr.ne.0) then
70  CALL wrf_error_fatal ( &
71 'frame/module_domain.f: Failed to allocate grid%a_u_bxe(sm32:em32,sm33:em33,spec_bdy_width). ')
72  endif
73 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_u_bxe=initial_data_value
74 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
75 ALLOCATE(grid%a_u_bys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
76  if (ierr.ne.0) then
77  CALL wrf_error_fatal ( &
78 'frame/module_domain.f: Failed to allocate grid%a_u_bys(sm31:em31,sm33:em33,spec_bdy_width). ')
79  endif
80 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_u_bys=initial_data_value
81 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
82 ALLOCATE(grid%a_u_bye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
83  if (ierr.ne.0) then
84  CALL wrf_error_fatal ( &
85 'frame/module_domain.f: Failed to allocate grid%a_u_bye(sm31:em31,sm33:em33,spec_bdy_width). ')
86  endif
87 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_u_bye=initial_data_value
88 ELSE
89 ALLOCATE(grid%a_u_bxs(1,1,1),STAT=ierr)
90  if (ierr.ne.0) then
91  CALL wrf_error_fatal ( &
92 'frame/module_domain.f: Failed to allocate grid%a_u_bxs(1,1,1).  ')
93  endif
94 ALLOCATE(grid%a_u_bxe(1,1,1),STAT=ierr)
95  if (ierr.ne.0) then
96  CALL wrf_error_fatal ( &
97 'frame/module_domain.f: Failed to allocate grid%a_u_bxe(1,1,1).  ')
98  endif
99 ALLOCATE(grid%a_u_bys(1,1,1),STAT=ierr)
100  if (ierr.ne.0) then
101  CALL wrf_error_fatal ( &
102 'frame/module_domain.f: Failed to allocate grid%a_u_bys(1,1,1).  ')
103  endif
104 ALLOCATE(grid%a_u_bye(1,1,1),STAT=ierr)
105  if (ierr.ne.0) then
106  CALL wrf_error_fatal ( &
107 'frame/module_domain.f: Failed to allocate grid%a_u_bye(1,1,1).  ')
108  endif
109 ENDIF
110 IF(.NOT.inter_domain)THEN
111 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
112 ALLOCATE(grid%a_u_btxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
113  if (ierr.ne.0) then
114  CALL wrf_error_fatal ( &
115 'frame/module_domain.f: Failed to allocate grid%a_u_btxs(sm32:em32,sm33:em33,spec_bdy_width). ')
116  endif
117 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_u_btxs=initial_data_value
118 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
119 ALLOCATE(grid%a_u_btxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
120  if (ierr.ne.0) then
121  CALL wrf_error_fatal ( &
122 'frame/module_domain.f: Failed to allocate grid%a_u_btxe(sm32:em32,sm33:em33,spec_bdy_width). ')
123  endif
124 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_u_btxe=initial_data_value
125 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
126 ALLOCATE(grid%a_u_btys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
127  if (ierr.ne.0) then
128  CALL wrf_error_fatal ( &
129 'frame/module_domain.f: Failed to allocate grid%a_u_btys(sm31:em31,sm33:em33,spec_bdy_width). ')
130  endif
131 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_u_btys=initial_data_value
132 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
133 ALLOCATE(grid%a_u_btye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
134  if (ierr.ne.0) then
135  CALL wrf_error_fatal ( &
136 'frame/module_domain.f: Failed to allocate grid%a_u_btye(sm31:em31,sm33:em33,spec_bdy_width). ')
137  endif
138 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_u_btye=initial_data_value
139 ELSE
140 ALLOCATE(grid%a_u_btxs(1,1,1),STAT=ierr)
141  if (ierr.ne.0) then
142  CALL wrf_error_fatal ( &
143 'frame/module_domain.f: Failed to allocate grid%a_u_btxs(1,1,1).  ')
144  endif
145 ALLOCATE(grid%a_u_btxe(1,1,1),STAT=ierr)
146  if (ierr.ne.0) then
147  CALL wrf_error_fatal ( &
148 'frame/module_domain.f: Failed to allocate grid%a_u_btxe(1,1,1).  ')
149  endif
150 ALLOCATE(grid%a_u_btys(1,1,1),STAT=ierr)
151  if (ierr.ne.0) then
152  CALL wrf_error_fatal ( &
153 'frame/module_domain.f: Failed to allocate grid%a_u_btys(1,1,1).  ')
154  endif
155 ALLOCATE(grid%a_u_btye(1,1,1),STAT=ierr)
156  if (ierr.ne.0) then
157  CALL wrf_error_fatal ( &
158 'frame/module_domain.f: Failed to allocate grid%a_u_btye(1,1,1).  ')
159  endif
160 ENDIF
161 IF(IAND(1,tl).NE.0)THEN
162 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
163 ALLOCATE(grid%g_u_1(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
164  if (ierr.ne.0) then
165  CALL wrf_error_fatal ( &
166 'frame/module_domain.f: Failed to allocate grid%g_u_1(sm31:em31,sm32:em32,sm33:em33). ')
167  endif
168 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_u_1=initial_data_value
169 ELSE
170 ALLOCATE(grid%g_u_1(1,1,1),STAT=ierr)
171  if (ierr.ne.0) then
172  CALL wrf_error_fatal ( &
173 'frame/module_domain.f: Failed to allocate grid%g_u_1(1,1,1).  ')
174  endif
175 ENDIF
176 IF(IAND(2,tl).NE.0)THEN
177 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
178 ALLOCATE(grid%g_u_2(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
179  if (ierr.ne.0) then
180  CALL wrf_error_fatal ( &
181 'frame/module_domain.f: Failed to allocate grid%g_u_2(sm31:em31,sm32:em32,sm33:em33). ')
182  endif
183 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_u_2=initial_data_value
184 ELSE
185 ALLOCATE(grid%g_u_2(1,1,1),STAT=ierr)
186  if (ierr.ne.0) then
187  CALL wrf_error_fatal ( &
188 'frame/module_domain.f: Failed to allocate grid%g_u_2(1,1,1).  ')
189  endif
190 ENDIF
191 IF(.NOT.inter_domain)THEN
192 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
193 ALLOCATE(grid%g_u_bxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
194  if (ierr.ne.0) then
195  CALL wrf_error_fatal ( &
196 'frame/module_domain.f: Failed to allocate grid%g_u_bxs(sm32:em32,sm33:em33,spec_bdy_width). ')
197  endif
198 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_u_bxs=initial_data_value
199 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
200 ALLOCATE(grid%g_u_bxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
201  if (ierr.ne.0) then
202  CALL wrf_error_fatal ( &
203 'frame/module_domain.f: Failed to allocate grid%g_u_bxe(sm32:em32,sm33:em33,spec_bdy_width). ')
204  endif
205 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_u_bxe=initial_data_value
206 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
207 ALLOCATE(grid%g_u_bys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
208  if (ierr.ne.0) then
209  CALL wrf_error_fatal ( &
210 'frame/module_domain.f: Failed to allocate grid%g_u_bys(sm31:em31,sm33:em33,spec_bdy_width). ')
211  endif
212 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_u_bys=initial_data_value
213 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
214 ALLOCATE(grid%g_u_bye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
215  if (ierr.ne.0) then
216  CALL wrf_error_fatal ( &
217 'frame/module_domain.f: Failed to allocate grid%g_u_bye(sm31:em31,sm33:em33,spec_bdy_width). ')
218  endif
219 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_u_bye=initial_data_value
220 ELSE
221 ALLOCATE(grid%g_u_bxs(1,1,1),STAT=ierr)
222  if (ierr.ne.0) then
223  CALL wrf_error_fatal ( &
224 'frame/module_domain.f: Failed to allocate grid%g_u_bxs(1,1,1).  ')
225  endif
226 ALLOCATE(grid%g_u_bxe(1,1,1),STAT=ierr)
227  if (ierr.ne.0) then
228  CALL wrf_error_fatal ( &
229 'frame/module_domain.f: Failed to allocate grid%g_u_bxe(1,1,1).  ')
230  endif
231 ALLOCATE(grid%g_u_bys(1,1,1),STAT=ierr)
232  if (ierr.ne.0) then
233  CALL wrf_error_fatal ( &
234 'frame/module_domain.f: Failed to allocate grid%g_u_bys(1,1,1).  ')
235  endif
236 ALLOCATE(grid%g_u_bye(1,1,1),STAT=ierr)
237  if (ierr.ne.0) then
238  CALL wrf_error_fatal ( &
239 'frame/module_domain.f: Failed to allocate grid%g_u_bye(1,1,1).  ')
240  endif
241 ENDIF
242 IF(.NOT.inter_domain)THEN
243 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
244 ALLOCATE(grid%g_u_btxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
245  if (ierr.ne.0) then
246  CALL wrf_error_fatal ( &
247 'frame/module_domain.f: Failed to allocate grid%g_u_btxs(sm32:em32,sm33:em33,spec_bdy_width). ')
248  endif
249 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_u_btxs=initial_data_value
250 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
251 ALLOCATE(grid%g_u_btxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
252  if (ierr.ne.0) then
253  CALL wrf_error_fatal ( &
254 'frame/module_domain.f: Failed to allocate grid%g_u_btxe(sm32:em32,sm33:em33,spec_bdy_width). ')
255  endif
256 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_u_btxe=initial_data_value
257 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
258 ALLOCATE(grid%g_u_btys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
259  if (ierr.ne.0) then
260  CALL wrf_error_fatal ( &
261 'frame/module_domain.f: Failed to allocate grid%g_u_btys(sm31:em31,sm33:em33,spec_bdy_width). ')
262  endif
263 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_u_btys=initial_data_value
264 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
265 ALLOCATE(grid%g_u_btye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
266  if (ierr.ne.0) then
267  CALL wrf_error_fatal ( &
268 'frame/module_domain.f: Failed to allocate grid%g_u_btye(sm31:em31,sm33:em33,spec_bdy_width). ')
269  endif
270 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_u_btye=initial_data_value
271 ELSE
272 ALLOCATE(grid%g_u_btxs(1,1,1),STAT=ierr)
273  if (ierr.ne.0) then
274  CALL wrf_error_fatal ( &
275 'frame/module_domain.f: Failed to allocate grid%g_u_btxs(1,1,1).  ')
276  endif
277 ALLOCATE(grid%g_u_btxe(1,1,1),STAT=ierr)
278  if (ierr.ne.0) then
279  CALL wrf_error_fatal ( &
280 'frame/module_domain.f: Failed to allocate grid%g_u_btxe(1,1,1).  ')
281  endif
282 ALLOCATE(grid%g_u_btys(1,1,1),STAT=ierr)
283  if (ierr.ne.0) then
284  CALL wrf_error_fatal ( &
285 'frame/module_domain.f: Failed to allocate grid%g_u_btys(1,1,1).  ')
286  endif
287 ALLOCATE(grid%g_u_btye(1,1,1),STAT=ierr)
288  if (ierr.ne.0) then
289  CALL wrf_error_fatal ( &
290 'frame/module_domain.f: Failed to allocate grid%g_u_btye(1,1,1).  ')
291  endif
292 ENDIF
293 IF(IAND(1,tl).NE.0)THEN
294 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
295 ALLOCATE(grid%a_v_1(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
296  if (ierr.ne.0) then
297  CALL wrf_error_fatal ( &
298 'frame/module_domain.f: Failed to allocate grid%a_v_1(sm31:em31,sm32:em32,sm33:em33). ')
299  endif
300 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_v_1=initial_data_value
301 ELSE
302 ALLOCATE(grid%a_v_1(1,1,1),STAT=ierr)
303  if (ierr.ne.0) then
304  CALL wrf_error_fatal ( &
305 'frame/module_domain.f: Failed to allocate grid%a_v_1(1,1,1).  ')
306  endif
307 ENDIF
308 IF(IAND(2,tl).NE.0)THEN
309 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
310 ALLOCATE(grid%a_v_2(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
311  if (ierr.ne.0) then
312  CALL wrf_error_fatal ( &
313 'frame/module_domain.f: Failed to allocate grid%a_v_2(sm31:em31,sm32:em32,sm33:em33). ')
314  endif
315 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_v_2=initial_data_value
316 ELSE
317 ALLOCATE(grid%a_v_2(1,1,1),STAT=ierr)
318  if (ierr.ne.0) then
319  CALL wrf_error_fatal ( &
320 'frame/module_domain.f: Failed to allocate grid%a_v_2(1,1,1).  ')
321  endif
322 ENDIF
323 IF(.NOT.inter_domain)THEN
324 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
325 ALLOCATE(grid%a_v_bxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
326  if (ierr.ne.0) then
327  CALL wrf_error_fatal ( &
328 'frame/module_domain.f: Failed to allocate grid%a_v_bxs(sm32:em32,sm33:em33,spec_bdy_width). ')
329  endif
330 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_v_bxs=initial_data_value
331 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
332 ALLOCATE(grid%a_v_bxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
333  if (ierr.ne.0) then
334  CALL wrf_error_fatal ( &
335 'frame/module_domain.f: Failed to allocate grid%a_v_bxe(sm32:em32,sm33:em33,spec_bdy_width). ')
336  endif
337 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_v_bxe=initial_data_value
338 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
339 ALLOCATE(grid%a_v_bys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
340  if (ierr.ne.0) then
341  CALL wrf_error_fatal ( &
342 'frame/module_domain.f: Failed to allocate grid%a_v_bys(sm31:em31,sm33:em33,spec_bdy_width). ')
343  endif
344 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_v_bys=initial_data_value
345 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
346 ALLOCATE(grid%a_v_bye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
347  if (ierr.ne.0) then
348  CALL wrf_error_fatal ( &
349 'frame/module_domain.f: Failed to allocate grid%a_v_bye(sm31:em31,sm33:em33,spec_bdy_width). ')
350  endif
351 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_v_bye=initial_data_value
352 ELSE
353 ALLOCATE(grid%a_v_bxs(1,1,1),STAT=ierr)
354  if (ierr.ne.0) then
355  CALL wrf_error_fatal ( &
356 'frame/module_domain.f: Failed to allocate grid%a_v_bxs(1,1,1).  ')
357  endif
358 ALLOCATE(grid%a_v_bxe(1,1,1),STAT=ierr)
359  if (ierr.ne.0) then
360  CALL wrf_error_fatal ( &
361 'frame/module_domain.f: Failed to allocate grid%a_v_bxe(1,1,1).  ')
362  endif
363 ALLOCATE(grid%a_v_bys(1,1,1),STAT=ierr)
364  if (ierr.ne.0) then
365  CALL wrf_error_fatal ( &
366 'frame/module_domain.f: Failed to allocate grid%a_v_bys(1,1,1).  ')
367  endif
368 ALLOCATE(grid%a_v_bye(1,1,1),STAT=ierr)
369  if (ierr.ne.0) then
370  CALL wrf_error_fatal ( &
371 'frame/module_domain.f: Failed to allocate grid%a_v_bye(1,1,1).  ')
372  endif
373 ENDIF
374 IF(.NOT.inter_domain)THEN
375 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
376 ALLOCATE(grid%a_v_btxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
377  if (ierr.ne.0) then
378  CALL wrf_error_fatal ( &
379 'frame/module_domain.f: Failed to allocate grid%a_v_btxs(sm32:em32,sm33:em33,spec_bdy_width). ')
380  endif
381 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_v_btxs=initial_data_value
382 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
383 ALLOCATE(grid%a_v_btxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
384  if (ierr.ne.0) then
385  CALL wrf_error_fatal ( &
386 'frame/module_domain.f: Failed to allocate grid%a_v_btxe(sm32:em32,sm33:em33,spec_bdy_width). ')
387  endif
388 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_v_btxe=initial_data_value
389 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
390 ALLOCATE(grid%a_v_btys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
391  if (ierr.ne.0) then
392  CALL wrf_error_fatal ( &
393 'frame/module_domain.f: Failed to allocate grid%a_v_btys(sm31:em31,sm33:em33,spec_bdy_width). ')
394  endif
395 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_v_btys=initial_data_value
396 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
397 ALLOCATE(grid%a_v_btye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
398  if (ierr.ne.0) then
399  CALL wrf_error_fatal ( &
400 'frame/module_domain.f: Failed to allocate grid%a_v_btye(sm31:em31,sm33:em33,spec_bdy_width). ')
401  endif
402 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_v_btye=initial_data_value
403 ELSE
404 ALLOCATE(grid%a_v_btxs(1,1,1),STAT=ierr)
405  if (ierr.ne.0) then
406  CALL wrf_error_fatal ( &
407 'frame/module_domain.f: Failed to allocate grid%a_v_btxs(1,1,1).  ')
408  endif
409 ALLOCATE(grid%a_v_btxe(1,1,1),STAT=ierr)
410  if (ierr.ne.0) then
411  CALL wrf_error_fatal ( &
412 'frame/module_domain.f: Failed to allocate grid%a_v_btxe(1,1,1).  ')
413  endif
414 ALLOCATE(grid%a_v_btys(1,1,1),STAT=ierr)
415  if (ierr.ne.0) then
416  CALL wrf_error_fatal ( &
417 'frame/module_domain.f: Failed to allocate grid%a_v_btys(1,1,1).  ')
418  endif
419 ALLOCATE(grid%a_v_btye(1,1,1),STAT=ierr)
420  if (ierr.ne.0) then
421  CALL wrf_error_fatal ( &
422 'frame/module_domain.f: Failed to allocate grid%a_v_btye(1,1,1).  ')
423  endif
424 ENDIF
425 IF(IAND(1,tl).NE.0)THEN
426 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
427 ALLOCATE(grid%g_v_1(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
428  if (ierr.ne.0) then
429  CALL wrf_error_fatal ( &
430 'frame/module_domain.f: Failed to allocate grid%g_v_1(sm31:em31,sm32:em32,sm33:em33). ')
431  endif
432 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_v_1=initial_data_value
433 ELSE
434 ALLOCATE(grid%g_v_1(1,1,1),STAT=ierr)
435  if (ierr.ne.0) then
436  CALL wrf_error_fatal ( &
437 'frame/module_domain.f: Failed to allocate grid%g_v_1(1,1,1).  ')
438  endif
439 ENDIF
440 IF(IAND(2,tl).NE.0)THEN
441 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
442 ALLOCATE(grid%g_v_2(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
443  if (ierr.ne.0) then
444  CALL wrf_error_fatal ( &
445 'frame/module_domain.f: Failed to allocate grid%g_v_2(sm31:em31,sm32:em32,sm33:em33). ')
446  endif
447 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_v_2=initial_data_value
448 ELSE
449 ALLOCATE(grid%g_v_2(1,1,1),STAT=ierr)
450  if (ierr.ne.0) then
451  CALL wrf_error_fatal ( &
452 'frame/module_domain.f: Failed to allocate grid%g_v_2(1,1,1).  ')
453  endif
454 ENDIF
455 IF(.NOT.inter_domain)THEN
456 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
457 ALLOCATE(grid%g_v_bxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
458  if (ierr.ne.0) then
459  CALL wrf_error_fatal ( &
460 'frame/module_domain.f: Failed to allocate grid%g_v_bxs(sm32:em32,sm33:em33,spec_bdy_width). ')
461  endif
462 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_v_bxs=initial_data_value
463 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
464 ALLOCATE(grid%g_v_bxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
465  if (ierr.ne.0) then
466  CALL wrf_error_fatal ( &
467 'frame/module_domain.f: Failed to allocate grid%g_v_bxe(sm32:em32,sm33:em33,spec_bdy_width). ')
468  endif
469 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_v_bxe=initial_data_value
470 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
471 ALLOCATE(grid%g_v_bys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
472  if (ierr.ne.0) then
473  CALL wrf_error_fatal ( &
474 'frame/module_domain.f: Failed to allocate grid%g_v_bys(sm31:em31,sm33:em33,spec_bdy_width). ')
475  endif
476 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_v_bys=initial_data_value
477 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
478 ALLOCATE(grid%g_v_bye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
479  if (ierr.ne.0) then
480  CALL wrf_error_fatal ( &
481 'frame/module_domain.f: Failed to allocate grid%g_v_bye(sm31:em31,sm33:em33,spec_bdy_width). ')
482  endif
483 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_v_bye=initial_data_value
484 ELSE
485 ALLOCATE(grid%g_v_bxs(1,1,1),STAT=ierr)
486  if (ierr.ne.0) then
487  CALL wrf_error_fatal ( &
488 'frame/module_domain.f: Failed to allocate grid%g_v_bxs(1,1,1).  ')
489  endif
490 ALLOCATE(grid%g_v_bxe(1,1,1),STAT=ierr)
491  if (ierr.ne.0) then
492  CALL wrf_error_fatal ( &
493 'frame/module_domain.f: Failed to allocate grid%g_v_bxe(1,1,1).  ')
494  endif
495 ALLOCATE(grid%g_v_bys(1,1,1),STAT=ierr)
496  if (ierr.ne.0) then
497  CALL wrf_error_fatal ( &
498 'frame/module_domain.f: Failed to allocate grid%g_v_bys(1,1,1).  ')
499  endif
500 ALLOCATE(grid%g_v_bye(1,1,1),STAT=ierr)
501  if (ierr.ne.0) then
502  CALL wrf_error_fatal ( &
503 'frame/module_domain.f: Failed to allocate grid%g_v_bye(1,1,1).  ')
504  endif
505 ENDIF
506 IF(.NOT.inter_domain)THEN
507 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
508 ALLOCATE(grid%g_v_btxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
509  if (ierr.ne.0) then
510  CALL wrf_error_fatal ( &
511 'frame/module_domain.f: Failed to allocate grid%g_v_btxs(sm32:em32,sm33:em33,spec_bdy_width). ')
512  endif
513 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_v_btxs=initial_data_value
514 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
515 ALLOCATE(grid%g_v_btxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
516  if (ierr.ne.0) then
517  CALL wrf_error_fatal ( &
518 'frame/module_domain.f: Failed to allocate grid%g_v_btxe(sm32:em32,sm33:em33,spec_bdy_width). ')
519  endif
520 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_v_btxe=initial_data_value
521 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
522 ALLOCATE(grid%g_v_btys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
523  if (ierr.ne.0) then
524  CALL wrf_error_fatal ( &
525 'frame/module_domain.f: Failed to allocate grid%g_v_btys(sm31:em31,sm33:em33,spec_bdy_width). ')
526  endif
527 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_v_btys=initial_data_value
528 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
529 ALLOCATE(grid%g_v_btye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
530  if (ierr.ne.0) then
531  CALL wrf_error_fatal ( &
532 'frame/module_domain.f: Failed to allocate grid%g_v_btye(sm31:em31,sm33:em33,spec_bdy_width). ')
533  endif
534 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_v_btye=initial_data_value
535 ELSE
536 ALLOCATE(grid%g_v_btxs(1,1,1),STAT=ierr)
537  if (ierr.ne.0) then
538  CALL wrf_error_fatal ( &
539 'frame/module_domain.f: Failed to allocate grid%g_v_btxs(1,1,1).  ')
540  endif
541 ALLOCATE(grid%g_v_btxe(1,1,1),STAT=ierr)
542  if (ierr.ne.0) then
543  CALL wrf_error_fatal ( &
544 'frame/module_domain.f: Failed to allocate grid%g_v_btxe(1,1,1).  ')
545  endif
546 ALLOCATE(grid%g_v_btys(1,1,1),STAT=ierr)
547  if (ierr.ne.0) then
548  CALL wrf_error_fatal ( &
549 'frame/module_domain.f: Failed to allocate grid%g_v_btys(1,1,1).  ')
550  endif
551 ALLOCATE(grid%g_v_btye(1,1,1),STAT=ierr)
552  if (ierr.ne.0) then
553  CALL wrf_error_fatal ( &
554 'frame/module_domain.f: Failed to allocate grid%g_v_btye(1,1,1).  ')
555  endif
556 ENDIF
557 IF(IAND(1,tl).NE.0)THEN
558 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
559 ALLOCATE(grid%a_w_1(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
560  if (ierr.ne.0) then
561  CALL wrf_error_fatal ( &
562 'frame/module_domain.f: Failed to allocate grid%a_w_1(sm31:em31,sm32:em32,sm33:em33). ')
563  endif
564 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_w_1=initial_data_value
565 ELSE
566 ALLOCATE(grid%a_w_1(1,1,1),STAT=ierr)
567  if (ierr.ne.0) then
568  CALL wrf_error_fatal ( &
569 'frame/module_domain.f: Failed to allocate grid%a_w_1(1,1,1).  ')
570  endif
571 ENDIF
572 IF(IAND(2,tl).NE.0)THEN
573 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
574 ALLOCATE(grid%a_w_2(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
575  if (ierr.ne.0) then
576  CALL wrf_error_fatal ( &
577 'frame/module_domain.f: Failed to allocate grid%a_w_2(sm31:em31,sm32:em32,sm33:em33). ')
578  endif
579 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_w_2=initial_data_value
580 ELSE
581 ALLOCATE(grid%a_w_2(1,1,1),STAT=ierr)
582  if (ierr.ne.0) then
583  CALL wrf_error_fatal ( &
584 'frame/module_domain.f: Failed to allocate grid%a_w_2(1,1,1).  ')
585  endif
586 ENDIF
587 IF(.NOT.inter_domain)THEN
588 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
589 ALLOCATE(grid%a_w_bxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
590  if (ierr.ne.0) then
591  CALL wrf_error_fatal ( &
592 'frame/module_domain.f: Failed to allocate grid%a_w_bxs(sm32:em32,sm33:em33,spec_bdy_width). ')
593  endif
594 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_w_bxs=initial_data_value
595 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
596 ALLOCATE(grid%a_w_bxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
597  if (ierr.ne.0) then
598  CALL wrf_error_fatal ( &
599 'frame/module_domain.f: Failed to allocate grid%a_w_bxe(sm32:em32,sm33:em33,spec_bdy_width). ')
600  endif
601 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_w_bxe=initial_data_value
602 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
603 ALLOCATE(grid%a_w_bys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
604  if (ierr.ne.0) then
605  CALL wrf_error_fatal ( &
606 'frame/module_domain.f: Failed to allocate grid%a_w_bys(sm31:em31,sm33:em33,spec_bdy_width). ')
607  endif
608 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_w_bys=initial_data_value
609 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
610 ALLOCATE(grid%a_w_bye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
611  if (ierr.ne.0) then
612  CALL wrf_error_fatal ( &
613 'frame/module_domain.f: Failed to allocate grid%a_w_bye(sm31:em31,sm33:em33,spec_bdy_width). ')
614  endif
615 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_w_bye=initial_data_value
616 ELSE
617 ALLOCATE(grid%a_w_bxs(1,1,1),STAT=ierr)
618  if (ierr.ne.0) then
619  CALL wrf_error_fatal ( &
620 'frame/module_domain.f: Failed to allocate grid%a_w_bxs(1,1,1).  ')
621  endif
622 ALLOCATE(grid%a_w_bxe(1,1,1),STAT=ierr)
623  if (ierr.ne.0) then
624  CALL wrf_error_fatal ( &
625 'frame/module_domain.f: Failed to allocate grid%a_w_bxe(1,1,1).  ')
626  endif
627 ALLOCATE(grid%a_w_bys(1,1,1),STAT=ierr)
628  if (ierr.ne.0) then
629  CALL wrf_error_fatal ( &
630 'frame/module_domain.f: Failed to allocate grid%a_w_bys(1,1,1).  ')
631  endif
632 ALLOCATE(grid%a_w_bye(1,1,1),STAT=ierr)
633  if (ierr.ne.0) then
634  CALL wrf_error_fatal ( &
635 'frame/module_domain.f: Failed to allocate grid%a_w_bye(1,1,1).  ')
636  endif
637 ENDIF
638 IF(.NOT.inter_domain)THEN
639 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
640 ALLOCATE(grid%a_w_btxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
641  if (ierr.ne.0) then
642  CALL wrf_error_fatal ( &
643 'frame/module_domain.f: Failed to allocate grid%a_w_btxs(sm32:em32,sm33:em33,spec_bdy_width). ')
644  endif
645 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_w_btxs=initial_data_value
646 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
647 ALLOCATE(grid%a_w_btxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
648  if (ierr.ne.0) then
649  CALL wrf_error_fatal ( &
650 'frame/module_domain.f: Failed to allocate grid%a_w_btxe(sm32:em32,sm33:em33,spec_bdy_width). ')
651  endif
652 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_w_btxe=initial_data_value
653 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
654 ALLOCATE(grid%a_w_btys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
655  if (ierr.ne.0) then
656  CALL wrf_error_fatal ( &
657 'frame/module_domain.f: Failed to allocate grid%a_w_btys(sm31:em31,sm33:em33,spec_bdy_width). ')
658  endif
659 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_w_btys=initial_data_value
660 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
661 ALLOCATE(grid%a_w_btye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
662  if (ierr.ne.0) then
663  CALL wrf_error_fatal ( &
664 'frame/module_domain.f: Failed to allocate grid%a_w_btye(sm31:em31,sm33:em33,spec_bdy_width). ')
665  endif
666 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_w_btye=initial_data_value
667 ELSE
668 ALLOCATE(grid%a_w_btxs(1,1,1),STAT=ierr)
669  if (ierr.ne.0) then
670  CALL wrf_error_fatal ( &
671 'frame/module_domain.f: Failed to allocate grid%a_w_btxs(1,1,1).  ')
672  endif
673 ALLOCATE(grid%a_w_btxe(1,1,1),STAT=ierr)
674  if (ierr.ne.0) then
675  CALL wrf_error_fatal ( &
676 'frame/module_domain.f: Failed to allocate grid%a_w_btxe(1,1,1).  ')
677  endif
678 ALLOCATE(grid%a_w_btys(1,1,1),STAT=ierr)
679  if (ierr.ne.0) then
680  CALL wrf_error_fatal ( &
681 'frame/module_domain.f: Failed to allocate grid%a_w_btys(1,1,1).  ')
682  endif
683 ALLOCATE(grid%a_w_btye(1,1,1),STAT=ierr)
684  if (ierr.ne.0) then
685  CALL wrf_error_fatal ( &
686 'frame/module_domain.f: Failed to allocate grid%a_w_btye(1,1,1).  ')
687  endif
688 ENDIF
689 IF(IAND(1,tl).NE.0)THEN
690 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
691 ALLOCATE(grid%g_w_1(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
692  if (ierr.ne.0) then
693  CALL wrf_error_fatal ( &
694 'frame/module_domain.f: Failed to allocate grid%g_w_1(sm31:em31,sm32:em32,sm33:em33). ')
695  endif
696 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_w_1=initial_data_value
697 ELSE
698 ALLOCATE(grid%g_w_1(1,1,1),STAT=ierr)
699  if (ierr.ne.0) then
700  CALL wrf_error_fatal ( &
701 'frame/module_domain.f: Failed to allocate grid%g_w_1(1,1,1).  ')
702  endif
703 ENDIF
704 IF(IAND(2,tl).NE.0)THEN
705 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
706 ALLOCATE(grid%g_w_2(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
707  if (ierr.ne.0) then
708  CALL wrf_error_fatal ( &
709 'frame/module_domain.f: Failed to allocate grid%g_w_2(sm31:em31,sm32:em32,sm33:em33). ')
710  endif
711 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_w_2=initial_data_value
712 ELSE
713 ALLOCATE(grid%g_w_2(1,1,1),STAT=ierr)
714  if (ierr.ne.0) then
715  CALL wrf_error_fatal ( &
716 'frame/module_domain.f: Failed to allocate grid%g_w_2(1,1,1).  ')
717  endif
718 ENDIF
719 IF(.NOT.inter_domain)THEN
720 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
721 ALLOCATE(grid%g_w_bxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
722  if (ierr.ne.0) then
723  CALL wrf_error_fatal ( &
724 'frame/module_domain.f: Failed to allocate grid%g_w_bxs(sm32:em32,sm33:em33,spec_bdy_width). ')
725  endif
726 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_w_bxs=initial_data_value
727 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
728 ALLOCATE(grid%g_w_bxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
729  if (ierr.ne.0) then
730  CALL wrf_error_fatal ( &
731 'frame/module_domain.f: Failed to allocate grid%g_w_bxe(sm32:em32,sm33:em33,spec_bdy_width). ')
732  endif
733 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_w_bxe=initial_data_value
734 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
735 ALLOCATE(grid%g_w_bys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
736  if (ierr.ne.0) then
737  CALL wrf_error_fatal ( &
738 'frame/module_domain.f: Failed to allocate grid%g_w_bys(sm31:em31,sm33:em33,spec_bdy_width). ')
739  endif
740 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_w_bys=initial_data_value
741 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
742 ALLOCATE(grid%g_w_bye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
743  if (ierr.ne.0) then
744  CALL wrf_error_fatal ( &
745 'frame/module_domain.f: Failed to allocate grid%g_w_bye(sm31:em31,sm33:em33,spec_bdy_width). ')
746  endif
747 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_w_bye=initial_data_value
748 ELSE
749 ALLOCATE(grid%g_w_bxs(1,1,1),STAT=ierr)
750  if (ierr.ne.0) then
751  CALL wrf_error_fatal ( &
752 'frame/module_domain.f: Failed to allocate grid%g_w_bxs(1,1,1).  ')
753  endif
754 ALLOCATE(grid%g_w_bxe(1,1,1),STAT=ierr)
755  if (ierr.ne.0) then
756  CALL wrf_error_fatal ( &
757 'frame/module_domain.f: Failed to allocate grid%g_w_bxe(1,1,1).  ')
758  endif
759 ALLOCATE(grid%g_w_bys(1,1,1),STAT=ierr)
760  if (ierr.ne.0) then
761  CALL wrf_error_fatal ( &
762 'frame/module_domain.f: Failed to allocate grid%g_w_bys(1,1,1).  ')
763  endif
764 ALLOCATE(grid%g_w_bye(1,1,1),STAT=ierr)
765  if (ierr.ne.0) then
766  CALL wrf_error_fatal ( &
767 'frame/module_domain.f: Failed to allocate grid%g_w_bye(1,1,1).  ')
768  endif
769 ENDIF
770 IF(.NOT.inter_domain)THEN
771 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
772 ALLOCATE(grid%g_w_btxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
773  if (ierr.ne.0) then
774  CALL wrf_error_fatal ( &
775 'frame/module_domain.f: Failed to allocate grid%g_w_btxs(sm32:em32,sm33:em33,spec_bdy_width). ')
776  endif
777 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_w_btxs=initial_data_value
778 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
779 ALLOCATE(grid%g_w_btxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
780  if (ierr.ne.0) then
781  CALL wrf_error_fatal ( &
782 'frame/module_domain.f: Failed to allocate grid%g_w_btxe(sm32:em32,sm33:em33,spec_bdy_width). ')
783  endif
784 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_w_btxe=initial_data_value
785 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
786 ALLOCATE(grid%g_w_btys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
787  if (ierr.ne.0) then
788  CALL wrf_error_fatal ( &
789 'frame/module_domain.f: Failed to allocate grid%g_w_btys(sm31:em31,sm33:em33,spec_bdy_width). ')
790  endif
791 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_w_btys=initial_data_value
792 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
793 ALLOCATE(grid%g_w_btye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
794  if (ierr.ne.0) then
795  CALL wrf_error_fatal ( &
796 'frame/module_domain.f: Failed to allocate grid%g_w_btye(sm31:em31,sm33:em33,spec_bdy_width). ')
797  endif
798 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_w_btye=initial_data_value
799 ELSE
800 ALLOCATE(grid%g_w_btxs(1,1,1),STAT=ierr)
801  if (ierr.ne.0) then
802  CALL wrf_error_fatal ( &
803 'frame/module_domain.f: Failed to allocate grid%g_w_btxs(1,1,1).  ')
804  endif
805 ALLOCATE(grid%g_w_btxe(1,1,1),STAT=ierr)
806  if (ierr.ne.0) then
807  CALL wrf_error_fatal ( &
808 'frame/module_domain.f: Failed to allocate grid%g_w_btxe(1,1,1).  ')
809  endif
810 ALLOCATE(grid%g_w_btys(1,1,1),STAT=ierr)
811  if (ierr.ne.0) then
812  CALL wrf_error_fatal ( &
813 'frame/module_domain.f: Failed to allocate grid%g_w_btys(1,1,1).  ')
814  endif
815 ALLOCATE(grid%g_w_btye(1,1,1),STAT=ierr)
816  if (ierr.ne.0) then
817  CALL wrf_error_fatal ( &
818 'frame/module_domain.f: Failed to allocate grid%g_w_btye(1,1,1).  ')
819  endif
820 ENDIF
821 IF(IAND(1,tl).NE.0)THEN
822 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
823 ALLOCATE(grid%a_ph_1(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
824  if (ierr.ne.0) then
825  CALL wrf_error_fatal ( &
826 'frame/module_domain.f: Failed to allocate grid%a_ph_1(sm31:em31,sm32:em32,sm33:em33). ')
827  endif
828 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_ph_1=initial_data_value
829 ELSE
830 ALLOCATE(grid%a_ph_1(1,1,1),STAT=ierr)
831  if (ierr.ne.0) then
832  CALL wrf_error_fatal ( &
833 'frame/module_domain.f: Failed to allocate grid%a_ph_1(1,1,1).  ')
834  endif
835 ENDIF
836 IF(IAND(2,tl).NE.0)THEN
837 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
838 ALLOCATE(grid%a_ph_2(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
839  if (ierr.ne.0) then
840  CALL wrf_error_fatal ( &
841 'frame/module_domain.f: Failed to allocate grid%a_ph_2(sm31:em31,sm32:em32,sm33:em33). ')
842  endif
843 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_ph_2=initial_data_value
844 ELSE
845 ALLOCATE(grid%a_ph_2(1,1,1),STAT=ierr)
846  if (ierr.ne.0) then
847  CALL wrf_error_fatal ( &
848 'frame/module_domain.f: Failed to allocate grid%a_ph_2(1,1,1).  ')
849  endif
850 ENDIF
851 IF(.NOT.inter_domain)THEN
852 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
853 ALLOCATE(grid%a_ph_bxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
854  if (ierr.ne.0) then
855  CALL wrf_error_fatal ( &
856 'frame/module_domain.f: Failed to allocate grid%a_ph_bxs(sm32:em32,sm33:em33,spec_bdy_width). ')
857  endif
858 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_ph_bxs=initial_data_value
859 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
860 ALLOCATE(grid%a_ph_bxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
861  if (ierr.ne.0) then
862  CALL wrf_error_fatal ( &
863 'frame/module_domain.f: Failed to allocate grid%a_ph_bxe(sm32:em32,sm33:em33,spec_bdy_width). ')
864  endif
865 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_ph_bxe=initial_data_value
866 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
867 ALLOCATE(grid%a_ph_bys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
868  if (ierr.ne.0) then
869  CALL wrf_error_fatal ( &
870 'frame/module_domain.f: Failed to allocate grid%a_ph_bys(sm31:em31,sm33:em33,spec_bdy_width). ')
871  endif
872 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_ph_bys=initial_data_value
873 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
874 ALLOCATE(grid%a_ph_bye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
875  if (ierr.ne.0) then
876  CALL wrf_error_fatal ( &
877 'frame/module_domain.f: Failed to allocate grid%a_ph_bye(sm31:em31,sm33:em33,spec_bdy_width). ')
878  endif
879 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_ph_bye=initial_data_value
880 ELSE
881 ALLOCATE(grid%a_ph_bxs(1,1,1),STAT=ierr)
882  if (ierr.ne.0) then
883  CALL wrf_error_fatal ( &
884 'frame/module_domain.f: Failed to allocate grid%a_ph_bxs(1,1,1).  ')
885  endif
886 ALLOCATE(grid%a_ph_bxe(1,1,1),STAT=ierr)
887  if (ierr.ne.0) then
888  CALL wrf_error_fatal ( &
889 'frame/module_domain.f: Failed to allocate grid%a_ph_bxe(1,1,1).  ')
890  endif
891 ALLOCATE(grid%a_ph_bys(1,1,1),STAT=ierr)
892  if (ierr.ne.0) then
893  CALL wrf_error_fatal ( &
894 'frame/module_domain.f: Failed to allocate grid%a_ph_bys(1,1,1).  ')
895  endif
896 ALLOCATE(grid%a_ph_bye(1,1,1),STAT=ierr)
897  if (ierr.ne.0) then
898  CALL wrf_error_fatal ( &
899 'frame/module_domain.f: Failed to allocate grid%a_ph_bye(1,1,1).  ')
900  endif
901 ENDIF
902 IF(.NOT.inter_domain)THEN
903 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
904 ALLOCATE(grid%a_ph_btxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
905  if (ierr.ne.0) then
906  CALL wrf_error_fatal ( &
907 'frame/module_domain.f: Failed to allocate grid%a_ph_btxs(sm32:em32,sm33:em33,spec_bdy_width). ')
908  endif
909 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_ph_btxs=initial_data_value
910 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
911 ALLOCATE(grid%a_ph_btxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
912  if (ierr.ne.0) then
913  CALL wrf_error_fatal ( &
914 'frame/module_domain.f: Failed to allocate grid%a_ph_btxe(sm32:em32,sm33:em33,spec_bdy_width). ')
915  endif
916 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_ph_btxe=initial_data_value
917 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
918 ALLOCATE(grid%a_ph_btys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
919  if (ierr.ne.0) then
920  CALL wrf_error_fatal ( &
921 'frame/module_domain.f: Failed to allocate grid%a_ph_btys(sm31:em31,sm33:em33,spec_bdy_width). ')
922  endif
923 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_ph_btys=initial_data_value
924 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
925 ALLOCATE(grid%a_ph_btye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
926  if (ierr.ne.0) then
927  CALL wrf_error_fatal ( &
928 'frame/module_domain.f: Failed to allocate grid%a_ph_btye(sm31:em31,sm33:em33,spec_bdy_width). ')
929  endif
930 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_ph_btye=initial_data_value
931 ELSE
932 ALLOCATE(grid%a_ph_btxs(1,1,1),STAT=ierr)
933  if (ierr.ne.0) then
934  CALL wrf_error_fatal ( &
935 'frame/module_domain.f: Failed to allocate grid%a_ph_btxs(1,1,1).  ')
936  endif
937 ALLOCATE(grid%a_ph_btxe(1,1,1),STAT=ierr)
938  if (ierr.ne.0) then
939  CALL wrf_error_fatal ( &
940 'frame/module_domain.f: Failed to allocate grid%a_ph_btxe(1,1,1).  ')
941  endif
942 ALLOCATE(grid%a_ph_btys(1,1,1),STAT=ierr)
943  if (ierr.ne.0) then
944  CALL wrf_error_fatal ( &
945 'frame/module_domain.f: Failed to allocate grid%a_ph_btys(1,1,1).  ')
946  endif
947 ALLOCATE(grid%a_ph_btye(1,1,1),STAT=ierr)
948  if (ierr.ne.0) then
949  CALL wrf_error_fatal ( &
950 'frame/module_domain.f: Failed to allocate grid%a_ph_btye(1,1,1).  ')
951  endif
952 ENDIF
953 IF(IAND(1,tl).NE.0)THEN
954 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
955 ALLOCATE(grid%g_ph_1(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
956  if (ierr.ne.0) then
957  CALL wrf_error_fatal ( &
958 'frame/module_domain.f: Failed to allocate grid%g_ph_1(sm31:em31,sm32:em32,sm33:em33). ')
959  endif
960 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_ph_1=initial_data_value
961 ELSE
962 ALLOCATE(grid%g_ph_1(1,1,1),STAT=ierr)
963  if (ierr.ne.0) then
964  CALL wrf_error_fatal ( &
965 'frame/module_domain.f: Failed to allocate grid%g_ph_1(1,1,1).  ')
966  endif
967 ENDIF
968 IF(IAND(2,tl).NE.0)THEN
969 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
970 ALLOCATE(grid%g_ph_2(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
971  if (ierr.ne.0) then
972  CALL wrf_error_fatal ( &
973 'frame/module_domain.f: Failed to allocate grid%g_ph_2(sm31:em31,sm32:em32,sm33:em33). ')
974  endif
975 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_ph_2=initial_data_value
976 ELSE
977 ALLOCATE(grid%g_ph_2(1,1,1),STAT=ierr)
978  if (ierr.ne.0) then
979  CALL wrf_error_fatal ( &
980 'frame/module_domain.f: Failed to allocate grid%g_ph_2(1,1,1).  ')
981  endif
982 ENDIF
983 IF(.NOT.inter_domain)THEN
984 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
985 ALLOCATE(grid%g_ph_bxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
986  if (ierr.ne.0) then
987  CALL wrf_error_fatal ( &
988 'frame/module_domain.f: Failed to allocate grid%g_ph_bxs(sm32:em32,sm33:em33,spec_bdy_width). ')
989  endif
990 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_ph_bxs=initial_data_value
991 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
992 ALLOCATE(grid%g_ph_bxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
993  if (ierr.ne.0) then
994  CALL wrf_error_fatal ( &
995 'frame/module_domain.f: Failed to allocate grid%g_ph_bxe(sm32:em32,sm33:em33,spec_bdy_width). ')
996  endif
997 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_ph_bxe=initial_data_value
998 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
999 ALLOCATE(grid%g_ph_bys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
1000  if (ierr.ne.0) then
1001  CALL wrf_error_fatal ( &
1002 'frame/module_domain.f: Failed to allocate grid%g_ph_bys(sm31:em31,sm33:em33,spec_bdy_width). ')
1003  endif
1004 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_ph_bys=initial_data_value
1005 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1006 ALLOCATE(grid%g_ph_bye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
1007  if (ierr.ne.0) then
1008  CALL wrf_error_fatal ( &
1009 'frame/module_domain.f: Failed to allocate grid%g_ph_bye(sm31:em31,sm33:em33,spec_bdy_width). ')
1010  endif
1011 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_ph_bye=initial_data_value
1012 ELSE
1013 ALLOCATE(grid%g_ph_bxs(1,1,1),STAT=ierr)
1014  if (ierr.ne.0) then
1015  CALL wrf_error_fatal ( &
1016 'frame/module_domain.f: Failed to allocate grid%g_ph_bxs(1,1,1).  ')
1017  endif
1018 ALLOCATE(grid%g_ph_bxe(1,1,1),STAT=ierr)
1019  if (ierr.ne.0) then
1020  CALL wrf_error_fatal ( &
1021 'frame/module_domain.f: Failed to allocate grid%g_ph_bxe(1,1,1).  ')
1022  endif
1023 ALLOCATE(grid%g_ph_bys(1,1,1),STAT=ierr)
1024  if (ierr.ne.0) then
1025  CALL wrf_error_fatal ( &
1026 'frame/module_domain.f: Failed to allocate grid%g_ph_bys(1,1,1).  ')
1027  endif
1028 ALLOCATE(grid%g_ph_bye(1,1,1),STAT=ierr)
1029  if (ierr.ne.0) then
1030  CALL wrf_error_fatal ( &
1031 'frame/module_domain.f: Failed to allocate grid%g_ph_bye(1,1,1).  ')
1032  endif
1033 ENDIF
1034 IF(.NOT.inter_domain)THEN
1035 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1036 ALLOCATE(grid%g_ph_btxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
1037  if (ierr.ne.0) then
1038  CALL wrf_error_fatal ( &
1039 'frame/module_domain.f: Failed to allocate grid%g_ph_btxs(sm32:em32,sm33:em33,spec_bdy_width). ')
1040  endif
1041 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_ph_btxs=initial_data_value
1042 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1043 ALLOCATE(grid%g_ph_btxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
1044  if (ierr.ne.0) then
1045  CALL wrf_error_fatal ( &
1046 'frame/module_domain.f: Failed to allocate grid%g_ph_btxe(sm32:em32,sm33:em33,spec_bdy_width). ')
1047  endif
1048 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_ph_btxe=initial_data_value
1049 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1050 ALLOCATE(grid%g_ph_btys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
1051  if (ierr.ne.0) then
1052  CALL wrf_error_fatal ( &
1053 'frame/module_domain.f: Failed to allocate grid%g_ph_btys(sm31:em31,sm33:em33,spec_bdy_width). ')
1054  endif
1055 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_ph_btys=initial_data_value
1056 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1057 ALLOCATE(grid%g_ph_btye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
1058  if (ierr.ne.0) then
1059  CALL wrf_error_fatal ( &
1060 'frame/module_domain.f: Failed to allocate grid%g_ph_btye(sm31:em31,sm33:em33,spec_bdy_width). ')
1061  endif
1062 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_ph_btye=initial_data_value
1063 ELSE
1064 ALLOCATE(grid%g_ph_btxs(1,1,1),STAT=ierr)
1065  if (ierr.ne.0) then
1066  CALL wrf_error_fatal ( &
1067 'frame/module_domain.f: Failed to allocate grid%g_ph_btxs(1,1,1).  ')
1068  endif
1069 ALLOCATE(grid%g_ph_btxe(1,1,1),STAT=ierr)
1070  if (ierr.ne.0) then
1071  CALL wrf_error_fatal ( &
1072 'frame/module_domain.f: Failed to allocate grid%g_ph_btxe(1,1,1).  ')
1073  endif
1074 ALLOCATE(grid%g_ph_btys(1,1,1),STAT=ierr)
1075  if (ierr.ne.0) then
1076  CALL wrf_error_fatal ( &
1077 'frame/module_domain.f: Failed to allocate grid%g_ph_btys(1,1,1).  ')
1078  endif
1079 ALLOCATE(grid%g_ph_btye(1,1,1),STAT=ierr)
1080  if (ierr.ne.0) then
1081  CALL wrf_error_fatal ( &
1082 'frame/module_domain.f: Failed to allocate grid%g_ph_btye(1,1,1).  ')
1083  endif
1084 ENDIF
1085 IF(IAND(1,tl).NE.0)THEN
1086 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
1087 ALLOCATE(grid%a_t_1(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
1088  if (ierr.ne.0) then
1089  CALL wrf_error_fatal ( &
1090 'frame/module_domain.f: Failed to allocate grid%a_t_1(sm31:em31,sm32:em32,sm33:em33). ')
1091  endif
1092 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_t_1=initial_data_value
1093 ELSE
1094 ALLOCATE(grid%a_t_1(1,1,1),STAT=ierr)
1095  if (ierr.ne.0) then
1096  CALL wrf_error_fatal ( &
1097 'frame/module_domain.f: Failed to allocate grid%a_t_1(1,1,1).  ')
1098  endif
1099 ENDIF
1100 IF(IAND(2,tl).NE.0)THEN
1101 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
1102 ALLOCATE(grid%a_t_2(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
1103  if (ierr.ne.0) then
1104  CALL wrf_error_fatal ( &
1105 'frame/module_domain.f: Failed to allocate grid%a_t_2(sm31:em31,sm32:em32,sm33:em33). ')
1106  endif
1107 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_t_2=initial_data_value
1108 ELSE
1109 ALLOCATE(grid%a_t_2(1,1,1),STAT=ierr)
1110  if (ierr.ne.0) then
1111  CALL wrf_error_fatal ( &
1112 'frame/module_domain.f: Failed to allocate grid%a_t_2(1,1,1).  ')
1113  endif
1114 ENDIF
1115 IF(.NOT.inter_domain)THEN
1116 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1117 ALLOCATE(grid%a_t_bxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
1118  if (ierr.ne.0) then
1119  CALL wrf_error_fatal ( &
1120 'frame/module_domain.f: Failed to allocate grid%a_t_bxs(sm32:em32,sm33:em33,spec_bdy_width). ')
1121  endif
1122 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_t_bxs=initial_data_value
1123 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1124 ALLOCATE(grid%a_t_bxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
1125  if (ierr.ne.0) then
1126  CALL wrf_error_fatal ( &
1127 'frame/module_domain.f: Failed to allocate grid%a_t_bxe(sm32:em32,sm33:em33,spec_bdy_width). ')
1128  endif
1129 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_t_bxe=initial_data_value
1130 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1131 ALLOCATE(grid%a_t_bys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
1132  if (ierr.ne.0) then
1133  CALL wrf_error_fatal ( &
1134 'frame/module_domain.f: Failed to allocate grid%a_t_bys(sm31:em31,sm33:em33,spec_bdy_width). ')
1135  endif
1136 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_t_bys=initial_data_value
1137 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1138 ALLOCATE(grid%a_t_bye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
1139  if (ierr.ne.0) then
1140  CALL wrf_error_fatal ( &
1141 'frame/module_domain.f: Failed to allocate grid%a_t_bye(sm31:em31,sm33:em33,spec_bdy_width). ')
1142  endif
1143 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_t_bye=initial_data_value
1144 ELSE
1145 ALLOCATE(grid%a_t_bxs(1,1,1),STAT=ierr)
1146  if (ierr.ne.0) then
1147  CALL wrf_error_fatal ( &
1148 'frame/module_domain.f: Failed to allocate grid%a_t_bxs(1,1,1).  ')
1149  endif
1150 ALLOCATE(grid%a_t_bxe(1,1,1),STAT=ierr)
1151  if (ierr.ne.0) then
1152  CALL wrf_error_fatal ( &
1153 'frame/module_domain.f: Failed to allocate grid%a_t_bxe(1,1,1).  ')
1154  endif
1155 ALLOCATE(grid%a_t_bys(1,1,1),STAT=ierr)
1156  if (ierr.ne.0) then
1157  CALL wrf_error_fatal ( &
1158 'frame/module_domain.f: Failed to allocate grid%a_t_bys(1,1,1).  ')
1159  endif
1160 ALLOCATE(grid%a_t_bye(1,1,1),STAT=ierr)
1161  if (ierr.ne.0) then
1162  CALL wrf_error_fatal ( &
1163 'frame/module_domain.f: Failed to allocate grid%a_t_bye(1,1,1).  ')
1164  endif
1165 ENDIF
1166 IF(.NOT.inter_domain)THEN
1167 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1168 ALLOCATE(grid%a_t_btxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
1169  if (ierr.ne.0) then
1170  CALL wrf_error_fatal ( &
1171 'frame/module_domain.f: Failed to allocate grid%a_t_btxs(sm32:em32,sm33:em33,spec_bdy_width). ')
1172  endif
1173 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_t_btxs=initial_data_value
1174 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1175 ALLOCATE(grid%a_t_btxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
1176  if (ierr.ne.0) then
1177  CALL wrf_error_fatal ( &
1178 'frame/module_domain.f: Failed to allocate grid%a_t_btxe(sm32:em32,sm33:em33,spec_bdy_width). ')
1179  endif
1180 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_t_btxe=initial_data_value
1181 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1182 ALLOCATE(grid%a_t_btys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
1183  if (ierr.ne.0) then
1184  CALL wrf_error_fatal ( &
1185 'frame/module_domain.f: Failed to allocate grid%a_t_btys(sm31:em31,sm33:em33,spec_bdy_width). ')
1186  endif
1187 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_t_btys=initial_data_value
1188 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1189 ALLOCATE(grid%a_t_btye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
1190  if (ierr.ne.0) then
1191  CALL wrf_error_fatal ( &
1192 'frame/module_domain.f: Failed to allocate grid%a_t_btye(sm31:em31,sm33:em33,spec_bdy_width). ')
1193  endif
1194 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_t_btye=initial_data_value
1195 ELSE
1196 ALLOCATE(grid%a_t_btxs(1,1,1),STAT=ierr)
1197  if (ierr.ne.0) then
1198  CALL wrf_error_fatal ( &
1199 'frame/module_domain.f: Failed to allocate grid%a_t_btxs(1,1,1).  ')
1200  endif
1201 ALLOCATE(grid%a_t_btxe(1,1,1),STAT=ierr)
1202  if (ierr.ne.0) then
1203  CALL wrf_error_fatal ( &
1204 'frame/module_domain.f: Failed to allocate grid%a_t_btxe(1,1,1).  ')
1205  endif
1206 ALLOCATE(grid%a_t_btys(1,1,1),STAT=ierr)
1207  if (ierr.ne.0) then
1208  CALL wrf_error_fatal ( &
1209 'frame/module_domain.f: Failed to allocate grid%a_t_btys(1,1,1).  ')
1210  endif
1211 ALLOCATE(grid%a_t_btye(1,1,1),STAT=ierr)
1212  if (ierr.ne.0) then
1213  CALL wrf_error_fatal ( &
1214 'frame/module_domain.f: Failed to allocate grid%a_t_btye(1,1,1).  ')
1215  endif
1216 ENDIF
1217 IF(IAND(1,tl).NE.0)THEN
1218 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
1219 ALLOCATE(grid%g_t_1(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
1220  if (ierr.ne.0) then
1221  CALL wrf_error_fatal ( &
1222 'frame/module_domain.f: Failed to allocate grid%g_t_1(sm31:em31,sm32:em32,sm33:em33). ')
1223  endif
1224 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_t_1=initial_data_value
1225 ELSE
1226 ALLOCATE(grid%g_t_1(1,1,1),STAT=ierr)
1227  if (ierr.ne.0) then
1228  CALL wrf_error_fatal ( &
1229 'frame/module_domain.f: Failed to allocate grid%g_t_1(1,1,1).  ')
1230  endif
1231 ENDIF
1232 IF(IAND(2,tl).NE.0)THEN
1233 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
1234 ALLOCATE(grid%g_t_2(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
1235  if (ierr.ne.0) then
1236  CALL wrf_error_fatal ( &
1237 'frame/module_domain.f: Failed to allocate grid%g_t_2(sm31:em31,sm32:em32,sm33:em33). ')
1238  endif
1239 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_t_2=initial_data_value
1240 ELSE
1241 ALLOCATE(grid%g_t_2(1,1,1),STAT=ierr)
1242  if (ierr.ne.0) then
1243  CALL wrf_error_fatal ( &
1244 'frame/module_domain.f: Failed to allocate grid%g_t_2(1,1,1).  ')
1245  endif
1246 ENDIF
1247 IF(.NOT.inter_domain)THEN
1248 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1249 ALLOCATE(grid%g_t_bxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
1250  if (ierr.ne.0) then
1251  CALL wrf_error_fatal ( &
1252 'frame/module_domain.f: Failed to allocate grid%g_t_bxs(sm32:em32,sm33:em33,spec_bdy_width). ')
1253  endif
1254 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_t_bxs=initial_data_value
1255 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1256 ALLOCATE(grid%g_t_bxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
1257  if (ierr.ne.0) then
1258  CALL wrf_error_fatal ( &
1259 'frame/module_domain.f: Failed to allocate grid%g_t_bxe(sm32:em32,sm33:em33,spec_bdy_width). ')
1260  endif
1261 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_t_bxe=initial_data_value
1262 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1263 ALLOCATE(grid%g_t_bys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
1264  if (ierr.ne.0) then
1265  CALL wrf_error_fatal ( &
1266 'frame/module_domain.f: Failed to allocate grid%g_t_bys(sm31:em31,sm33:em33,spec_bdy_width). ')
1267  endif
1268 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_t_bys=initial_data_value
1269 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1270 ALLOCATE(grid%g_t_bye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
1271  if (ierr.ne.0) then
1272  CALL wrf_error_fatal ( &
1273 'frame/module_domain.f: Failed to allocate grid%g_t_bye(sm31:em31,sm33:em33,spec_bdy_width). ')
1274  endif
1275 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_t_bye=initial_data_value
1276 ELSE
1277 ALLOCATE(grid%g_t_bxs(1,1,1),STAT=ierr)
1278  if (ierr.ne.0) then
1279  CALL wrf_error_fatal ( &
1280 'frame/module_domain.f: Failed to allocate grid%g_t_bxs(1,1,1).  ')
1281  endif
1282 ALLOCATE(grid%g_t_bxe(1,1,1),STAT=ierr)
1283  if (ierr.ne.0) then
1284  CALL wrf_error_fatal ( &
1285 'frame/module_domain.f: Failed to allocate grid%g_t_bxe(1,1,1).  ')
1286  endif
1287 ALLOCATE(grid%g_t_bys(1,1,1),STAT=ierr)
1288  if (ierr.ne.0) then
1289  CALL wrf_error_fatal ( &
1290 'frame/module_domain.f: Failed to allocate grid%g_t_bys(1,1,1).  ')
1291  endif
1292 ALLOCATE(grid%g_t_bye(1,1,1),STAT=ierr)
1293  if (ierr.ne.0) then
1294  CALL wrf_error_fatal ( &
1295 'frame/module_domain.f: Failed to allocate grid%g_t_bye(1,1,1).  ')
1296  endif
1297 ENDIF
1298 IF(.NOT.inter_domain)THEN
1299 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1300 ALLOCATE(grid%g_t_btxs(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
1301  if (ierr.ne.0) then
1302  CALL wrf_error_fatal ( &
1303 'frame/module_domain.f: Failed to allocate grid%g_t_btxs(sm32:em32,sm33:em33,spec_bdy_width). ')
1304  endif
1305 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_t_btxs=initial_data_value
1306 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1307 ALLOCATE(grid%g_t_btxe(sm32:em32,sm33:em33,spec_bdy_width),STAT=ierr)
1308  if (ierr.ne.0) then
1309  CALL wrf_error_fatal ( &
1310 'frame/module_domain.f: Failed to allocate grid%g_t_btxe(sm32:em32,sm33:em33,spec_bdy_width). ')
1311  endif
1312 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_t_btxe=initial_data_value
1313 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1314 ALLOCATE(grid%g_t_btys(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
1315  if (ierr.ne.0) then
1316  CALL wrf_error_fatal ( &
1317 'frame/module_domain.f: Failed to allocate grid%g_t_btys(sm31:em31,sm33:em33,spec_bdy_width). ')
1318  endif
1319 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_t_btys=initial_data_value
1320 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width))) * RWORDSIZE
1321 ALLOCATE(grid%g_t_btye(sm31:em31,sm33:em33,spec_bdy_width),STAT=ierr)
1322  if (ierr.ne.0) then
1323  CALL wrf_error_fatal ( &
1324 'frame/module_domain.f: Failed to allocate grid%g_t_btye(sm31:em31,sm33:em33,spec_bdy_width). ')
1325  endif
1326 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_t_btye=initial_data_value
1327 ELSE
1328 ALLOCATE(grid%g_t_btxs(1,1,1),STAT=ierr)
1329  if (ierr.ne.0) then
1330  CALL wrf_error_fatal ( &
1331 'frame/module_domain.f: Failed to allocate grid%g_t_btxs(1,1,1).  ')
1332  endif
1333 ALLOCATE(grid%g_t_btxe(1,1,1),STAT=ierr)
1334  if (ierr.ne.0) then
1335  CALL wrf_error_fatal ( &
1336 'frame/module_domain.f: Failed to allocate grid%g_t_btxe(1,1,1).  ')
1337  endif
1338 ALLOCATE(grid%g_t_btys(1,1,1),STAT=ierr)
1339  if (ierr.ne.0) then
1340  CALL wrf_error_fatal ( &
1341 'frame/module_domain.f: Failed to allocate grid%g_t_btys(1,1,1).  ')
1342  endif
1343 ALLOCATE(grid%g_t_btye(1,1,1),STAT=ierr)
1344  if (ierr.ne.0) then
1345  CALL wrf_error_fatal ( &
1346 'frame/module_domain.f: Failed to allocate grid%g_t_btye(1,1,1).  ')
1347  endif
1348 ENDIF
1349 IF(IAND(1,tl).NE.0)THEN
1350 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1351 ALLOCATE(grid%a_mu_1(sm31:em31,sm32:em32),STAT=ierr)
1352  if (ierr.ne.0) then
1353  CALL wrf_error_fatal ( &
1354 'frame/module_domain.f: Failed to allocate grid%a_mu_1(sm31:em31,sm32:em32). ')
1355  endif
1356 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_mu_1=initial_data_value
1357 ELSE
1358 ALLOCATE(grid%a_mu_1(1,1),STAT=ierr)
1359  if (ierr.ne.0) then
1360  CALL wrf_error_fatal ( &
1361 'frame/module_domain.f: Failed to allocate grid%a_mu_1(1,1).  ')
1362  endif
1363 ENDIF
1364 IF(IAND(2,tl).NE.0)THEN
1365 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1366 ALLOCATE(grid%a_mu_2(sm31:em31,sm32:em32),STAT=ierr)
1367  if (ierr.ne.0) then
1368  CALL wrf_error_fatal ( &
1369 'frame/module_domain.f: Failed to allocate grid%a_mu_2(sm31:em31,sm32:em32). ')
1370  endif
1371 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_mu_2=initial_data_value
1372 ELSE
1373 ALLOCATE(grid%a_mu_2(1,1),STAT=ierr)
1374  if (ierr.ne.0) then
1375  CALL wrf_error_fatal ( &
1376 'frame/module_domain.f: Failed to allocate grid%a_mu_2(1,1).  ')
1377  endif
1378 ENDIF
1379 IF(.NOT.inter_domain)THEN
1380 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(spec_bdy_width))) * RWORDSIZE
1381 ALLOCATE(grid%a_mu_bxs(sm32:em32,1,spec_bdy_width),STAT=ierr)
1382  if (ierr.ne.0) then
1383  CALL wrf_error_fatal ( &
1384 'frame/module_domain.f: Failed to allocate grid%a_mu_bxs(sm32:em32,1,spec_bdy_width). ')
1385  endif
1386 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_mu_bxs=initial_data_value
1387 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(spec_bdy_width))) * RWORDSIZE
1388 ALLOCATE(grid%a_mu_bxe(sm32:em32,1,spec_bdy_width),STAT=ierr)
1389  if (ierr.ne.0) then
1390  CALL wrf_error_fatal ( &
1391 'frame/module_domain.f: Failed to allocate grid%a_mu_bxe(sm32:em32,1,spec_bdy_width). ')
1392  endif
1393 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_mu_bxe=initial_data_value
1394 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(spec_bdy_width))) * RWORDSIZE
1395 ALLOCATE(grid%a_mu_bys(sm31:em31,1,spec_bdy_width),STAT=ierr)
1396  if (ierr.ne.0) then
1397  CALL wrf_error_fatal ( &
1398 'frame/module_domain.f: Failed to allocate grid%a_mu_bys(sm31:em31,1,spec_bdy_width). ')
1399  endif
1400 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_mu_bys=initial_data_value
1401 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(spec_bdy_width))) * RWORDSIZE
1402 ALLOCATE(grid%a_mu_bye(sm31:em31,1,spec_bdy_width),STAT=ierr)
1403  if (ierr.ne.0) then
1404  CALL wrf_error_fatal ( &
1405 'frame/module_domain.f: Failed to allocate grid%a_mu_bye(sm31:em31,1,spec_bdy_width). ')
1406  endif
1407 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_mu_bye=initial_data_value
1408 ELSE
1409 ALLOCATE(grid%a_mu_bxs(1,1,1),STAT=ierr)
1410  if (ierr.ne.0) then
1411  CALL wrf_error_fatal ( &
1412 'frame/module_domain.f: Failed to allocate grid%a_mu_bxs(1,1,1).  ')
1413  endif
1414 ALLOCATE(grid%a_mu_bxe(1,1,1),STAT=ierr)
1415  if (ierr.ne.0) then
1416  CALL wrf_error_fatal ( &
1417 'frame/module_domain.f: Failed to allocate grid%a_mu_bxe(1,1,1).  ')
1418  endif
1419 ALLOCATE(grid%a_mu_bys(1,1,1),STAT=ierr)
1420  if (ierr.ne.0) then
1421  CALL wrf_error_fatal ( &
1422 'frame/module_domain.f: Failed to allocate grid%a_mu_bys(1,1,1).  ')
1423  endif
1424 ALLOCATE(grid%a_mu_bye(1,1,1),STAT=ierr)
1425  if (ierr.ne.0) then
1426  CALL wrf_error_fatal ( &
1427 'frame/module_domain.f: Failed to allocate grid%a_mu_bye(1,1,1).  ')
1428  endif
1429 ENDIF
1430 IF(.NOT.inter_domain)THEN
1431 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(spec_bdy_width))) * RWORDSIZE
1432 ALLOCATE(grid%a_mu_btxs(sm32:em32,1,spec_bdy_width),STAT=ierr)
1433  if (ierr.ne.0) then
1434  CALL wrf_error_fatal ( &
1435 'frame/module_domain.f: Failed to allocate grid%a_mu_btxs(sm32:em32,1,spec_bdy_width). ')
1436  endif
1437 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_mu_btxs=initial_data_value
1438 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(spec_bdy_width))) * RWORDSIZE
1439 ALLOCATE(grid%a_mu_btxe(sm32:em32,1,spec_bdy_width),STAT=ierr)
1440  if (ierr.ne.0) then
1441  CALL wrf_error_fatal ( &
1442 'frame/module_domain.f: Failed to allocate grid%a_mu_btxe(sm32:em32,1,spec_bdy_width). ')
1443  endif
1444 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_mu_btxe=initial_data_value
1445 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(spec_bdy_width))) * RWORDSIZE
1446 ALLOCATE(grid%a_mu_btys(sm31:em31,1,spec_bdy_width),STAT=ierr)
1447  if (ierr.ne.0) then
1448  CALL wrf_error_fatal ( &
1449 'frame/module_domain.f: Failed to allocate grid%a_mu_btys(sm31:em31,1,spec_bdy_width). ')
1450  endif
1451 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_mu_btys=initial_data_value
1452 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(spec_bdy_width))) * RWORDSIZE
1453 ALLOCATE(grid%a_mu_btye(sm31:em31,1,spec_bdy_width),STAT=ierr)
1454  if (ierr.ne.0) then
1455  CALL wrf_error_fatal ( &
1456 'frame/module_domain.f: Failed to allocate grid%a_mu_btye(sm31:em31,1,spec_bdy_width). ')
1457  endif
1458 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_mu_btye=initial_data_value
1459 ELSE
1460 ALLOCATE(grid%a_mu_btxs(1,1,1),STAT=ierr)
1461  if (ierr.ne.0) then
1462  CALL wrf_error_fatal ( &
1463 'frame/module_domain.f: Failed to allocate grid%a_mu_btxs(1,1,1).  ')
1464  endif
1465 ALLOCATE(grid%a_mu_btxe(1,1,1),STAT=ierr)
1466  if (ierr.ne.0) then
1467  CALL wrf_error_fatal ( &
1468 'frame/module_domain.f: Failed to allocate grid%a_mu_btxe(1,1,1).  ')
1469  endif
1470 ALLOCATE(grid%a_mu_btys(1,1,1),STAT=ierr)
1471  if (ierr.ne.0) then
1472  CALL wrf_error_fatal ( &
1473 'frame/module_domain.f: Failed to allocate grid%a_mu_btys(1,1,1).  ')
1474  endif
1475 ALLOCATE(grid%a_mu_btye(1,1,1),STAT=ierr)
1476  if (ierr.ne.0) then
1477  CALL wrf_error_fatal ( &
1478 'frame/module_domain.f: Failed to allocate grid%a_mu_btye(1,1,1).  ')
1479  endif
1480 ENDIF
1481 IF(IAND(1,tl).NE.0)THEN
1482 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1483 ALLOCATE(grid%g_mu_1(sm31:em31,sm32:em32),STAT=ierr)
1484  if (ierr.ne.0) then
1485  CALL wrf_error_fatal ( &
1486 'frame/module_domain.f: Failed to allocate grid%g_mu_1(sm31:em31,sm32:em32). ')
1487  endif
1488 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_mu_1=initial_data_value
1489 ELSE
1490 ALLOCATE(grid%g_mu_1(1,1),STAT=ierr)
1491  if (ierr.ne.0) then
1492  CALL wrf_error_fatal ( &
1493 'frame/module_domain.f: Failed to allocate grid%g_mu_1(1,1).  ')
1494  endif
1495 ENDIF
1496 IF(IAND(2,tl).NE.0)THEN
1497 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1498 ALLOCATE(grid%g_mu_2(sm31:em31,sm32:em32),STAT=ierr)
1499  if (ierr.ne.0) then
1500  CALL wrf_error_fatal ( &
1501 'frame/module_domain.f: Failed to allocate grid%g_mu_2(sm31:em31,sm32:em32). ')
1502  endif
1503 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_mu_2=initial_data_value
1504 ELSE
1505 ALLOCATE(grid%g_mu_2(1,1),STAT=ierr)
1506  if (ierr.ne.0) then
1507  CALL wrf_error_fatal ( &
1508 'frame/module_domain.f: Failed to allocate grid%g_mu_2(1,1).  ')
1509  endif
1510 ENDIF
1511 IF(.NOT.inter_domain)THEN
1512 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(spec_bdy_width))) * RWORDSIZE
1513 ALLOCATE(grid%g_mu_bxs(sm32:em32,1,spec_bdy_width),STAT=ierr)
1514  if (ierr.ne.0) then
1515  CALL wrf_error_fatal ( &
1516 'frame/module_domain.f: Failed to allocate grid%g_mu_bxs(sm32:em32,1,spec_bdy_width). ')
1517  endif
1518 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_mu_bxs=initial_data_value
1519 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(spec_bdy_width))) * RWORDSIZE
1520 ALLOCATE(grid%g_mu_bxe(sm32:em32,1,spec_bdy_width),STAT=ierr)
1521  if (ierr.ne.0) then
1522  CALL wrf_error_fatal ( &
1523 'frame/module_domain.f: Failed to allocate grid%g_mu_bxe(sm32:em32,1,spec_bdy_width). ')
1524  endif
1525 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_mu_bxe=initial_data_value
1526 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(spec_bdy_width))) * RWORDSIZE
1527 ALLOCATE(grid%g_mu_bys(sm31:em31,1,spec_bdy_width),STAT=ierr)
1528  if (ierr.ne.0) then
1529  CALL wrf_error_fatal ( &
1530 'frame/module_domain.f: Failed to allocate grid%g_mu_bys(sm31:em31,1,spec_bdy_width). ')
1531  endif
1532 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_mu_bys=initial_data_value
1533 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(spec_bdy_width))) * RWORDSIZE
1534 ALLOCATE(grid%g_mu_bye(sm31:em31,1,spec_bdy_width),STAT=ierr)
1535  if (ierr.ne.0) then
1536  CALL wrf_error_fatal ( &
1537 'frame/module_domain.f: Failed to allocate grid%g_mu_bye(sm31:em31,1,spec_bdy_width). ')
1538  endif
1539 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_mu_bye=initial_data_value
1540 ELSE
1541 ALLOCATE(grid%g_mu_bxs(1,1,1),STAT=ierr)
1542  if (ierr.ne.0) then
1543  CALL wrf_error_fatal ( &
1544 'frame/module_domain.f: Failed to allocate grid%g_mu_bxs(1,1,1).  ')
1545  endif
1546 ALLOCATE(grid%g_mu_bxe(1,1,1),STAT=ierr)
1547  if (ierr.ne.0) then
1548  CALL wrf_error_fatal ( &
1549 'frame/module_domain.f: Failed to allocate grid%g_mu_bxe(1,1,1).  ')
1550  endif
1551 ALLOCATE(grid%g_mu_bys(1,1,1),STAT=ierr)
1552  if (ierr.ne.0) then
1553  CALL wrf_error_fatal ( &
1554 'frame/module_domain.f: Failed to allocate grid%g_mu_bys(1,1,1).  ')
1555  endif
1556 ALLOCATE(grid%g_mu_bye(1,1,1),STAT=ierr)
1557  if (ierr.ne.0) then
1558  CALL wrf_error_fatal ( &
1559 'frame/module_domain.f: Failed to allocate grid%g_mu_bye(1,1,1).  ')
1560  endif
1561 ENDIF
1562 IF(.NOT.inter_domain)THEN
1563 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(spec_bdy_width))) * RWORDSIZE
1564 ALLOCATE(grid%g_mu_btxs(sm32:em32,1,spec_bdy_width),STAT=ierr)
1565  if (ierr.ne.0) then
1566  CALL wrf_error_fatal ( &
1567 'frame/module_domain.f: Failed to allocate grid%g_mu_btxs(sm32:em32,1,spec_bdy_width). ')
1568  endif
1569 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_mu_btxs=initial_data_value
1570 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(spec_bdy_width))) * RWORDSIZE
1571 ALLOCATE(grid%g_mu_btxe(sm32:em32,1,spec_bdy_width),STAT=ierr)
1572  if (ierr.ne.0) then
1573  CALL wrf_error_fatal ( &
1574 'frame/module_domain.f: Failed to allocate grid%g_mu_btxe(sm32:em32,1,spec_bdy_width). ')
1575  endif
1576 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_mu_btxe=initial_data_value
1577 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(spec_bdy_width))) * RWORDSIZE
1578 ALLOCATE(grid%g_mu_btys(sm31:em31,1,spec_bdy_width),STAT=ierr)
1579  if (ierr.ne.0) then
1580  CALL wrf_error_fatal ( &
1581 'frame/module_domain.f: Failed to allocate grid%g_mu_btys(sm31:em31,1,spec_bdy_width). ')
1582  endif
1583 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_mu_btys=initial_data_value
1584 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(spec_bdy_width))) * RWORDSIZE
1585 ALLOCATE(grid%g_mu_btye(sm31:em31,1,spec_bdy_width),STAT=ierr)
1586  if (ierr.ne.0) then
1587  CALL wrf_error_fatal ( &
1588 'frame/module_domain.f: Failed to allocate grid%g_mu_btye(sm31:em31,1,spec_bdy_width). ')
1589  endif
1590 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_mu_btye=initial_data_value
1591 ELSE
1592 ALLOCATE(grid%g_mu_btxs(1,1,1),STAT=ierr)
1593  if (ierr.ne.0) then
1594  CALL wrf_error_fatal ( &
1595 'frame/module_domain.f: Failed to allocate grid%g_mu_btxs(1,1,1).  ')
1596  endif
1597 ALLOCATE(grid%g_mu_btxe(1,1,1),STAT=ierr)
1598  if (ierr.ne.0) then
1599  CALL wrf_error_fatal ( &
1600 'frame/module_domain.f: Failed to allocate grid%g_mu_btxe(1,1,1).  ')
1601  endif
1602 ALLOCATE(grid%g_mu_btys(1,1,1),STAT=ierr)
1603  if (ierr.ne.0) then
1604  CALL wrf_error_fatal ( &
1605 'frame/module_domain.f: Failed to allocate grid%g_mu_btys(1,1,1).  ')
1606  endif
1607 ALLOCATE(grid%g_mu_btye(1,1,1),STAT=ierr)
1608  if (ierr.ne.0) then
1609  CALL wrf_error_fatal ( &
1610 'frame/module_domain.f: Failed to allocate grid%g_mu_btye(1,1,1).  ')
1611  endif
1612 ENDIF
1613 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1614 ALLOCATE(grid%nest_pos(sm31:em31,sm32:em32),STAT=ierr)
1615  if (ierr.ne.0) then
1616  CALL wrf_error_fatal ( &
1617 'frame/module_domain.f: Failed to allocate grid%nest_pos(sm31:em31,sm32:em32). ')
1618  endif
1619 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%nest_pos=initial_data_value
1620 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1621 ALLOCATE(grid%nest_mask(sm31:em31,sm32:em32),STAT=ierr)
1622  if (ierr.ne.0) then
1623  CALL wrf_error_fatal ( &
1624 'frame/module_domain.f: Failed to allocate grid%nest_mask(sm31:em31,sm32:em32). ')
1625  endif
1626 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%nest_mask=initial_data_value
1627 IF(.NOT.inter_domain)THEN
1628 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1629 ALLOCATE(grid%ht_coarse(sm31:em31,sm32:em32),STAT=ierr)
1630  if (ierr.ne.0) then
1631  CALL wrf_error_fatal ( &
1632 'frame/module_domain.f: Failed to allocate grid%ht_coarse(sm31:em31,sm32:em32). ')
1633  endif
1634 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ht_coarse=initial_data_value
1635 ELSE
1636 ALLOCATE(grid%ht_coarse(1,1),STAT=ierr)
1637  if (ierr.ne.0) then
1638  CALL wrf_error_fatal ( &
1639 'frame/module_domain.f: Failed to allocate grid%ht_coarse(1,1).  ')
1640  endif
1641 ENDIF
1642 IF(.NOT.inter_domain)THEN
1643 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
1644 ALLOCATE(grid%a_z(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
1645  if (ierr.ne.0) then
1646  CALL wrf_error_fatal ( &
1647 'frame/module_domain.f: Failed to allocate grid%a_z(sm31:em31,sm32:em32,sm33:em33). ')
1648  endif
1649 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_z=initial_data_value
1650 ELSE
1651 ALLOCATE(grid%a_z(1,1,1),STAT=ierr)
1652  if (ierr.ne.0) then
1653  CALL wrf_error_fatal ( &
1654 'frame/module_domain.f: Failed to allocate grid%a_z(1,1,1).  ')
1655  endif
1656 ENDIF
1657 IF(.NOT.inter_domain)THEN
1658 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
1659 ALLOCATE(grid%g_z(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
1660  if (ierr.ne.0) then
1661  CALL wrf_error_fatal ( &
1662 'frame/module_domain.f: Failed to allocate grid%g_z(sm31:em31,sm32:em32,sm33:em33). ')
1663  endif
1664 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_z=initial_data_value
1665 ELSE
1666 ALLOCATE(grid%g_z(1,1,1),STAT=ierr)
1667  if (ierr.ne.0) then
1668  CALL wrf_error_fatal ( &
1669 'frame/module_domain.f: Failed to allocate grid%g_z(1,1,1).  ')
1670  endif
1671 ENDIF
1672 IF ( setinitval .EQ. 3 ) grid%cfn=initial_data_value
1673 IF ( setinitval .EQ. 3 ) grid%cfn1=initial_data_value
1674 IF ( setinitval .EQ. 3 ) grid%step_number=0
1675 IF(.NOT.inter_domain)THEN
1676 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
1677 ALLOCATE(grid%kma_a(sm33:em33),STAT=ierr)
1678  if (ierr.ne.0) then
1679  CALL wrf_error_fatal ( &
1680 'frame/module_domain.f: Failed to allocate grid%kma_a(sm33:em33). ')
1681  endif
1682 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%kma_a=initial_data_value
1683 ELSE
1684 ALLOCATE(grid%kma_a(1),STAT=ierr)
1685  if (ierr.ne.0) then
1686  CALL wrf_error_fatal ( &
1687 'frame/module_domain.f: Failed to allocate grid%kma_a(1).  ')
1688  endif
1689 ENDIF
1690 IF(.NOT.inter_domain)THEN
1691 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
1692 ALLOCATE(grid%kma_b(sm33:em33),STAT=ierr)
1693  if (ierr.ne.0) then
1694  CALL wrf_error_fatal ( &
1695 'frame/module_domain.f: Failed to allocate grid%kma_b(sm33:em33). ')
1696  endif
1697 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%kma_b=initial_data_value
1698 ELSE
1699 ALLOCATE(grid%kma_b(1),STAT=ierr)
1700  if (ierr.ne.0) then
1701  CALL wrf_error_fatal ( &
1702 'frame/module_domain.f: Failed to allocate grid%kma_b(1).  ')
1703  endif
1704 ENDIF
1705 IF(.NOT.inter_domain)THEN
1706 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1707 ALLOCATE(grid%q2(sm31:em31,sm32:em32),STAT=ierr)
1708  if (ierr.ne.0) then
1709  CALL wrf_error_fatal ( &
1710 'frame/module_domain.f: Failed to allocate grid%q2(sm31:em31,sm32:em32). ')
1711  endif
1712 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%q2=initial_data_value
1713 ELSE
1714 ALLOCATE(grid%q2(1,1),STAT=ierr)
1715  if (ierr.ne.0) then
1716  CALL wrf_error_fatal ( &
1717 'frame/module_domain.f: Failed to allocate grid%q2(1,1).  ')
1718  endif
1719 ENDIF
1720 IF(.NOT.inter_domain)THEN
1721 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1722 ALLOCATE(grid%t2(sm31:em31,sm32:em32),STAT=ierr)
1723  if (ierr.ne.0) then
1724  CALL wrf_error_fatal ( &
1725 'frame/module_domain.f: Failed to allocate grid%t2(sm31:em31,sm32:em32). ')
1726  endif
1727 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%t2=initial_data_value
1728 ELSE
1729 ALLOCATE(grid%t2(1,1),STAT=ierr)
1730  if (ierr.ne.0) then
1731  CALL wrf_error_fatal ( &
1732 'frame/module_domain.f: Failed to allocate grid%t2(1,1).  ')
1733  endif
1734 ENDIF
1735 IF(.NOT.inter_domain)THEN
1736 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1737 ALLOCATE(grid%th2(sm31:em31,sm32:em32),STAT=ierr)
1738  if (ierr.ne.0) then
1739  CALL wrf_error_fatal ( &
1740 'frame/module_domain.f: Failed to allocate grid%th2(sm31:em31,sm32:em32). ')
1741  endif
1742 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%th2=initial_data_value
1743 ELSE
1744 ALLOCATE(grid%th2(1,1),STAT=ierr)
1745  if (ierr.ne.0) then
1746  CALL wrf_error_fatal ( &
1747 'frame/module_domain.f: Failed to allocate grid%th2(1,1).  ')
1748  endif
1749 ENDIF
1750 IF(.NOT.inter_domain)THEN
1751 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1752 ALLOCATE(grid%psfc(sm31:em31,sm32:em32),STAT=ierr)
1753  if (ierr.ne.0) then
1754  CALL wrf_error_fatal ( &
1755 'frame/module_domain.f: Failed to allocate grid%psfc(sm31:em31,sm32:em32). ')
1756  endif
1757 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%psfc=initial_data_value
1758 ELSE
1759 ALLOCATE(grid%psfc(1,1),STAT=ierr)
1760  if (ierr.ne.0) then
1761  CALL wrf_error_fatal ( &
1762 'frame/module_domain.f: Failed to allocate grid%psfc(1,1).  ')
1763  endif
1764 ENDIF
1765 IF(.NOT.inter_domain)THEN
1766 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1767 ALLOCATE(grid%u10(sm31:em31,sm32:em32),STAT=ierr)
1768  if (ierr.ne.0) then
1769  CALL wrf_error_fatal ( &
1770 'frame/module_domain.f: Failed to allocate grid%u10(sm31:em31,sm32:em32). ')
1771  endif
1772 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%u10=initial_data_value
1773 ELSE
1774 ALLOCATE(grid%u10(1,1),STAT=ierr)
1775  if (ierr.ne.0) then
1776  CALL wrf_error_fatal ( &
1777 'frame/module_domain.f: Failed to allocate grid%u10(1,1).  ')
1778  endif
1779 ENDIF
1780 IF(.NOT.inter_domain)THEN
1781 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1782 ALLOCATE(grid%v10(sm31:em31,sm32:em32),STAT=ierr)
1783  if (ierr.ne.0) then
1784  CALL wrf_error_fatal ( &
1785 'frame/module_domain.f: Failed to allocate grid%v10(sm31:em31,sm32:em32). ')
1786  endif
1787 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%v10=initial_data_value
1788 ELSE
1789 ALLOCATE(grid%v10(1,1),STAT=ierr)
1790  if (ierr.ne.0) then
1791  CALL wrf_error_fatal ( &
1792 'frame/module_domain.f: Failed to allocate grid%v10(1,1).  ')
1793  endif
1794 ENDIF
1795 IF(.NOT.inter_domain)THEN
1796 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1797 ALLOCATE(grid%uratx(sm31:em31,sm32:em32),STAT=ierr)
1798  if (ierr.ne.0) then
1799  CALL wrf_error_fatal ( &
1800 'frame/module_domain.f: Failed to allocate grid%uratx(sm31:em31,sm32:em32). ')
1801  endif
1802 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%uratx=initial_data_value
1803 ELSE
1804 ALLOCATE(grid%uratx(1,1),STAT=ierr)
1805  if (ierr.ne.0) then
1806  CALL wrf_error_fatal ( &
1807 'frame/module_domain.f: Failed to allocate grid%uratx(1,1).  ')
1808  endif
1809 ENDIF
1810 IF(.NOT.inter_domain)THEN
1811 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1812 ALLOCATE(grid%vratx(sm31:em31,sm32:em32),STAT=ierr)
1813  if (ierr.ne.0) then
1814  CALL wrf_error_fatal ( &
1815 'frame/module_domain.f: Failed to allocate grid%vratx(sm31:em31,sm32:em32). ')
1816  endif
1817 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vratx=initial_data_value
1818 ELSE
1819 ALLOCATE(grid%vratx(1,1),STAT=ierr)
1820  if (ierr.ne.0) then
1821  CALL wrf_error_fatal ( &
1822 'frame/module_domain.f: Failed to allocate grid%vratx(1,1).  ')
1823  endif
1824 ENDIF
1825 IF(.NOT.inter_domain)THEN
1826 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
1827 ALLOCATE(grid%tratx(sm31:em31,sm32:em32),STAT=ierr)
1828  if (ierr.ne.0) then
1829  CALL wrf_error_fatal ( &
1830 'frame/module_domain.f: Failed to allocate grid%tratx(sm31:em31,sm32:em32). ')
1831  endif
1832 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%tratx=initial_data_value
1833 ELSE
1834 ALLOCATE(grid%tratx(1,1),STAT=ierr)
1835  if (ierr.ne.0) then
1836  CALL wrf_error_fatal ( &
1837 'frame/module_domain.f: Failed to allocate grid%tratx(1,1).  ')
1838  endif
1839 ENDIF
1840 IF ( setinitval .EQ. 3 ) grid%rdx=initial_data_value
1841 IF ( setinitval .EQ. 3 ) grid%rdy=initial_data_value
1842 IF ( setinitval .EQ. 3 ) grid%dts=initial_data_value
1843 IF ( setinitval .EQ. 3 ) grid%dtseps=initial_data_value
1844 IF ( setinitval .EQ. 3 ) grid%resm=initial_data_value
1845 IF ( setinitval .EQ. 3 ) grid%zetatop=initial_data_value
1846 IF ( setinitval .EQ. 3 ) grid%cf1=initial_data_value
1847 IF ( setinitval .EQ. 3 ) grid%cf2=initial_data_value
1848 IF ( setinitval .EQ. 3 ) grid%cf3=initial_data_value
1849 IF ( setinitval .EQ. 3 ) grid%number_at_same_level=0
1850 IF ( setinitval .EQ. 3 ) grid%itimestep=0
1851 IF ( setinitval .EQ. 3 ) grid%xtime=initial_data_value
1852 IF ( setinitval .EQ. 3 ) grid%julian=initial_data_value
1853 IF ( setinitval .EQ. 3 ) grid%lbc_fid=0
1854 IF ( setinitval .EQ. 3 ) grid%tiled=.FALSE.
1855 IF ( setinitval .EQ. 3 ) grid%patched=.FALSE.
1856 IF(.NOT.inter_domain)THEN
1857 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * IWORDSIZE
1858 ALLOCATE(grid%imask_nostag(sm31:em31,sm32:em32),STAT=ierr)
1859  if (ierr.ne.0) then
1860  CALL wrf_error_fatal ( &
1861 'frame/module_domain.f: Failed to allocate grid%imask_nostag(sm31:em31,sm32:em32). ')
1862  endif
1863 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%imask_nostag=0
1864 ELSE
1865 ALLOCATE(grid%imask_nostag(1,1),STAT=ierr)
1866  if (ierr.ne.0) then
1867  CALL wrf_error_fatal ( &
1868 'frame/module_domain.f: Failed to allocate grid%imask_nostag(1,1).  ')
1869  endif
1870 ENDIF
1871 IF(.NOT.inter_domain)THEN
1872 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * IWORDSIZE
1873 ALLOCATE(grid%imask_xstag(sm31:em31,sm32:em32),STAT=ierr)
1874  if (ierr.ne.0) then
1875  CALL wrf_error_fatal ( &
1876 'frame/module_domain.f: Failed to allocate grid%imask_xstag(sm31:em31,sm32:em32). ')
1877  endif
1878 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%imask_xstag=0
1879 ELSE
1880 ALLOCATE(grid%imask_xstag(1,1),STAT=ierr)
1881  if (ierr.ne.0) then
1882  CALL wrf_error_fatal ( &
1883 'frame/module_domain.f: Failed to allocate grid%imask_xstag(1,1).  ')
1884  endif
1885 ENDIF
1886 IF(.NOT.inter_domain)THEN
1887 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * IWORDSIZE
1888 ALLOCATE(grid%imask_ystag(sm31:em31,sm32:em32),STAT=ierr)
1889  if (ierr.ne.0) then
1890  CALL wrf_error_fatal ( &
1891 'frame/module_domain.f: Failed to allocate grid%imask_ystag(sm31:em31,sm32:em32). ')
1892  endif
1893 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%imask_ystag=0
1894 ELSE
1895 ALLOCATE(grid%imask_ystag(1,1),STAT=ierr)
1896  if (ierr.ne.0) then
1897  CALL wrf_error_fatal ( &
1898 'frame/module_domain.f: Failed to allocate grid%imask_ystag(1,1).  ')
1899  endif
1900 ENDIF
1901 IF(.NOT.inter_domain)THEN
1902 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * IWORDSIZE
1903 ALLOCATE(grid%imask_xystag(sm31:em31,sm32:em32),STAT=ierr)
1904  if (ierr.ne.0) then
1905  CALL wrf_error_fatal ( &
1906 'frame/module_domain.f: Failed to allocate grid%imask_xystag(sm31:em31,sm32:em32). ')
1907  endif
1908 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%imask_xystag=0
1909 ELSE
1910 ALLOCATE(grid%imask_xystag(1,1),STAT=ierr)
1911  if (ierr.ne.0) then
1912  CALL wrf_error_fatal ( &
1913 'frame/module_domain.f: Failed to allocate grid%imask_xystag(1,1).  ')
1914  endif
1915 ENDIF
1916 IF ( setinitval .EQ. 3 ) grid%xi=initial_data_value
1917 IF ( setinitval .EQ. 3 ) grid%xj=initial_data_value
1918 IF ( setinitval .EQ. 3 ) grid%vc_i=initial_data_value
1919 IF ( setinitval .EQ. 3 ) grid%vc_j=initial_data_value
1920 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1)*num_moist)) * RWORDSIZE
1921 ALLOCATE(grid%moist(sm31:em31,sm32:em32,sm33:em33,num_moist),STAT=ierr)
1922  if (ierr.ne.0) then
1923  CALL wrf_error_fatal ( &
1924 'frame/module_domain.f: Failed to allocate grid%moist(sm31:em31,sm32:em32,sm33:em33,num_moist). ')
1925  endif
1926 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%moist=initial_data_value
1927 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1)*num_a_moist)) * RWORDSIZE
1928 ALLOCATE(grid%a_moist(sm31:em31,sm32:em32,sm33:em33,num_a_moist),STAT=ierr)
1929  if (ierr.ne.0) then
1930  CALL wrf_error_fatal ( &
1931 'frame/module_domain.f: Failed to allocate grid%a_moist(sm31:em31,sm32:em32,sm33:em33,num_a_moist). ')
1932  endif
1933 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_moist=initial_data_value
1934 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1)*num_g_moist)) * RWORDSIZE
1935 ALLOCATE(grid%g_moist(sm31:em31,sm32:em32,sm33:em33,num_g_moist),STAT=ierr)
1936  if (ierr.ne.0) then
1937  CALL wrf_error_fatal ( &
1938 'frame/module_domain.f: Failed to allocate grid%g_moist(sm31:em31,sm32:em32,sm33:em33,num_g_moist). ')
1939  endif
1940 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_moist=initial_data_value
1941 IF(.NOT.inter_domain)THEN
1942 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_moist)) * RWORDSIZE
1943 ALLOCATE(grid%moist_bxs(sm32:em32,sm33:em33,spec_bdy_width,num_moist),STAT=ierr)
1944  if (ierr.ne.0) then
1945  CALL wrf_error_fatal ( &
1946 'frame/module_domain.f: Failed to allocate grid%moist_bxs(sm32:em32,sm33:em33,spec_bdy_width,num_moist). ')
1947  endif
1948 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%moist_bxs=initial_data_value
1949 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_moist)) * RWORDSIZE
1950 ALLOCATE(grid%moist_bxe(sm32:em32,sm33:em33,spec_bdy_width,num_moist),STAT=ierr)
1951  if (ierr.ne.0) then
1952  CALL wrf_error_fatal ( &
1953 'frame/module_domain.f: Failed to allocate grid%moist_bxe(sm32:em32,sm33:em33,spec_bdy_width,num_moist). ')
1954  endif
1955 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%moist_bxe=initial_data_value
1956 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_moist)) * RWORDSIZE
1957 ALLOCATE(grid%moist_bys(sm31:em31,sm33:em33,spec_bdy_width,num_moist),STAT=ierr)
1958  if (ierr.ne.0) then
1959  CALL wrf_error_fatal ( &
1960 'frame/module_domain.f: Failed to allocate grid%moist_bys(sm31:em31,sm33:em33,spec_bdy_width,num_moist). ')
1961  endif
1962 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%moist_bys=initial_data_value
1963 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_moist)) * RWORDSIZE
1964 ALLOCATE(grid%moist_bye(sm31:em31,sm33:em33,spec_bdy_width,num_moist),STAT=ierr)
1965  if (ierr.ne.0) then
1966  CALL wrf_error_fatal ( &
1967 'frame/module_domain.f: Failed to allocate grid%moist_bye(sm31:em31,sm33:em33,spec_bdy_width,num_moist). ')
1968  endif
1969 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%moist_bye=initial_data_value
1970 ELSE
1971 ALLOCATE(grid%moist_bxs(1,1,1,num_moist),STAT=ierr)
1972  if (ierr.ne.0) then
1973  CALL wrf_error_fatal ( &
1974 'frame/module_domain.f: Failed to allocate grid%moist_bxs(1,1,1,num_moist).  ')
1975  endif
1976 ALLOCATE(grid%moist_bxe(1,1,1,num_moist),STAT=ierr)
1977  if (ierr.ne.0) then
1978  CALL wrf_error_fatal ( &
1979 'frame/module_domain.f: Failed to allocate grid%moist_bxe(1,1,1,num_moist).  ')
1980  endif
1981 ALLOCATE(grid%moist_bys(1,1,1,num_moist),STAT=ierr)
1982  if (ierr.ne.0) then
1983  CALL wrf_error_fatal ( &
1984 'frame/module_domain.f: Failed to allocate grid%moist_bys(1,1,1,num_moist).  ')
1985  endif
1986 ALLOCATE(grid%moist_bye(1,1,1,num_moist),STAT=ierr)
1987  if (ierr.ne.0) then
1988  CALL wrf_error_fatal ( &
1989 'frame/module_domain.f: Failed to allocate grid%moist_bye(1,1,1,num_moist).  ')
1990  endif
1991 ENDIF
1992 IF(.NOT.inter_domain)THEN
1993 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_moist)) * RWORDSIZE
1994 ALLOCATE(grid%moist_btxs(sm32:em32,sm33:em33,spec_bdy_width,num_moist),STAT=ierr)
1995  if (ierr.ne.0) then
1996  CALL wrf_error_fatal ( &
1997 'frame/module_domain.f: Failed to allocate grid%moist_btxs(sm32:em32,sm33:em33,spec_bdy_width,num_moist). ')
1998  endif
1999 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%moist_btxs=initial_data_value
2000 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_moist)) * RWORDSIZE
2001 ALLOCATE(grid%moist_btxe(sm32:em32,sm33:em33,spec_bdy_width,num_moist),STAT=ierr)
2002  if (ierr.ne.0) then
2003  CALL wrf_error_fatal ( &
2004 'frame/module_domain.f: Failed to allocate grid%moist_btxe(sm32:em32,sm33:em33,spec_bdy_width,num_moist). ')
2005  endif
2006 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%moist_btxe=initial_data_value
2007 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_moist)) * RWORDSIZE
2008 ALLOCATE(grid%moist_btys(sm31:em31,sm33:em33,spec_bdy_width,num_moist),STAT=ierr)
2009  if (ierr.ne.0) then
2010  CALL wrf_error_fatal ( &
2011 'frame/module_domain.f: Failed to allocate grid%moist_btys(sm31:em31,sm33:em33,spec_bdy_width,num_moist). ')
2012  endif
2013 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%moist_btys=initial_data_value
2014 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_moist)) * RWORDSIZE
2015 ALLOCATE(grid%moist_btye(sm31:em31,sm33:em33,spec_bdy_width,num_moist),STAT=ierr)
2016  if (ierr.ne.0) then
2017  CALL wrf_error_fatal ( &
2018 'frame/module_domain.f: Failed to allocate grid%moist_btye(sm31:em31,sm33:em33,spec_bdy_width,num_moist). ')
2019  endif
2020 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%moist_btye=initial_data_value
2021 ELSE
2022 ALLOCATE(grid%moist_btxs(1,1,1,num_moist),STAT=ierr)
2023  if (ierr.ne.0) then
2024  CALL wrf_error_fatal ( &
2025 'frame/module_domain.f: Failed to allocate grid%moist_btxs(1,1,1,num_moist).  ')
2026  endif
2027 ALLOCATE(grid%moist_btxe(1,1,1,num_moist),STAT=ierr)
2028  if (ierr.ne.0) then
2029  CALL wrf_error_fatal ( &
2030 'frame/module_domain.f: Failed to allocate grid%moist_btxe(1,1,1,num_moist).  ')
2031  endif
2032 ALLOCATE(grid%moist_btys(1,1,1,num_moist),STAT=ierr)
2033  if (ierr.ne.0) then
2034  CALL wrf_error_fatal ( &
2035 'frame/module_domain.f: Failed to allocate grid%moist_btys(1,1,1,num_moist).  ')
2036  endif
2037 ALLOCATE(grid%moist_btye(1,1,1,num_moist),STAT=ierr)
2038  if (ierr.ne.0) then
2039  CALL wrf_error_fatal ( &
2040 'frame/module_domain.f: Failed to allocate grid%moist_btye(1,1,1,num_moist).  ')
2041  endif
2042 ENDIF
2043 IF(.NOT.inter_domain)THEN
2044 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_a_moist)) * RWORDSIZE
2045 ALLOCATE(grid%a_moist_bxs(sm32:em32,sm33:em33,spec_bdy_width,num_a_moist),STAT=ierr)
2046  if (ierr.ne.0) then
2047  CALL wrf_error_fatal ( &
2048 'frame/module_domain.f: Failed to allocate grid%a_moist_bxs(sm32:em32,sm33:em33,spec_bdy_width,num_a_moist). ')
2049  endif
2050 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_moist_bxs=initial_data_value
2051 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_a_moist)) * RWORDSIZE
2052 ALLOCATE(grid%a_moist_bxe(sm32:em32,sm33:em33,spec_bdy_width,num_a_moist),STAT=ierr)
2053  if (ierr.ne.0) then
2054  CALL wrf_error_fatal ( &
2055 'frame/module_domain.f: Failed to allocate grid%a_moist_bxe(sm32:em32,sm33:em33,spec_bdy_width,num_a_moist). ')
2056  endif
2057 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_moist_bxe=initial_data_value
2058 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_a_moist)) * RWORDSIZE
2059 ALLOCATE(grid%a_moist_bys(sm31:em31,sm33:em33,spec_bdy_width,num_a_moist),STAT=ierr)
2060  if (ierr.ne.0) then
2061  CALL wrf_error_fatal ( &
2062 'frame/module_domain.f: Failed to allocate grid%a_moist_bys(sm31:em31,sm33:em33,spec_bdy_width,num_a_moist). ')
2063  endif
2064 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_moist_bys=initial_data_value
2065 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_a_moist)) * RWORDSIZE
2066 ALLOCATE(grid%a_moist_bye(sm31:em31,sm33:em33,spec_bdy_width,num_a_moist),STAT=ierr)
2067  if (ierr.ne.0) then
2068  CALL wrf_error_fatal ( &
2069 'frame/module_domain.f: Failed to allocate grid%a_moist_bye(sm31:em31,sm33:em33,spec_bdy_width,num_a_moist). ')
2070  endif
2071 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_moist_bye=initial_data_value
2072 ELSE
2073 ALLOCATE(grid%a_moist_bxs(1,1,1,num_a_moist),STAT=ierr)
2074  if (ierr.ne.0) then
2075  CALL wrf_error_fatal ( &
2076 'frame/module_domain.f: Failed to allocate grid%a_moist_bxs(1,1,1,num_a_moist).  ')
2077  endif
2078 ALLOCATE(grid%a_moist_bxe(1,1,1,num_a_moist),STAT=ierr)
2079  if (ierr.ne.0) then
2080  CALL wrf_error_fatal ( &
2081 'frame/module_domain.f: Failed to allocate grid%a_moist_bxe(1,1,1,num_a_moist).  ')
2082  endif
2083 ALLOCATE(grid%a_moist_bys(1,1,1,num_a_moist),STAT=ierr)
2084  if (ierr.ne.0) then
2085  CALL wrf_error_fatal ( &
2086 'frame/module_domain.f: Failed to allocate grid%a_moist_bys(1,1,1,num_a_moist).  ')
2087  endif
2088 ALLOCATE(grid%a_moist_bye(1,1,1,num_a_moist),STAT=ierr)
2089  if (ierr.ne.0) then
2090  CALL wrf_error_fatal ( &
2091 'frame/module_domain.f: Failed to allocate grid%a_moist_bye(1,1,1,num_a_moist).  ')
2092  endif
2093 ENDIF
2094 IF(.NOT.inter_domain)THEN
2095 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_a_moist)) * RWORDSIZE
2096 ALLOCATE(grid%a_moist_btxs(sm32:em32,sm33:em33,spec_bdy_width,num_a_moist),STAT=ierr)
2097  if (ierr.ne.0) then
2098  CALL wrf_error_fatal ( &
2099 'frame/module_domain.f: Failed to allocate grid%a_moist_btxs(sm32:em32,sm33:em33,spec_bdy_width,num_a_moist). ')
2100  endif
2101 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_moist_btxs=initial_data_value
2102 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_a_moist)) * RWORDSIZE
2103 ALLOCATE(grid%a_moist_btxe(sm32:em32,sm33:em33,spec_bdy_width,num_a_moist),STAT=ierr)
2104  if (ierr.ne.0) then
2105  CALL wrf_error_fatal ( &
2106 'frame/module_domain.f: Failed to allocate grid%a_moist_btxe(sm32:em32,sm33:em33,spec_bdy_width,num_a_moist). ')
2107  endif
2108 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_moist_btxe=initial_data_value
2109 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_a_moist)) * RWORDSIZE
2110 ALLOCATE(grid%a_moist_btys(sm31:em31,sm33:em33,spec_bdy_width,num_a_moist),STAT=ierr)
2111  if (ierr.ne.0) then
2112  CALL wrf_error_fatal ( &
2113 'frame/module_domain.f: Failed to allocate grid%a_moist_btys(sm31:em31,sm33:em33,spec_bdy_width,num_a_moist). ')
2114  endif
2115 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_moist_btys=initial_data_value
2116 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_a_moist)) * RWORDSIZE
2117 ALLOCATE(grid%a_moist_btye(sm31:em31,sm33:em33,spec_bdy_width,num_a_moist),STAT=ierr)
2118  if (ierr.ne.0) then
2119  CALL wrf_error_fatal ( &
2120 'frame/module_domain.f: Failed to allocate grid%a_moist_btye(sm31:em31,sm33:em33,spec_bdy_width,num_a_moist). ')
2121  endif
2122 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_moist_btye=initial_data_value
2123 ELSE
2124 ALLOCATE(grid%a_moist_btxs(1,1,1,num_a_moist),STAT=ierr)
2125  if (ierr.ne.0) then
2126  CALL wrf_error_fatal ( &
2127 'frame/module_domain.f: Failed to allocate grid%a_moist_btxs(1,1,1,num_a_moist).  ')
2128  endif
2129 ALLOCATE(grid%a_moist_btxe(1,1,1,num_a_moist),STAT=ierr)
2130  if (ierr.ne.0) then
2131  CALL wrf_error_fatal ( &
2132 'frame/module_domain.f: Failed to allocate grid%a_moist_btxe(1,1,1,num_a_moist).  ')
2133  endif
2134 ALLOCATE(grid%a_moist_btys(1,1,1,num_a_moist),STAT=ierr)
2135  if (ierr.ne.0) then
2136  CALL wrf_error_fatal ( &
2137 'frame/module_domain.f: Failed to allocate grid%a_moist_btys(1,1,1,num_a_moist).  ')
2138  endif
2139 ALLOCATE(grid%a_moist_btye(1,1,1,num_a_moist),STAT=ierr)
2140  if (ierr.ne.0) then
2141  CALL wrf_error_fatal ( &
2142 'frame/module_domain.f: Failed to allocate grid%a_moist_btye(1,1,1,num_a_moist).  ')
2143  endif
2144 ENDIF
2145 IF(.NOT.inter_domain)THEN
2146 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_g_moist)) * RWORDSIZE
2147 ALLOCATE(grid%g_moist_bxs(sm32:em32,sm33:em33,spec_bdy_width,num_g_moist),STAT=ierr)
2148  if (ierr.ne.0) then
2149  CALL wrf_error_fatal ( &
2150 'frame/module_domain.f: Failed to allocate grid%g_moist_bxs(sm32:em32,sm33:em33,spec_bdy_width,num_g_moist). ')
2151  endif
2152 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_moist_bxs=initial_data_value
2153 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_g_moist)) * RWORDSIZE
2154 ALLOCATE(grid%g_moist_bxe(sm32:em32,sm33:em33,spec_bdy_width,num_g_moist),STAT=ierr)
2155  if (ierr.ne.0) then
2156  CALL wrf_error_fatal ( &
2157 'frame/module_domain.f: Failed to allocate grid%g_moist_bxe(sm32:em32,sm33:em33,spec_bdy_width,num_g_moist). ')
2158  endif
2159 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_moist_bxe=initial_data_value
2160 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_g_moist)) * RWORDSIZE
2161 ALLOCATE(grid%g_moist_bys(sm31:em31,sm33:em33,spec_bdy_width,num_g_moist),STAT=ierr)
2162  if (ierr.ne.0) then
2163  CALL wrf_error_fatal ( &
2164 'frame/module_domain.f: Failed to allocate grid%g_moist_bys(sm31:em31,sm33:em33,spec_bdy_width,num_g_moist). ')
2165  endif
2166 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_moist_bys=initial_data_value
2167 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_g_moist)) * RWORDSIZE
2168 ALLOCATE(grid%g_moist_bye(sm31:em31,sm33:em33,spec_bdy_width,num_g_moist),STAT=ierr)
2169  if (ierr.ne.0) then
2170  CALL wrf_error_fatal ( &
2171 'frame/module_domain.f: Failed to allocate grid%g_moist_bye(sm31:em31,sm33:em33,spec_bdy_width,num_g_moist). ')
2172  endif
2173 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_moist_bye=initial_data_value
2174 ELSE
2175 ALLOCATE(grid%g_moist_bxs(1,1,1,num_g_moist),STAT=ierr)
2176  if (ierr.ne.0) then
2177  CALL wrf_error_fatal ( &
2178 'frame/module_domain.f: Failed to allocate grid%g_moist_bxs(1,1,1,num_g_moist).  ')
2179  endif
2180 ALLOCATE(grid%g_moist_bxe(1,1,1,num_g_moist),STAT=ierr)
2181  if (ierr.ne.0) then
2182  CALL wrf_error_fatal ( &
2183 'frame/module_domain.f: Failed to allocate grid%g_moist_bxe(1,1,1,num_g_moist).  ')
2184  endif
2185 ALLOCATE(grid%g_moist_bys(1,1,1,num_g_moist),STAT=ierr)
2186  if (ierr.ne.0) then
2187  CALL wrf_error_fatal ( &
2188 'frame/module_domain.f: Failed to allocate grid%g_moist_bys(1,1,1,num_g_moist).  ')
2189  endif
2190 ALLOCATE(grid%g_moist_bye(1,1,1,num_g_moist),STAT=ierr)
2191  if (ierr.ne.0) then
2192  CALL wrf_error_fatal ( &
2193 'frame/module_domain.f: Failed to allocate grid%g_moist_bye(1,1,1,num_g_moist).  ')
2194  endif
2195 ENDIF
2196 IF(.NOT.inter_domain)THEN
2197 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_g_moist)) * RWORDSIZE
2198 ALLOCATE(grid%g_moist_btxs(sm32:em32,sm33:em33,spec_bdy_width,num_g_moist),STAT=ierr)
2199  if (ierr.ne.0) then
2200  CALL wrf_error_fatal ( &
2201 'frame/module_domain.f: Failed to allocate grid%g_moist_btxs(sm32:em32,sm33:em33,spec_bdy_width,num_g_moist). ')
2202  endif
2203 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_moist_btxs=initial_data_value
2204 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_g_moist)) * RWORDSIZE
2205 ALLOCATE(grid%g_moist_btxe(sm32:em32,sm33:em33,spec_bdy_width,num_g_moist),STAT=ierr)
2206  if (ierr.ne.0) then
2207  CALL wrf_error_fatal ( &
2208 'frame/module_domain.f: Failed to allocate grid%g_moist_btxe(sm32:em32,sm33:em33,spec_bdy_width,num_g_moist). ')
2209  endif
2210 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_moist_btxe=initial_data_value
2211 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_g_moist)) * RWORDSIZE
2212 ALLOCATE(grid%g_moist_btys(sm31:em31,sm33:em33,spec_bdy_width,num_g_moist),STAT=ierr)
2213  if (ierr.ne.0) then
2214  CALL wrf_error_fatal ( &
2215 'frame/module_domain.f: Failed to allocate grid%g_moist_btys(sm31:em31,sm33:em33,spec_bdy_width,num_g_moist). ')
2216  endif
2217 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_moist_btys=initial_data_value
2218 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_g_moist)) * RWORDSIZE
2219 ALLOCATE(grid%g_moist_btye(sm31:em31,sm33:em33,spec_bdy_width,num_g_moist),STAT=ierr)
2220  if (ierr.ne.0) then
2221  CALL wrf_error_fatal ( &
2222 'frame/module_domain.f: Failed to allocate grid%g_moist_btye(sm31:em31,sm33:em33,spec_bdy_width,num_g_moist). ')
2223  endif
2224 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_moist_btye=initial_data_value
2225 ELSE
2226 ALLOCATE(grid%g_moist_btxs(1,1,1,num_g_moist),STAT=ierr)
2227  if (ierr.ne.0) then
2228  CALL wrf_error_fatal ( &
2229 'frame/module_domain.f: Failed to allocate grid%g_moist_btxs(1,1,1,num_g_moist).  ')
2230  endif
2231 ALLOCATE(grid%g_moist_btxe(1,1,1,num_g_moist),STAT=ierr)
2232  if (ierr.ne.0) then
2233  CALL wrf_error_fatal ( &
2234 'frame/module_domain.f: Failed to allocate grid%g_moist_btxe(1,1,1,num_g_moist).  ')
2235  endif
2236 ALLOCATE(grid%g_moist_btys(1,1,1,num_g_moist),STAT=ierr)
2237  if (ierr.ne.0) then
2238  CALL wrf_error_fatal ( &
2239 'frame/module_domain.f: Failed to allocate grid%g_moist_btys(1,1,1,num_g_moist).  ')
2240  endif
2241 ALLOCATE(grid%g_moist_btye(1,1,1,num_g_moist),STAT=ierr)
2242  if (ierr.ne.0) then
2243  CALL wrf_error_fatal ( &
2244 'frame/module_domain.f: Failed to allocate grid%g_moist_btye(1,1,1,num_g_moist).  ')
2245  endif
2246 ENDIF
2247 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1)*num_scalar)) * RWORDSIZE
2248 ALLOCATE(grid%scalar(sm31:em31,sm32:em32,sm33:em33,num_scalar),STAT=ierr)
2249  if (ierr.ne.0) then
2250  CALL wrf_error_fatal ( &
2251 'frame/module_domain.f: Failed to allocate grid%scalar(sm31:em31,sm32:em32,sm33:em33,num_scalar). ')
2252  endif
2253 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%scalar=initial_data_value
2254 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1)*num_a_scalar)) * RWORDSIZE
2255 ALLOCATE(grid%a_scalar(sm31:em31,sm32:em32,sm33:em33,num_a_scalar),STAT=ierr)
2256  if (ierr.ne.0) then
2257  CALL wrf_error_fatal ( &
2258 'frame/module_domain.f: Failed to allocate grid%a_scalar(sm31:em31,sm32:em32,sm33:em33,num_a_scalar). ')
2259  endif
2260 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_scalar=initial_data_value
2261 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1)*num_g_scalar)) * RWORDSIZE
2262 ALLOCATE(grid%g_scalar(sm31:em31,sm32:em32,sm33:em33,num_g_scalar),STAT=ierr)
2263  if (ierr.ne.0) then
2264  CALL wrf_error_fatal ( &
2265 'frame/module_domain.f: Failed to allocate grid%g_scalar(sm31:em31,sm32:em32,sm33:em33,num_g_scalar). ')
2266  endif
2267 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_scalar=initial_data_value
2268 IF(.NOT.inter_domain)THEN
2269 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_scalar)) * RWORDSIZE
2270 ALLOCATE(grid%scalar_bxs(sm32:em32,sm33:em33,spec_bdy_width,num_scalar),STAT=ierr)
2271  if (ierr.ne.0) then
2272  CALL wrf_error_fatal ( &
2273 'frame/module_domain.f: Failed to allocate grid%scalar_bxs(sm32:em32,sm33:em33,spec_bdy_width,num_scalar). ')
2274  endif
2275 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%scalar_bxs=initial_data_value
2276 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_scalar)) * RWORDSIZE
2277 ALLOCATE(grid%scalar_bxe(sm32:em32,sm33:em33,spec_bdy_width,num_scalar),STAT=ierr)
2278  if (ierr.ne.0) then
2279  CALL wrf_error_fatal ( &
2280 'frame/module_domain.f: Failed to allocate grid%scalar_bxe(sm32:em32,sm33:em33,spec_bdy_width,num_scalar). ')
2281  endif
2282 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%scalar_bxe=initial_data_value
2283 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_scalar)) * RWORDSIZE
2284 ALLOCATE(grid%scalar_bys(sm31:em31,sm33:em33,spec_bdy_width,num_scalar),STAT=ierr)
2285  if (ierr.ne.0) then
2286  CALL wrf_error_fatal ( &
2287 'frame/module_domain.f: Failed to allocate grid%scalar_bys(sm31:em31,sm33:em33,spec_bdy_width,num_scalar). ')
2288  endif
2289 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%scalar_bys=initial_data_value
2290 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_scalar)) * RWORDSIZE
2291 ALLOCATE(grid%scalar_bye(sm31:em31,sm33:em33,spec_bdy_width,num_scalar),STAT=ierr)
2292  if (ierr.ne.0) then
2293  CALL wrf_error_fatal ( &
2294 'frame/module_domain.f: Failed to allocate grid%scalar_bye(sm31:em31,sm33:em33,spec_bdy_width,num_scalar). ')
2295  endif
2296 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%scalar_bye=initial_data_value
2297 ELSE
2298 ALLOCATE(grid%scalar_bxs(1,1,1,num_scalar),STAT=ierr)
2299  if (ierr.ne.0) then
2300  CALL wrf_error_fatal ( &
2301 'frame/module_domain.f: Failed to allocate grid%scalar_bxs(1,1,1,num_scalar).  ')
2302  endif
2303 ALLOCATE(grid%scalar_bxe(1,1,1,num_scalar),STAT=ierr)
2304  if (ierr.ne.0) then
2305  CALL wrf_error_fatal ( &
2306 'frame/module_domain.f: Failed to allocate grid%scalar_bxe(1,1,1,num_scalar).  ')
2307  endif
2308 ALLOCATE(grid%scalar_bys(1,1,1,num_scalar),STAT=ierr)
2309  if (ierr.ne.0) then
2310  CALL wrf_error_fatal ( &
2311 'frame/module_domain.f: Failed to allocate grid%scalar_bys(1,1,1,num_scalar).  ')
2312  endif
2313 ALLOCATE(grid%scalar_bye(1,1,1,num_scalar),STAT=ierr)
2314  if (ierr.ne.0) then
2315  CALL wrf_error_fatal ( &
2316 'frame/module_domain.f: Failed to allocate grid%scalar_bye(1,1,1,num_scalar).  ')
2317  endif
2318 ENDIF
2319 IF(.NOT.inter_domain)THEN
2320 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_scalar)) * RWORDSIZE
2321 ALLOCATE(grid%scalar_btxs(sm32:em32,sm33:em33,spec_bdy_width,num_scalar),STAT=ierr)
2322  if (ierr.ne.0) then
2323  CALL wrf_error_fatal ( &
2324 'frame/module_domain.f: Failed to allocate grid%scalar_btxs(sm32:em32,sm33:em33,spec_bdy_width,num_scalar). ')
2325  endif
2326 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%scalar_btxs=initial_data_value
2327 num_bytes_allocated = num_bytes_allocated + (((em32-sm32+1)*(em33-sm33+1)*(spec_bdy_width)*num_scalar)) * RWORDSIZE
2328 ALLOCATE(grid%scalar_btxe(sm32:em32,sm33:em33,spec_bdy_width,num_scalar),STAT=ierr)
2329  if (ierr.ne.0) then
2330  CALL wrf_error_fatal ( &
2331 'frame/module_domain.f: Failed to allocate grid%scalar_btxe(sm32:em32,sm33:em33,spec_bdy_width,num_scalar). ')
2332  endif
2333 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%scalar_btxe=initial_data_value
2334 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_scalar)) * RWORDSIZE
2335 ALLOCATE(grid%scalar_btys(sm31:em31,sm33:em33,spec_bdy_width,num_scalar),STAT=ierr)
2336  if (ierr.ne.0) then
2337  CALL wrf_error_fatal ( &
2338 'frame/module_domain.f: Failed to allocate grid%scalar_btys(sm31:em31,sm33:em33,spec_bdy_width,num_scalar). ')
2339  endif
2340 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%scalar_btys=initial_data_value
2341 num_bytes_allocated = num_bytes_allocated + (((em31-sm31+1)*(em33-sm33+1)*(spec_bdy_width)*num_scalar)) * RWORDSIZE
2342 ALLOCATE(grid%scalar_btye(sm31:em31,sm33:em33,spec_bdy_width,num_scalar),STAT=ierr)
2343  if (ierr.ne.0) then
2344  CALL wrf_error_fatal ( &
2345 'frame/module_domain.f: Failed to allocate grid%scalar_btye(sm31:em31,sm33:em33,spec_bdy_width,num_scalar). ')
2346  endif
2347 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%scalar_btye=initial_data_value
2348 ELSE
2349 ALLOCATE(grid%scalar_btxs(1,1,1,num_scalar),STAT=ierr)
2350  if (ierr.ne.0) then
2351  CALL wrf_error_fatal ( &
2352 'frame/module_domain.f: Failed to allocate grid%scalar_btxs(1,1,1,num_scalar).  ')
2353  endif
2354 ALLOCATE(grid%scalar_btxe(1,1,1,num_scalar),STAT=ierr)
2355  if (ierr.ne.0) then
2356  CALL wrf_error_fatal ( &
2357 'frame/module_domain.f: Failed to allocate grid%scalar_btxe(1,1,1,num_scalar).  ')
2358  endif
2359 ALLOCATE(grid%scalar_btys(1,1,1,num_scalar),STAT=ierr)
2360  if (ierr.ne.0) then
2361  CALL wrf_error_fatal ( &
2362 'frame/module_domain.f: Failed to allocate grid%scalar_btys(1,1,1,num_scalar).  ')
2363  endif
2364 ALLOCATE(grid%scalar_btye(1,1,1,num_scalar),STAT=ierr)
2365  if (ierr.ne.0) then
2366  CALL wrf_error_fatal ( &
2367 'frame/module_domain.f: Failed to allocate grid%scalar_btye(1,1,1,num_scalar).  ')
2368  endif
2369 ENDIF
2370 IF(.NOT.inter_domain)THEN
2371 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%spec_bdy_width)-(1)+1))) * RWORDSIZE
2372 ALLOCATE(grid%fcx(1:model_config_rec%spec_bdy_width),STAT=ierr)
2373  if (ierr.ne.0) then
2374  CALL wrf_error_fatal ( &
2375 'frame/module_domain.f: Failed to allocate grid%fcx(1:model_config_rec%spec_bdy_width). ')
2376  endif
2377 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%fcx=initial_data_value
2378 ELSE
2379 ALLOCATE(grid%fcx(1),STAT=ierr)
2380  if (ierr.ne.0) then
2381  CALL wrf_error_fatal ( &
2382 'frame/module_domain.f: Failed to allocate grid%fcx(1).  ')
2383  endif
2384 ENDIF
2385 IF(.NOT.inter_domain)THEN
2386 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%spec_bdy_width)-(1)+1))) * RWORDSIZE
2387 ALLOCATE(grid%gcx(1:model_config_rec%spec_bdy_width),STAT=ierr)
2388  if (ierr.ne.0) then
2389  CALL wrf_error_fatal ( &
2390 'frame/module_domain.f: Failed to allocate grid%gcx(1:model_config_rec%spec_bdy_width). ')
2391  endif
2392 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%gcx=initial_data_value
2393 ELSE
2394 ALLOCATE(grid%gcx(1),STAT=ierr)
2395  if (ierr.ne.0) then
2396  CALL wrf_error_fatal ( &
2397 'frame/module_domain.f: Failed to allocate grid%gcx(1).  ')
2398  endif
2399 ENDIF
2400 IF ( setinitval .EQ. 3 ) grid%dtbc=initial_data_value
2401 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2402 ALLOCATE(grid%landmask(sm31:em31,sm32:em32),STAT=ierr)
2403  if (ierr.ne.0) then
2404  CALL wrf_error_fatal ( &
2405 'frame/module_domain.f: Failed to allocate grid%landmask(sm31:em31,sm32:em32). ')
2406  endif
2407 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%landmask=initial_data_value
2408 IF(.NOT.inter_domain)THEN
2409 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2410 ALLOCATE(grid%shdmax(sm31:em31,sm32:em32),STAT=ierr)
2411  if (ierr.ne.0) then
2412  CALL wrf_error_fatal ( &
2413 'frame/module_domain.f: Failed to allocate grid%shdmax(sm31:em31,sm32:em32). ')
2414  endif
2415 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%shdmax=initial_data_value
2416 ELSE
2417 ALLOCATE(grid%shdmax(1,1),STAT=ierr)
2418  if (ierr.ne.0) then
2419  CALL wrf_error_fatal ( &
2420 'frame/module_domain.f: Failed to allocate grid%shdmax(1,1).  ')
2421  endif
2422 ENDIF
2423 IF(.NOT.inter_domain)THEN
2424 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2425 ALLOCATE(grid%shdmin(sm31:em31,sm32:em32),STAT=ierr)
2426  if (ierr.ne.0) then
2427  CALL wrf_error_fatal ( &
2428 'frame/module_domain.f: Failed to allocate grid%shdmin(sm31:em31,sm32:em32). ')
2429  endif
2430 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%shdmin=initial_data_value
2431 ELSE
2432 ALLOCATE(grid%shdmin(1,1),STAT=ierr)
2433  if (ierr.ne.0) then
2434  CALL wrf_error_fatal ( &
2435 'frame/module_domain.f: Failed to allocate grid%shdmin(1,1).  ')
2436  endif
2437 ENDIF
2438 IF(.NOT.inter_domain)THEN
2439 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2440 ALLOCATE(grid%snoalb(sm31:em31,sm32:em32),STAT=ierr)
2441  if (ierr.ne.0) then
2442  CALL wrf_error_fatal ( &
2443 'frame/module_domain.f: Failed to allocate grid%snoalb(sm31:em31,sm32:em32). ')
2444  endif
2445 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%snoalb=initial_data_value
2446 ELSE
2447 ALLOCATE(grid%snoalb(1,1),STAT=ierr)
2448  if (ierr.ne.0) then
2449  CALL wrf_error_fatal ( &
2450 'frame/module_domain.f: Failed to allocate grid%snoalb(1,1).  ')
2451  endif
2452 ENDIF
2453 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((model_config_rec%num_soil_layers)-(1)+1))) * RWORDSIZE
2454 ALLOCATE(grid%tslb(sm31:em31,sm32:em32,1:model_config_rec%num_soil_layers),STAT=ierr)
2455  if (ierr.ne.0) then
2456  CALL wrf_error_fatal ( &
2457 'frame/module_domain.f: Failed to allocate grid%tslb(sm31:em31,sm32:em32,1:model_config_rec%num_soil_layers). ')
2458  endif
2459 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%tslb=initial_data_value
2460 IF(.NOT.inter_domain)THEN
2461 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%num_soil_layers)-(1)+1))) * RWORDSIZE
2462 ALLOCATE(grid%zs(1:model_config_rec%num_soil_layers),STAT=ierr)
2463  if (ierr.ne.0) then
2464  CALL wrf_error_fatal ( &
2465 'frame/module_domain.f: Failed to allocate grid%zs(1:model_config_rec%num_soil_layers). ')
2466  endif
2467 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%zs=initial_data_value
2468 ELSE
2469 ALLOCATE(grid%zs(1),STAT=ierr)
2470  if (ierr.ne.0) then
2471  CALL wrf_error_fatal ( &
2472 'frame/module_domain.f: Failed to allocate grid%zs(1).  ')
2473  endif
2474 ENDIF
2475 IF(.NOT.inter_domain)THEN
2476 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%num_soil_layers)-(1)+1))) * RWORDSIZE
2477 ALLOCATE(grid%dzs(1:model_config_rec%num_soil_layers),STAT=ierr)
2478  if (ierr.ne.0) then
2479  CALL wrf_error_fatal ( &
2480 'frame/module_domain.f: Failed to allocate grid%dzs(1:model_config_rec%num_soil_layers). ')
2481  endif
2482 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%dzs=initial_data_value
2483 ELSE
2484 ALLOCATE(grid%dzs(1),STAT=ierr)
2485  if (ierr.ne.0) then
2486  CALL wrf_error_fatal ( &
2487 'frame/module_domain.f: Failed to allocate grid%dzs(1).  ')
2488  endif
2489 ENDIF
2490 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((model_config_rec%num_soil_layers)-(1)+1))) * RWORDSIZE
2491 ALLOCATE(grid%smois(sm31:em31,sm32:em32,1:model_config_rec%num_soil_layers),STAT=ierr)
2492  if (ierr.ne.0) then
2493  CALL wrf_error_fatal ( &
2494 'frame/module_domain.f: Failed to allocate grid%smois(sm31:em31,sm32:em32,1:model_config_rec%num_soil_layers). ')
2495  endif
2496 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%smois=initial_data_value
2497 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((model_config_rec%num_soil_layers)-(1)+1))) * RWORDSIZE
2498 ALLOCATE(grid%sh2o(sm31:em31,sm32:em32,1:model_config_rec%num_soil_layers),STAT=ierr)
2499  if (ierr.ne.0) then
2500  CALL wrf_error_fatal ( &
2501 'frame/module_domain.f: Failed to allocate grid%sh2o(sm31:em31,sm32:em32,1:model_config_rec%num_soil_layers). ')
2502  endif
2503 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%sh2o=initial_data_value
2504 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2505 ALLOCATE(grid%xice(sm31:em31,sm32:em32),STAT=ierr)
2506  if (ierr.ne.0) then
2507  CALL wrf_error_fatal ( &
2508 'frame/module_domain.f: Failed to allocate grid%xice(sm31:em31,sm32:em32). ')
2509  endif
2510 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xice=initial_data_value
2511 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2512 ALLOCATE(grid%sfcrunoff(sm31:em31,sm32:em32),STAT=ierr)
2513  if (ierr.ne.0) then
2514  CALL wrf_error_fatal ( &
2515 'frame/module_domain.f: Failed to allocate grid%sfcrunoff(sm31:em31,sm32:em32). ')
2516  endif
2517 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%sfcrunoff=initial_data_value
2518 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2519 ALLOCATE(grid%udrunoff(sm31:em31,sm32:em32),STAT=ierr)
2520  if (ierr.ne.0) then
2521  CALL wrf_error_fatal ( &
2522 'frame/module_domain.f: Failed to allocate grid%udrunoff(sm31:em31,sm32:em32). ')
2523  endif
2524 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%udrunoff=initial_data_value
2525 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * IWORDSIZE
2526 ALLOCATE(grid%ivgtyp(sm31:em31,sm32:em32),STAT=ierr)
2527  if (ierr.ne.0) then
2528  CALL wrf_error_fatal ( &
2529 'frame/module_domain.f: Failed to allocate grid%ivgtyp(sm31:em31,sm32:em32). ')
2530  endif
2531 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ivgtyp=0
2532 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * IWORDSIZE
2533 ALLOCATE(grid%isltyp(sm31:em31,sm32:em32),STAT=ierr)
2534  if (ierr.ne.0) then
2535  CALL wrf_error_fatal ( &
2536 'frame/module_domain.f: Failed to allocate grid%isltyp(sm31:em31,sm32:em32). ')
2537  endif
2538 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%isltyp=0
2539 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2540 ALLOCATE(grid%vegfra(sm31:em31,sm32:em32),STAT=ierr)
2541  if (ierr.ne.0) then
2542  CALL wrf_error_fatal ( &
2543 'frame/module_domain.f: Failed to allocate grid%vegfra(sm31:em31,sm32:em32). ')
2544  endif
2545 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vegfra=initial_data_value
2546 IF(.NOT.inter_domain)THEN
2547 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2548 ALLOCATE(grid%sfcevp(sm31:em31,sm32:em32),STAT=ierr)
2549  if (ierr.ne.0) then
2550  CALL wrf_error_fatal ( &
2551 'frame/module_domain.f: Failed to allocate grid%sfcevp(sm31:em31,sm32:em32). ')
2552  endif
2553 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%sfcevp=initial_data_value
2554 ELSE
2555 ALLOCATE(grid%sfcevp(1,1),STAT=ierr)
2556  if (ierr.ne.0) then
2557  CALL wrf_error_fatal ( &
2558 'frame/module_domain.f: Failed to allocate grid%sfcevp(1,1).  ')
2559  endif
2560 ENDIF
2561 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2562 ALLOCATE(grid%acsnow(sm31:em31,sm32:em32),STAT=ierr)
2563  if (ierr.ne.0) then
2564  CALL wrf_error_fatal ( &
2565 'frame/module_domain.f: Failed to allocate grid%acsnow(sm31:em31,sm32:em32). ')
2566  endif
2567 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%acsnow=initial_data_value
2568 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2569 ALLOCATE(grid%acsnom(sm31:em31,sm32:em32),STAT=ierr)
2570  if (ierr.ne.0) then
2571  CALL wrf_error_fatal ( &
2572 'frame/module_domain.f: Failed to allocate grid%acsnom(sm31:em31,sm32:em32). ')
2573  endif
2574 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%acsnom=initial_data_value
2575 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2576 ALLOCATE(grid%snow(sm31:em31,sm32:em32),STAT=ierr)
2577  if (ierr.ne.0) then
2578  CALL wrf_error_fatal ( &
2579 'frame/module_domain.f: Failed to allocate grid%snow(sm31:em31,sm32:em32). ')
2580  endif
2581 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%snow=initial_data_value
2582 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2583 ALLOCATE(grid%snowh(sm31:em31,sm32:em32),STAT=ierr)
2584  if (ierr.ne.0) then
2585  CALL wrf_error_fatal ( &
2586 'frame/module_domain.f: Failed to allocate grid%snowh(sm31:em31,sm32:em32). ')
2587  endif
2588 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%snowh=initial_data_value
2589 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2590 ALLOCATE(grid%rhosn(sm31:em31,sm32:em32),STAT=ierr)
2591  if (ierr.ne.0) then
2592  CALL wrf_error_fatal ( &
2593 'frame/module_domain.f: Failed to allocate grid%rhosn(sm31:em31,sm32:em32). ')
2594  endif
2595 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%rhosn=initial_data_value
2596 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2597 ALLOCATE(grid%canwat(sm31:em31,sm32:em32),STAT=ierr)
2598  if (ierr.ne.0) then
2599  CALL wrf_error_fatal ( &
2600 'frame/module_domain.f: Failed to allocate grid%canwat(sm31:em31,sm32:em32). ')
2601  endif
2602 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%canwat=initial_data_value
2603 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2604 ALLOCATE(grid%sst(sm31:em31,sm32:em32),STAT=ierr)
2605  if (ierr.ne.0) then
2606  CALL wrf_error_fatal ( &
2607 'frame/module_domain.f: Failed to allocate grid%sst(sm31:em31,sm32:em32). ')
2608  endif
2609 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%sst=initial_data_value
2610 IF ( setinitval .EQ. 3 ) grid%ifndsnowh=0
2611 IF ( setinitval .EQ. 3 ) grid%ifndsoilw=0
2612 IF(.NOT.inter_domain)THEN
2613 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2614 ALLOCATE(grid%htop(sm31:em31,sm32:em32),STAT=ierr)
2615  if (ierr.ne.0) then
2616  CALL wrf_error_fatal ( &
2617 'frame/module_domain.f: Failed to allocate grid%htop(sm31:em31,sm32:em32). ')
2618  endif
2619 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%htop=initial_data_value
2620 ELSE
2621 ALLOCATE(grid%htop(1,1),STAT=ierr)
2622  if (ierr.ne.0) then
2623  CALL wrf_error_fatal ( &
2624 'frame/module_domain.f: Failed to allocate grid%htop(1,1).  ')
2625  endif
2626 ENDIF
2627 IF(.NOT.inter_domain)THEN
2628 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2629 ALLOCATE(grid%hbot(sm31:em31,sm32:em32),STAT=ierr)
2630  if (ierr.ne.0) then
2631  CALL wrf_error_fatal ( &
2632 'frame/module_domain.f: Failed to allocate grid%hbot(sm31:em31,sm32:em32). ')
2633  endif
2634 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%hbot=initial_data_value
2635 ELSE
2636 ALLOCATE(grid%hbot(1,1),STAT=ierr)
2637  if (ierr.ne.0) then
2638  CALL wrf_error_fatal ( &
2639 'frame/module_domain.f: Failed to allocate grid%hbot(1,1).  ')
2640  endif
2641 ENDIF
2642 IF(.NOT.inter_domain)THEN
2643 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2644 ALLOCATE(grid%cuppt(sm31:em31,sm32:em32),STAT=ierr)
2645  if (ierr.ne.0) then
2646  CALL wrf_error_fatal ( &
2647 'frame/module_domain.f: Failed to allocate grid%cuppt(sm31:em31,sm32:em32). ')
2648  endif
2649 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%cuppt=initial_data_value
2650 ELSE
2651 ALLOCATE(grid%cuppt(1,1),STAT=ierr)
2652  if (ierr.ne.0) then
2653  CALL wrf_error_fatal ( &
2654 'frame/module_domain.f: Failed to allocate grid%cuppt(1,1).  ')
2655  endif
2656 ENDIF
2657 IF(.NOT.inter_domain)THEN
2658 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2659 ALLOCATE(grid%rswtoa(sm31:em31,sm32:em32),STAT=ierr)
2660  if (ierr.ne.0) then
2661  CALL wrf_error_fatal ( &
2662 'frame/module_domain.f: Failed to allocate grid%rswtoa(sm31:em31,sm32:em32). ')
2663  endif
2664 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%rswtoa=initial_data_value
2665 ELSE
2666 ALLOCATE(grid%rswtoa(1,1),STAT=ierr)
2667  if (ierr.ne.0) then
2668  CALL wrf_error_fatal ( &
2669 'frame/module_domain.f: Failed to allocate grid%rswtoa(1,1).  ')
2670  endif
2671 ENDIF
2672 IF(.NOT.inter_domain)THEN
2673 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2674 ALLOCATE(grid%rlwtoa(sm31:em31,sm32:em32),STAT=ierr)
2675  if (ierr.ne.0) then
2676  CALL wrf_error_fatal ( &
2677 'frame/module_domain.f: Failed to allocate grid%rlwtoa(sm31:em31,sm32:em32). ')
2678  endif
2679 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%rlwtoa=initial_data_value
2680 ELSE
2681 ALLOCATE(grid%rlwtoa(1,1),STAT=ierr)
2682  if (ierr.ne.0) then
2683  CALL wrf_error_fatal ( &
2684 'frame/module_domain.f: Failed to allocate grid%rlwtoa(1,1).  ')
2685  endif
2686 ENDIF
2687 IF(.NOT.inter_domain)THEN
2688 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2689 ALLOCATE(grid%czmean(sm31:em31,sm32:em32),STAT=ierr)
2690  if (ierr.ne.0) then
2691  CALL wrf_error_fatal ( &
2692 'frame/module_domain.f: Failed to allocate grid%czmean(sm31:em31,sm32:em32). ')
2693  endif
2694 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%czmean=initial_data_value
2695 ELSE
2696 ALLOCATE(grid%czmean(1,1),STAT=ierr)
2697  if (ierr.ne.0) then
2698  CALL wrf_error_fatal ( &
2699 'frame/module_domain.f: Failed to allocate grid%czmean(1,1).  ')
2700  endif
2701 ENDIF
2702 IF(.NOT.inter_domain)THEN
2703 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2704 ALLOCATE(grid%cfracl(sm31:em31,sm32:em32),STAT=ierr)
2705  if (ierr.ne.0) then
2706  CALL wrf_error_fatal ( &
2707 'frame/module_domain.f: Failed to allocate grid%cfracl(sm31:em31,sm32:em32). ')
2708  endif
2709 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%cfracl=initial_data_value
2710 ELSE
2711 ALLOCATE(grid%cfracl(1,1),STAT=ierr)
2712  if (ierr.ne.0) then
2713  CALL wrf_error_fatal ( &
2714 'frame/module_domain.f: Failed to allocate grid%cfracl(1,1).  ')
2715  endif
2716 ENDIF
2717 IF(.NOT.inter_domain)THEN
2718 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2719 ALLOCATE(grid%cfracm(sm31:em31,sm32:em32),STAT=ierr)
2720  if (ierr.ne.0) then
2721  CALL wrf_error_fatal ( &
2722 'frame/module_domain.f: Failed to allocate grid%cfracm(sm31:em31,sm32:em32). ')
2723  endif
2724 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%cfracm=initial_data_value
2725 ELSE
2726 ALLOCATE(grid%cfracm(1,1),STAT=ierr)
2727  if (ierr.ne.0) then
2728  CALL wrf_error_fatal ( &
2729 'frame/module_domain.f: Failed to allocate grid%cfracm(1,1).  ')
2730  endif
2731 ENDIF
2732 IF(.NOT.inter_domain)THEN
2733 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2734 ALLOCATE(grid%cfrach(sm31:em31,sm32:em32),STAT=ierr)
2735  if (ierr.ne.0) then
2736  CALL wrf_error_fatal ( &
2737 'frame/module_domain.f: Failed to allocate grid%cfrach(sm31:em31,sm32:em32). ')
2738  endif
2739 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%cfrach=initial_data_value
2740 ELSE
2741 ALLOCATE(grid%cfrach(1,1),STAT=ierr)
2742  if (ierr.ne.0) then
2743  CALL wrf_error_fatal ( &
2744 'frame/module_domain.f: Failed to allocate grid%cfrach(1,1).  ')
2745  endif
2746 ENDIF
2747 IF(.NOT.inter_domain)THEN
2748 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2749 ALLOCATE(grid%acfrst(sm31:em31,sm32:em32),STAT=ierr)
2750  if (ierr.ne.0) then
2751  CALL wrf_error_fatal ( &
2752 'frame/module_domain.f: Failed to allocate grid%acfrst(sm31:em31,sm32:em32). ')
2753  endif
2754 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%acfrst=initial_data_value
2755 ELSE
2756 ALLOCATE(grid%acfrst(1,1),STAT=ierr)
2757  if (ierr.ne.0) then
2758  CALL wrf_error_fatal ( &
2759 'frame/module_domain.f: Failed to allocate grid%acfrst(1,1).  ')
2760  endif
2761 ENDIF
2762 IF(.NOT.inter_domain)THEN
2763 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * IWORDSIZE
2764 ALLOCATE(grid%ncfrst(sm31:em31,sm32:em32),STAT=ierr)
2765  if (ierr.ne.0) then
2766  CALL wrf_error_fatal ( &
2767 'frame/module_domain.f: Failed to allocate grid%ncfrst(sm31:em31,sm32:em32). ')
2768  endif
2769 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ncfrst=0
2770 ELSE
2771 ALLOCATE(grid%ncfrst(1,1),STAT=ierr)
2772  if (ierr.ne.0) then
2773  CALL wrf_error_fatal ( &
2774 'frame/module_domain.f: Failed to allocate grid%ncfrst(1,1).  ')
2775  endif
2776 ENDIF
2777 IF(.NOT.inter_domain)THEN
2778 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2779 ALLOCATE(grid%acfrcv(sm31:em31,sm32:em32),STAT=ierr)
2780  if (ierr.ne.0) then
2781  CALL wrf_error_fatal ( &
2782 'frame/module_domain.f: Failed to allocate grid%acfrcv(sm31:em31,sm32:em32). ')
2783  endif
2784 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%acfrcv=initial_data_value
2785 ELSE
2786 ALLOCATE(grid%acfrcv(1,1),STAT=ierr)
2787  if (ierr.ne.0) then
2788  CALL wrf_error_fatal ( &
2789 'frame/module_domain.f: Failed to allocate grid%acfrcv(1,1).  ')
2790  endif
2791 ENDIF
2792 IF(.NOT.inter_domain)THEN
2793 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * IWORDSIZE
2794 ALLOCATE(grid%ncfrcv(sm31:em31,sm32:em32),STAT=ierr)
2795  if (ierr.ne.0) then
2796  CALL wrf_error_fatal ( &
2797 'frame/module_domain.f: Failed to allocate grid%ncfrcv(sm31:em31,sm32:em32). ')
2798  endif
2799 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ncfrcv=0
2800 ELSE
2801 ALLOCATE(grid%ncfrcv(1,1),STAT=ierr)
2802  if (ierr.ne.0) then
2803  CALL wrf_error_fatal ( &
2804 'frame/module_domain.f: Failed to allocate grid%ncfrcv(1,1).  ')
2805  endif
2806 ENDIF
2807 IF(.NOT.inter_domain)THEN
2808 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
2809 ALLOCATE(grid%h_diabatic(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
2810  if (ierr.ne.0) then
2811  CALL wrf_error_fatal ( &
2812 'frame/module_domain.f: Failed to allocate grid%h_diabatic(sm31:em31,sm32:em32,sm33:em33). ')
2813  endif
2814 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%h_diabatic=initial_data_value
2815 ELSE
2816 ALLOCATE(grid%h_diabatic(1,1,1),STAT=ierr)
2817  if (ierr.ne.0) then
2818  CALL wrf_error_fatal ( &
2819 'frame/module_domain.f: Failed to allocate grid%h_diabatic(1,1,1).  ')
2820  endif
2821 ENDIF
2822 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2823 ALLOCATE(grid%msft(sm31:em31,sm32:em32),STAT=ierr)
2824  if (ierr.ne.0) then
2825  CALL wrf_error_fatal ( &
2826 'frame/module_domain.f: Failed to allocate grid%msft(sm31:em31,sm32:em32). ')
2827  endif
2828 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%msft=initial_data_value
2829 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2830 ALLOCATE(grid%msfu(sm31:em31,sm32:em32),STAT=ierr)
2831  if (ierr.ne.0) then
2832  CALL wrf_error_fatal ( &
2833 'frame/module_domain.f: Failed to allocate grid%msfu(sm31:em31,sm32:em32). ')
2834  endif
2835 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%msfu=initial_data_value
2836 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2837 ALLOCATE(grid%msfv(sm31:em31,sm32:em32),STAT=ierr)
2838  if (ierr.ne.0) then
2839  CALL wrf_error_fatal ( &
2840 'frame/module_domain.f: Failed to allocate grid%msfv(sm31:em31,sm32:em32). ')
2841  endif
2842 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%msfv=initial_data_value
2843 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2844 ALLOCATE(grid%f(sm31:em31,sm32:em32),STAT=ierr)
2845  if (ierr.ne.0) then
2846  CALL wrf_error_fatal ( &
2847 'frame/module_domain.f: Failed to allocate grid%f(sm31:em31,sm32:em32). ')
2848  endif
2849 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%f=initial_data_value
2850 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2851 ALLOCATE(grid%e(sm31:em31,sm32:em32),STAT=ierr)
2852  if (ierr.ne.0) then
2853  CALL wrf_error_fatal ( &
2854 'frame/module_domain.f: Failed to allocate grid%e(sm31:em31,sm32:em32). ')
2855  endif
2856 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%e=initial_data_value
2857 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2858 ALLOCATE(grid%sina(sm31:em31,sm32:em32),STAT=ierr)
2859  if (ierr.ne.0) then
2860  CALL wrf_error_fatal ( &
2861 'frame/module_domain.f: Failed to allocate grid%sina(sm31:em31,sm32:em32). ')
2862  endif
2863 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%sina=initial_data_value
2864 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2865 ALLOCATE(grid%cosa(sm31:em31,sm32:em32),STAT=ierr)
2866  if (ierr.ne.0) then
2867  CALL wrf_error_fatal ( &
2868 'frame/module_domain.f: Failed to allocate grid%cosa(sm31:em31,sm32:em32). ')
2869  endif
2870 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%cosa=initial_data_value
2871 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2872 ALLOCATE(grid%ht(sm31:em31,sm32:em32),STAT=ierr)
2873  if (ierr.ne.0) then
2874  CALL wrf_error_fatal ( &
2875 'frame/module_domain.f: Failed to allocate grid%ht(sm31:em31,sm32:em32). ')
2876  endif
2877 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ht=initial_data_value
2878 IF(.NOT.inter_domain)THEN
2879 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2880 ALLOCATE(grid%ht_fine(sm31:em31,sm32:em32),STAT=ierr)
2881  if (ierr.ne.0) then
2882  CALL wrf_error_fatal ( &
2883 'frame/module_domain.f: Failed to allocate grid%ht_fine(sm31:em31,sm32:em32). ')
2884  endif
2885 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ht_fine=initial_data_value
2886 ELSE
2887 ALLOCATE(grid%ht_fine(1,1),STAT=ierr)
2888  if (ierr.ne.0) then
2889  CALL wrf_error_fatal ( &
2890 'frame/module_domain.f: Failed to allocate grid%ht_fine(1,1).  ')
2891  endif
2892 ENDIF
2893 IF(.NOT.inter_domain)THEN
2894 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2895 ALLOCATE(grid%ht_int(sm31:em31,sm32:em32),STAT=ierr)
2896  if (ierr.ne.0) then
2897  CALL wrf_error_fatal ( &
2898 'frame/module_domain.f: Failed to allocate grid%ht_int(sm31:em31,sm32:em32). ')
2899  endif
2900 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ht_int=initial_data_value
2901 ELSE
2902 ALLOCATE(grid%ht_int(1,1),STAT=ierr)
2903  if (ierr.ne.0) then
2904  CALL wrf_error_fatal ( &
2905 'frame/module_domain.f: Failed to allocate grid%ht_int(1,1).  ')
2906  endif
2907 ENDIF
2908 IF(.NOT.inter_domain)THEN
2909 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2910 ALLOCATE(grid%ht_input(sm31:em31,sm32:em32),STAT=ierr)
2911  if (ierr.ne.0) then
2912  CALL wrf_error_fatal ( &
2913 'frame/module_domain.f: Failed to allocate grid%ht_input(sm31:em31,sm32:em32). ')
2914  endif
2915 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ht_input=initial_data_value
2916 ELSE
2917 ALLOCATE(grid%ht_input(1,1),STAT=ierr)
2918  if (ierr.ne.0) then
2919  CALL wrf_error_fatal ( &
2920 'frame/module_domain.f: Failed to allocate grid%ht_input(1,1).  ')
2921  endif
2922 ENDIF
2923 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2924 ALLOCATE(grid%tsk(sm31:em31,sm32:em32),STAT=ierr)
2925  if (ierr.ne.0) then
2926  CALL wrf_error_fatal ( &
2927 'frame/module_domain.f: Failed to allocate grid%tsk(sm31:em31,sm32:em32). ')
2928  endif
2929 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%tsk=initial_data_value
2930 IF(.NOT.inter_domain)THEN
2931 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
2932 ALLOCATE(grid%tsk_save(sm31:em31,sm32:em32),STAT=ierr)
2933  if (ierr.ne.0) then
2934  CALL wrf_error_fatal ( &
2935 'frame/module_domain.f: Failed to allocate grid%tsk_save(sm31:em31,sm32:em32). ')
2936  endif
2937 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%tsk_save=initial_data_value
2938 ELSE
2939 ALLOCATE(grid%tsk_save(1,1),STAT=ierr)
2940  if (ierr.ne.0) then
2941  CALL wrf_error_fatal ( &
2942 'frame/module_domain.f: Failed to allocate grid%tsk_save(1,1).  ')
2943  endif
2944 ENDIF
2945 IF(.NOT.inter_domain)THEN
2946 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
2947 ALLOCATE(grid%u_base(sm33:em33),STAT=ierr)
2948  if (ierr.ne.0) then
2949  CALL wrf_error_fatal ( &
2950 'frame/module_domain.f: Failed to allocate grid%u_base(sm33:em33). ')
2951  endif
2952 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%u_base=initial_data_value
2953 ELSE
2954 ALLOCATE(grid%u_base(1),STAT=ierr)
2955  if (ierr.ne.0) then
2956  CALL wrf_error_fatal ( &
2957 'frame/module_domain.f: Failed to allocate grid%u_base(1).  ')
2958  endif
2959 ENDIF
2960 IF(.NOT.inter_domain)THEN
2961 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
2962 ALLOCATE(grid%v_base(sm33:em33),STAT=ierr)
2963  if (ierr.ne.0) then
2964  CALL wrf_error_fatal ( &
2965 'frame/module_domain.f: Failed to allocate grid%v_base(sm33:em33). ')
2966  endif
2967 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%v_base=initial_data_value
2968 ELSE
2969 ALLOCATE(grid%v_base(1),STAT=ierr)
2970  if (ierr.ne.0) then
2971  CALL wrf_error_fatal ( &
2972 'frame/module_domain.f: Failed to allocate grid%v_base(1).  ')
2973  endif
2974 ENDIF
2975 IF(.NOT.inter_domain)THEN
2976 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
2977 ALLOCATE(grid%qv_base(sm33:em33),STAT=ierr)
2978  if (ierr.ne.0) then
2979  CALL wrf_error_fatal ( &
2980 'frame/module_domain.f: Failed to allocate grid%qv_base(sm33:em33). ')
2981  endif
2982 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%qv_base=initial_data_value
2983 ELSE
2984 ALLOCATE(grid%qv_base(1),STAT=ierr)
2985  if (ierr.ne.0) then
2986  CALL wrf_error_fatal ( &
2987 'frame/module_domain.f: Failed to allocate grid%qv_base(1).  ')
2988  endif
2989 ENDIF
2990 IF(.NOT.inter_domain)THEN
2991 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
2992 ALLOCATE(grid%z_base(sm33:em33),STAT=ierr)
2993  if (ierr.ne.0) then
2994  CALL wrf_error_fatal ( &
2995 'frame/module_domain.f: Failed to allocate grid%z_base(sm33:em33). ')
2996  endif
2997 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%z_base=initial_data_value
2998 ELSE
2999 ALLOCATE(grid%z_base(1),STAT=ierr)
3000  if (ierr.ne.0) then
3001  CALL wrf_error_fatal ( &
3002 'frame/module_domain.f: Failed to allocate grid%z_base(1).  ')
3003  endif
3004 ENDIF
3005 IF ( setinitval .EQ. 3 ) grid%u_frame=initial_data_value
3006 IF ( setinitval .EQ. 3 ) grid%v_frame=initial_data_value
3007 IF ( setinitval .EQ. 3 ) grid%p_top=initial_data_value
3008 IF ( setinitval .EQ. 3 ) grid%imicrogram=0
3009 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
3010 ALLOCATE(grid%rainc(sm31:em31,sm32:em32),STAT=ierr)
3011  if (ierr.ne.0) then
3012  CALL wrf_error_fatal ( &
3013 'frame/module_domain.f: Failed to allocate grid%rainc(sm31:em31,sm32:em32). ')
3014  endif
3015 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%rainc=initial_data_value
3016 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
3017 ALLOCATE(grid%rainnc(sm31:em31,sm32:em32),STAT=ierr)
3018  if (ierr.ne.0) then
3019  CALL wrf_error_fatal ( &
3020 'frame/module_domain.f: Failed to allocate grid%rainnc(sm31:em31,sm32:em32). ')
3021  endif
3022 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%rainnc=initial_data_value
3023 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
3024 ALLOCATE(grid%xlat(sm31:em31,sm32:em32),STAT=ierr)
3025  if (ierr.ne.0) then
3026  CALL wrf_error_fatal ( &
3027 'frame/module_domain.f: Failed to allocate grid%xlat(sm31:em31,sm32:em32). ')
3028  endif
3029 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xlat=initial_data_value
3030 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
3031 ALLOCATE(grid%xlong(sm31:em31,sm32:em32),STAT=ierr)
3032  if (ierr.ne.0) then
3033  CALL wrf_error_fatal ( &
3034 'frame/module_domain.f: Failed to allocate grid%xlong(sm31:em31,sm32:em32). ')
3035  endif
3036 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xlong=initial_data_value
3037 IF(.NOT.inter_domain)THEN
3038 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
3039 ALLOCATE(grid%albbck(sm31:em31,sm32:em32),STAT=ierr)
3040  if (ierr.ne.0) then
3041  CALL wrf_error_fatal ( &
3042 'frame/module_domain.f: Failed to allocate grid%albbck(sm31:em31,sm32:em32). ')
3043  endif
3044 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%albbck=initial_data_value
3045 ELSE
3046 ALLOCATE(grid%albbck(1,1),STAT=ierr)
3047  if (ierr.ne.0) then
3048  CALL wrf_error_fatal ( &
3049 'frame/module_domain.f: Failed to allocate grid%albbck(1,1).  ')
3050  endif
3051 ENDIF
3052 IF(.NOT.inter_domain)THEN
3053 num_bytes_allocated = num_bytes_allocated + ((((7501)-(1)+1))) * RWORDSIZE
3054 ALLOCATE(grid%mp_restart_state(1:7501),STAT=ierr)
3055  if (ierr.ne.0) then
3056  CALL wrf_error_fatal ( &
3057 'frame/module_domain.f: Failed to allocate grid%mp_restart_state(1:7501). ')
3058  endif
3059 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%mp_restart_state=initial_data_value
3060 ELSE
3061 ALLOCATE(grid%mp_restart_state(1),STAT=ierr)
3062  if (ierr.ne.0) then
3063  CALL wrf_error_fatal ( &
3064 'frame/module_domain.f: Failed to allocate grid%mp_restart_state(1).  ')
3065  endif
3066 ENDIF
3067 IF(.NOT.inter_domain)THEN
3068 num_bytes_allocated = num_bytes_allocated + ((((7501)-(1)+1))) * RWORDSIZE
3069 ALLOCATE(grid%tbpvs_state(1:7501),STAT=ierr)
3070  if (ierr.ne.0) then
3071  CALL wrf_error_fatal ( &
3072 'frame/module_domain.f: Failed to allocate grid%tbpvs_state(1:7501). ')
3073  endif
3074 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%tbpvs_state=initial_data_value
3075 ELSE
3076 ALLOCATE(grid%tbpvs_state(1),STAT=ierr)
3077  if (ierr.ne.0) then
3078  CALL wrf_error_fatal ( &
3079 'frame/module_domain.f: Failed to allocate grid%tbpvs_state(1).  ')
3080  endif
3081 ENDIF
3082 IF(.NOT.inter_domain)THEN
3083 num_bytes_allocated = num_bytes_allocated + ((((7501)-(1)+1))) * RWORDSIZE
3084 ALLOCATE(grid%tbpvs0_state(1:7501),STAT=ierr)
3085  if (ierr.ne.0) then
3086  CALL wrf_error_fatal ( &
3087 'frame/module_domain.f: Failed to allocate grid%tbpvs0_state(1:7501). ')
3088  endif
3089 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%tbpvs0_state=initial_data_value
3090 ELSE
3091 ALLOCATE(grid%tbpvs0_state(1),STAT=ierr)
3092  if (ierr.ne.0) then
3093  CALL wrf_error_fatal ( &
3094 'frame/module_domain.f: Failed to allocate grid%tbpvs0_state(1).  ')
3095  endif
3096 ENDIF
3097 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
3098 ALLOCATE(grid%tmn(sm31:em31,sm32:em32),STAT=ierr)
3099  if (ierr.ne.0) then
3100  CALL wrf_error_fatal ( &
3101 'frame/module_domain.f: Failed to allocate grid%tmn(sm31:em31,sm32:em32). ')
3102  endif
3103 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%tmn=initial_data_value
3104 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
3105 ALLOCATE(grid%xland(sm31:em31,sm32:em32),STAT=ierr)
3106  if (ierr.ne.0) then
3107  CALL wrf_error_fatal ( &
3108 'frame/module_domain.f: Failed to allocate grid%xland(sm31:em31,sm32:em32). ')
3109  endif
3110 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xland=initial_data_value
3111 IF(.NOT.inter_domain)THEN
3112 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
3113 ALLOCATE(grid%znt(sm31:em31,sm32:em32),STAT=ierr)
3114  if (ierr.ne.0) then
3115  CALL wrf_error_fatal ( &
3116 'frame/module_domain.f: Failed to allocate grid%znt(sm31:em31,sm32:em32). ')
3117  endif
3118 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%znt=initial_data_value
3119 ELSE
3120 ALLOCATE(grid%znt(1,1),STAT=ierr)
3121  if (ierr.ne.0) then
3122  CALL wrf_error_fatal ( &
3123 'frame/module_domain.f: Failed to allocate grid%znt(1,1).  ')
3124  endif
3125 ENDIF
3126 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
3127 ALLOCATE(grid%snowc(sm31:em31,sm32:em32),STAT=ierr)
3128  if (ierr.ne.0) then
3129  CALL wrf_error_fatal ( &
3130 'frame/module_domain.f: Failed to allocate grid%snowc(sm31:em31,sm32:em32). ')
3131  endif
3132 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%snowc=initial_data_value
3133 IF ( setinitval .EQ. 3 ) grid%stepbl=0
3134 IF(.NOT.inter_domain)THEN
3135 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
3136 ALLOCATE(grid%xkmv(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
3137  if (ierr.ne.0) then
3138  CALL wrf_error_fatal ( &
3139 'frame/module_domain.f: Failed to allocate grid%xkmv(sm31:em31,sm32:em32,sm33:em33). ')
3140  endif
3141 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xkmv=initial_data_value
3142 ELSE
3143 ALLOCATE(grid%xkmv(1,1,1),STAT=ierr)
3144  if (ierr.ne.0) then
3145  CALL wrf_error_fatal ( &
3146 'frame/module_domain.f: Failed to allocate grid%xkmv(1,1,1).  ')
3147  endif
3148 ENDIF
3149 IF(.NOT.inter_domain)THEN
3150 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
3151 ALLOCATE(grid%xkmh(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
3152  if (ierr.ne.0) then
3153  CALL wrf_error_fatal ( &
3154 'frame/module_domain.f: Failed to allocate grid%xkmh(sm31:em31,sm32:em32,sm33:em33). ')
3155  endif
3156 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xkmh=initial_data_value
3157 ELSE
3158 ALLOCATE(grid%xkmh(1,1,1),STAT=ierr)
3159  if (ierr.ne.0) then
3160  CALL wrf_error_fatal ( &
3161 'frame/module_domain.f: Failed to allocate grid%xkmh(1,1,1).  ')
3162  endif
3163 ENDIF
3164 IF(.NOT.inter_domain)THEN
3165 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
3166 ALLOCATE(grid%xkmhd(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
3167  if (ierr.ne.0) then
3168  CALL wrf_error_fatal ( &
3169 'frame/module_domain.f: Failed to allocate grid%xkmhd(sm31:em31,sm32:em32,sm33:em33). ')
3170  endif
3171 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xkmhd=initial_data_value
3172 ELSE
3173 ALLOCATE(grid%xkmhd(1,1,1),STAT=ierr)
3174  if (ierr.ne.0) then
3175  CALL wrf_error_fatal ( &
3176 'frame/module_domain.f: Failed to allocate grid%xkmhd(1,1,1).  ')
3177  endif
3178 ENDIF
3179 IF(.NOT.inter_domain)THEN
3180 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
3181 ALLOCATE(grid%a_xkmhd(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
3182  if (ierr.ne.0) then
3183  CALL wrf_error_fatal ( &
3184 'frame/module_domain.f: Failed to allocate grid%a_xkmhd(sm31:em31,sm32:em32,sm33:em33). ')
3185  endif
3186 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%a_xkmhd=initial_data_value
3187 ELSE
3188 ALLOCATE(grid%a_xkmhd(1,1,1),STAT=ierr)
3189  if (ierr.ne.0) then
3190  CALL wrf_error_fatal ( &
3191 'frame/module_domain.f: Failed to allocate grid%a_xkmhd(1,1,1).  ')
3192  endif
3193 ENDIF
3194 IF(.NOT.inter_domain)THEN
3195 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
3196 ALLOCATE(grid%g_xkmhd(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
3197  if (ierr.ne.0) then
3198  CALL wrf_error_fatal ( &
3199 'frame/module_domain.f: Failed to allocate grid%g_xkmhd(sm31:em31,sm32:em32,sm33:em33). ')
3200  endif
3201 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%g_xkmhd=initial_data_value
3202 ELSE
3203 ALLOCATE(grid%g_xkmhd(1,1,1),STAT=ierr)
3204  if (ierr.ne.0) then
3205  CALL wrf_error_fatal ( &
3206 'frame/module_domain.f: Failed to allocate grid%g_xkmhd(1,1,1).  ')
3207  endif
3208 ENDIF
3209 IF(.NOT.inter_domain)THEN
3210 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
3211 ALLOCATE(grid%xkhv(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
3212  if (ierr.ne.0) then
3213  CALL wrf_error_fatal ( &
3214 'frame/module_domain.f: Failed to allocate grid%xkhv(sm31:em31,sm32:em32,sm33:em33). ')
3215  endif
3216 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xkhv=initial_data_value
3217 ELSE
3218 ALLOCATE(grid%xkhv(1,1,1),STAT=ierr)
3219  if (ierr.ne.0) then
3220  CALL wrf_error_fatal ( &
3221 'frame/module_domain.f: Failed to allocate grid%xkhv(1,1,1).  ')
3222  endif
3223 ENDIF
3224 IF(.NOT.inter_domain)THEN
3225 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
3226 ALLOCATE(grid%xkhh(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
3227  if (ierr.ne.0) then
3228  CALL wrf_error_fatal ( &
3229 'frame/module_domain.f: Failed to allocate grid%xkhh(sm31:em31,sm32:em32,sm33:em33). ')
3230  endif
3231 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xkhh=initial_data_value
3232 ELSE
3233 ALLOCATE(grid%xkhh(1,1,1),STAT=ierr)
3234  if (ierr.ne.0) then
3235  CALL wrf_error_fatal ( &
3236 'frame/module_domain.f: Failed to allocate grid%xkhh(1,1,1).  ')
3237  endif
3238 ENDIF
3239 IF ( setinitval .EQ. 3 ) grid%warm_rain=.FALSE.
3240 IF ( setinitval .EQ. 3 ) grid%adv_moist_cond=.FALSE.
3241 IF ( setinitval .EQ. 3 ) grid%moved=.FALSE.
3242 IF ( setinitval .EQ. 3 ) grid%write_increments=.FALSE.
3243 IF ( setinitval .EQ. 3 ) grid%var4d=.FALSE.
3244 IF ( setinitval .EQ. 3 ) grid%var4d_multi_inc=0
3245 IF ( setinitval .EQ. 3 ) grid%var4d_coupling=0
3246 IF ( setinitval .EQ. 3 ) grid%global=.FALSE.
3247 IF ( setinitval .EQ. 3 ) grid%oi_use=.FALSE.
3248 IF ( setinitval .EQ. 3 ) grid%print_detail_airep=.FALSE.
3249 IF ( setinitval .EQ. 3 ) grid%print_detail_radar=.FALSE.
3250 IF ( setinitval .EQ. 3 ) grid%print_detail_rad=.FALSE.
3251 IF ( setinitval .EQ. 3 ) grid%print_detail_xa=.FALSE.
3252 IF ( setinitval .EQ. 3 ) grid%print_detail_xb=.FALSE.
3253 IF ( setinitval .EQ. 3 ) grid%print_detail_obs=.FALSE.
3254 IF ( setinitval .EQ. 3 ) grid%print_detail_f_obs=.FALSE.
3255 IF ( setinitval .EQ. 3 ) grid%print_detail_map=.FALSE.
3256 IF ( setinitval .EQ. 3 ) grid%print_detail_grad=.FALSE.
3257 IF ( setinitval .EQ. 3 ) grid%print_detail_regression=.FALSE.
3258 IF ( setinitval .EQ. 3 ) grid%print_detail_spectral=.FALSE.
3259 IF ( setinitval .EQ. 3 ) grid%print_detail_testing=.FALSE.
3260 IF ( setinitval .EQ. 3 ) grid%print_detail_parallel=.FALSE.
3261 IF ( setinitval .EQ. 3 ) grid%print_detail_be=.FALSE.
3262 IF ( setinitval .EQ. 3 ) grid%print_detail_timing=.FALSE.
3263 IF ( setinitval .EQ. 3 ) grid%check_max_iv_print=.FALSE.
3264 IF ( setinitval .EQ. 3 ) grid%analysis_accu=0
3265 IF ( setinitval .EQ. 3 ) grid%calc_w_increment=.FALSE.
3266 IF ( setinitval .EQ. 3 ) grid%dt_cloud_model=.FALSE.
3267 IF ( setinitval .EQ. 3 ) grid%write_qcw=.FALSE.
3268 IF ( setinitval .EQ. 3 ) grid%write_qrn=.FALSE.
3269 IF ( setinitval .EQ. 3 ) grid%write_qci=.FALSE.
3270 IF ( setinitval .EQ. 3 ) grid%write_qsn=.FALSE.
3271 IF ( setinitval .EQ. 3 ) grid%write_qgr=.FALSE.
3272 IF ( setinitval .EQ. 3 ) grid%write_filtered_obs=.FALSE.
3273 IF ( setinitval .EQ. 3 ) grid%fg_format=0
3274 IF ( setinitval .EQ. 3 ) grid%ob_format=0
3275 IF ( setinitval .EQ. 3 ) grid%num_fgat_time=0
3276 IF ( setinitval .EQ. 3 ) grid%use_synopobs=.FALSE.
3277 IF ( setinitval .EQ. 3 ) grid%use_shipsobs=.FALSE.
3278 IF ( setinitval .EQ. 3 ) grid%use_metarobs=.FALSE.
3279 IF ( setinitval .EQ. 3 ) grid%use_soundobs=.FALSE.
3280 IF ( setinitval .EQ. 3 ) grid%use_pilotobs=.FALSE.
3281 IF ( setinitval .EQ. 3 ) grid%use_airepobs=.FALSE.
3282 IF ( setinitval .EQ. 3 ) grid%use_geoamvobs=.FALSE.
3283 IF ( setinitval .EQ. 3 ) grid%use_polaramvobs=.FALSE.
3284 IF ( setinitval .EQ. 3 ) grid%use_bogusobs=.FALSE.
3285 IF ( setinitval .EQ. 3 ) grid%use_buoyobs=.FALSE.
3286 IF ( setinitval .EQ. 3 ) grid%use_profilerobs=.FALSE.
3287 IF ( setinitval .EQ. 3 ) grid%use_satemobs=.FALSE.
3288 IF ( setinitval .EQ. 3 ) grid%use_gpspwobs=.FALSE.
3289 IF ( setinitval .EQ. 3 ) grid%use_gpsrefobs=.FALSE.
3290 IF ( setinitval .EQ. 3 ) grid%use_ssmiretrievalobs=.FALSE.
3291 IF ( setinitval .EQ. 3 ) grid%use_ssmitbobs=.FALSE.
3292 IF ( setinitval .EQ. 3 ) grid%use_ssmt1obs=.FALSE.
3293 IF ( setinitval .EQ. 3 ) grid%use_ssmt2obs=.FALSE.
3294 IF ( setinitval .EQ. 3 ) grid%use_qscatobs=.FALSE.
3295 IF ( setinitval .EQ. 3 ) grid%use_radarobs=.FALSE.
3296 IF ( setinitval .EQ. 3 ) grid%use_radar_rv=.FALSE.
3297 IF ( setinitval .EQ. 3 ) grid%use_radar_rf=.FALSE.
3298 IF ( setinitval .EQ. 3 ) grid%use_hirs2obs=.FALSE.
3299 IF ( setinitval .EQ. 3 ) grid%use_hirs3obs=.FALSE.
3300 IF ( setinitval .EQ. 3 ) grid%use_hirs4obs=.FALSE.
3301 IF ( setinitval .EQ. 3 ) grid%use_mhsobs=.FALSE.
3302 IF ( setinitval .EQ. 3 ) grid%use_msuobs=.FALSE.
3303 IF ( setinitval .EQ. 3 ) grid%use_amsuaobs=.FALSE.
3304 IF ( setinitval .EQ. 3 ) grid%use_amsubobs=.FALSE.
3305 IF ( setinitval .EQ. 3 ) grid%use_airsobs=.FALSE.
3306 IF ( setinitval .EQ. 3 ) grid%use_airsretobs=.FALSE.
3307 IF ( setinitval .EQ. 3 ) grid%use_eos_amsuaobs=.FALSE.
3308 IF ( setinitval .EQ. 3 ) grid%use_eos_radobs=.FALSE.
3309 IF ( setinitval .EQ. 3 ) grid%use_hsbobs=.FALSE.
3310 IF ( setinitval .EQ. 3 ) grid%use_ssmisobs=.FALSE.
3311 IF ( setinitval .EQ. 3 ) grid%use_kma1dvar=.FALSE.
3312 IF ( setinitval .EQ. 3 ) grid%use_filtered_rad=.FALSE.
3313 IF ( setinitval .EQ. 3 ) grid%use_obs_errfac=.FALSE.
3314 IF ( setinitval .EQ. 3 ) grid%check_max_iv=.FALSE.
3315 IF ( setinitval .EQ. 3 ) grid%put_rand_seed=.FALSE.
3316 IF ( setinitval .EQ. 3 ) grid%omb_set_rand=.FALSE.
3317 IF ( setinitval .EQ. 3 ) grid%omb_add_noise=.FALSE.
3318 IF ( setinitval .EQ. 3 ) grid%position_lev_dependant=.FALSE.
3319 IF ( setinitval .EQ. 3 ) grid%obs_qc_pointer=0
3320 IF ( setinitval .EQ. 3 ) grid%max_sound_input=0
3321 IF ( setinitval .EQ. 3 ) grid%max_synop_input=0
3322 IF ( setinitval .EQ. 3 ) grid%max_geoamv_input=0
3323 IF ( setinitval .EQ. 3 ) grid%max_polaramv_input=0
3324 IF ( setinitval .EQ. 3 ) grid%max_airep_input=0
3325 IF ( setinitval .EQ. 3 ) grid%max_satem_input=0
3326 IF ( setinitval .EQ. 3 ) grid%max_pilot_input=0
3327 IF ( setinitval .EQ. 3 ) grid%max_radar_input=0
3328 IF ( setinitval .EQ. 3 ) grid%max_metar_input=0
3329 IF ( setinitval .EQ. 3 ) grid%max_gpspw_input=0
3330 IF ( setinitval .EQ. 3 ) grid%max_ships_input=0
3331 IF ( setinitval .EQ. 3 ) grid%max_profiler_input=0
3332 IF ( setinitval .EQ. 3 ) grid%max_bogus_input=0
3333 IF ( setinitval .EQ. 3 ) grid%max_buoy_input=0
3334 IF ( setinitval .EQ. 3 ) grid%max_ssmi_rv_input=0
3335 IF ( setinitval .EQ. 3 ) grid%max_ssmi_tb_input=0
3336 IF ( setinitval .EQ. 3 ) grid%max_ssmt1_input=0
3337 IF ( setinitval .EQ. 3 ) grid%max_ssmt2_input=0
3338 IF ( setinitval .EQ. 3 ) grid%max_qscat_input=0
3339 IF ( setinitval .EQ. 3 ) grid%max_gpsref_input=0
3340 IF ( setinitval .EQ. 3 ) grid%max_airsr_input=0
3341 IF ( setinitval .EQ. 3 ) grid%max_tovs_input=0
3342 IF ( setinitval .EQ. 3 ) grid%max_ssmis_input=0
3343 IF ( setinitval .EQ. 3 ) grid%report_start=0
3344 IF ( setinitval .EQ. 3 ) grid%report_end=0
3345 IF ( setinitval .EQ. 3 ) grid%tovs_start=0
3346 IF ( setinitval .EQ. 3 ) grid%tovs_end=0
3347 IF ( setinitval .EQ. 3 ) grid%max_ext_its=0
3348 IF ( setinitval .EQ. 3 ) grid%ntmax=0
3349 IF ( setinitval .EQ. 3 ) grid%nsave=0
3350 IF ( setinitval .EQ. 3 ) grid%write_interval=0
3351 IF ( setinitval .EQ. 3 ) grid%eps=initial_data_value
3352 IF ( setinitval .EQ. 3 ) grid%rf_passes=0
3353 IF ( setinitval .EQ. 3 ) grid%var_scaling1=initial_data_value
3354 IF ( setinitval .EQ. 3 ) grid%var_scaling2=initial_data_value
3355 IF ( setinitval .EQ. 3 ) grid%var_scaling3=initial_data_value
3356 IF ( setinitval .EQ. 3 ) grid%var_scaling4=initial_data_value
3357 IF ( setinitval .EQ. 3 ) grid%var_scaling5=initial_data_value
3358 IF ( setinitval .EQ. 3 ) grid%len_scaling1=initial_data_value
3359 IF ( setinitval .EQ. 3 ) grid%len_scaling2=initial_data_value
3360 IF ( setinitval .EQ. 3 ) grid%len_scaling3=initial_data_value
3361 IF ( setinitval .EQ. 3 ) grid%len_scaling4=initial_data_value
3362 IF ( setinitval .EQ. 3 ) grid%len_scaling5=initial_data_value
3363 IF ( setinitval .EQ. 3 ) grid%jb_factor=initial_data_value
3364 IF ( setinitval .EQ. 3 ) grid%je_factor=initial_data_value
3365 IF ( setinitval .EQ. 3 ) grid%power_truncation=initial_data_value
3366 IF ( setinitval .EQ. 3 ) grid%def_sub_domain=.FALSE.
3367 IF ( setinitval .EQ. 3 ) grid%x_start_sub_domain=initial_data_value
3368 IF ( setinitval .EQ. 3 ) grid%y_start_sub_domain=initial_data_value
3369 IF ( setinitval .EQ. 3 ) grid%x_end_sub_domain=initial_data_value
3370 IF ( setinitval .EQ. 3 ) grid%y_end_sub_domain=initial_data_value
3371 IF ( setinitval .EQ. 3 ) grid%stdout=0
3372 IF ( setinitval .EQ. 3 ) grid%stderr=0
3373 IF ( setinitval .EQ. 3 ) grid%trace_unit=0
3374 IF ( setinitval .EQ. 3 ) grid%trace_pe=0
3375 IF ( setinitval .EQ. 3 ) grid%trace_repeat_head=0
3376 IF ( setinitval .EQ. 3 ) grid%trace_repeat_body=0
3377 IF ( setinitval .EQ. 3 ) grid%trace_max_depth=0
3378 IF ( setinitval .EQ. 3 ) grid%trace_use=.FALSE.
3379 IF ( setinitval .EQ. 3 ) grid%trace_use_frequent=.FALSE.
3380 IF ( setinitval .EQ. 3 ) grid%trace_use_dull=.FALSE.
3381 IF ( setinitval .EQ. 3 ) grid%trace_memory=.FALSE.
3382 IF ( setinitval .EQ. 3 ) grid%trace_all_pes=.FALSE.
3383 IF ( setinitval .EQ. 3 ) grid%trace_csv=.FALSE.
3384 IF ( setinitval .EQ. 3 ) grid%use_html=.FALSE.
3385 IF ( setinitval .EQ. 3 ) grid%warnings_are_fatal=.FALSE.
3386 IF ( setinitval .EQ. 3 ) grid%test_wrfvar=.FALSE.
3387 IF ( setinitval .EQ. 3 ) grid%test_transforms=.FALSE.
3388 IF ( setinitval .EQ. 3 ) grid%test_statistics=.FALSE.
3389 IF ( setinitval .EQ. 3 ) grid%interpolate_stats=.FALSE.
3390 IF ( setinitval .EQ. 3 ) grid%test_dm_exact=.FALSE.
3391 IF ( setinitval .EQ. 3 ) grid%cv_options_hum=0
3392 IF ( setinitval .EQ. 3 ) grid%check_rh=0
3393 IF ( setinitval .EQ. 3 ) grid%set_omb_rand_fac=0
3394 IF ( setinitval .EQ. 3 ) grid%seed_array1=0
3395 IF ( setinitval .EQ. 3 ) grid%seed_array2=0
3396 IF ( setinitval .EQ. 3 ) grid%sfc_assi_options=0
3397 IF ( setinitval .EQ. 3 ) grid%calculate_cg_cost_fn=.FALSE.
3398 IF ( setinitval .EQ. 3 ) grid%lat_stats_option=.FALSE.
3399 IF ( setinitval .EQ. 3 ) grid%balance_type=0
3400 IF ( setinitval .EQ. 3 ) grid%vert_corr=0
3401 IF ( setinitval .EQ. 3 ) grid%vertical_ip=0
3402 IF ( setinitval .EQ. 3 ) grid%vert_evalue=0
3403 IF ( setinitval .EQ. 3 ) grid%max_vert_var1=initial_data_value
3404 IF ( setinitval .EQ. 3 ) grid%max_vert_var2=initial_data_value
3405 IF ( setinitval .EQ. 3 ) grid%max_vert_var3=initial_data_value
3406 IF ( setinitval .EQ. 3 ) grid%max_vert_var4=initial_data_value
3407 IF ( setinitval .EQ. 3 ) grid%max_vert_var5=initial_data_value
3408 IF ( setinitval .EQ. 3 ) grid%rtminit_print=0
3409 IF ( setinitval .EQ. 3 ) grid%rtminit_nsensor=0
3410 IF ( setinitval .EQ. 3 ) grid%rtminit_platform=0
3411 IF ( setinitval .EQ. 3 ) grid%rtminit_satid=0
3412 IF ( setinitval .EQ. 3 ) grid%rtminit_sensor=0
3413 IF ( setinitval .EQ. 3 ) grid%rad_monitoring=0
3414 IF ( setinitval .EQ. 3 ) grid%thinning_mesh=initial_data_value
3415 IF ( setinitval .EQ. 3 ) grid%thinning=.FALSE.
3416 IF ( setinitval .EQ. 3 ) grid%read_biascoef=.FALSE.
3417 IF ( setinitval .EQ. 3 ) grid%biascorr=.FALSE.
3418 IF ( setinitval .EQ. 3 ) grid%biasprep=.FALSE.
3419 IF ( setinitval .EQ. 3 ) grid%rttov_scatt=.FALSE.
3420 IF ( setinitval .EQ. 3 ) grid%write_profile=.FALSE.
3421 IF ( setinitval .EQ. 3 ) grid%qc_rad=.FALSE.
3422 IF ( setinitval .EQ. 3 ) grid%write_iv_rad_ascii=.FALSE.
3423 IF ( setinitval .EQ. 3 ) grid%write_oa_rad_ascii=.FALSE.
3424 IF ( setinitval .EQ. 3 ) grid%write_filtered_rad=.FALSE.
3425 IF ( setinitval .EQ. 3 ) grid%use_error_factor_rad=.FALSE.
3426 IF ( setinitval .EQ. 3 ) grid%use_landem=.FALSE.
3427 IF ( setinitval .EQ. 3 ) grid%mw_emis_sea=0
3428 IF ( setinitval .EQ. 3 ) grid%tovs_min_transfer=0
3429 IF ( setinitval .EQ. 3 ) grid%tovs_batch=.FALSE.
3430 IF ( setinitval .EQ. 3 ) grid%rtm_option=0
3431 IF ( setinitval .EQ. 3 ) grid%use_crtm_kmatrix=.FALSE.
3432 IF ( setinitval .EQ. 3 ) grid%use_crtm_kmatrix_fast=.FALSE.
3433 IF ( setinitval .EQ. 3 ) grid%crtm_cloud=.FALSE.
3434 IF ( setinitval .EQ. 3 ) grid%num_pseudo=0
3435 IF ( setinitval .EQ. 3 ) grid%pseudo_x=initial_data_value
3436 IF ( setinitval .EQ. 3 ) grid%pseudo_y=initial_data_value
3437 IF ( setinitval .EQ. 3 ) grid%pseudo_z=initial_data_value
3438 IF ( setinitval .EQ. 3 ) grid%pseudo_val=initial_data_value
3439 IF ( setinitval .EQ. 3 ) grid%pseudo_err=initial_data_value
3440 IF ( setinitval .EQ. 3 ) grid%alphacv_method=0
3441 IF ( setinitval .EQ. 3 ) grid%ensdim_alpha=0
3442 IF ( setinitval .EQ. 3 ) grid%alpha_truncation=0
3443 IF ( setinitval .EQ. 3 ) grid%alpha_corr_type=0
3444 IF ( setinitval .EQ. 3 ) grid%alpha_corr_scale=initial_data_value
3445 IF ( setinitval .EQ. 3 ) grid%alpha_std_dev=initial_data_value
3446 IF ( setinitval .EQ. 3 ) grid%jcdfi_use=.FALSE.
3447 IF ( setinitval .EQ. 3 ) grid%jcdfi_tauc=initial_data_value
3448 IF ( setinitval .EQ. 3 ) grid%jcdfi_gama=initial_data_value
3449 IF ( setinitval .EQ. 3 ) grid%jcdfi_error_wind=initial_data_value
3450 IF ( setinitval .EQ. 3 ) grid%jcdfi_error_t=initial_data_value
3451 IF ( setinitval .EQ. 3 ) grid%jcdfi_error_q=initial_data_value
3452 IF ( setinitval .EQ. 3 ) grid%jcdfi_error_mu=initial_data_value
3453 IF ( setinitval .EQ. 3 ) grid%run_days=0
3454 IF ( setinitval .EQ. 3 ) grid%run_hours=0
3455 IF ( setinitval .EQ. 3 ) grid%run_minutes=0
3456 IF ( setinitval .EQ. 3 ) grid%run_seconds=0
3457 IF ( setinitval .EQ. 3 ) grid%start_year=0
3458 IF ( setinitval .EQ. 3 ) grid%start_month=0
3459 IF ( setinitval .EQ. 3 ) grid%start_day=0
3460 IF ( setinitval .EQ. 3 ) grid%start_hour=0
3461 IF ( setinitval .EQ. 3 ) grid%start_minute=0
3462 IF ( setinitval .EQ. 3 ) grid%start_second=0
3463 IF ( setinitval .EQ. 3 ) grid%end_year=0
3464 IF ( setinitval .EQ. 3 ) grid%end_month=0
3465 IF ( setinitval .EQ. 3 ) grid%end_day=0
3466 IF ( setinitval .EQ. 3 ) grid%end_hour=0
3467 IF ( setinitval .EQ. 3 ) grid%end_minute=0
3468 IF ( setinitval .EQ. 3 ) grid%end_second=0
3469 IF ( setinitval .EQ. 3 ) grid%interval_seconds=0
3470 IF ( setinitval .EQ. 3 ) grid%input_from_file=.FALSE.
3471 IF ( setinitval .EQ. 3 ) grid%fine_input_stream=0
3472 IF ( setinitval .EQ. 3 ) grid%input_from_hires=.FALSE.
3473 IF ( setinitval .EQ. 3 ) grid%oid=0
3474 IF ( setinitval .EQ. 3 ) grid%auxhist1_oid=0
3475 IF ( setinitval .EQ. 3 ) grid%auxhist2_oid=0
3476 IF ( setinitval .EQ. 3 ) grid%auxhist3_oid=0
3477 IF ( setinitval .EQ. 3 ) grid%auxhist4_oid=0
3478 IF ( setinitval .EQ. 3 ) grid%auxhist5_oid=0
3479 IF ( setinitval .EQ. 3 ) grid%auxhist6_oid=0
3480 IF ( setinitval .EQ. 3 ) grid%auxhist7_oid=0
3481 IF ( setinitval .EQ. 3 ) grid%auxhist8_oid=0
3482 IF ( setinitval .EQ. 3 ) grid%auxhist9_oid=0
3483 IF ( setinitval .EQ. 3 ) grid%auxhist10_oid=0
3484 IF ( setinitval .EQ. 3 ) grid%auxhist11_oid=0
3485 IF ( setinitval .EQ. 3 ) grid%auxinput1_oid=0
3486 IF ( setinitval .EQ. 3 ) grid%auxinput2_oid=0
3487 IF ( setinitval .EQ. 3 ) grid%auxinput3_oid=0
3488 IF ( setinitval .EQ. 3 ) grid%auxinput4_oid=0
3489 IF ( setinitval .EQ. 3 ) grid%auxinput5_oid=0
3490 IF ( setinitval .EQ. 3 ) grid%auxinput6_oid=0
3491 IF ( setinitval .EQ. 3 ) grid%auxinput7_oid=0
3492 IF ( setinitval .EQ. 3 ) grid%auxinput8_oid=0
3493 IF ( setinitval .EQ. 3 ) grid%auxinput9_oid=0
3494 IF ( setinitval .EQ. 3 ) grid%auxinput10_oid=0
3495 IF ( setinitval .EQ. 3 ) grid%auxinput11_oid=0
3496 IF ( setinitval .EQ. 3 ) grid%history_interval=0
3497 IF ( setinitval .EQ. 3 ) grid%frames_per_outfile=0
3498 IF ( setinitval .EQ. 3 ) grid%frames_per_auxhist1=0
3499 IF ( setinitval .EQ. 3 ) grid%frames_per_auxhist2=0
3500 IF ( setinitval .EQ. 3 ) grid%frames_per_auxhist3=0
3501 IF ( setinitval .EQ. 3 ) grid%frames_per_auxhist4=0
3502 IF ( setinitval .EQ. 3 ) grid%frames_per_auxhist5=0
3503 IF ( setinitval .EQ. 3 ) grid%frames_per_auxhist6=0
3504 IF ( setinitval .EQ. 3 ) grid%frames_per_auxhist7=0
3505 IF ( setinitval .EQ. 3 ) grid%frames_per_auxhist8=0
3506 IF ( setinitval .EQ. 3 ) grid%frames_per_auxhist9=0
3507 IF ( setinitval .EQ. 3 ) grid%frames_per_auxhist10=0
3508 IF ( setinitval .EQ. 3 ) grid%frames_per_auxhist11=0
3509 IF ( setinitval .EQ. 3 ) grid%restart=.FALSE.
3510 IF ( setinitval .EQ. 3 ) grid%restart_interval=0
3511 IF ( setinitval .EQ. 3 ) grid%io_form_input=0
3512 IF ( setinitval .EQ. 3 ) grid%io_form_history=0
3513 IF ( setinitval .EQ. 3 ) grid%io_form_restart=0
3514 IF ( setinitval .EQ. 3 ) grid%io_form_boundary=0
3515 IF ( setinitval .EQ. 3 ) grid%debug_level=0
3516 IF ( setinitval .EQ. 3 ) grid%self_test_domain=.FALSE.
3517 IF ( setinitval .EQ. 3 ) grid%history_interval_mo=0
3518 IF ( setinitval .EQ. 3 ) grid%history_interval_d=0
3519 IF ( setinitval .EQ. 3 ) grid%history_interval_h=0
3520 IF ( setinitval .EQ. 3 ) grid%history_interval_m=0
3521 IF ( setinitval .EQ. 3 ) grid%history_interval_s=0
3522 IF ( setinitval .EQ. 3 ) grid%inputout_interval_mo=0
3523 IF ( setinitval .EQ. 3 ) grid%inputout_interval_d=0
3524 IF ( setinitval .EQ. 3 ) grid%inputout_interval_h=0
3525 IF ( setinitval .EQ. 3 ) grid%inputout_interval_m=0
3526 IF ( setinitval .EQ. 3 ) grid%inputout_interval_s=0
3527 IF ( setinitval .EQ. 3 ) grid%inputout_interval=0
3528 IF ( setinitval .EQ. 3 ) grid%auxhist1_interval_mo=0
3529 IF ( setinitval .EQ. 3 ) grid%auxhist1_interval_d=0
3530 IF ( setinitval .EQ. 3 ) grid%auxhist1_interval_h=0
3531 IF ( setinitval .EQ. 3 ) grid%auxhist1_interval_m=0
3532 IF ( setinitval .EQ. 3 ) grid%auxhist1_interval_s=0
3533 IF ( setinitval .EQ. 3 ) grid%auxhist1_interval=0
3534 IF ( setinitval .EQ. 3 ) grid%auxhist2_interval_mo=0
3535 IF ( setinitval .EQ. 3 ) grid%auxhist2_interval_d=0
3536 IF ( setinitval .EQ. 3 ) grid%auxhist2_interval_h=0
3537 IF ( setinitval .EQ. 3 ) grid%auxhist2_interval_m=0
3538 IF ( setinitval .EQ. 3 ) grid%auxhist2_interval_s=0
3539 IF ( setinitval .EQ. 3 ) grid%auxhist2_interval=0
3540 IF ( setinitval .EQ. 3 ) grid%auxhist3_interval_mo=0
3541 IF ( setinitval .EQ. 3 ) grid%auxhist3_interval_d=0
3542 IF ( setinitval .EQ. 3 ) grid%auxhist3_interval_h=0
3543 IF ( setinitval .EQ. 3 ) grid%auxhist3_interval_m=0
3544 IF ( setinitval .EQ. 3 ) grid%auxhist3_interval_s=0
3545 IF ( setinitval .EQ. 3 ) grid%auxhist3_interval=0
3546 IF ( setinitval .EQ. 3 ) grid%auxhist4_interval_mo=0
3547 IF ( setinitval .EQ. 3 ) grid%auxhist4_interval_d=0
3548 IF ( setinitval .EQ. 3 ) grid%auxhist4_interval_h=0
3549 IF ( setinitval .EQ. 3 ) grid%auxhist4_interval_m=0
3550 IF ( setinitval .EQ. 3 ) grid%auxhist4_interval_s=0
3551 IF ( setinitval .EQ. 3 ) grid%auxhist4_interval=0
3552 IF ( setinitval .EQ. 3 ) grid%auxhist5_interval_mo=0
3553 IF ( setinitval .EQ. 3 ) grid%auxhist5_interval_d=0
3554 IF ( setinitval .EQ. 3 ) grid%auxhist5_interval_h=0
3555 IF ( setinitval .EQ. 3 ) grid%auxhist5_interval_m=0
3556 IF ( setinitval .EQ. 3 ) grid%auxhist5_interval_s=0
3557 IF ( setinitval .EQ. 3 ) grid%auxhist5_interval=0
3558 IF ( setinitval .EQ. 3 ) grid%auxhist6_interval_mo=0
3559 IF ( setinitval .EQ. 3 ) grid%auxhist6_interval_d=0
3560 IF ( setinitval .EQ. 3 ) grid%auxhist6_interval_h=0
3561 IF ( setinitval .EQ. 3 ) grid%auxhist6_interval_m=0
3562 IF ( setinitval .EQ. 3 ) grid%auxhist6_interval_s=0
3563 IF ( setinitval .EQ. 3 ) grid%auxhist6_interval=0
3564 IF ( setinitval .EQ. 3 ) grid%auxhist7_interval_mo=0
3565 IF ( setinitval .EQ. 3 ) grid%auxhist7_interval_d=0
3566 IF ( setinitval .EQ. 3 ) grid%auxhist7_interval_h=0
3567 IF ( setinitval .EQ. 3 ) grid%auxhist7_interval_m=0
3568 IF ( setinitval .EQ. 3 ) grid%auxhist7_interval_s=0
3569 IF ( setinitval .EQ. 3 ) grid%auxhist7_interval=0
3570 IF ( setinitval .EQ. 3 ) grid%auxhist8_interval_mo=0
3571 IF ( setinitval .EQ. 3 ) grid%auxhist8_interval_d=0
3572 IF ( setinitval .EQ. 3 ) grid%auxhist8_interval_h=0
3573 IF ( setinitval .EQ. 3 ) grid%auxhist8_interval_m=0
3574 IF ( setinitval .EQ. 3 ) grid%auxhist8_interval_s=0
3575 IF ( setinitval .EQ. 3 ) grid%auxhist8_interval=0
3576 IF ( setinitval .EQ. 3 ) grid%auxhist9_interval_mo=0
3577 IF ( setinitval .EQ. 3 ) grid%auxhist9_interval_d=0
3578 IF ( setinitval .EQ. 3 ) grid%auxhist9_interval_h=0
3579 IF ( setinitval .EQ. 3 ) grid%auxhist9_interval_m=0
3580 IF ( setinitval .EQ. 3 ) grid%auxhist9_interval_s=0
3581 IF ( setinitval .EQ. 3 ) grid%auxhist9_interval=0
3582 IF ( setinitval .EQ. 3 ) grid%auxhist10_interval_mo=0
3583 IF ( setinitval .EQ. 3 ) grid%auxhist10_interval_d=0
3584 IF ( setinitval .EQ. 3 ) grid%auxhist10_interval_h=0
3585 IF ( setinitval .EQ. 3 ) grid%auxhist10_interval_m=0
3586 IF ( setinitval .EQ. 3 ) grid%auxhist10_interval_s=0
3587 IF ( setinitval .EQ. 3 ) grid%auxhist10_interval=0
3588 IF ( setinitval .EQ. 3 ) grid%auxhist11_interval_mo=0
3589 IF ( setinitval .EQ. 3 ) grid%auxhist11_interval_d=0
3590 IF ( setinitval .EQ. 3 ) grid%auxhist11_interval_h=0
3591 IF ( setinitval .EQ. 3 ) grid%auxhist11_interval_m=0
3592 IF ( setinitval .EQ. 3 ) grid%auxhist11_interval_s=0
3593 IF ( setinitval .EQ. 3 ) grid%auxhist11_interval=0
3594 IF ( setinitval .EQ. 3 ) grid%auxinput1_interval_mo=0
3595 IF ( setinitval .EQ. 3 ) grid%auxinput1_interval_d=0
3596 IF ( setinitval .EQ. 3 ) grid%auxinput1_interval_h=0
3597 IF ( setinitval .EQ. 3 ) grid%auxinput1_interval_m=0
3598 IF ( setinitval .EQ. 3 ) grid%auxinput1_interval_s=0
3599 IF ( setinitval .EQ. 3 ) grid%auxinput1_interval=0
3600 IF ( setinitval .EQ. 3 ) grid%auxinput2_interval_mo=0
3601 IF ( setinitval .EQ. 3 ) grid%auxinput2_interval_d=0
3602 IF ( setinitval .EQ. 3 ) grid%auxinput2_interval_h=0
3603 IF ( setinitval .EQ. 3 ) grid%auxinput2_interval_m=0
3604 IF ( setinitval .EQ. 3 ) grid%auxinput2_interval_s=0
3605 IF ( setinitval .EQ. 3 ) grid%auxinput2_interval=0
3606 IF ( setinitval .EQ. 3 ) grid%auxinput3_interval_mo=0
3607 IF ( setinitval .EQ. 3 ) grid%auxinput3_interval_d=0
3608 IF ( setinitval .EQ. 3 ) grid%auxinput3_interval_h=0
3609 IF ( setinitval .EQ. 3 ) grid%auxinput3_interval_m=0
3610 IF ( setinitval .EQ. 3 ) grid%auxinput3_interval_s=0
3611 IF ( setinitval .EQ. 3 ) grid%auxinput3_interval=0
3612 IF ( setinitval .EQ. 3 ) grid%auxinput4_interval_mo=0
3613 IF ( setinitval .EQ. 3 ) grid%auxinput4_interval_d=0
3614 IF ( setinitval .EQ. 3 ) grid%auxinput4_interval_h=0
3615 IF ( setinitval .EQ. 3 ) grid%auxinput4_interval_m=0
3616 IF ( setinitval .EQ. 3 ) grid%auxinput4_interval_s=0
3617 IF ( setinitval .EQ. 3 ) grid%auxinput4_interval=0
3618 IF ( setinitval .EQ. 3 ) grid%auxinput5_interval_mo=0
3619 IF ( setinitval .EQ. 3 ) grid%auxinput5_interval_d=0
3620 IF ( setinitval .EQ. 3 ) grid%auxinput5_interval_h=0
3621 IF ( setinitval .EQ. 3 ) grid%auxinput5_interval_m=0
3622 IF ( setinitval .EQ. 3 ) grid%auxinput5_interval_s=0
3623 IF ( setinitval .EQ. 3 ) grid%auxinput5_interval=0
3624 IF ( setinitval .EQ. 3 ) grid%auxinput6_interval_mo=0
3625 IF ( setinitval .EQ. 3 ) grid%auxinput6_interval_d=0
3626 IF ( setinitval .EQ. 3 ) grid%auxinput6_interval_h=0
3627 IF ( setinitval .EQ. 3 ) grid%auxinput6_interval_m=0
3628 IF ( setinitval .EQ. 3 ) grid%auxinput6_interval_s=0
3629 IF ( setinitval .EQ. 3 ) grid%auxinput6_interval=0
3630 IF ( setinitval .EQ. 3 ) grid%auxinput7_interval_mo=0
3631 IF ( setinitval .EQ. 3 ) grid%auxinput7_interval_d=0
3632 IF ( setinitval .EQ. 3 ) grid%auxinput7_interval_h=0
3633 IF ( setinitval .EQ. 3 ) grid%auxinput7_interval_m=0
3634 IF ( setinitval .EQ. 3 ) grid%auxinput7_interval_s=0
3635 IF ( setinitval .EQ. 3 ) grid%auxinput7_interval=0
3636 IF ( setinitval .EQ. 3 ) grid%auxinput8_interval_mo=0
3637 IF ( setinitval .EQ. 3 ) grid%auxinput8_interval_d=0
3638 IF ( setinitval .EQ. 3 ) grid%auxinput8_interval_h=0
3639 IF ( setinitval .EQ. 3 ) grid%auxinput8_interval_m=0
3640 IF ( setinitval .EQ. 3 ) grid%auxinput8_interval_s=0
3641 IF ( setinitval .EQ. 3 ) grid%auxinput8_interval=0
3642 IF ( setinitval .EQ. 3 ) grid%auxinput9_interval_mo=0
3643 IF ( setinitval .EQ. 3 ) grid%auxinput9_interval_d=0
3644 IF ( setinitval .EQ. 3 ) grid%auxinput9_interval_h=0
3645 IF ( setinitval .EQ. 3 ) grid%auxinput9_interval_m=0
3646 IF ( setinitval .EQ. 3 ) grid%auxinput9_interval_s=0
3647 IF ( setinitval .EQ. 3 ) grid%auxinput9_interval=0
3648 IF ( setinitval .EQ. 3 ) grid%gfdda_interval_mo=0
3649 IF ( setinitval .EQ. 3 ) grid%gfdda_interval_d=0
3650 IF ( setinitval .EQ. 3 ) grid%gfdda_interval_h=0
3651 IF ( setinitval .EQ. 3 ) grid%gfdda_interval_m=0
3652 IF ( setinitval .EQ. 3 ) grid%gfdda_interval_s=0
3653 IF ( setinitval .EQ. 3 ) grid%gfdda_interval=0
3654 IF ( setinitval .EQ. 3 ) grid%auxinput11_interval_mo=0
3655 IF ( setinitval .EQ. 3 ) grid%auxinput11_interval_d=0
3656 IF ( setinitval .EQ. 3 ) grid%auxinput11_interval_h=0
3657 IF ( setinitval .EQ. 3 ) grid%auxinput11_interval_m=0
3658 IF ( setinitval .EQ. 3 ) grid%auxinput11_interval_s=0
3659 IF ( setinitval .EQ. 3 ) grid%auxinput11_interval=0
3660 IF ( setinitval .EQ. 3 ) grid%restart_interval_mo=0
3661 IF ( setinitval .EQ. 3 ) grid%restart_interval_d=0
3662 IF ( setinitval .EQ. 3 ) grid%restart_interval_h=0
3663 IF ( setinitval .EQ. 3 ) grid%restart_interval_m=0
3664 IF ( setinitval .EQ. 3 ) grid%restart_interval_s=0
3665 IF ( setinitval .EQ. 3 ) grid%history_begin_y=0
3666 IF ( setinitval .EQ. 3 ) grid%history_begin_mo=0
3667 IF ( setinitval .EQ. 3 ) grid%history_begin_d=0
3668 IF ( setinitval .EQ. 3 ) grid%history_begin_h=0
3669 IF ( setinitval .EQ. 3 ) grid%history_begin_m=0
3670 IF ( setinitval .EQ. 3 ) grid%history_begin_s=0
3671 IF ( setinitval .EQ. 3 ) grid%inputout_begin_y=0
3672 IF ( setinitval .EQ. 3 ) grid%inputout_begin_mo=0
3673 IF ( setinitval .EQ. 3 ) grid%inputout_begin_d=0
3674 IF ( setinitval .EQ. 3 ) grid%inputout_begin_h=0
3675 IF ( setinitval .EQ. 3 ) grid%inputout_begin_m=0
3676 IF ( setinitval .EQ. 3 ) grid%inputout_begin_s=0
3677 IF ( setinitval .EQ. 3 ) grid%auxhist1_begin_y=0
3678 IF ( setinitval .EQ. 3 ) grid%auxhist1_begin_mo=0
3679 IF ( setinitval .EQ. 3 ) grid%auxhist1_begin_d=0
3680 IF ( setinitval .EQ. 3 ) grid%auxhist1_begin_h=0
3681 IF ( setinitval .EQ. 3 ) grid%auxhist1_begin_m=0
3682 IF ( setinitval .EQ. 3 ) grid%auxhist1_begin_s=0
3683 IF ( setinitval .EQ. 3 ) grid%auxhist2_begin_y=0
3684 IF ( setinitval .EQ. 3 ) grid%auxhist2_begin_mo=0
3685 IF ( setinitval .EQ. 3 ) grid%auxhist2_begin_d=0
3686 IF ( setinitval .EQ. 3 ) grid%auxhist2_begin_h=0
3687 IF ( setinitval .EQ. 3 ) grid%auxhist2_begin_m=0
3688 IF ( setinitval .EQ. 3 ) grid%auxhist2_begin_s=0
3689 IF ( setinitval .EQ. 3 ) grid%auxhist3_begin_y=0
3690 IF ( setinitval .EQ. 3 ) grid%auxhist3_begin_mo=0
3691 IF ( setinitval .EQ. 3 ) grid%auxhist3_begin_d=0
3692 IF ( setinitval .EQ. 3 ) grid%auxhist3_begin_h=0
3693 IF ( setinitval .EQ. 3 ) grid%auxhist3_begin_m=0
3694 IF ( setinitval .EQ. 3 ) grid%auxhist3_begin_s=0
3695 IF ( setinitval .EQ. 3 ) grid%auxhist4_begin_y=0
3696 IF ( setinitval .EQ. 3 ) grid%auxhist4_begin_mo=0
3697 IF ( setinitval .EQ. 3 ) grid%auxhist4_begin_d=0
3698 IF ( setinitval .EQ. 3 ) grid%auxhist4_begin_h=0
3699 IF ( setinitval .EQ. 3 ) grid%auxhist4_begin_m=0
3700 IF ( setinitval .EQ. 3 ) grid%auxhist4_begin_s=0
3701 IF ( setinitval .EQ. 3 ) grid%auxhist5_begin_y=0
3702 IF ( setinitval .EQ. 3 ) grid%auxhist5_begin_mo=0
3703 IF ( setinitval .EQ. 3 ) grid%auxhist5_begin_d=0
3704 IF ( setinitval .EQ. 3 ) grid%auxhist5_begin_h=0
3705 IF ( setinitval .EQ. 3 ) grid%auxhist5_begin_m=0
3706 IF ( setinitval .EQ. 3 ) grid%auxhist5_begin_s=0
3707 IF ( setinitval .EQ. 3 ) grid%auxhist6_begin_y=0
3708 IF ( setinitval .EQ. 3 ) grid%auxhist6_begin_mo=0
3709 IF ( setinitval .EQ. 3 ) grid%auxhist6_begin_d=0
3710 IF ( setinitval .EQ. 3 ) grid%auxhist6_begin_h=0
3711 IF ( setinitval .EQ. 3 ) grid%auxhist6_begin_m=0
3712 IF ( setinitval .EQ. 3 ) grid%auxhist6_begin_s=0
3713 IF ( setinitval .EQ. 3 ) grid%auxhist7_begin_y=0
3714 IF ( setinitval .EQ. 3 ) grid%auxhist7_begin_mo=0
3715 IF ( setinitval .EQ. 3 ) grid%auxhist7_begin_d=0
3716 IF ( setinitval .EQ. 3 ) grid%auxhist7_begin_h=0
3717 IF ( setinitval .EQ. 3 ) grid%auxhist7_begin_m=0
3718 IF ( setinitval .EQ. 3 ) grid%auxhist7_begin_s=0
3719 IF ( setinitval .EQ. 3 ) grid%auxhist8_begin_y=0
3720 IF ( setinitval .EQ. 3 ) grid%auxhist8_begin_mo=0
3721 IF ( setinitval .EQ. 3 ) grid%auxhist8_begin_d=0
3722 IF ( setinitval .EQ. 3 ) grid%auxhist8_begin_h=0
3723 IF ( setinitval .EQ. 3 ) grid%auxhist8_begin_m=0
3724 IF ( setinitval .EQ. 3 ) grid%auxhist8_begin_s=0
3725 IF ( setinitval .EQ. 3 ) grid%auxhist9_begin_y=0
3726 IF ( setinitval .EQ. 3 ) grid%auxhist9_begin_mo=0
3727 IF ( setinitval .EQ. 3 ) grid%auxhist9_begin_d=0
3728 IF ( setinitval .EQ. 3 ) grid%auxhist9_begin_h=0
3729 IF ( setinitval .EQ. 3 ) grid%auxhist9_begin_m=0
3730 IF ( setinitval .EQ. 3 ) grid%auxhist9_begin_s=0
3731 IF ( setinitval .EQ. 3 ) grid%auxhist10_begin_y=0
3732 IF ( setinitval .EQ. 3 ) grid%auxhist10_begin_mo=0
3733 IF ( setinitval .EQ. 3 ) grid%auxhist10_begin_d=0
3734 IF ( setinitval .EQ. 3 ) grid%auxhist10_begin_h=0
3735 IF ( setinitval .EQ. 3 ) grid%auxhist10_begin_m=0
3736 IF ( setinitval .EQ. 3 ) grid%auxhist10_begin_s=0
3737 IF ( setinitval .EQ. 3 ) grid%auxhist11_begin_y=0
3738 IF ( setinitval .EQ. 3 ) grid%auxhist11_begin_mo=0
3739 IF ( setinitval .EQ. 3 ) grid%auxhist11_begin_d=0
3740 IF ( setinitval .EQ. 3 ) grid%auxhist11_begin_h=0
3741 IF ( setinitval .EQ. 3 ) grid%auxhist11_begin_m=0
3742 IF ( setinitval .EQ. 3 ) grid%auxhist11_begin_s=0
3743 IF ( setinitval .EQ. 3 ) grid%auxinput1_begin_y=0
3744 IF ( setinitval .EQ. 3 ) grid%auxinput1_begin_mo=0
3745 IF ( setinitval .EQ. 3 ) grid%auxinput1_begin_d=0
3746 IF ( setinitval .EQ. 3 ) grid%auxinput1_begin_h=0
3747 IF ( setinitval .EQ. 3 ) grid%auxinput1_begin_m=0
3748 IF ( setinitval .EQ. 3 ) grid%auxinput1_begin_s=0
3749 IF ( setinitval .EQ. 3 ) grid%auxinput2_begin_y=0
3750 IF ( setinitval .EQ. 3 ) grid%auxinput2_begin_mo=0
3751 IF ( setinitval .EQ. 3 ) grid%auxinput2_begin_d=0
3752 IF ( setinitval .EQ. 3 ) grid%auxinput2_begin_h=0
3753 IF ( setinitval .EQ. 3 ) grid%auxinput2_begin_m=0
3754 IF ( setinitval .EQ. 3 ) grid%auxinput2_begin_s=0
3755 IF ( setinitval .EQ. 3 ) grid%auxinput3_begin_y=0
3756 IF ( setinitval .EQ. 3 ) grid%auxinput3_begin_mo=0
3757 IF ( setinitval .EQ. 3 ) grid%auxinput3_begin_d=0
3758 IF ( setinitval .EQ. 3 ) grid%auxinput3_begin_h=0
3759 IF ( setinitval .EQ. 3 ) grid%auxinput3_begin_m=0
3760 IF ( setinitval .EQ. 3 ) grid%auxinput3_begin_s=0
3761 IF ( setinitval .EQ. 3 ) grid%auxinput4_begin_y=0
3762 IF ( setinitval .EQ. 3 ) grid%auxinput4_begin_mo=0
3763 IF ( setinitval .EQ. 3 ) grid%auxinput4_begin_d=0
3764 IF ( setinitval .EQ. 3 ) grid%auxinput4_begin_h=0
3765 IF ( setinitval .EQ. 3 ) grid%auxinput4_begin_m=0
3766 IF ( setinitval .EQ. 3 ) grid%auxinput4_begin_s=0
3767 IF ( setinitval .EQ. 3 ) grid%auxinput5_begin_y=0
3768 IF ( setinitval .EQ. 3 ) grid%auxinput5_begin_mo=0
3769 IF ( setinitval .EQ. 3 ) grid%auxinput5_begin_d=0
3770 IF ( setinitval .EQ. 3 ) grid%auxinput5_begin_h=0
3771 IF ( setinitval .EQ. 3 ) grid%auxinput5_begin_m=0
3772 IF ( setinitval .EQ. 3 ) grid%auxinput5_begin_s=0
3773 IF ( setinitval .EQ. 3 ) grid%auxinput6_begin_y=0
3774 IF ( setinitval .EQ. 3 ) grid%auxinput6_begin_mo=0
3775 IF ( setinitval .EQ. 3 ) grid%auxinput6_begin_d=0
3776 IF ( setinitval .EQ. 3 ) grid%auxinput6_begin_h=0
3777 IF ( setinitval .EQ. 3 ) grid%auxinput6_begin_m=0
3778 IF ( setinitval .EQ. 3 ) grid%auxinput6_begin_s=0
3779 IF ( setinitval .EQ. 3 ) grid%auxinput7_begin_y=0
3780 IF ( setinitval .EQ. 3 ) grid%auxinput7_begin_mo=0
3781 IF ( setinitval .EQ. 3 ) grid%auxinput7_begin_d=0
3782 IF ( setinitval .EQ. 3 ) grid%auxinput7_begin_h=0
3783 IF ( setinitval .EQ. 3 ) grid%auxinput7_begin_m=0
3784 IF ( setinitval .EQ. 3 ) grid%auxinput7_begin_s=0
3785 IF ( setinitval .EQ. 3 ) grid%auxinput8_begin_y=0
3786 IF ( setinitval .EQ. 3 ) grid%auxinput8_begin_mo=0
3787 IF ( setinitval .EQ. 3 ) grid%auxinput8_begin_d=0
3788 IF ( setinitval .EQ. 3 ) grid%auxinput8_begin_h=0
3789 IF ( setinitval .EQ. 3 ) grid%auxinput8_begin_m=0
3790 IF ( setinitval .EQ. 3 ) grid%auxinput8_begin_s=0
3791 IF ( setinitval .EQ. 3 ) grid%auxinput9_begin_y=0
3792 IF ( setinitval .EQ. 3 ) grid%auxinput9_begin_mo=0
3793 IF ( setinitval .EQ. 3 ) grid%auxinput9_begin_d=0
3794 IF ( setinitval .EQ. 3 ) grid%auxinput9_begin_h=0
3795 IF ( setinitval .EQ. 3 ) grid%auxinput9_begin_m=0
3796 IF ( setinitval .EQ. 3 ) grid%auxinput9_begin_s=0
3797 IF ( setinitval .EQ. 3 ) grid%gfdda_begin_y=0
3798 IF ( setinitval .EQ. 3 ) grid%gfdda_begin_mo=0
3799 IF ( setinitval .EQ. 3 ) grid%gfdda_begin_d=0
3800 IF ( setinitval .EQ. 3 ) grid%gfdda_begin_h=0
3801 IF ( setinitval .EQ. 3 ) grid%gfdda_begin_m=0
3802 IF ( setinitval .EQ. 3 ) grid%gfdda_begin_s=0
3803 IF ( setinitval .EQ. 3 ) grid%auxinput11_begin_y=0
3804 IF ( setinitval .EQ. 3 ) grid%auxinput11_begin_mo=0
3805 IF ( setinitval .EQ. 3 ) grid%auxinput11_begin_d=0
3806 IF ( setinitval .EQ. 3 ) grid%auxinput11_begin_h=0
3807 IF ( setinitval .EQ. 3 ) grid%auxinput11_begin_m=0
3808 IF ( setinitval .EQ. 3 ) grid%auxinput11_begin_s=0
3809 IF ( setinitval .EQ. 3 ) grid%restart_begin_y=0
3810 IF ( setinitval .EQ. 3 ) grid%restart_begin_mo=0
3811 IF ( setinitval .EQ. 3 ) grid%restart_begin_d=0
3812 IF ( setinitval .EQ. 3 ) grid%restart_begin_h=0
3813 IF ( setinitval .EQ. 3 ) grid%restart_begin_m=0
3814 IF ( setinitval .EQ. 3 ) grid%restart_begin_s=0
3815 IF ( setinitval .EQ. 3 ) grid%history_end_y=0
3816 IF ( setinitval .EQ. 3 ) grid%history_end_mo=0
3817 IF ( setinitval .EQ. 3 ) grid%history_end_d=0
3818 IF ( setinitval .EQ. 3 ) grid%history_end_h=0
3819 IF ( setinitval .EQ. 3 ) grid%history_end_m=0
3820 IF ( setinitval .EQ. 3 ) grid%history_end_s=0
3821 IF ( setinitval .EQ. 3 ) grid%inputout_end_y=0
3822 IF ( setinitval .EQ. 3 ) grid%inputout_end_mo=0
3823 IF ( setinitval .EQ. 3 ) grid%inputout_end_d=0
3824 IF ( setinitval .EQ. 3 ) grid%inputout_end_h=0
3825 IF ( setinitval .EQ. 3 ) grid%inputout_end_m=0
3826 IF ( setinitval .EQ. 3 ) grid%inputout_end_s=0
3827 IF ( setinitval .EQ. 3 ) grid%auxhist1_end_y=0
3828 IF ( setinitval .EQ. 3 ) grid%auxhist1_end_mo=0
3829 IF ( setinitval .EQ. 3 ) grid%auxhist1_end_d=0
3830 IF ( setinitval .EQ. 3 ) grid%auxhist1_end_h=0
3831 IF ( setinitval .EQ. 3 ) grid%auxhist1_end_m=0
3832 IF ( setinitval .EQ. 3 ) grid%auxhist1_end_s=0
3833 IF ( setinitval .EQ. 3 ) grid%auxhist2_end_y=0
3834 IF ( setinitval .EQ. 3 ) grid%auxhist2_end_mo=0
3835 IF ( setinitval .EQ. 3 ) grid%auxhist2_end_d=0
3836 IF ( setinitval .EQ. 3 ) grid%auxhist2_end_h=0
3837 IF ( setinitval .EQ. 3 ) grid%auxhist2_end_m=0
3838 IF ( setinitval .EQ. 3 ) grid%auxhist2_end_s=0
3839 IF ( setinitval .EQ. 3 ) grid%auxhist3_end_y=0
3840 IF ( setinitval .EQ. 3 ) grid%auxhist3_end_mo=0
3841 IF ( setinitval .EQ. 3 ) grid%auxhist3_end_d=0
3842 IF ( setinitval .EQ. 3 ) grid%auxhist3_end_h=0
3843 IF ( setinitval .EQ. 3 ) grid%auxhist3_end_m=0
3844 IF ( setinitval .EQ. 3 ) grid%auxhist3_end_s=0
3845 IF ( setinitval .EQ. 3 ) grid%auxhist4_end_y=0
3846 IF ( setinitval .EQ. 3 ) grid%auxhist4_end_mo=0
3847 IF ( setinitval .EQ. 3 ) grid%auxhist4_end_d=0
3848 IF ( setinitval .EQ. 3 ) grid%auxhist4_end_h=0
3849 IF ( setinitval .EQ. 3 ) grid%auxhist4_end_m=0
3850 IF ( setinitval .EQ. 3 ) grid%auxhist4_end_s=0
3851 IF ( setinitval .EQ. 3 ) grid%auxhist5_end_y=0
3852 IF ( setinitval .EQ. 3 ) grid%auxhist5_end_mo=0
3853 IF ( setinitval .EQ. 3 ) grid%auxhist5_end_d=0
3854 IF ( setinitval .EQ. 3 ) grid%auxhist5_end_h=0
3855 IF ( setinitval .EQ. 3 ) grid%auxhist5_end_m=0
3856 IF ( setinitval .EQ. 3 ) grid%auxhist5_end_s=0
3857 IF ( setinitval .EQ. 3 ) grid%auxhist6_end_y=0
3858 IF ( setinitval .EQ. 3 ) grid%auxhist6_end_mo=0
3859 IF ( setinitval .EQ. 3 ) grid%auxhist6_end_d=0
3860 IF ( setinitval .EQ. 3 ) grid%auxhist6_end_h=0
3861 IF ( setinitval .EQ. 3 ) grid%auxhist6_end_m=0
3862 IF ( setinitval .EQ. 3 ) grid%auxhist6_end_s=0
3863 IF ( setinitval .EQ. 3 ) grid%auxhist7_end_y=0
3864 IF ( setinitval .EQ. 3 ) grid%auxhist7_end_mo=0
3865 IF ( setinitval .EQ. 3 ) grid%auxhist7_end_d=0
3866 IF ( setinitval .EQ. 3 ) grid%auxhist7_end_h=0
3867 IF ( setinitval .EQ. 3 ) grid%auxhist7_end_m=0
3868 IF ( setinitval .EQ. 3 ) grid%auxhist7_end_s=0
3869 IF ( setinitval .EQ. 3 ) grid%auxhist8_end_y=0
3870 IF ( setinitval .EQ. 3 ) grid%auxhist8_end_mo=0
3871 IF ( setinitval .EQ. 3 ) grid%auxhist8_end_d=0
3872 IF ( setinitval .EQ. 3 ) grid%auxhist8_end_h=0
3873 IF ( setinitval .EQ. 3 ) grid%auxhist8_end_m=0
3874 IF ( setinitval .EQ. 3 ) grid%auxhist8_end_s=0
3875 IF ( setinitval .EQ. 3 ) grid%auxhist9_end_y=0
3876 IF ( setinitval .EQ. 3 ) grid%auxhist9_end_mo=0
3877 IF ( setinitval .EQ. 3 ) grid%auxhist9_end_d=0
3878 IF ( setinitval .EQ. 3 ) grid%auxhist9_end_h=0
3879 IF ( setinitval .EQ. 3 ) grid%auxhist9_end_m=0
3880 IF ( setinitval .EQ. 3 ) grid%auxhist9_end_s=0
3881 IF ( setinitval .EQ. 3 ) grid%auxhist10_end_y=0
3882 IF ( setinitval .EQ. 3 ) grid%auxhist10_end_mo=0
3883 IF ( setinitval .EQ. 3 ) grid%auxhist10_end_d=0
3884 IF ( setinitval .EQ. 3 ) grid%auxhist10_end_h=0
3885 IF ( setinitval .EQ. 3 ) grid%auxhist10_end_m=0
3886 IF ( setinitval .EQ. 3 ) grid%auxhist10_end_s=0
3887 IF ( setinitval .EQ. 3 ) grid%auxhist11_end_y=0
3888 IF ( setinitval .EQ. 3 ) grid%auxhist11_end_mo=0
3889 IF ( setinitval .EQ. 3 ) grid%auxhist11_end_d=0
3890 IF ( setinitval .EQ. 3 ) grid%auxhist11_end_h=0
3891 IF ( setinitval .EQ. 3 ) grid%auxhist11_end_m=0
3892 IF ( setinitval .EQ. 3 ) grid%auxhist11_end_s=0
3893 IF ( setinitval .EQ. 3 ) grid%auxinput1_end_y=0
3894 IF ( setinitval .EQ. 3 ) grid%auxinput1_end_mo=0
3895 IF ( setinitval .EQ. 3 ) grid%auxinput1_end_d=0
3896 IF ( setinitval .EQ. 3 ) grid%auxinput1_end_h=0
3897 IF ( setinitval .EQ. 3 ) grid%auxinput1_end_m=0
3898 IF ( setinitval .EQ. 3 ) grid%auxinput1_end_s=0
3899 IF ( setinitval .EQ. 3 ) grid%auxinput2_end_y=0
3900 IF ( setinitval .EQ. 3 ) grid%auxinput2_end_mo=0
3901 IF ( setinitval .EQ. 3 ) grid%auxinput2_end_d=0
3902 IF ( setinitval .EQ. 3 ) grid%auxinput2_end_h=0
3903 IF ( setinitval .EQ. 3 ) grid%auxinput2_end_m=0
3904 IF ( setinitval .EQ. 3 ) grid%auxinput2_end_s=0
3905 IF ( setinitval .EQ. 3 ) grid%auxinput3_end_y=0
3906 IF ( setinitval .EQ. 3 ) grid%auxinput3_end_mo=0
3907 IF ( setinitval .EQ. 3 ) grid%auxinput3_end_d=0
3908 IF ( setinitval .EQ. 3 ) grid%auxinput3_end_h=0
3909 IF ( setinitval .EQ. 3 ) grid%auxinput3_end_m=0
3910 IF ( setinitval .EQ. 3 ) grid%auxinput3_end_s=0
3911 IF ( setinitval .EQ. 3 ) grid%auxinput4_end_y=0
3912 IF ( setinitval .EQ. 3 ) grid%auxinput4_end_mo=0
3913 IF ( setinitval .EQ. 3 ) grid%auxinput4_end_d=0
3914 IF ( setinitval .EQ. 3 ) grid%auxinput4_end_h=0
3915 IF ( setinitval .EQ. 3 ) grid%auxinput4_end_m=0
3916 IF ( setinitval .EQ. 3 ) grid%auxinput4_end_s=0
3917 IF ( setinitval .EQ. 3 ) grid%auxinput5_end_y=0
3918 IF ( setinitval .EQ. 3 ) grid%auxinput5_end_mo=0
3919 IF ( setinitval .EQ. 3 ) grid%auxinput5_end_d=0
3920 IF ( setinitval .EQ. 3 ) grid%auxinput5_end_h=0
3921 IF ( setinitval .EQ. 3 ) grid%auxinput5_end_m=0
3922 IF ( setinitval .EQ. 3 ) grid%auxinput5_end_s=0
3923 IF ( setinitval .EQ. 3 ) grid%auxinput6_end_y=0
3924 IF ( setinitval .EQ. 3 ) grid%auxinput6_end_mo=0
3925 IF ( setinitval .EQ. 3 ) grid%auxinput6_end_d=0
3926 IF ( setinitval .EQ. 3 ) grid%auxinput6_end_h=0
3927 IF ( setinitval .EQ. 3 ) grid%auxinput6_end_m=0
3928 IF ( setinitval .EQ. 3 ) grid%auxinput6_end_s=0
3929 IF ( setinitval .EQ. 3 ) grid%auxinput7_end_y=0
3930 IF ( setinitval .EQ. 3 ) grid%auxinput7_end_mo=0
3931 IF ( setinitval .EQ. 3 ) grid%auxinput7_end_d=0
3932 IF ( setinitval .EQ. 3 ) grid%auxinput7_end_h=0
3933 IF ( setinitval .EQ. 3 ) grid%auxinput7_end_m=0
3934 IF ( setinitval .EQ. 3 ) grid%auxinput7_end_s=0
3935 IF ( setinitval .EQ. 3 ) grid%auxinput8_end_y=0
3936 IF ( setinitval .EQ. 3 ) grid%auxinput8_end_mo=0
3937 IF ( setinitval .EQ. 3 ) grid%auxinput8_end_d=0
3938 IF ( setinitval .EQ. 3 ) grid%auxinput8_end_h=0
3939 IF ( setinitval .EQ. 3 ) grid%auxinput8_end_m=0
3940 IF ( setinitval .EQ. 3 ) grid%auxinput8_end_s=0
3941 IF ( setinitval .EQ. 3 ) grid%auxinput9_end_y=0
3942 IF ( setinitval .EQ. 3 ) grid%auxinput9_end_mo=0
3943 IF ( setinitval .EQ. 3 ) grid%auxinput9_end_d=0
3944 IF ( setinitval .EQ. 3 ) grid%auxinput9_end_h=0
3945 IF ( setinitval .EQ. 3 ) grid%auxinput9_end_m=0
3946 IF ( setinitval .EQ. 3 ) grid%auxinput9_end_s=0
3947 IF ( setinitval .EQ. 3 ) grid%gfdda_end_y=0
3948 IF ( setinitval .EQ. 3 ) grid%gfdda_end_mo=0
3949 IF ( setinitval .EQ. 3 ) grid%gfdda_end_d=0
3950 IF ( setinitval .EQ. 3 ) grid%gfdda_end_h=0
3951 IF ( setinitval .EQ. 3 ) grid%gfdda_end_m=0
3952 IF ( setinitval .EQ. 3 ) grid%gfdda_end_s=0
3953 IF ( setinitval .EQ. 3 ) grid%auxinput11_end_y=0
3954 IF ( setinitval .EQ. 3 ) grid%auxinput11_end_mo=0
3955 IF ( setinitval .EQ. 3 ) grid%auxinput11_end_d=0
3956 IF ( setinitval .EQ. 3 ) grid%auxinput11_end_h=0
3957 IF ( setinitval .EQ. 3 ) grid%auxinput11_end_m=0
3958 IF ( setinitval .EQ. 3 ) grid%auxinput11_end_s=0
3959 IF ( setinitval .EQ. 3 ) grid%io_form_auxinput1=0
3960 IF ( setinitval .EQ. 3 ) grid%io_form_auxinput2=0
3961 IF ( setinitval .EQ. 3 ) grid%io_form_auxinput3=0
3962 IF ( setinitval .EQ. 3 ) grid%io_form_auxinput4=0
3963 IF ( setinitval .EQ. 3 ) grid%io_form_auxinput5=0
3964 IF ( setinitval .EQ. 3 ) grid%io_form_auxinput6=0
3965 IF ( setinitval .EQ. 3 ) grid%io_form_auxinput7=0
3966 IF ( setinitval .EQ. 3 ) grid%io_form_auxinput8=0
3967 IF ( setinitval .EQ. 3 ) grid%io_form_auxinput9=0
3968 IF ( setinitval .EQ. 3 ) grid%io_form_gfdda=0
3969 IF ( setinitval .EQ. 3 ) grid%io_form_auxinput11=0
3970 IF ( setinitval .EQ. 3 ) grid%io_form_auxhist1=0
3971 IF ( setinitval .EQ. 3 ) grid%io_form_auxhist2=0
3972 IF ( setinitval .EQ. 3 ) grid%io_form_auxhist3=0
3973 IF ( setinitval .EQ. 3 ) grid%io_form_auxhist4=0
3974 IF ( setinitval .EQ. 3 ) grid%io_form_auxhist5=0
3975 IF ( setinitval .EQ. 3 ) grid%io_form_auxhist6=0
3976 IF ( setinitval .EQ. 3 ) grid%io_form_auxhist7=0
3977 IF ( setinitval .EQ. 3 ) grid%io_form_auxhist8=0
3978 IF ( setinitval .EQ. 3 ) grid%io_form_auxhist9=0
3979 IF ( setinitval .EQ. 3 ) grid%io_form_auxhist10=0
3980 IF ( setinitval .EQ. 3 ) grid%io_form_auxhist11=0
3981 IF ( setinitval .EQ. 3 ) grid%simulation_start_year=0
3982 IF ( setinitval .EQ. 3 ) grid%simulation_start_month=0
3983 IF ( setinitval .EQ. 3 ) grid%simulation_start_day=0
3984 IF ( setinitval .EQ. 3 ) grid%simulation_start_hour=0
3985 IF ( setinitval .EQ. 3 ) grid%simulation_start_minute=0
3986 IF ( setinitval .EQ. 3 ) grid%simulation_start_second=0
3987 IF ( setinitval .EQ. 3 ) grid%reset_simulation_start=.FALSE.
3988 IF ( setinitval .EQ. 3 ) grid%sr_x=0
3989 IF ( setinitval .EQ. 3 ) grid%sr_y=0
3990 IF ( setinitval .EQ. 3 ) grid%julyr=0
3991 IF ( setinitval .EQ. 3 ) grid%julday=0
3992 IF ( setinitval .EQ. 3 ) grid%gmt=initial_data_value
3993 IF ( setinitval .EQ. 3 ) grid%write_input=.FALSE.
3994 IF ( setinitval .EQ. 3 ) grid%write_restart_at_0h=.FALSE.
3995 IF ( setinitval .EQ. 3 ) grid%adjust_output_times=.FALSE.
3996 IF ( setinitval .EQ. 3 ) grid%adjust_input_times=.FALSE.
3997 IF ( setinitval .EQ. 3 ) grid%diag_print=0
3998 IF ( setinitval .EQ. 3 ) grid%nocolons=.FALSE.
3999 IF ( setinitval .EQ. 3 ) grid%time_step=0
4000 IF ( setinitval .EQ. 3 ) grid%time_step_fract_num=0
4001 IF ( setinitval .EQ. 3 ) grid%time_step_fract_den=0
4002 IF ( setinitval .EQ. 3 ) grid%max_dom=0
4003 IF ( setinitval .EQ. 3 ) grid%s_we=0
4004 IF ( setinitval .EQ. 3 ) grid%e_we=0
4005 IF ( setinitval .EQ. 3 ) grid%s_sn=0
4006 IF ( setinitval .EQ. 3 ) grid%e_sn=0
4007 IF ( setinitval .EQ. 3 ) grid%s_vert=0
4008 IF ( setinitval .EQ. 3 ) grid%e_vert=0
4009 IF ( setinitval .EQ. 3 ) grid%num_metgrid_levels=0
4010 IF ( setinitval .EQ. 3 ) grid%p_top_requested=initial_data_value
4011 IF ( setinitval .EQ. 3 ) grid%interp_type=0
4012 IF ( setinitval .EQ. 3 ) grid%extrap_type=0
4013 IF ( setinitval .EQ. 3 ) grid%t_extrap_type=0
4014 IF ( setinitval .EQ. 3 ) grid%lowest_lev_from_sfc=.FALSE.
4015 IF ( setinitval .EQ. 3 ) grid%use_levels_below_ground=.FALSE.
4016 IF ( setinitval .EQ. 3 ) grid%use_surface=.FALSE.
4017 IF ( setinitval .EQ. 3 ) grid%lagrange_order=0
4018 IF ( setinitval .EQ. 3 ) grid%force_sfc_in_vinterp=0
4019 IF ( setinitval .EQ. 3 ) grid%zap_close_levels=initial_data_value
4020 IF ( setinitval .EQ. 3 ) grid%sfcp_to_sfcp=.FALSE.
4021 IF ( setinitval .EQ. 3 ) grid%adjust_heights=.FALSE.
4022 IF ( setinitval .EQ. 3 ) grid%dx=initial_data_value
4023 IF ( setinitval .EQ. 3 ) grid%dy=initial_data_value
4024 IF ( setinitval .EQ. 3 ) grid%grid_id=0
4025 IF ( setinitval .EQ. 3 ) grid%parent_id=0
4026 IF ( setinitval .EQ. 3 ) grid%i_parent_start=0
4027 IF ( setinitval .EQ. 3 ) grid%j_parent_start=0
4028 IF ( setinitval .EQ. 3 ) grid%parent_grid_ratio=0
4029 IF ( setinitval .EQ. 3 ) grid%parent_time_step_ratio=0
4030 IF ( setinitval .EQ. 3 ) grid%feedback=0
4031 IF ( setinitval .EQ. 3 ) grid%smooth_option=0
4032 IF ( setinitval .EQ. 3 ) grid%blend_width=0
4033 IF ( setinitval .EQ. 3 ) grid%ztop=initial_data_value
4034 IF ( setinitval .EQ. 3 ) grid%moad_grid_ratio=0
4035 IF ( setinitval .EQ. 3 ) grid%moad_time_step_ratio=0
4036 IF ( setinitval .EQ. 3 ) grid%shw=0
4037 IF ( setinitval .EQ. 3 ) grid%tile_sz_x=0
4038 IF ( setinitval .EQ. 3 ) grid%tile_sz_y=0
4039 IF ( setinitval .EQ. 3 ) grid%numtiles=0
4040 IF ( setinitval .EQ. 3 ) grid%nproc_x=0
4041 IF ( setinitval .EQ. 3 ) grid%nproc_y=0
4042 IF ( setinitval .EQ. 3 ) grid%irand=0
4043 IF ( setinitval .EQ. 3 ) grid%dt=initial_data_value
4044 IF ( setinitval .EQ. 3 ) grid%num_moves=0
4045 IF ( setinitval .EQ. 3 ) grid%vortex_interval=0
4046 IF ( setinitval .EQ. 3 ) grid%max_vortex_speed=0
4047 IF ( setinitval .EQ. 3 ) grid%corral_dist=0
4048 IF ( setinitval .EQ. 3 ) grid%move_id=0
4049 IF ( setinitval .EQ. 3 ) grid%move_interval=0
4050 IF ( setinitval .EQ. 3 ) grid%move_cd_x=0
4051 IF ( setinitval .EQ. 3 ) grid%move_cd_y=0
4052 IF ( setinitval .EQ. 3 ) grid%swap_x=.FALSE.
4053 IF ( setinitval .EQ. 3 ) grid%swap_y=.FALSE.
4054 IF ( setinitval .EQ. 3 ) grid%cycle_x=.FALSE.
4055 IF ( setinitval .EQ. 3 ) grid%cycle_y=.FALSE.
4056 IF ( setinitval .EQ. 3 ) grid%reorder_mesh=.FALSE.
4057 IF ( setinitval .EQ. 3 ) grid%perturb_input=.FALSE.
4058 IF ( setinitval .EQ. 3 ) grid%eta_levels=initial_data_value
4059 IF ( setinitval .EQ. 3 ) grid%max_dz=initial_data_value
4060 IF ( setinitval .EQ. 3 ) grid%mp_physics=0
4061 IF ( setinitval .EQ. 3 ) grid%progn=0
4062 IF ( setinitval .EQ. 3 ) grid%ra_lw_physics=0
4063 IF ( setinitval .EQ. 3 ) grid%ra_sw_physics=0
4064 IF ( setinitval .EQ. 3 ) grid%radt=initial_data_value
4065 IF ( setinitval .EQ. 3 ) grid%naer=initial_data_value
4066 IF ( setinitval .EQ. 3 ) grid%sf_sfclay_physics=0
4067 IF ( setinitval .EQ. 3 ) grid%sf_surface_physics=0
4068 IF ( setinitval .EQ. 3 ) grid%bl_pbl_physics=0
4069 IF ( setinitval .EQ. 3 ) grid%bldt=initial_data_value
4070 IF ( setinitval .EQ. 3 ) grid%cu_physics=0
4071 IF ( setinitval .EQ. 3 ) grid%cudt=initial_data_value
4072 IF ( setinitval .EQ. 3 ) grid%gsmdt=initial_data_value
4073 IF ( setinitval .EQ. 3 ) grid%isfflx=0
4074 IF ( setinitval .EQ. 3 ) grid%ifsnow=0
4075 IF ( setinitval .EQ. 3 ) grid%icloud=0
4076 IF ( setinitval .EQ. 3 ) grid%swrad_scat=initial_data_value
4077 IF ( setinitval .EQ. 3 ) grid%surface_input_source=0
4078 IF ( setinitval .EQ. 3 ) grid%num_soil_layers=0
4079 IF ( setinitval .EQ. 3 ) grid%num_months=0
4080 IF ( setinitval .EQ. 3 ) grid%maxiens=0
4081 IF ( setinitval .EQ. 3 ) grid%maxens=0
4082 IF ( setinitval .EQ. 3 ) grid%maxens2=0
4083 IF ( setinitval .EQ. 3 ) grid%maxens3=0
4084 IF ( setinitval .EQ. 3 ) grid%ensdim=0
4085 IF ( setinitval .EQ. 3 ) grid%chem_opt=0
4086 IF ( setinitval .EQ. 3 ) grid%num_land_cat=0
4087 IF ( setinitval .EQ. 3 ) grid%num_soil_cat=0
4088 IF ( setinitval .EQ. 3 ) grid%mp_zero_out=0
4089 IF ( setinitval .EQ. 3 ) grid%mp_zero_out_thresh=initial_data_value
4090 IF ( setinitval .EQ. 3 ) grid%seaice_threshold=initial_data_value
4091 IF ( setinitval .EQ. 3 ) grid%sst_update=0
4092 IF ( setinitval .EQ. 3 ) grid%ucmcall=0
4093 IF ( setinitval .EQ. 3 ) grid%co2tf=0
4094 IF ( setinitval .EQ. 3 ) grid%ra_call_offset=0
4095 IF ( setinitval .EQ. 3 ) grid%cam_abs_freq_s=initial_data_value
4096 IF ( setinitval .EQ. 3 ) grid%levsiz=0
4097 IF ( setinitval .EQ. 3 ) grid%paerlev=0
4098 IF ( setinitval .EQ. 3 ) grid%cam_abs_dim1=0
4099 IF ( setinitval .EQ. 3 ) grid%cam_abs_dim2=0
4100 IF ( setinitval .EQ. 3 ) grid%cu_rad_feedback=.FALSE.
4101 IF ( setinitval .EQ. 3 ) grid%fgdt=initial_data_value
4102 IF ( setinitval .EQ. 3 ) grid%grid_fdda=0
4103 IF ( setinitval .EQ. 3 ) grid%if_no_pbl_nudging_uv=0
4104 IF ( setinitval .EQ. 3 ) grid%if_no_pbl_nudging_t=0
4105 IF ( setinitval .EQ. 3 ) grid%if_no_pbl_nudging_q=0
4106 IF ( setinitval .EQ. 3 ) grid%if_zfac_uv=0
4107 IF ( setinitval .EQ. 3 ) grid%k_zfac_uv=0
4108 IF ( setinitval .EQ. 3 ) grid%if_zfac_t=0
4109 IF ( setinitval .EQ. 3 ) grid%k_zfac_t=0
4110 IF ( setinitval .EQ. 3 ) grid%if_zfac_q=0
4111 IF ( setinitval .EQ. 3 ) grid%k_zfac_q=0
4112 IF ( setinitval .EQ. 3 ) grid%guv=initial_data_value
4113 IF ( setinitval .EQ. 3 ) grid%gt=initial_data_value
4114 IF ( setinitval .EQ. 3 ) grid%gq=initial_data_value
4115 IF ( setinitval .EQ. 3 ) grid%dtramp_min=initial_data_value
4116 IF ( setinitval .EQ. 3 ) grid%if_ramping=0
4117 IF ( setinitval .EQ. 3 ) grid%obs_nudge_opt=0
4118 IF ( setinitval .EQ. 3 ) grid%max_obs=0
4119 IF ( setinitval .EQ. 3 ) grid%nobs_ndg_vars=0
4120 IF ( setinitval .EQ. 3 ) grid%nobs_err_flds=0
4121 IF ( setinitval .EQ. 3 ) grid%fdda_start=initial_data_value
4122 IF ( setinitval .EQ. 3 ) grid%fdda_end=initial_data_value
4123 IF ( setinitval .EQ. 3 ) grid%obs_nudge_wind=0
4124 IF ( setinitval .EQ. 3 ) grid%obs_coef_wind=initial_data_value
4125 IF ( setinitval .EQ. 3 ) grid%obs_nudge_temp=0
4126 IF ( setinitval .EQ. 3 ) grid%obs_coef_temp=initial_data_value
4127 IF ( setinitval .EQ. 3 ) grid%obs_nudge_mois=0
4128 IF ( setinitval .EQ. 3 ) grid%obs_coef_mois=initial_data_value
4129 IF ( setinitval .EQ. 3 ) grid%obs_nudge_pstr=0
4130 IF ( setinitval .EQ. 3 ) grid%obs_coef_pstr=initial_data_value
4131 IF ( setinitval .EQ. 3 ) grid%obs_rinxy=initial_data_value
4132 IF ( setinitval .EQ. 3 ) grid%obs_rinsig=initial_data_value
4133 IF ( setinitval .EQ. 3 ) grid%obs_twindo=initial_data_value
4134 IF ( setinitval .EQ. 3 ) grid%obs_npfi=0
4135 IF ( setinitval .EQ. 3 ) grid%obs_ionf=0
4136 IF ( setinitval .EQ. 3 ) grid%obs_idynin=0
4137 IF ( setinitval .EQ. 3 ) grid%obs_dtramp=initial_data_value
4138 IF ( setinitval .EQ. 3 ) grid%obs_ipf_in4dob=.FALSE.
4139 IF ( setinitval .EQ. 3 ) grid%obs_ipf_errob=.FALSE.
4140 IF ( setinitval .EQ. 3 ) grid%obs_ipf_nudob=.FALSE.
4141 IF ( setinitval .EQ. 3 ) grid%dyn_opt=0
4142 IF ( setinitval .EQ. 3 ) grid%rk_ord=0
4143 IF ( setinitval .EQ. 3 ) grid%w_damping=0
4144 IF ( setinitval .EQ. 3 ) grid%diff_opt=0
4145 IF ( setinitval .EQ. 3 ) grid%km_opt=0
4146 IF ( setinitval .EQ. 3 ) grid%damp_opt=0
4147 IF ( setinitval .EQ. 3 ) grid%zdamp=initial_data_value
4148 IF ( setinitval .EQ. 3 ) grid%dampcoef=initial_data_value
4149 IF ( setinitval .EQ. 3 ) grid%khdif=initial_data_value
4150 IF ( setinitval .EQ. 3 ) grid%kvdif=initial_data_value
4151 IF ( setinitval .EQ. 3 ) grid%diff_6th_factor=initial_data_value
4152 IF ( setinitval .EQ. 3 ) grid%diff_6th_opt=0
4153 IF ( setinitval .EQ. 3 ) grid%smdiv=initial_data_value
4154 IF ( setinitval .EQ. 3 ) grid%emdiv=initial_data_value
4155 IF ( setinitval .EQ. 3 ) grid%epssm=initial_data_value
4156 IF ( setinitval .EQ. 3 ) grid%non_hydrostatic=.FALSE.
4157 IF ( setinitval .EQ. 3 ) grid%time_step_sound=0
4158 IF ( setinitval .EQ. 3 ) grid%h_mom_adv_order=0
4159 IF ( setinitval .EQ. 3 ) grid%v_mom_adv_order=0
4160 IF ( setinitval .EQ. 3 ) grid%h_sca_adv_order=0
4161 IF ( setinitval .EQ. 3 ) grid%v_sca_adv_order=0
4162 IF ( setinitval .EQ. 3 ) grid%pd_moist=.FALSE.
4163 IF ( setinitval .EQ. 3 ) grid%pd_chem=.FALSE.
4164 IF ( setinitval .EQ. 3 ) grid%pd_scalar=.FALSE.
4165 IF ( setinitval .EQ. 3 ) grid%pd_tke=.FALSE.
4166 IF ( setinitval .EQ. 3 ) grid%top_radiation=.FALSE.
4167 IF ( setinitval .EQ. 3 ) grid%mix_cr_len=initial_data_value
4168 IF ( setinitval .EQ. 3 ) grid%tke_upper_bound=initial_data_value
4169 IF ( setinitval .EQ. 3 ) grid%kh_tke_upper_bound=initial_data_value
4170 IF ( setinitval .EQ. 3 ) grid%kv_tke_upper_bound=initial_data_value
4171 IF ( setinitval .EQ. 3 ) grid%tke_drag_coefficient=initial_data_value
4172 IF ( setinitval .EQ. 3 ) grid%tke_heat_flux=initial_data_value
4173 IF ( setinitval .EQ. 3 ) grid%pert_coriolis=.FALSE.
4174 IF ( setinitval .EQ. 3 ) grid%mix_full_fields=.FALSE.
4175 IF ( setinitval .EQ. 3 ) grid%base_pres=initial_data_value
4176 IF ( setinitval .EQ. 3 ) grid%base_temp=initial_data_value
4177 IF ( setinitval .EQ. 3 ) grid%base_lapse=initial_data_value
4178 IF ( setinitval .EQ. 3 ) grid%spec_bdy_width=0
4179 IF ( setinitval .EQ. 3 ) grid%spec_zone=0
4180 IF ( setinitval .EQ. 3 ) grid%relax_zone=0
4181 IF ( setinitval .EQ. 3 ) grid%specified=.FALSE.
4182 IF ( setinitval .EQ. 3 ) grid%periodic_x=.FALSE.
4183 IF ( setinitval .EQ. 3 ) grid%symmetric_xs=.FALSE.
4184 IF ( setinitval .EQ. 3 ) grid%symmetric_xe=.FALSE.
4185 IF ( setinitval .EQ. 3 ) grid%open_xs=.FALSE.
4186 IF ( setinitval .EQ. 3 ) grid%open_xe=.FALSE.
4187 IF ( setinitval .EQ. 3 ) grid%periodic_y=.FALSE.
4188 IF ( setinitval .EQ. 3 ) grid%symmetric_ys=.FALSE.
4189 IF ( setinitval .EQ. 3 ) grid%symmetric_ye=.FALSE.
4190 IF ( setinitval .EQ. 3 ) grid%open_ys=.FALSE.
4191 IF ( setinitval .EQ. 3 ) grid%open_ye=.FALSE.
4192 IF ( setinitval .EQ. 3 ) grid%nested=.FALSE.
4193 IF ( setinitval .EQ. 3 ) grid%real_data_init_type=0
4194 IF ( setinitval .EQ. 3 ) grid%background_proc_id=0
4195 IF ( setinitval .EQ. 3 ) grid%forecast_proc_id=0
4196 IF ( setinitval .EQ. 3 ) grid%production_status=0
4197 IF ( setinitval .EQ. 3 ) grid%compression=0
4198 IF ( setinitval .EQ. 3 ) grid%cen_lat=initial_data_value
4199 IF ( setinitval .EQ. 3 ) grid%cen_lon=initial_data_value
4200 IF ( setinitval .EQ. 3 ) grid%truelat1=initial_data_value
4201 IF ( setinitval .EQ. 3 ) grid%truelat2=initial_data_value
4202 IF ( setinitval .EQ. 3 ) grid%moad_cen_lat=initial_data_value
4203 IF ( setinitval .EQ. 3 ) grid%stand_lon=initial_data_value
4204 IF ( setinitval .EQ. 3 ) grid%bdyfrq=initial_data_value
4205 IF ( setinitval .EQ. 3 ) grid%iswater=0
4206 IF ( setinitval .EQ. 3 ) grid%isice=0
4207 IF ( setinitval .EQ. 3 ) grid%isurban=0
4208 IF ( setinitval .EQ. 3 ) grid%isoilwater=0
4209 IF ( setinitval .EQ. 3 ) grid%map_proj=0
4210 IF ( setinitval .EQ. 3 ) grid%nodyn_nodyn_dummy=0
4211 IF(.NOT.inter_domain)THEN
4212 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4213 ALLOCATE(grid%vv%v1(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4214  if (ierr.ne.0) then
4215  CALL wrf_error_fatal ( &
4216 'frame/module_domain.f: Failed to allocate grid%vv%v1(sm31:em31,sm32:em32,sm33:em33). ')
4217  endif
4218 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vv%v1=initial_data_value
4219 ELSE
4220 ALLOCATE(grid%vv%v1(1,1,1),STAT=ierr)
4221  if (ierr.ne.0) then
4222  CALL wrf_error_fatal ( &
4223 'frame/module_domain.f: Failed to allocate grid%vv%v1(1,1,1).  ')
4224  endif
4225 ENDIF
4226 IF(.NOT.inter_domain)THEN
4227 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4228 ALLOCATE(grid%vv%v2(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4229  if (ierr.ne.0) then
4230  CALL wrf_error_fatal ( &
4231 'frame/module_domain.f: Failed to allocate grid%vv%v2(sm31:em31,sm32:em32,sm33:em33). ')
4232  endif
4233 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vv%v2=initial_data_value
4234 ELSE
4235 ALLOCATE(grid%vv%v2(1,1,1),STAT=ierr)
4236  if (ierr.ne.0) then
4237  CALL wrf_error_fatal ( &
4238 'frame/module_domain.f: Failed to allocate grid%vv%v2(1,1,1).  ')
4239  endif
4240 ENDIF
4241 IF(.NOT.inter_domain)THEN
4242 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4243 ALLOCATE(grid%vv%v3(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4244  if (ierr.ne.0) then
4245  CALL wrf_error_fatal ( &
4246 'frame/module_domain.f: Failed to allocate grid%vv%v3(sm31:em31,sm32:em32,sm33:em33). ')
4247  endif
4248 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vv%v3=initial_data_value
4249 ELSE
4250 ALLOCATE(grid%vv%v3(1,1,1),STAT=ierr)
4251  if (ierr.ne.0) then
4252  CALL wrf_error_fatal ( &
4253 'frame/module_domain.f: Failed to allocate grid%vv%v3(1,1,1).  ')
4254  endif
4255 ENDIF
4256 IF(.NOT.inter_domain)THEN
4257 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4258 ALLOCATE(grid%vv%v4(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4259  if (ierr.ne.0) then
4260  CALL wrf_error_fatal ( &
4261 'frame/module_domain.f: Failed to allocate grid%vv%v4(sm31:em31,sm32:em32,sm33:em33). ')
4262  endif
4263 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vv%v4=initial_data_value
4264 ELSE
4265 ALLOCATE(grid%vv%v4(1,1,1),STAT=ierr)
4266  if (ierr.ne.0) then
4267  CALL wrf_error_fatal ( &
4268 'frame/module_domain.f: Failed to allocate grid%vv%v4(1,1,1).  ')
4269  endif
4270 ENDIF
4271 IF(.NOT.inter_domain)THEN
4272 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4273 ALLOCATE(grid%vv%v5(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4274  if (ierr.ne.0) then
4275  CALL wrf_error_fatal ( &
4276 'frame/module_domain.f: Failed to allocate grid%vv%v5(sm31:em31,sm32:em32,sm33:em33). ')
4277  endif
4278 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vv%v5=initial_data_value
4279 ELSE
4280 ALLOCATE(grid%vv%v5(1,1,1),STAT=ierr)
4281  if (ierr.ne.0) then
4282  CALL wrf_error_fatal ( &
4283 'frame/module_domain.f: Failed to allocate grid%vv%v5(1,1,1).  ')
4284  endif
4285 ENDIF
4286 IF(.NOT.inter_domain)THEN
4287 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((model_config_rec%ensdim_alpha)-(1)+1))) * RWORDSIZE
4288 ALLOCATE(grid%vv%alpha(sm31:em31,sm32:em32,1:model_config_rec%ensdim_alpha),STAT=ierr)
4289  if (ierr.ne.0) then
4290  CALL wrf_error_fatal ( &
4291 'frame/module_domain.f: Failed to allocate grid%vv%alpha(sm31:em31,sm32:em32,1:model_config_rec%ensdim_alpha). ')
4292  endif
4293 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vv%alpha=initial_data_value
4294 ELSE
4295 ALLOCATE(grid%vv%alpha(1,1,1),STAT=ierr)
4296  if (ierr.ne.0) then
4297  CALL wrf_error_fatal ( &
4298 'frame/module_domain.f: Failed to allocate grid%vv%alpha(1,1,1).  ')
4299  endif
4300 ENDIF
4301 IF(.NOT.inter_domain)THEN
4302 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4303 ALLOCATE(grid%vp%v1(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4304  if (ierr.ne.0) then
4305  CALL wrf_error_fatal ( &
4306 'frame/module_domain.f: Failed to allocate grid%vp%v1(sm31:em31,sm32:em32,sm33:em33). ')
4307  endif
4308 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vp%v1=initial_data_value
4309 ELSE
4310 ALLOCATE(grid%vp%v1(1,1,1),STAT=ierr)
4311  if (ierr.ne.0) then
4312  CALL wrf_error_fatal ( &
4313 'frame/module_domain.f: Failed to allocate grid%vp%v1(1,1,1).  ')
4314  endif
4315 ENDIF
4316 IF(.NOT.inter_domain)THEN
4317 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4318 ALLOCATE(grid%vp%v2(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4319  if (ierr.ne.0) then
4320  CALL wrf_error_fatal ( &
4321 'frame/module_domain.f: Failed to allocate grid%vp%v2(sm31:em31,sm32:em32,sm33:em33). ')
4322  endif
4323 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vp%v2=initial_data_value
4324 ELSE
4325 ALLOCATE(grid%vp%v2(1,1,1),STAT=ierr)
4326  if (ierr.ne.0) then
4327  CALL wrf_error_fatal ( &
4328 'frame/module_domain.f: Failed to allocate grid%vp%v2(1,1,1).  ')
4329  endif
4330 ENDIF
4331 IF(.NOT.inter_domain)THEN
4332 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4333 ALLOCATE(grid%vp%v3(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4334  if (ierr.ne.0) then
4335  CALL wrf_error_fatal ( &
4336 'frame/module_domain.f: Failed to allocate grid%vp%v3(sm31:em31,sm32:em32,sm33:em33). ')
4337  endif
4338 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vp%v3=initial_data_value
4339 ELSE
4340 ALLOCATE(grid%vp%v3(1,1,1),STAT=ierr)
4341  if (ierr.ne.0) then
4342  CALL wrf_error_fatal ( &
4343 'frame/module_domain.f: Failed to allocate grid%vp%v3(1,1,1).  ')
4344  endif
4345 ENDIF
4346 IF(.NOT.inter_domain)THEN
4347 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4348 ALLOCATE(grid%vp%v4(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4349  if (ierr.ne.0) then
4350  CALL wrf_error_fatal ( &
4351 'frame/module_domain.f: Failed to allocate grid%vp%v4(sm31:em31,sm32:em32,sm33:em33). ')
4352  endif
4353 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vp%v4=initial_data_value
4354 ELSE
4355 ALLOCATE(grid%vp%v4(1,1,1),STAT=ierr)
4356  if (ierr.ne.0) then
4357  CALL wrf_error_fatal ( &
4358 'frame/module_domain.f: Failed to allocate grid%vp%v4(1,1,1).  ')
4359  endif
4360 ENDIF
4361 IF(.NOT.inter_domain)THEN
4362 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4363 ALLOCATE(grid%vp%v5(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4364  if (ierr.ne.0) then
4365  CALL wrf_error_fatal ( &
4366 'frame/module_domain.f: Failed to allocate grid%vp%v5(sm31:em31,sm32:em32,sm33:em33). ')
4367  endif
4368 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vp%v5=initial_data_value
4369 ELSE
4370 ALLOCATE(grid%vp%v5(1,1,1),STAT=ierr)
4371  if (ierr.ne.0) then
4372  CALL wrf_error_fatal ( &
4373 'frame/module_domain.f: Failed to allocate grid%vp%v5(1,1,1).  ')
4374  endif
4375 ENDIF
4376 IF(.NOT.inter_domain)THEN
4377 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((model_config_rec%ensdim_alpha)-(1)+1))) * RWORDSIZE
4378 ALLOCATE(grid%vp%alpha(sm31:em31,sm32:em32,1:model_config_rec%ensdim_alpha),STAT=ierr)
4379  if (ierr.ne.0) then
4380  CALL wrf_error_fatal ( &
4381 'frame/module_domain.f: Failed to allocate grid%vp%alpha(sm31:em31,sm32:em32,1:model_config_rec%ensdim_alpha). ')
4382  endif
4383 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%vp%alpha=initial_data_value
4384 ELSE
4385 ALLOCATE(grid%vp%alpha(1,1,1),STAT=ierr)
4386  if (ierr.ne.0) then
4387  CALL wrf_error_fatal ( &
4388 'frame/module_domain.f: Failed to allocate grid%vp%alpha(1,1,1).  ')
4389  endif
4390 ENDIF
4391 IF ( setinitval .EQ. 3 ) grid%ep%ne=0
4392 IF(.NOT.inter_domain)THEN
4393 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))*(((model_config_rec%ensdim_alpha)-(1)+1))) * RWORDSIZE
4394 ALLOCATE(grid%ep%v1(sm31:em31,sm32:em32,sm33:em33,1:model_config_rec%ensdim_alpha),STAT=ierr)
4395  if (ierr.ne.0) then
4396  CALL wrf_error_fatal ( &
4397 'frame/module_domain.f: Failed to allocate grid%ep%v1(sm31:em31,sm32:em32,sm33:em33,1:model_config_rec%ensdim_alpha). ')
4398  endif
4399 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ep%v1=initial_data_value
4400 ELSE
4401 ALLOCATE(grid%ep%v1(1,1,1,1),STAT=ierr)
4402  if (ierr.ne.0) then
4403  CALL wrf_error_fatal ( &
4404 'frame/module_domain.f: Failed to allocate grid%ep%v1(1,1,1,1).  ')
4405  endif
4406 ENDIF
4407 IF(.NOT.inter_domain)THEN
4408 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))*(((model_config_rec%ensdim_alpha)-(1)+1))) * RWORDSIZE
4409 ALLOCATE(grid%ep%v2(sm31:em31,sm32:em32,sm33:em33,1:model_config_rec%ensdim_alpha),STAT=ierr)
4410  if (ierr.ne.0) then
4411  CALL wrf_error_fatal ( &
4412 'frame/module_domain.f: Failed to allocate grid%ep%v2(sm31:em31,sm32:em32,sm33:em33,1:model_config_rec%ensdim_alpha). ')
4413  endif
4414 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ep%v2=initial_data_value
4415 ELSE
4416 ALLOCATE(grid%ep%v2(1,1,1,1),STAT=ierr)
4417  if (ierr.ne.0) then
4418  CALL wrf_error_fatal ( &
4419 'frame/module_domain.f: Failed to allocate grid%ep%v2(1,1,1,1).  ')
4420  endif
4421 ENDIF
4422 IF(.NOT.inter_domain)THEN
4423 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))*(((model_config_rec%ensdim_alpha)-(1)+1))) * RWORDSIZE
4424 ALLOCATE(grid%ep%v3(sm31:em31,sm32:em32,sm33:em33,1:model_config_rec%ensdim_alpha),STAT=ierr)
4425  if (ierr.ne.0) then
4426  CALL wrf_error_fatal ( &
4427 'frame/module_domain.f: Failed to allocate grid%ep%v3(sm31:em31,sm32:em32,sm33:em33,1:model_config_rec%ensdim_alpha). ')
4428  endif
4429 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ep%v3=initial_data_value
4430 ELSE
4431 ALLOCATE(grid%ep%v3(1,1,1,1),STAT=ierr)
4432  if (ierr.ne.0) then
4433  CALL wrf_error_fatal ( &
4434 'frame/module_domain.f: Failed to allocate grid%ep%v3(1,1,1,1).  ')
4435  endif
4436 ENDIF
4437 IF(.NOT.inter_domain)THEN
4438 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))*(((model_config_rec%ensdim_alpha)-(1)+1))) * RWORDSIZE
4439 ALLOCATE(grid%ep%v4(sm31:em31,sm32:em32,sm33:em33,1:model_config_rec%ensdim_alpha),STAT=ierr)
4440  if (ierr.ne.0) then
4441  CALL wrf_error_fatal ( &
4442 'frame/module_domain.f: Failed to allocate grid%ep%v4(sm31:em31,sm32:em32,sm33:em33,1:model_config_rec%ensdim_alpha). ')
4443  endif
4444 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ep%v4=initial_data_value
4445 ELSE
4446 ALLOCATE(grid%ep%v4(1,1,1,1),STAT=ierr)
4447  if (ierr.ne.0) then
4448  CALL wrf_error_fatal ( &
4449 'frame/module_domain.f: Failed to allocate grid%ep%v4(1,1,1,1).  ')
4450  endif
4451 ENDIF
4452 IF(.NOT.inter_domain)THEN
4453 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))*(((model_config_rec%ensdim_alpha)-(1)+1))) * RWORDSIZE
4454 ALLOCATE(grid%ep%v5(sm31:em31,sm32:em32,sm33:em33,1:model_config_rec%ensdim_alpha),STAT=ierr)
4455  if (ierr.ne.0) then
4456  CALL wrf_error_fatal ( &
4457 'frame/module_domain.f: Failed to allocate grid%ep%v5(sm31:em31,sm32:em32,sm33:em33,1:model_config_rec%ensdim_alpha). ')
4458  endif
4459 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%ep%v5=initial_data_value
4460 ELSE
4461 ALLOCATE(grid%ep%v5(1,1,1,1),STAT=ierr)
4462  if (ierr.ne.0) then
4463  CALL wrf_error_fatal ( &
4464 'frame/module_domain.f: Failed to allocate grid%ep%v5(1,1,1,1).  ')
4465  endif
4466 ENDIF
4467 IF ( setinitval .EQ. 3 ) grid%xb%map=0
4468 IF ( setinitval .EQ. 3 ) grid%xb%ptop=initial_data_value
4469 IF ( setinitval .EQ. 3 ) grid%xb%ztop=initial_data_value
4470 IF ( setinitval .EQ. 3 ) grid%xb%ds=initial_data_value
4471 IF ( setinitval .EQ. 3 ) grid%xb%sigmaf_0=initial_data_value
4472 IF ( setinitval .EQ. 3 ) grid%xb%mix=0
4473 IF ( setinitval .EQ. 3 ) grid%xb%mjy=0
4474 IF ( setinitval .EQ. 3 ) grid%xb%mkz=0
4475 IF ( setinitval .EQ. 3 ) grid%xb%num_of_var=0
4476 IF ( setinitval .EQ. 3 ) grid%xb%ids=0
4477 IF ( setinitval .EQ. 3 ) grid%xb%ide=0
4478 IF ( setinitval .EQ. 3 ) grid%xb%jds=0
4479 IF ( setinitval .EQ. 3 ) grid%xb%jde=0
4480 IF ( setinitval .EQ. 3 ) grid%xb%kds=0
4481 IF ( setinitval .EQ. 3 ) grid%xb%kde=0
4482 IF ( setinitval .EQ. 3 ) grid%xb%ims=0
4483 IF ( setinitval .EQ. 3 ) grid%xb%ime=0
4484 IF ( setinitval .EQ. 3 ) grid%xb%jms=0
4485 IF ( setinitval .EQ. 3 ) grid%xb%jme=0
4486 IF ( setinitval .EQ. 3 ) grid%xb%kms=0
4487 IF ( setinitval .EQ. 3 ) grid%xb%kme=0
4488 IF ( setinitval .EQ. 3 ) grid%xb%its=0
4489 IF ( setinitval .EQ. 3 ) grid%xb%ite=0
4490 IF ( setinitval .EQ. 3 ) grid%xb%jts=0
4491 IF ( setinitval .EQ. 3 ) grid%xb%jte=0
4492 IF ( setinitval .EQ. 3 ) grid%xb%kts=0
4493 IF ( setinitval .EQ. 3 ) grid%xb%kte=0
4494 IF(.NOT.inter_domain)THEN
4495 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
4496 ALLOCATE(grid%xb%grid_box_area(sm31:em31,sm32:em32),STAT=ierr)
4497  if (ierr.ne.0) then
4498  CALL wrf_error_fatal ( &
4499 'frame/module_domain.f: Failed to allocate grid%xb%grid_box_area(sm31:em31,sm32:em32). ')
4500  endif
4501 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%grid_box_area=initial_data_value
4502 ELSE
4503 ALLOCATE(grid%xb%grid_box_area(1,1),STAT=ierr)
4504  if (ierr.ne.0) then
4505  CALL wrf_error_fatal ( &
4506 'frame/module_domain.f: Failed to allocate grid%xb%grid_box_area(1,1).  ')
4507  endif
4508 ENDIF
4509 IF(.NOT.inter_domain)THEN
4510 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
4511 ALLOCATE(grid%xb%map_factor(sm31:em31,sm32:em32),STAT=ierr)
4512  if (ierr.ne.0) then
4513  CALL wrf_error_fatal ( &
4514 'frame/module_domain.f: Failed to allocate grid%xb%map_factor(sm31:em31,sm32:em32). ')
4515  endif
4516 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%map_factor=initial_data_value
4517 ELSE
4518 ALLOCATE(grid%xb%map_factor(1,1),STAT=ierr)
4519  if (ierr.ne.0) then
4520  CALL wrf_error_fatal ( &
4521 'frame/module_domain.f: Failed to allocate grid%xb%map_factor(1,1).  ')
4522  endif
4523 ENDIF
4524 IF(.NOT.inter_domain)THEN
4525 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4526 ALLOCATE(grid%xb%u(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4527  if (ierr.ne.0) then
4528  CALL wrf_error_fatal ( &
4529 'frame/module_domain.f: Failed to allocate grid%xb%u(sm31:em31,sm32:em32,sm33:em33). ')
4530  endif
4531 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%u=initial_data_value
4532 ELSE
4533 ALLOCATE(grid%xb%u(1,1,1),STAT=ierr)
4534  if (ierr.ne.0) then
4535  CALL wrf_error_fatal ( &
4536 'frame/module_domain.f: Failed to allocate grid%xb%u(1,1,1).  ')
4537  endif
4538 ENDIF
4539 IF(.NOT.inter_domain)THEN
4540 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4541 ALLOCATE(grid%xb%v(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4542  if (ierr.ne.0) then
4543  CALL wrf_error_fatal ( &
4544 'frame/module_domain.f: Failed to allocate grid%xb%v(sm31:em31,sm32:em32,sm33:em33). ')
4545  endif
4546 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%v=initial_data_value
4547 ELSE
4548 ALLOCATE(grid%xb%v(1,1,1),STAT=ierr)
4549  if (ierr.ne.0) then
4550  CALL wrf_error_fatal ( &
4551 'frame/module_domain.f: Failed to allocate grid%xb%v(1,1,1).  ')
4552  endif
4553 ENDIF
4554 IF(.NOT.inter_domain)THEN
4555 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4556 ALLOCATE(grid%xb%w(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4557  if (ierr.ne.0) then
4558  CALL wrf_error_fatal ( &
4559 'frame/module_domain.f: Failed to allocate grid%xb%w(sm31:em31,sm32:em32,sm33:em33). ')
4560  endif
4561 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%w=initial_data_value
4562 ELSE
4563 ALLOCATE(grid%xb%w(1,1,1),STAT=ierr)
4564  if (ierr.ne.0) then
4565  CALL wrf_error_fatal ( &
4566 'frame/module_domain.f: Failed to allocate grid%xb%w(1,1,1).  ')
4567  endif
4568 ENDIF
4569 IF(.NOT.inter_domain)THEN
4570 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4571 ALLOCATE(grid%xb%t(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4572  if (ierr.ne.0) then
4573  CALL wrf_error_fatal ( &
4574 'frame/module_domain.f: Failed to allocate grid%xb%t(sm31:em31,sm32:em32,sm33:em33). ')
4575  endif
4576 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%t=initial_data_value
4577 ELSE
4578 ALLOCATE(grid%xb%t(1,1,1),STAT=ierr)
4579  if (ierr.ne.0) then
4580  CALL wrf_error_fatal ( &
4581 'frame/module_domain.f: Failed to allocate grid%xb%t(1,1,1).  ')
4582  endif
4583 ENDIF
4584 IF(.NOT.inter_domain)THEN
4585 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4586 ALLOCATE(grid%xb%p(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4587  if (ierr.ne.0) then
4588  CALL wrf_error_fatal ( &
4589 'frame/module_domain.f: Failed to allocate grid%xb%p(sm31:em31,sm32:em32,sm33:em33). ')
4590  endif
4591 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%p=initial_data_value
4592 ELSE
4593 ALLOCATE(grid%xb%p(1,1,1),STAT=ierr)
4594  if (ierr.ne.0) then
4595  CALL wrf_error_fatal ( &
4596 'frame/module_domain.f: Failed to allocate grid%xb%p(1,1,1).  ')
4597  endif
4598 ENDIF
4599 IF(.NOT.inter_domain)THEN
4600 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4601 ALLOCATE(grid%xb%q(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4602  if (ierr.ne.0) then
4603  CALL wrf_error_fatal ( &
4604 'frame/module_domain.f: Failed to allocate grid%xb%q(sm31:em31,sm32:em32,sm33:em33). ')
4605  endif
4606 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%q=initial_data_value
4607 ELSE
4608 ALLOCATE(grid%xb%q(1,1,1),STAT=ierr)
4609  if (ierr.ne.0) then
4610  CALL wrf_error_fatal ( &
4611 'frame/module_domain.f: Failed to allocate grid%xb%q(1,1,1).  ')
4612  endif
4613 ENDIF
4614 IF(.NOT.inter_domain)THEN
4615 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4616 ALLOCATE(grid%xb%qrn(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4617  if (ierr.ne.0) then
4618  CALL wrf_error_fatal ( &
4619 'frame/module_domain.f: Failed to allocate grid%xb%qrn(sm31:em31,sm32:em32,sm33:em33). ')
4620  endif
4621 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%qrn=initial_data_value
4622 ELSE
4623 ALLOCATE(grid%xb%qrn(1,1,1),STAT=ierr)
4624  if (ierr.ne.0) then
4625  CALL wrf_error_fatal ( &
4626 'frame/module_domain.f: Failed to allocate grid%xb%qrn(1,1,1).  ')
4627  endif
4628 ENDIF
4629 IF(.NOT.inter_domain)THEN
4630 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4631 ALLOCATE(grid%xb%qcw(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4632  if (ierr.ne.0) then
4633  CALL wrf_error_fatal ( &
4634 'frame/module_domain.f: Failed to allocate grid%xb%qcw(sm31:em31,sm32:em32,sm33:em33). ')
4635  endif
4636 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%qcw=initial_data_value
4637 ELSE
4638 ALLOCATE(grid%xb%qcw(1,1,1),STAT=ierr)
4639  if (ierr.ne.0) then
4640  CALL wrf_error_fatal ( &
4641 'frame/module_domain.f: Failed to allocate grid%xb%qcw(1,1,1).  ')
4642  endif
4643 ENDIF
4644 IF(.NOT.inter_domain)THEN
4645 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4646 ALLOCATE(grid%xb%qci(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4647  if (ierr.ne.0) then
4648  CALL wrf_error_fatal ( &
4649 'frame/module_domain.f: Failed to allocate grid%xb%qci(sm31:em31,sm32:em32,sm33:em33). ')
4650  endif
4651 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%qci=initial_data_value
4652 ELSE
4653 ALLOCATE(grid%xb%qci(1,1,1),STAT=ierr)
4654  if (ierr.ne.0) then
4655  CALL wrf_error_fatal ( &
4656 'frame/module_domain.f: Failed to allocate grid%xb%qci(1,1,1).  ')
4657  endif
4658 ENDIF
4659 IF(.NOT.inter_domain)THEN
4660 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4661 ALLOCATE(grid%xb%qsn(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4662  if (ierr.ne.0) then
4663  CALL wrf_error_fatal ( &
4664 'frame/module_domain.f: Failed to allocate grid%xb%qsn(sm31:em31,sm32:em32,sm33:em33). ')
4665  endif
4666 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%qsn=initial_data_value
4667 ELSE
4668 ALLOCATE(grid%xb%qsn(1,1,1),STAT=ierr)
4669  if (ierr.ne.0) then
4670  CALL wrf_error_fatal ( &
4671 'frame/module_domain.f: Failed to allocate grid%xb%qsn(1,1,1).  ')
4672  endif
4673 ENDIF
4674 IF(.NOT.inter_domain)THEN
4675 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4676 ALLOCATE(grid%xb%qgr(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4677  if (ierr.ne.0) then
4678  CALL wrf_error_fatal ( &
4679 'frame/module_domain.f: Failed to allocate grid%xb%qgr(sm31:em31,sm32:em32,sm33:em33). ')
4680  endif
4681 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%qgr=initial_data_value
4682 ELSE
4683 ALLOCATE(grid%xb%qgr(1,1,1),STAT=ierr)
4684  if (ierr.ne.0) then
4685  CALL wrf_error_fatal ( &
4686 'frame/module_domain.f: Failed to allocate grid%xb%qgr(1,1,1).  ')
4687  endif
4688 ENDIF
4689 IF(.NOT.inter_domain)THEN
4690 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4691 ALLOCATE(grid%xb%qt(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4692  if (ierr.ne.0) then
4693  CALL wrf_error_fatal ( &
4694 'frame/module_domain.f: Failed to allocate grid%xb%qt(sm31:em31,sm32:em32,sm33:em33). ')
4695  endif
4696 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%qt=initial_data_value
4697 ELSE
4698 ALLOCATE(grid%xb%qt(1,1,1),STAT=ierr)
4699  if (ierr.ne.0) then
4700  CALL wrf_error_fatal ( &
4701 'frame/module_domain.f: Failed to allocate grid%xb%qt(1,1,1).  ')
4702  endif
4703 ENDIF
4704 IF(.NOT.inter_domain)THEN
4705 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4706 ALLOCATE(grid%xb%delt(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4707  if (ierr.ne.0) then
4708  CALL wrf_error_fatal ( &
4709 'frame/module_domain.f: Failed to allocate grid%xb%delt(sm31:em31,sm32:em32,sm33:em33). ')
4710  endif
4711 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%delt=initial_data_value
4712 ELSE
4713 ALLOCATE(grid%xb%delt(1,1,1),STAT=ierr)
4714  if (ierr.ne.0) then
4715  CALL wrf_error_fatal ( &
4716 'frame/module_domain.f: Failed to allocate grid%xb%delt(1,1,1).  ')
4717  endif
4718 ENDIF
4719 IF(.NOT.inter_domain)THEN
4720 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4721 ALLOCATE(grid%xb%h(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4722  if (ierr.ne.0) then
4723  CALL wrf_error_fatal ( &
4724 'frame/module_domain.f: Failed to allocate grid%xb%h(sm31:em31,sm32:em32,sm33:em33). ')
4725  endif
4726 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%h=initial_data_value
4727 ELSE
4728 ALLOCATE(grid%xb%h(1,1,1),STAT=ierr)
4729  if (ierr.ne.0) then
4730  CALL wrf_error_fatal ( &
4731 'frame/module_domain.f: Failed to allocate grid%xb%h(1,1,1).  ')
4732  endif
4733 ENDIF
4734 IF(.NOT.inter_domain)THEN
4735 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4736 ALLOCATE(grid%xb%hf(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4737  if (ierr.ne.0) then
4738  CALL wrf_error_fatal ( &
4739 'frame/module_domain.f: Failed to allocate grid%xb%hf(sm31:em31,sm32:em32,sm33:em33). ')
4740  endif
4741 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%hf=initial_data_value
4742 ELSE
4743 ALLOCATE(grid%xb%hf(1,1,1),STAT=ierr)
4744  if (ierr.ne.0) then
4745  CALL wrf_error_fatal ( &
4746 'frame/module_domain.f: Failed to allocate grid%xb%hf(1,1,1).  ')
4747  endif
4748 ENDIF
4749 IF(.NOT.inter_domain)THEN
4750 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4751 ALLOCATE(grid%xb%wh(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4752  if (ierr.ne.0) then
4753  CALL wrf_error_fatal ( &
4754 'frame/module_domain.f: Failed to allocate grid%xb%wh(sm31:em31,sm32:em32,sm33:em33). ')
4755  endif
4756 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%wh=initial_data_value
4757 ELSE
4758 ALLOCATE(grid%xb%wh(1,1,1),STAT=ierr)
4759  if (ierr.ne.0) then
4760  CALL wrf_error_fatal ( &
4761 'frame/module_domain.f: Failed to allocate grid%xb%wh(1,1,1).  ')
4762  endif
4763 ENDIF
4764 IF(.NOT.inter_domain)THEN
4765 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4766 ALLOCATE(grid%xb%rho(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4767  if (ierr.ne.0) then
4768  CALL wrf_error_fatal ( &
4769 'frame/module_domain.f: Failed to allocate grid%xb%rho(sm31:em31,sm32:em32,sm33:em33). ')
4770  endif
4771 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%rho=initial_data_value
4772 ELSE
4773 ALLOCATE(grid%xb%rho(1,1,1),STAT=ierr)
4774  if (ierr.ne.0) then
4775  CALL wrf_error_fatal ( &
4776 'frame/module_domain.f: Failed to allocate grid%xb%rho(1,1,1).  ')
4777  endif
4778 ENDIF
4779 IF(.NOT.inter_domain)THEN
4780 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4781 ALLOCATE(grid%xb%rh(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4782  if (ierr.ne.0) then
4783  CALL wrf_error_fatal ( &
4784 'frame/module_domain.f: Failed to allocate grid%xb%rh(sm31:em31,sm32:em32,sm33:em33). ')
4785  endif
4786 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%rh=initial_data_value
4787 ELSE
4788 ALLOCATE(grid%xb%rh(1,1,1),STAT=ierr)
4789  if (ierr.ne.0) then
4790  CALL wrf_error_fatal ( &
4791 'frame/module_domain.f: Failed to allocate grid%xb%rh(1,1,1).  ')
4792  endif
4793 ENDIF
4794 IF(.NOT.inter_domain)THEN
4795 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4796 ALLOCATE(grid%xb%es(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4797  if (ierr.ne.0) then
4798  CALL wrf_error_fatal ( &
4799 'frame/module_domain.f: Failed to allocate grid%xb%es(sm31:em31,sm32:em32,sm33:em33). ')
4800  endif
4801 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%es=initial_data_value
4802 ELSE
4803 ALLOCATE(grid%xb%es(1,1,1),STAT=ierr)
4804  if (ierr.ne.0) then
4805  CALL wrf_error_fatal ( &
4806 'frame/module_domain.f: Failed to allocate grid%xb%es(1,1,1).  ')
4807  endif
4808 ENDIF
4809 IF(.NOT.inter_domain)THEN
4810 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4811 ALLOCATE(grid%xb%qs(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4812  if (ierr.ne.0) then
4813  CALL wrf_error_fatal ( &
4814 'frame/module_domain.f: Failed to allocate grid%xb%qs(sm31:em31,sm32:em32,sm33:em33). ')
4815  endif
4816 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%qs=initial_data_value
4817 ELSE
4818 ALLOCATE(grid%xb%qs(1,1,1),STAT=ierr)
4819  if (ierr.ne.0) then
4820  CALL wrf_error_fatal ( &
4821 'frame/module_domain.f: Failed to allocate grid%xb%qs(1,1,1).  ')
4822  endif
4823 ENDIF
4824 IF(.NOT.inter_domain)THEN
4825 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4826 ALLOCATE(grid%xb%td(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4827  if (ierr.ne.0) then
4828  CALL wrf_error_fatal ( &
4829 'frame/module_domain.f: Failed to allocate grid%xb%td(sm31:em31,sm32:em32,sm33:em33). ')
4830  endif
4831 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%td=initial_data_value
4832 ELSE
4833 ALLOCATE(grid%xb%td(1,1,1),STAT=ierr)
4834  if (ierr.ne.0) then
4835  CALL wrf_error_fatal ( &
4836 'frame/module_domain.f: Failed to allocate grid%xb%td(1,1,1).  ')
4837  endif
4838 ENDIF
4839 IF(.NOT.inter_domain)THEN
4840 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4841 ALLOCATE(grid%xb%vertical_inner_product(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4842  if (ierr.ne.0) then
4843  CALL wrf_error_fatal ( &
4844 'frame/module_domain.f: Failed to allocate grid%xb%vertical_inner_product(sm31:em31,sm32:em32,sm33:em33). ')
4845  endif
4846 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%vertical_inner_product=initial_data_value
4847 ELSE
4848 ALLOCATE(grid%xb%vertical_inner_product(1,1,1),STAT=ierr)
4849  if (ierr.ne.0) then
4850  CALL wrf_error_fatal ( &
4851 'frame/module_domain.f: Failed to allocate grid%xb%vertical_inner_product(1,1,1).  ')
4852  endif
4853 ENDIF
4854 IF(.NOT.inter_domain)THEN
4855 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
4856 ALLOCATE(grid%xb%ref(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
4857  if (ierr.ne.0) then
4858  CALL wrf_error_fatal ( &
4859 'frame/module_domain.f: Failed to allocate grid%xb%ref(sm31:em31,sm32:em32,sm33:em33). ')
4860  endif
4861 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%ref=initial_data_value
4862 ELSE
4863 ALLOCATE(grid%xb%ref(1,1,1),STAT=ierr)
4864  if (ierr.ne.0) then
4865  CALL wrf_error_fatal ( &
4866 'frame/module_domain.f: Failed to allocate grid%xb%ref(1,1,1).  ')
4867  endif
4868 ENDIF
4869 IF(.NOT.inter_domain)THEN
4870 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
4871 ALLOCATE(grid%xb%rough(sm31:em31,sm32:em32),STAT=ierr)
4872  if (ierr.ne.0) then
4873  CALL wrf_error_fatal ( &
4874 'frame/module_domain.f: Failed to allocate grid%xb%rough(sm31:em31,sm32:em32). ')
4875  endif
4876 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%rough=initial_data_value
4877 ELSE
4878 ALLOCATE(grid%xb%rough(1,1),STAT=ierr)
4879  if (ierr.ne.0) then
4880  CALL wrf_error_fatal ( &
4881 'frame/module_domain.f: Failed to allocate grid%xb%rough(1,1).  ')
4882  endif
4883 ENDIF
4884 IF(.NOT.inter_domain)THEN
4885 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
4886 ALLOCATE(grid%xb%tpw(sm31:em31,sm32:em32),STAT=ierr)
4887  if (ierr.ne.0) then
4888  CALL wrf_error_fatal ( &
4889 'frame/module_domain.f: Failed to allocate grid%xb%tpw(sm31:em31,sm32:em32). ')
4890  endif
4891 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%tpw=initial_data_value
4892 ELSE
4893 ALLOCATE(grid%xb%tpw(1,1),STAT=ierr)
4894  if (ierr.ne.0) then
4895  CALL wrf_error_fatal ( &
4896 'frame/module_domain.f: Failed to allocate grid%xb%tpw(1,1).  ')
4897  endif
4898 ENDIF
4899 IF(.NOT.inter_domain)THEN
4900 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
4901 ALLOCATE(grid%xb%slp(sm31:em31,sm32:em32),STAT=ierr)
4902  if (ierr.ne.0) then
4903  CALL wrf_error_fatal ( &
4904 'frame/module_domain.f: Failed to allocate grid%xb%slp(sm31:em31,sm32:em32). ')
4905  endif
4906 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%slp=initial_data_value
4907 ELSE
4908 ALLOCATE(grid%xb%slp(1,1),STAT=ierr)
4909  if (ierr.ne.0) then
4910  CALL wrf_error_fatal ( &
4911 'frame/module_domain.f: Failed to allocate grid%xb%slp(1,1).  ')
4912  endif
4913 ENDIF
4914 IF(.NOT.inter_domain)THEN
4915 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
4916 ALLOCATE(grid%xb%speed(sm31:em31,sm32:em32),STAT=ierr)
4917  if (ierr.ne.0) then
4918  CALL wrf_error_fatal ( &
4919 'frame/module_domain.f: Failed to allocate grid%xb%speed(sm31:em31,sm32:em32). ')
4920  endif
4921 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%speed=initial_data_value
4922 ELSE
4923 ALLOCATE(grid%xb%speed(1,1),STAT=ierr)
4924  if (ierr.ne.0) then
4925  CALL wrf_error_fatal ( &
4926 'frame/module_domain.f: Failed to allocate grid%xb%speed(1,1).  ')
4927  endif
4928 ENDIF
4929 IF(.NOT.inter_domain)THEN
4930 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
4931 ALLOCATE(grid%xb%tb19v(sm31:em31,sm32:em32),STAT=ierr)
4932  if (ierr.ne.0) then
4933  CALL wrf_error_fatal ( &
4934 'frame/module_domain.f: Failed to allocate grid%xb%tb19v(sm31:em31,sm32:em32). ')
4935  endif
4936 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%tb19v=initial_data_value
4937 ELSE
4938 ALLOCATE(grid%xb%tb19v(1,1),STAT=ierr)
4939  if (ierr.ne.0) then
4940  CALL wrf_error_fatal ( &
4941 'frame/module_domain.f: Failed to allocate grid%xb%tb19v(1,1).  ')
4942  endif
4943 ENDIF
4944 IF(.NOT.inter_domain)THEN
4945 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
4946 ALLOCATE(grid%xb%tb19h(sm31:em31,sm32:em32),STAT=ierr)
4947  if (ierr.ne.0) then
4948  CALL wrf_error_fatal ( &
4949 'frame/module_domain.f: Failed to allocate grid%xb%tb19h(sm31:em31,sm32:em32). ')
4950  endif
4951 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%tb19h=initial_data_value
4952 ELSE
4953 ALLOCATE(grid%xb%tb19h(1,1),STAT=ierr)
4954  if (ierr.ne.0) then
4955  CALL wrf_error_fatal ( &
4956 'frame/module_domain.f: Failed to allocate grid%xb%tb19h(1,1).  ')
4957  endif
4958 ENDIF
4959 IF(.NOT.inter_domain)THEN
4960 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
4961 ALLOCATE(grid%xb%tb22v(sm31:em31,sm32:em32),STAT=ierr)
4962  if (ierr.ne.0) then
4963  CALL wrf_error_fatal ( &
4964 'frame/module_domain.f: Failed to allocate grid%xb%tb22v(sm31:em31,sm32:em32). ')
4965  endif
4966 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%tb22v=initial_data_value
4967 ELSE
4968 ALLOCATE(grid%xb%tb22v(1,1),STAT=ierr)
4969  if (ierr.ne.0) then
4970  CALL wrf_error_fatal ( &
4971 'frame/module_domain.f: Failed to allocate grid%xb%tb22v(1,1).  ')
4972  endif
4973 ENDIF
4974 IF(.NOT.inter_domain)THEN
4975 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
4976 ALLOCATE(grid%xb%tb37v(sm31:em31,sm32:em32),STAT=ierr)
4977  if (ierr.ne.0) then
4978  CALL wrf_error_fatal ( &
4979 'frame/module_domain.f: Failed to allocate grid%xb%tb37v(sm31:em31,sm32:em32). ')
4980  endif
4981 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%tb37v=initial_data_value
4982 ELSE
4983 ALLOCATE(grid%xb%tb37v(1,1),STAT=ierr)
4984  if (ierr.ne.0) then
4985  CALL wrf_error_fatal ( &
4986 'frame/module_domain.f: Failed to allocate grid%xb%tb37v(1,1).  ')
4987  endif
4988 ENDIF
4989 IF(.NOT.inter_domain)THEN
4990 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
4991 ALLOCATE(grid%xb%tb37h(sm31:em31,sm32:em32),STAT=ierr)
4992  if (ierr.ne.0) then
4993  CALL wrf_error_fatal ( &
4994 'frame/module_domain.f: Failed to allocate grid%xb%tb37h(sm31:em31,sm32:em32). ')
4995  endif
4996 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%tb37h=initial_data_value
4997 ELSE
4998 ALLOCATE(grid%xb%tb37h(1,1),STAT=ierr)
4999  if (ierr.ne.0) then
5000  CALL wrf_error_fatal ( &
5001 'frame/module_domain.f: Failed to allocate grid%xb%tb37h(1,1).  ')
5002  endif
5003 ENDIF
5004 IF(.NOT.inter_domain)THEN
5005 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5006 ALLOCATE(grid%xb%tb85v(sm31:em31,sm32:em32),STAT=ierr)
5007  if (ierr.ne.0) then
5008  CALL wrf_error_fatal ( &
5009 'frame/module_domain.f: Failed to allocate grid%xb%tb85v(sm31:em31,sm32:em32). ')
5010  endif
5011 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%tb85v=initial_data_value
5012 ELSE
5013 ALLOCATE(grid%xb%tb85v(1,1),STAT=ierr)
5014  if (ierr.ne.0) then
5015  CALL wrf_error_fatal ( &
5016 'frame/module_domain.f: Failed to allocate grid%xb%tb85v(1,1).  ')
5017  endif
5018 ENDIF
5019 IF(.NOT.inter_domain)THEN
5020 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5021 ALLOCATE(grid%xb%tb85h(sm31:em31,sm32:em32),STAT=ierr)
5022  if (ierr.ne.0) then
5023  CALL wrf_error_fatal ( &
5024 'frame/module_domain.f: Failed to allocate grid%xb%tb85h(sm31:em31,sm32:em32). ')
5025  endif
5026 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%tb85h=initial_data_value
5027 ELSE
5028 ALLOCATE(grid%xb%tb85h(1,1),STAT=ierr)
5029  if (ierr.ne.0) then
5030  CALL wrf_error_fatal ( &
5031 'frame/module_domain.f: Failed to allocate grid%xb%tb85h(1,1).  ')
5032  endif
5033 ENDIF
5034 IF(.NOT.inter_domain)THEN
5035 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5036 ALLOCATE(grid%xb%cori(sm31:em31,sm32:em32),STAT=ierr)
5037  if (ierr.ne.0) then
5038  CALL wrf_error_fatal ( &
5039 'frame/module_domain.f: Failed to allocate grid%xb%cori(sm31:em31,sm32:em32). ')
5040  endif
5041 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%cori=initial_data_value
5042 ELSE
5043 ALLOCATE(grid%xb%cori(1,1),STAT=ierr)
5044  if (ierr.ne.0) then
5045  CALL wrf_error_fatal ( &
5046 'frame/module_domain.f: Failed to allocate grid%xb%cori(1,1).  ')
5047  endif
5048 ENDIF
5049 IF(.NOT.inter_domain)THEN
5050 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5051 ALLOCATE(grid%xb%tgrn(sm31:em31,sm32:em32),STAT=ierr)
5052  if (ierr.ne.0) then
5053  CALL wrf_error_fatal ( &
5054 'frame/module_domain.f: Failed to allocate grid%xb%tgrn(sm31:em31,sm32:em32). ')
5055  endif
5056 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%tgrn=initial_data_value
5057 ELSE
5058 ALLOCATE(grid%xb%tgrn(1,1),STAT=ierr)
5059  if (ierr.ne.0) then
5060  CALL wrf_error_fatal ( &
5061 'frame/module_domain.f: Failed to allocate grid%xb%tgrn(1,1).  ')
5062  endif
5063 ENDIF
5064 IF(.NOT.inter_domain)THEN
5065 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5066 ALLOCATE(grid%xb%lat(sm31:em31,sm32:em32),STAT=ierr)
5067  if (ierr.ne.0) then
5068  CALL wrf_error_fatal ( &
5069 'frame/module_domain.f: Failed to allocate grid%xb%lat(sm31:em31,sm32:em32). ')
5070  endif
5071 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%lat=initial_data_value
5072 ELSE
5073 ALLOCATE(grid%xb%lat(1,1),STAT=ierr)
5074  if (ierr.ne.0) then
5075  CALL wrf_error_fatal ( &
5076 'frame/module_domain.f: Failed to allocate grid%xb%lat(1,1).  ')
5077  endif
5078 ENDIF
5079 IF(.NOT.inter_domain)THEN
5080 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5081 ALLOCATE(grid%xb%lon(sm31:em31,sm32:em32),STAT=ierr)
5082  if (ierr.ne.0) then
5083  CALL wrf_error_fatal ( &
5084 'frame/module_domain.f: Failed to allocate grid%xb%lon(sm31:em31,sm32:em32). ')
5085  endif
5086 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%lon=initial_data_value
5087 ELSE
5088 ALLOCATE(grid%xb%lon(1,1),STAT=ierr)
5089  if (ierr.ne.0) then
5090  CALL wrf_error_fatal ( &
5091 'frame/module_domain.f: Failed to allocate grid%xb%lon(1,1).  ')
5092  endif
5093 ENDIF
5094 IF(.NOT.inter_domain)THEN
5095 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5096 ALLOCATE(grid%xb%terr(sm31:em31,sm32:em32),STAT=ierr)
5097  if (ierr.ne.0) then
5098  CALL wrf_error_fatal ( &
5099 'frame/module_domain.f: Failed to allocate grid%xb%terr(sm31:em31,sm32:em32). ')
5100  endif
5101 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%terr=initial_data_value
5102 ELSE
5103 ALLOCATE(grid%xb%terr(1,1),STAT=ierr)
5104  if (ierr.ne.0) then
5105  CALL wrf_error_fatal ( &
5106 'frame/module_domain.f: Failed to allocate grid%xb%terr(1,1).  ')
5107  endif
5108 ENDIF
5109 IF(.NOT.inter_domain)THEN
5110 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5111 ALLOCATE(grid%xb%psac(sm31:em31,sm32:em32),STAT=ierr)
5112  if (ierr.ne.0) then
5113  CALL wrf_error_fatal ( &
5114 'frame/module_domain.f: Failed to allocate grid%xb%psac(sm31:em31,sm32:em32). ')
5115  endif
5116 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%psac=initial_data_value
5117 ELSE
5118 ALLOCATE(grid%xb%psac(1,1),STAT=ierr)
5119  if (ierr.ne.0) then
5120  CALL wrf_error_fatal ( &
5121 'frame/module_domain.f: Failed to allocate grid%xb%psac(1,1).  ')
5122  endif
5123 ENDIF
5124 IF(.NOT.inter_domain)THEN
5125 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5126 ALLOCATE(grid%xb%lanu(sm31:em31,sm32:em32),STAT=ierr)
5127  if (ierr.ne.0) then
5128  CALL wrf_error_fatal ( &
5129 'frame/module_domain.f: Failed to allocate grid%xb%lanu(sm31:em31,sm32:em32). ')
5130  endif
5131 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%lanu=initial_data_value
5132 ELSE
5133 ALLOCATE(grid%xb%lanu(1,1),STAT=ierr)
5134  if (ierr.ne.0) then
5135  CALL wrf_error_fatal ( &
5136 'frame/module_domain.f: Failed to allocate grid%xb%lanu(1,1).  ')
5137  endif
5138 ENDIF
5139 IF(.NOT.inter_domain)THEN
5140 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5141 ALLOCATE(grid%xb%snow(sm31:em31,sm32:em32),STAT=ierr)
5142  if (ierr.ne.0) then
5143  CALL wrf_error_fatal ( &
5144 'frame/module_domain.f: Failed to allocate grid%xb%snow(sm31:em31,sm32:em32). ')
5145  endif
5146 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%snow=initial_data_value
5147 ELSE
5148 ALLOCATE(grid%xb%snow(1,1),STAT=ierr)
5149  if (ierr.ne.0) then
5150  CALL wrf_error_fatal ( &
5151 'frame/module_domain.f: Failed to allocate grid%xb%snow(1,1).  ')
5152  endif
5153 ENDIF
5154 IF(.NOT.inter_domain)THEN
5155 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5156 ALLOCATE(grid%xb%xland(sm31:em31,sm32:em32),STAT=ierr)
5157  if (ierr.ne.0) then
5158  CALL wrf_error_fatal ( &
5159 'frame/module_domain.f: Failed to allocate grid%xb%xland(sm31:em31,sm32:em32). ')
5160  endif
5161 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%xland=initial_data_value
5162 ELSE
5163 ALLOCATE(grid%xb%xland(1,1),STAT=ierr)
5164  if (ierr.ne.0) then
5165  CALL wrf_error_fatal ( &
5166 'frame/module_domain.f: Failed to allocate grid%xb%xland(1,1).  ')
5167  endif
5168 ENDIF
5169 IF(.NOT.inter_domain)THEN
5170 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5171 ALLOCATE(grid%xb%landmask(sm31:em31,sm32:em32),STAT=ierr)
5172  if (ierr.ne.0) then
5173  CALL wrf_error_fatal ( &
5174 'frame/module_domain.f: Failed to allocate grid%xb%landmask(sm31:em31,sm32:em32). ')
5175  endif
5176 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%landmask=initial_data_value
5177 ELSE
5178 ALLOCATE(grid%xb%landmask(1,1),STAT=ierr)
5179  if (ierr.ne.0) then
5180  CALL wrf_error_fatal ( &
5181 'frame/module_domain.f: Failed to allocate grid%xb%landmask(1,1).  ')
5182  endif
5183 ENDIF
5184 IF(.NOT.inter_domain)THEN
5185 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5186 ALLOCATE(grid%xb%u10(sm31:em31,sm32:em32),STAT=ierr)
5187  if (ierr.ne.0) then
5188  CALL wrf_error_fatal ( &
5189 'frame/module_domain.f: Failed to allocate grid%xb%u10(sm31:em31,sm32:em32). ')
5190  endif
5191 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%u10=initial_data_value
5192 ELSE
5193 ALLOCATE(grid%xb%u10(1,1),STAT=ierr)
5194  if (ierr.ne.0) then
5195  CALL wrf_error_fatal ( &
5196 'frame/module_domain.f: Failed to allocate grid%xb%u10(1,1).  ')
5197  endif
5198 ENDIF
5199 IF(.NOT.inter_domain)THEN
5200 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5201 ALLOCATE(grid%xb%v10(sm31:em31,sm32:em32),STAT=ierr)
5202  if (ierr.ne.0) then
5203  CALL wrf_error_fatal ( &
5204 'frame/module_domain.f: Failed to allocate grid%xb%v10(sm31:em31,sm32:em32). ')
5205  endif
5206 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%v10=initial_data_value
5207 ELSE
5208 ALLOCATE(grid%xb%v10(1,1),STAT=ierr)
5209  if (ierr.ne.0) then
5210  CALL wrf_error_fatal ( &
5211 'frame/module_domain.f: Failed to allocate grid%xb%v10(1,1).  ')
5212  endif
5213 ENDIF
5214 IF(.NOT.inter_domain)THEN
5215 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5216 ALLOCATE(grid%xb%t2(sm31:em31,sm32:em32),STAT=ierr)
5217  if (ierr.ne.0) then
5218  CALL wrf_error_fatal ( &
5219 'frame/module_domain.f: Failed to allocate grid%xb%t2(sm31:em31,sm32:em32). ')
5220  endif
5221 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%t2=initial_data_value
5222 ELSE
5223 ALLOCATE(grid%xb%t2(1,1),STAT=ierr)
5224  if (ierr.ne.0) then
5225  CALL wrf_error_fatal ( &
5226 'frame/module_domain.f: Failed to allocate grid%xb%t2(1,1).  ')
5227  endif
5228 ENDIF
5229 IF(.NOT.inter_domain)THEN
5230 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5231 ALLOCATE(grid%xb%q2(sm31:em31,sm32:em32),STAT=ierr)
5232  if (ierr.ne.0) then
5233  CALL wrf_error_fatal ( &
5234 'frame/module_domain.f: Failed to allocate grid%xb%q2(sm31:em31,sm32:em32). ')
5235  endif
5236 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%q2=initial_data_value
5237 ELSE
5238 ALLOCATE(grid%xb%q2(1,1),STAT=ierr)
5239  if (ierr.ne.0) then
5240  CALL wrf_error_fatal ( &
5241 'frame/module_domain.f: Failed to allocate grid%xb%q2(1,1).  ')
5242  endif
5243 ENDIF
5244 IF(.NOT.inter_domain)THEN
5245 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5246 ALLOCATE(grid%xb%psfc(sm31:em31,sm32:em32),STAT=ierr)
5247  if (ierr.ne.0) then
5248  CALL wrf_error_fatal ( &
5249 'frame/module_domain.f: Failed to allocate grid%xb%psfc(sm31:em31,sm32:em32). ')
5250  endif
5251 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%psfc=initial_data_value
5252 ELSE
5253 ALLOCATE(grid%xb%psfc(1,1),STAT=ierr)
5254  if (ierr.ne.0) then
5255  CALL wrf_error_fatal ( &
5256 'frame/module_domain.f: Failed to allocate grid%xb%psfc(1,1).  ')
5257  endif
5258 ENDIF
5259 IF(.NOT.inter_domain)THEN
5260 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5261 ALLOCATE(grid%xb%tsk(sm31:em31,sm32:em32),STAT=ierr)
5262  if (ierr.ne.0) then
5263  CALL wrf_error_fatal ( &
5264 'frame/module_domain.f: Failed to allocate grid%xb%tsk(sm31:em31,sm32:em32). ')
5265  endif
5266 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%tsk=initial_data_value
5267 ELSE
5268 ALLOCATE(grid%xb%tsk(1,1),STAT=ierr)
5269  if (ierr.ne.0) then
5270  CALL wrf_error_fatal ( &
5271 'frame/module_domain.f: Failed to allocate grid%xb%tsk(1,1).  ')
5272  endif
5273 ENDIF
5274 IF(.NOT.inter_domain)THEN
5275 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5276 ALLOCATE(grid%xb%smois(sm31:em31,sm32:em32),STAT=ierr)
5277  if (ierr.ne.0) then
5278  CALL wrf_error_fatal ( &
5279 'frame/module_domain.f: Failed to allocate grid%xb%smois(sm31:em31,sm32:em32). ')
5280  endif
5281 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%smois=initial_data_value
5282 ELSE
5283 ALLOCATE(grid%xb%smois(1,1),STAT=ierr)
5284  if (ierr.ne.0) then
5285  CALL wrf_error_fatal ( &
5286 'frame/module_domain.f: Failed to allocate grid%xb%smois(1,1).  ')
5287  endif
5288 ENDIF
5289 IF(.NOT.inter_domain)THEN
5290 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5291 ALLOCATE(grid%xb%tslb(sm31:em31,sm32:em32),STAT=ierr)
5292  if (ierr.ne.0) then
5293  CALL wrf_error_fatal ( &
5294 'frame/module_domain.f: Failed to allocate grid%xb%tslb(sm31:em31,sm32:em32). ')
5295  endif
5296 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%tslb=initial_data_value
5297 ELSE
5298 ALLOCATE(grid%xb%tslb(1,1),STAT=ierr)
5299  if (ierr.ne.0) then
5300  CALL wrf_error_fatal ( &
5301 'frame/module_domain.f: Failed to allocate grid%xb%tslb(1,1).  ')
5302  endif
5303 ENDIF
5304 IF(.NOT.inter_domain)THEN
5305 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5306 ALLOCATE(grid%xb%xice(sm31:em31,sm32:em32),STAT=ierr)
5307  if (ierr.ne.0) then
5308  CALL wrf_error_fatal ( &
5309 'frame/module_domain.f: Failed to allocate grid%xb%xice(sm31:em31,sm32:em32). ')
5310  endif
5311 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%xice=initial_data_value
5312 ELSE
5313 ALLOCATE(grid%xb%xice(1,1),STAT=ierr)
5314  if (ierr.ne.0) then
5315  CALL wrf_error_fatal ( &
5316 'frame/module_domain.f: Failed to allocate grid%xb%xice(1,1).  ')
5317  endif
5318 ENDIF
5319 IF(.NOT.inter_domain)THEN
5320 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * IWORDSIZE
5321 ALLOCATE(grid%xb%ivgtyp(sm31:em31,sm32:em32),STAT=ierr)
5322  if (ierr.ne.0) then
5323  CALL wrf_error_fatal ( &
5324 'frame/module_domain.f: Failed to allocate grid%xb%ivgtyp(sm31:em31,sm32:em32). ')
5325  endif
5326 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%ivgtyp=0
5327 ELSE
5328 ALLOCATE(grid%xb%ivgtyp(1,1),STAT=ierr)
5329  if (ierr.ne.0) then
5330  CALL wrf_error_fatal ( &
5331 'frame/module_domain.f: Failed to allocate grid%xb%ivgtyp(1,1).  ')
5332  endif
5333 ENDIF
5334 IF(.NOT.inter_domain)THEN
5335 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * IWORDSIZE
5336 ALLOCATE(grid%xb%isltyp(sm31:em31,sm32:em32),STAT=ierr)
5337  if (ierr.ne.0) then
5338  CALL wrf_error_fatal ( &
5339 'frame/module_domain.f: Failed to allocate grid%xb%isltyp(sm31:em31,sm32:em32). ')
5340  endif
5341 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%isltyp=0
5342 ELSE
5343 ALLOCATE(grid%xb%isltyp(1,1),STAT=ierr)
5344  if (ierr.ne.0) then
5345  CALL wrf_error_fatal ( &
5346 'frame/module_domain.f: Failed to allocate grid%xb%isltyp(1,1).  ')
5347  endif
5348 ENDIF
5349 IF(.NOT.inter_domain)THEN
5350 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5351 ALLOCATE(grid%xb%vegfra(sm31:em31,sm32:em32),STAT=ierr)
5352  if (ierr.ne.0) then
5353  CALL wrf_error_fatal ( &
5354 'frame/module_domain.f: Failed to allocate grid%xb%vegfra(sm31:em31,sm32:em32). ')
5355  endif
5356 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%vegfra=initial_data_value
5357 ELSE
5358 ALLOCATE(grid%xb%vegfra(1,1),STAT=ierr)
5359  if (ierr.ne.0) then
5360  CALL wrf_error_fatal ( &
5361 'frame/module_domain.f: Failed to allocate grid%xb%vegfra(1,1).  ')
5362  endif
5363 ENDIF
5364 IF(.NOT.inter_domain)THEN
5365 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5366 ALLOCATE(grid%xb%snowh(sm31:em31,sm32:em32),STAT=ierr)
5367  if (ierr.ne.0) then
5368  CALL wrf_error_fatal ( &
5369 'frame/module_domain.f: Failed to allocate grid%xb%snowh(sm31:em31,sm32:em32). ')
5370  endif
5371 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%snowh=initial_data_value
5372 ELSE
5373 ALLOCATE(grid%xb%snowh(1,1),STAT=ierr)
5374  if (ierr.ne.0) then
5375  CALL wrf_error_fatal ( &
5376 'frame/module_domain.f: Failed to allocate grid%xb%snowh(1,1).  ')
5377  endif
5378 ENDIF
5379 IF(.NOT.inter_domain)THEN
5380 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5381 ALLOCATE(grid%xb%regime(sm31:em31,sm32:em32),STAT=ierr)
5382  if (ierr.ne.0) then
5383  CALL wrf_error_fatal ( &
5384 'frame/module_domain.f: Failed to allocate grid%xb%regime(sm31:em31,sm32:em32). ')
5385  endif
5386 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%regime=initial_data_value
5387 ELSE
5388 ALLOCATE(grid%xb%regime(1,1),STAT=ierr)
5389  if (ierr.ne.0) then
5390  CALL wrf_error_fatal ( &
5391 'frame/module_domain.f: Failed to allocate grid%xb%regime(1,1).  ')
5392  endif
5393 ENDIF
5394 IF(.NOT.inter_domain)THEN
5395 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
5396 ALLOCATE(grid%xb%znu(sm33:em33),STAT=ierr)
5397  if (ierr.ne.0) then
5398  CALL wrf_error_fatal ( &
5399 'frame/module_domain.f: Failed to allocate grid%xb%znu(sm33:em33). ')
5400  endif
5401 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%znu=initial_data_value
5402 ELSE
5403 ALLOCATE(grid%xb%znu(1),STAT=ierr)
5404  if (ierr.ne.0) then
5405  CALL wrf_error_fatal ( &
5406 'frame/module_domain.f: Failed to allocate grid%xb%znu(1).  ')
5407  endif
5408 ENDIF
5409 IF(.NOT.inter_domain)THEN
5410 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
5411 ALLOCATE(grid%xb%znw(sm33:em33),STAT=ierr)
5412  if (ierr.ne.0) then
5413  CALL wrf_error_fatal ( &
5414 'frame/module_domain.f: Failed to allocate grid%xb%znw(sm33:em33). ')
5415  endif
5416 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%znw=initial_data_value
5417 ELSE
5418 ALLOCATE(grid%xb%znw(1),STAT=ierr)
5419  if (ierr.ne.0) then
5420  CALL wrf_error_fatal ( &
5421 'frame/module_domain.f: Failed to allocate grid%xb%znw(1).  ')
5422  endif
5423 ENDIF
5424 IF(.NOT.inter_domain)THEN
5425 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
5426 ALLOCATE(grid%xb%dn(sm33:em33),STAT=ierr)
5427  if (ierr.ne.0) then
5428  CALL wrf_error_fatal ( &
5429 'frame/module_domain.f: Failed to allocate grid%xb%dn(sm33:em33). ')
5430  endif
5431 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%dn=initial_data_value
5432 ELSE
5433 ALLOCATE(grid%xb%dn(1),STAT=ierr)
5434  if (ierr.ne.0) then
5435  CALL wrf_error_fatal ( &
5436 'frame/module_domain.f: Failed to allocate grid%xb%dn(1).  ')
5437  endif
5438 ENDIF
5439 IF(.NOT.inter_domain)THEN
5440 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
5441 ALLOCATE(grid%xb%dnw(sm33:em33),STAT=ierr)
5442  if (ierr.ne.0) then
5443  CALL wrf_error_fatal ( &
5444 'frame/module_domain.f: Failed to allocate grid%xb%dnw(sm33:em33). ')
5445  endif
5446 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%dnw=initial_data_value
5447 ELSE
5448 ALLOCATE(grid%xb%dnw(1),STAT=ierr)
5449  if (ierr.ne.0) then
5450  CALL wrf_error_fatal ( &
5451 'frame/module_domain.f: Failed to allocate grid%xb%dnw(1).  ')
5452  endif
5453 ENDIF
5454 IF(.NOT.inter_domain)THEN
5455 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
5456 ALLOCATE(grid%xb%sigmah(sm33:em33),STAT=ierr)
5457  if (ierr.ne.0) then
5458  CALL wrf_error_fatal ( &
5459 'frame/module_domain.f: Failed to allocate grid%xb%sigmah(sm33:em33). ')
5460  endif
5461 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%sigmah=initial_data_value
5462 ELSE
5463 ALLOCATE(grid%xb%sigmah(1),STAT=ierr)
5464  if (ierr.ne.0) then
5465  CALL wrf_error_fatal ( &
5466 'frame/module_domain.f: Failed to allocate grid%xb%sigmah(1).  ')
5467  endif
5468 ENDIF
5469 IF(.NOT.inter_domain)THEN
5470 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
5471 ALLOCATE(grid%xb%sigmaf(sm33:em33),STAT=ierr)
5472  if (ierr.ne.0) then
5473  CALL wrf_error_fatal ( &
5474 'frame/module_domain.f: Failed to allocate grid%xb%sigmaf(sm33:em33). ')
5475  endif
5476 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%sigmaf=initial_data_value
5477 ELSE
5478 ALLOCATE(grid%xb%sigmaf(1),STAT=ierr)
5479  if (ierr.ne.0) then
5480  CALL wrf_error_fatal ( &
5481 'frame/module_domain.f: Failed to allocate grid%xb%sigmaf(1).  ')
5482  endif
5483 ENDIF
5484 IF(.NOT.inter_domain)THEN
5485 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5486 ALLOCATE(grid%xb%coefx(sm31:em31,sm32:em32),STAT=ierr)
5487  if (ierr.ne.0) then
5488  CALL wrf_error_fatal ( &
5489 'frame/module_domain.f: Failed to allocate grid%xb%coefx(sm31:em31,sm32:em32). ')
5490  endif
5491 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%coefx=initial_data_value
5492 ELSE
5493 ALLOCATE(grid%xb%coefx(1,1),STAT=ierr)
5494  if (ierr.ne.0) then
5495  CALL wrf_error_fatal ( &
5496 'frame/module_domain.f: Failed to allocate grid%xb%coefx(1,1).  ')
5497  endif
5498 ENDIF
5499 IF(.NOT.inter_domain)THEN
5500 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5501 ALLOCATE(grid%xb%coefy(sm31:em31,sm32:em32),STAT=ierr)
5502  if (ierr.ne.0) then
5503  CALL wrf_error_fatal ( &
5504 'frame/module_domain.f: Failed to allocate grid%xb%coefy(sm31:em31,sm32:em32). ')
5505  endif
5506 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%coefy=initial_data_value
5507 ELSE
5508 ALLOCATE(grid%xb%coefy(1,1),STAT=ierr)
5509  if (ierr.ne.0) then
5510  CALL wrf_error_fatal ( &
5511 'frame/module_domain.f: Failed to allocate grid%xb%coefy(1,1).  ')
5512  endif
5513 ENDIF
5514 IF(.NOT.inter_domain)THEN
5515 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5516 ALLOCATE(grid%xb%coefz(sm31:em31,sm32:em32),STAT=ierr)
5517  if (ierr.ne.0) then
5518  CALL wrf_error_fatal ( &
5519 'frame/module_domain.f: Failed to allocate grid%xb%coefz(sm31:em31,sm32:em32). ')
5520  endif
5521 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%coefz=initial_data_value
5522 ELSE
5523 ALLOCATE(grid%xb%coefz(1,1),STAT=ierr)
5524  if (ierr.ne.0) then
5525  CALL wrf_error_fatal ( &
5526 'frame/module_domain.f: Failed to allocate grid%xb%coefz(1,1).  ')
5527  endif
5528 ENDIF
5529 IF(.NOT.inter_domain)THEN
5530 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
5531 ALLOCATE(grid%xb%kma_a(sm33:em33),STAT=ierr)
5532  if (ierr.ne.0) then
5533  CALL wrf_error_fatal ( &
5534 'frame/module_domain.f: Failed to allocate grid%xb%kma_a(sm33:em33). ')
5535  endif
5536 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%kma_a=initial_data_value
5537 ELSE
5538 ALLOCATE(grid%xb%kma_a(1),STAT=ierr)
5539  if (ierr.ne.0) then
5540  CALL wrf_error_fatal ( &
5541 'frame/module_domain.f: Failed to allocate grid%xb%kma_a(1).  ')
5542  endif
5543 ENDIF
5544 IF(.NOT.inter_domain)THEN
5545 num_bytes_allocated = num_bytes_allocated + ((((em33)-(sm33)+1))) * RWORDSIZE
5546 ALLOCATE(grid%xb%kma_b(sm33:em33),STAT=ierr)
5547  if (ierr.ne.0) then
5548  CALL wrf_error_fatal ( &
5549 'frame/module_domain.f: Failed to allocate grid%xb%kma_b(sm33:em33). ')
5550  endif
5551 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xb%kma_b=initial_data_value
5552 ELSE
5553 ALLOCATE(grid%xb%kma_b(1),STAT=ierr)
5554  if (ierr.ne.0) then
5555  CALL wrf_error_fatal ( &
5556 'frame/module_domain.f: Failed to allocate grid%xb%kma_b(1).  ')
5557  endif
5558 ENDIF
5559 IF(.NOT.inter_domain)THEN
5560 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5561 ALLOCATE(grid%xa%u(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5562  if (ierr.ne.0) then
5563  CALL wrf_error_fatal ( &
5564 'frame/module_domain.f: Failed to allocate grid%xa%u(sm31:em31,sm32:em32,sm33:em33). ')
5565  endif
5566 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%u=initial_data_value
5567 ELSE
5568 ALLOCATE(grid%xa%u(1,1,1),STAT=ierr)
5569  if (ierr.ne.0) then
5570  CALL wrf_error_fatal ( &
5571 'frame/module_domain.f: Failed to allocate grid%xa%u(1,1,1).  ')
5572  endif
5573 ENDIF
5574 IF(.NOT.inter_domain)THEN
5575 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5576 ALLOCATE(grid%xa%v(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5577  if (ierr.ne.0) then
5578  CALL wrf_error_fatal ( &
5579 'frame/module_domain.f: Failed to allocate grid%xa%v(sm31:em31,sm32:em32,sm33:em33). ')
5580  endif
5581 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%v=initial_data_value
5582 ELSE
5583 ALLOCATE(grid%xa%v(1,1,1),STAT=ierr)
5584  if (ierr.ne.0) then
5585  CALL wrf_error_fatal ( &
5586 'frame/module_domain.f: Failed to allocate grid%xa%v(1,1,1).  ')
5587  endif
5588 ENDIF
5589 IF(.NOT.inter_domain)THEN
5590 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5591 ALLOCATE(grid%xa%w(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5592  if (ierr.ne.0) then
5593  CALL wrf_error_fatal ( &
5594 'frame/module_domain.f: Failed to allocate grid%xa%w(sm31:em31,sm32:em32,sm33:em33). ')
5595  endif
5596 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%w=initial_data_value
5597 ELSE
5598 ALLOCATE(grid%xa%w(1,1,1),STAT=ierr)
5599  if (ierr.ne.0) then
5600  CALL wrf_error_fatal ( &
5601 'frame/module_domain.f: Failed to allocate grid%xa%w(1,1,1).  ')
5602  endif
5603 ENDIF
5604 IF(.NOT.inter_domain)THEN
5605 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5606 ALLOCATE(grid%xa%t(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5607  if (ierr.ne.0) then
5608  CALL wrf_error_fatal ( &
5609 'frame/module_domain.f: Failed to allocate grid%xa%t(sm31:em31,sm32:em32,sm33:em33). ')
5610  endif
5611 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%t=initial_data_value
5612 ELSE
5613 ALLOCATE(grid%xa%t(1,1,1),STAT=ierr)
5614  if (ierr.ne.0) then
5615  CALL wrf_error_fatal ( &
5616 'frame/module_domain.f: Failed to allocate grid%xa%t(1,1,1).  ')
5617  endif
5618 ENDIF
5619 IF(.NOT.inter_domain)THEN
5620 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5621 ALLOCATE(grid%xa%q(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5622  if (ierr.ne.0) then
5623  CALL wrf_error_fatal ( &
5624 'frame/module_domain.f: Failed to allocate grid%xa%q(sm31:em31,sm32:em32,sm33:em33). ')
5625  endif
5626 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%q=initial_data_value
5627 ELSE
5628 ALLOCATE(grid%xa%q(1,1,1),STAT=ierr)
5629  if (ierr.ne.0) then
5630  CALL wrf_error_fatal ( &
5631 'frame/module_domain.f: Failed to allocate grid%xa%q(1,1,1).  ')
5632  endif
5633 ENDIF
5634 IF(.NOT.inter_domain)THEN
5635 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5636 ALLOCATE(grid%xa%p(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5637  if (ierr.ne.0) then
5638  CALL wrf_error_fatal ( &
5639 'frame/module_domain.f: Failed to allocate grid%xa%p(sm31:em31,sm32:em32,sm33:em33). ')
5640  endif
5641 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%p=initial_data_value
5642 ELSE
5643 ALLOCATE(grid%xa%p(1,1,1),STAT=ierr)
5644  if (ierr.ne.0) then
5645  CALL wrf_error_fatal ( &
5646 'frame/module_domain.f: Failed to allocate grid%xa%p(1,1,1).  ')
5647  endif
5648 ENDIF
5649 IF(.NOT.inter_domain)THEN
5650 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5651 ALLOCATE(grid%xa%rh(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5652  if (ierr.ne.0) then
5653  CALL wrf_error_fatal ( &
5654 'frame/module_domain.f: Failed to allocate grid%xa%rh(sm31:em31,sm32:em32,sm33:em33). ')
5655  endif
5656 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%rh=initial_data_value
5657 ELSE
5658 ALLOCATE(grid%xa%rh(1,1,1),STAT=ierr)
5659  if (ierr.ne.0) then
5660  CALL wrf_error_fatal ( &
5661 'frame/module_domain.f: Failed to allocate grid%xa%rh(1,1,1).  ')
5662  endif
5663 ENDIF
5664 IF(.NOT.inter_domain)THEN
5665 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5666 ALLOCATE(grid%xa%rho(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5667  if (ierr.ne.0) then
5668  CALL wrf_error_fatal ( &
5669 'frame/module_domain.f: Failed to allocate grid%xa%rho(sm31:em31,sm32:em32,sm33:em33). ')
5670  endif
5671 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%rho=initial_data_value
5672 ELSE
5673 ALLOCATE(grid%xa%rho(1,1,1),STAT=ierr)
5674  if (ierr.ne.0) then
5675  CALL wrf_error_fatal ( &
5676 'frame/module_domain.f: Failed to allocate grid%xa%rho(1,1,1).  ')
5677  endif
5678 ENDIF
5679 IF(.NOT.inter_domain)THEN
5680 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5681 ALLOCATE(grid%xa%wh(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5682  if (ierr.ne.0) then
5683  CALL wrf_error_fatal ( &
5684 'frame/module_domain.f: Failed to allocate grid%xa%wh(sm31:em31,sm32:em32,sm33:em33). ')
5685  endif
5686 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%wh=initial_data_value
5687 ELSE
5688 ALLOCATE(grid%xa%wh(1,1,1),STAT=ierr)
5689  if (ierr.ne.0) then
5690  CALL wrf_error_fatal ( &
5691 'frame/module_domain.f: Failed to allocate grid%xa%wh(1,1,1).  ')
5692  endif
5693 ENDIF
5694 IF(.NOT.inter_domain)THEN
5695 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5696 ALLOCATE(grid%xa%qrn(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5697  if (ierr.ne.0) then
5698  CALL wrf_error_fatal ( &
5699 'frame/module_domain.f: Failed to allocate grid%xa%qrn(sm31:em31,sm32:em32,sm33:em33). ')
5700  endif
5701 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%qrn=initial_data_value
5702 ELSE
5703 ALLOCATE(grid%xa%qrn(1,1,1),STAT=ierr)
5704  if (ierr.ne.0) then
5705  CALL wrf_error_fatal ( &
5706 'frame/module_domain.f: Failed to allocate grid%xa%qrn(1,1,1).  ')
5707  endif
5708 ENDIF
5709 IF(.NOT.inter_domain)THEN
5710 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5711 ALLOCATE(grid%xa%qcw(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5712  if (ierr.ne.0) then
5713  CALL wrf_error_fatal ( &
5714 'frame/module_domain.f: Failed to allocate grid%xa%qcw(sm31:em31,sm32:em32,sm33:em33). ')
5715  endif
5716 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%qcw=initial_data_value
5717 ELSE
5718 ALLOCATE(grid%xa%qcw(1,1,1),STAT=ierr)
5719  if (ierr.ne.0) then
5720  CALL wrf_error_fatal ( &
5721 'frame/module_domain.f: Failed to allocate grid%xa%qcw(1,1,1).  ')
5722  endif
5723 ENDIF
5724 IF(.NOT.inter_domain)THEN
5725 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5726 ALLOCATE(grid%xa%qci(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5727  if (ierr.ne.0) then
5728  CALL wrf_error_fatal ( &
5729 'frame/module_domain.f: Failed to allocate grid%xa%qci(sm31:em31,sm32:em32,sm33:em33). ')
5730  endif
5731 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%qci=initial_data_value
5732 ELSE
5733 ALLOCATE(grid%xa%qci(1,1,1),STAT=ierr)
5734  if (ierr.ne.0) then
5735  CALL wrf_error_fatal ( &
5736 'frame/module_domain.f: Failed to allocate grid%xa%qci(1,1,1).  ')
5737  endif
5738 ENDIF
5739 IF(.NOT.inter_domain)THEN
5740 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5741 ALLOCATE(grid%xa%qsn(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5742  if (ierr.ne.0) then
5743  CALL wrf_error_fatal ( &
5744 'frame/module_domain.f: Failed to allocate grid%xa%qsn(sm31:em31,sm32:em32,sm33:em33). ')
5745  endif
5746 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%qsn=initial_data_value
5747 ELSE
5748 ALLOCATE(grid%xa%qsn(1,1,1),STAT=ierr)
5749  if (ierr.ne.0) then
5750  CALL wrf_error_fatal ( &
5751 'frame/module_domain.f: Failed to allocate grid%xa%qsn(1,1,1).  ')
5752  endif
5753 ENDIF
5754 IF(.NOT.inter_domain)THEN
5755 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5756 ALLOCATE(grid%xa%qgr(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5757  if (ierr.ne.0) then
5758  CALL wrf_error_fatal ( &
5759 'frame/module_domain.f: Failed to allocate grid%xa%qgr(sm31:em31,sm32:em32,sm33:em33). ')
5760  endif
5761 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%qgr=initial_data_value
5762 ELSE
5763 ALLOCATE(grid%xa%qgr(1,1,1),STAT=ierr)
5764  if (ierr.ne.0) then
5765  CALL wrf_error_fatal ( &
5766 'frame/module_domain.f: Failed to allocate grid%xa%qgr(1,1,1).  ')
5767  endif
5768 ENDIF
5769 IF(.NOT.inter_domain)THEN
5770 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5771 ALLOCATE(grid%xa%qt(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5772  if (ierr.ne.0) then
5773  CALL wrf_error_fatal ( &
5774 'frame/module_domain.f: Failed to allocate grid%xa%qt(sm31:em31,sm32:em32,sm33:em33). ')
5775  endif
5776 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%qt=initial_data_value
5777 ELSE
5778 ALLOCATE(grid%xa%qt(1,1,1),STAT=ierr)
5779  if (ierr.ne.0) then
5780  CALL wrf_error_fatal ( &
5781 'frame/module_domain.f: Failed to allocate grid%xa%qt(1,1,1).  ')
5782  endif
5783 ENDIF
5784 IF(.NOT.inter_domain)THEN
5785 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5786 ALLOCATE(grid%xa%tgrn(sm31:em31,sm32:em32),STAT=ierr)
5787  if (ierr.ne.0) then
5788  CALL wrf_error_fatal ( &
5789 'frame/module_domain.f: Failed to allocate grid%xa%tgrn(sm31:em31,sm32:em32). ')
5790  endif
5791 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%tgrn=initial_data_value
5792 ELSE
5793 ALLOCATE(grid%xa%tgrn(1,1),STAT=ierr)
5794  if (ierr.ne.0) then
5795  CALL wrf_error_fatal ( &
5796 'frame/module_domain.f: Failed to allocate grid%xa%tgrn(1,1).  ')
5797  endif
5798 ENDIF
5799 IF(.NOT.inter_domain)THEN
5800 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5801 ALLOCATE(grid%xa%psfc(sm31:em31,sm32:em32),STAT=ierr)
5802  if (ierr.ne.0) then
5803  CALL wrf_error_fatal ( &
5804 'frame/module_domain.f: Failed to allocate grid%xa%psfc(sm31:em31,sm32:em32). ')
5805  endif
5806 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%psfc=initial_data_value
5807 ELSE
5808 ALLOCATE(grid%xa%psfc(1,1),STAT=ierr)
5809  if (ierr.ne.0) then
5810  CALL wrf_error_fatal ( &
5811 'frame/module_domain.f: Failed to allocate grid%xa%psfc(1,1).  ')
5812  endif
5813 ENDIF
5814 IF(.NOT.inter_domain)THEN
5815 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5816 ALLOCATE(grid%xa%u10(sm31:em31,sm32:em32),STAT=ierr)
5817  if (ierr.ne.0) then
5818  CALL wrf_error_fatal ( &
5819 'frame/module_domain.f: Failed to allocate grid%xa%u10(sm31:em31,sm32:em32). ')
5820  endif
5821 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%u10=initial_data_value
5822 ELSE
5823 ALLOCATE(grid%xa%u10(1,1),STAT=ierr)
5824  if (ierr.ne.0) then
5825  CALL wrf_error_fatal ( &
5826 'frame/module_domain.f: Failed to allocate grid%xa%u10(1,1).  ')
5827  endif
5828 ENDIF
5829 IF(.NOT.inter_domain)THEN
5830 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5831 ALLOCATE(grid%xa%v10(sm31:em31,sm32:em32),STAT=ierr)
5832  if (ierr.ne.0) then
5833  CALL wrf_error_fatal ( &
5834 'frame/module_domain.f: Failed to allocate grid%xa%v10(sm31:em31,sm32:em32). ')
5835  endif
5836 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%v10=initial_data_value
5837 ELSE
5838 ALLOCATE(grid%xa%v10(1,1),STAT=ierr)
5839  if (ierr.ne.0) then
5840  CALL wrf_error_fatal ( &
5841 'frame/module_domain.f: Failed to allocate grid%xa%v10(1,1).  ')
5842  endif
5843 ENDIF
5844 IF(.NOT.inter_domain)THEN
5845 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5846 ALLOCATE(grid%xa%t2(sm31:em31,sm32:em32),STAT=ierr)
5847  if (ierr.ne.0) then
5848  CALL wrf_error_fatal ( &
5849 'frame/module_domain.f: Failed to allocate grid%xa%t2(sm31:em31,sm32:em32). ')
5850  endif
5851 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%t2=initial_data_value
5852 ELSE
5853 ALLOCATE(grid%xa%t2(1,1),STAT=ierr)
5854  if (ierr.ne.0) then
5855  CALL wrf_error_fatal ( &
5856 'frame/module_domain.f: Failed to allocate grid%xa%t2(1,1).  ')
5857  endif
5858 ENDIF
5859 IF(.NOT.inter_domain)THEN
5860 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5861 ALLOCATE(grid%xa%q2(sm31:em31,sm32:em32),STAT=ierr)
5862  if (ierr.ne.0) then
5863  CALL wrf_error_fatal ( &
5864 'frame/module_domain.f: Failed to allocate grid%xa%q2(sm31:em31,sm32:em32). ')
5865  endif
5866 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%q2=initial_data_value
5867 ELSE
5868 ALLOCATE(grid%xa%q2(1,1),STAT=ierr)
5869  if (ierr.ne.0) then
5870  CALL wrf_error_fatal ( &
5871 'frame/module_domain.f: Failed to allocate grid%xa%q2(1,1).  ')
5872  endif
5873 ENDIF
5874 IF(.NOT.inter_domain)THEN
5875 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
5876 ALLOCATE(grid%xa%ref(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
5877  if (ierr.ne.0) then
5878  CALL wrf_error_fatal ( &
5879 'frame/module_domain.f: Failed to allocate grid%xa%ref(sm31:em31,sm32:em32,sm33:em33). ')
5880  endif
5881 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%ref=initial_data_value
5882 ELSE
5883 ALLOCATE(grid%xa%ref(1,1,1),STAT=ierr)
5884  if (ierr.ne.0) then
5885  CALL wrf_error_fatal ( &
5886 'frame/module_domain.f: Failed to allocate grid%xa%ref(1,1,1).  ')
5887  endif
5888 ENDIF
5889 IF(.NOT.inter_domain)THEN
5890 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5891 ALLOCATE(grid%xa%tpw(sm31:em31,sm32:em32),STAT=ierr)
5892  if (ierr.ne.0) then
5893  CALL wrf_error_fatal ( &
5894 'frame/module_domain.f: Failed to allocate grid%xa%tpw(sm31:em31,sm32:em32). ')
5895  endif
5896 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%tpw=initial_data_value
5897 ELSE
5898 ALLOCATE(grid%xa%tpw(1,1),STAT=ierr)
5899  if (ierr.ne.0) then
5900  CALL wrf_error_fatal ( &
5901 'frame/module_domain.f: Failed to allocate grid%xa%tpw(1,1).  ')
5902  endif
5903 ENDIF
5904 IF(.NOT.inter_domain)THEN
5905 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5906 ALLOCATE(grid%xa%speed(sm31:em31,sm32:em32),STAT=ierr)
5907  if (ierr.ne.0) then
5908  CALL wrf_error_fatal ( &
5909 'frame/module_domain.f: Failed to allocate grid%xa%speed(sm31:em31,sm32:em32). ')
5910  endif
5911 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%speed=initial_data_value
5912 ELSE
5913 ALLOCATE(grid%xa%speed(1,1),STAT=ierr)
5914  if (ierr.ne.0) then
5915  CALL wrf_error_fatal ( &
5916 'frame/module_domain.f: Failed to allocate grid%xa%speed(1,1).  ')
5917  endif
5918 ENDIF
5919 IF(.NOT.inter_domain)THEN
5920 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5921 ALLOCATE(grid%xa%tb19v(sm31:em31,sm32:em32),STAT=ierr)
5922  if (ierr.ne.0) then
5923  CALL wrf_error_fatal ( &
5924 'frame/module_domain.f: Failed to allocate grid%xa%tb19v(sm31:em31,sm32:em32). ')
5925  endif
5926 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%tb19v=initial_data_value
5927 ELSE
5928 ALLOCATE(grid%xa%tb19v(1,1),STAT=ierr)
5929  if (ierr.ne.0) then
5930  CALL wrf_error_fatal ( &
5931 'frame/module_domain.f: Failed to allocate grid%xa%tb19v(1,1).  ')
5932  endif
5933 ENDIF
5934 IF(.NOT.inter_domain)THEN
5935 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5936 ALLOCATE(grid%xa%tb19h(sm31:em31,sm32:em32),STAT=ierr)
5937  if (ierr.ne.0) then
5938  CALL wrf_error_fatal ( &
5939 'frame/module_domain.f: Failed to allocate grid%xa%tb19h(sm31:em31,sm32:em32). ')
5940  endif
5941 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%tb19h=initial_data_value
5942 ELSE
5943 ALLOCATE(grid%xa%tb19h(1,1),STAT=ierr)
5944  if (ierr.ne.0) then
5945  CALL wrf_error_fatal ( &
5946 'frame/module_domain.f: Failed to allocate grid%xa%tb19h(1,1).  ')
5947  endif
5948 ENDIF
5949 IF(.NOT.inter_domain)THEN
5950 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5951 ALLOCATE(grid%xa%tb22v(sm31:em31,sm32:em32),STAT=ierr)
5952  if (ierr.ne.0) then
5953  CALL wrf_error_fatal ( &
5954 'frame/module_domain.f: Failed to allocate grid%xa%tb22v(sm31:em31,sm32:em32). ')
5955  endif
5956 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%tb22v=initial_data_value
5957 ELSE
5958 ALLOCATE(grid%xa%tb22v(1,1),STAT=ierr)
5959  if (ierr.ne.0) then
5960  CALL wrf_error_fatal ( &
5961 'frame/module_domain.f: Failed to allocate grid%xa%tb22v(1,1).  ')
5962  endif
5963 ENDIF
5964 IF(.NOT.inter_domain)THEN
5965 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5966 ALLOCATE(grid%xa%tb37v(sm31:em31,sm32:em32),STAT=ierr)
5967  if (ierr.ne.0) then
5968  CALL wrf_error_fatal ( &
5969 'frame/module_domain.f: Failed to allocate grid%xa%tb37v(sm31:em31,sm32:em32). ')
5970  endif
5971 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%tb37v=initial_data_value
5972 ELSE
5973 ALLOCATE(grid%xa%tb37v(1,1),STAT=ierr)
5974  if (ierr.ne.0) then
5975  CALL wrf_error_fatal ( &
5976 'frame/module_domain.f: Failed to allocate grid%xa%tb37v(1,1).  ')
5977  endif
5978 ENDIF
5979 IF(.NOT.inter_domain)THEN
5980 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5981 ALLOCATE(grid%xa%tb37h(sm31:em31,sm32:em32),STAT=ierr)
5982  if (ierr.ne.0) then
5983  CALL wrf_error_fatal ( &
5984 'frame/module_domain.f: Failed to allocate grid%xa%tb37h(sm31:em31,sm32:em32). ')
5985  endif
5986 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%tb37h=initial_data_value
5987 ELSE
5988 ALLOCATE(grid%xa%tb37h(1,1),STAT=ierr)
5989  if (ierr.ne.0) then
5990  CALL wrf_error_fatal ( &
5991 'frame/module_domain.f: Failed to allocate grid%xa%tb37h(1,1).  ')
5992  endif
5993 ENDIF
5994 IF(.NOT.inter_domain)THEN
5995 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
5996 ALLOCATE(grid%xa%tb85v(sm31:em31,sm32:em32),STAT=ierr)
5997  if (ierr.ne.0) then
5998  CALL wrf_error_fatal ( &
5999 'frame/module_domain.f: Failed to allocate grid%xa%tb85v(sm31:em31,sm32:em32). ')
6000  endif
6001 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%tb85v=initial_data_value
6002 ELSE
6003 ALLOCATE(grid%xa%tb85v(1,1),STAT=ierr)
6004  if (ierr.ne.0) then
6005  CALL wrf_error_fatal ( &
6006 'frame/module_domain.f: Failed to allocate grid%xa%tb85v(1,1).  ')
6007  endif
6008 ENDIF
6009 IF(.NOT.inter_domain)THEN
6010 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
6011 ALLOCATE(grid%xa%tb85h(sm31:em31,sm32:em32),STAT=ierr)
6012  if (ierr.ne.0) then
6013  CALL wrf_error_fatal ( &
6014 'frame/module_domain.f: Failed to allocate grid%xa%tb85h(sm31:em31,sm32:em32). ')
6015  endif
6016 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xa%tb85h=initial_data_value
6017 ELSE
6018 ALLOCATE(grid%xa%tb85h(1,1),STAT=ierr)
6019  if (ierr.ne.0) then
6020  CALL wrf_error_fatal ( &
6021 'frame/module_domain.f: Failed to allocate grid%xa%tb85h(1,1).  ')
6022  endif
6023 ENDIF
6024 IF ( setinitval .EQ. 3 ) grid%xp%domdesc=0
6025 IF ( setinitval .EQ. 3 ) grid%xp%comms(max_comms)=0
6026 IF ( setinitval .EQ. 3 ) grid%xp%ids=0
6027 IF ( setinitval .EQ. 3 ) grid%xp%ide=0
6028 IF ( setinitval .EQ. 3 ) grid%xp%jds=0
6029 IF ( setinitval .EQ. 3 ) grid%xp%jde=0
6030 IF ( setinitval .EQ. 3 ) grid%xp%kds=0
6031 IF ( setinitval .EQ. 3 ) grid%xp%kde=0
6032 IF ( setinitval .EQ. 3 ) grid%xp%ims=0
6033 IF ( setinitval .EQ. 3 ) grid%xp%ime=0
6034 IF ( setinitval .EQ. 3 ) grid%xp%jms=0
6035 IF ( setinitval .EQ. 3 ) grid%xp%jme=0
6036 IF ( setinitval .EQ. 3 ) grid%xp%kms=0
6037 IF ( setinitval .EQ. 3 ) grid%xp%kme=0
6038 IF ( setinitval .EQ. 3 ) grid%xp%its=0
6039 IF ( setinitval .EQ. 3 ) grid%xp%ite=0
6040 IF ( setinitval .EQ. 3 ) grid%xp%jts=0
6041 IF ( setinitval .EQ. 3 ) grid%xp%jte=0
6042 IF ( setinitval .EQ. 3 ) grid%xp%kts=0
6043 IF ( setinitval .EQ. 3 ) grid%xp%kte=0
6044 IF ( setinitval .EQ. 3 ) grid%xp%ips=0
6045 IF ( setinitval .EQ. 3 ) grid%xp%ipe=0
6046 IF ( setinitval .EQ. 3 ) grid%xp%jps=0
6047 IF ( setinitval .EQ. 3 ) grid%xp%jpe=0
6048 IF ( setinitval .EQ. 3 ) grid%xp%kps=0
6049 IF ( setinitval .EQ. 3 ) grid%xp%kpe=0
6050 IF ( setinitval .EQ. 3 ) grid%xp%idsx=0
6051 IF ( setinitval .EQ. 3 ) grid%xp%idex=0
6052 IF ( setinitval .EQ. 3 ) grid%xp%jdsx=0
6053 IF ( setinitval .EQ. 3 ) grid%xp%jdex=0
6054 IF ( setinitval .EQ. 3 ) grid%xp%kdsx=0
6055 IF ( setinitval .EQ. 3 ) grid%xp%kdex=0
6056 IF ( setinitval .EQ. 3 ) grid%xp%imsx=0
6057 IF ( setinitval .EQ. 3 ) grid%xp%imex=0
6058 IF ( setinitval .EQ. 3 ) grid%xp%jmsx=0
6059 IF ( setinitval .EQ. 3 ) grid%xp%jmex=0
6060 IF ( setinitval .EQ. 3 ) grid%xp%kmsx=0
6061 IF ( setinitval .EQ. 3 ) grid%xp%kmex=0
6062 IF ( setinitval .EQ. 3 ) grid%xp%itsx=0
6063 IF ( setinitval .EQ. 3 ) grid%xp%itex=0
6064 IF ( setinitval .EQ. 3 ) grid%xp%jtsx=0
6065 IF ( setinitval .EQ. 3 ) grid%xp%jtex=0
6066 IF ( setinitval .EQ. 3 ) grid%xp%ktsx=0
6067 IF ( setinitval .EQ. 3 ) grid%xp%ktex=0
6068 IF ( setinitval .EQ. 3 ) grid%xp%ipsx=0
6069 IF ( setinitval .EQ. 3 ) grid%xp%ipex=0
6070 IF ( setinitval .EQ. 3 ) grid%xp%jpsx=0
6071 IF ( setinitval .EQ. 3 ) grid%xp%jpex=0
6072 IF ( setinitval .EQ. 3 ) grid%xp%kpsx=0
6073 IF ( setinitval .EQ. 3 ) grid%xp%kpex=0
6074 IF ( setinitval .EQ. 3 ) grid%xp%idsy=0
6075 IF ( setinitval .EQ. 3 ) grid%xp%idey=0
6076 IF ( setinitval .EQ. 3 ) grid%xp%jdsy=0
6077 IF ( setinitval .EQ. 3 ) grid%xp%jdey=0
6078 IF ( setinitval .EQ. 3 ) grid%xp%kdsy=0
6079 IF ( setinitval .EQ. 3 ) grid%xp%kdey=0
6080 IF ( setinitval .EQ. 3 ) grid%xp%imsy=0
6081 IF ( setinitval .EQ. 3 ) grid%xp%imey=0
6082 IF ( setinitval .EQ. 3 ) grid%xp%jmsy=0
6083 IF ( setinitval .EQ. 3 ) grid%xp%jmey=0
6084 IF ( setinitval .EQ. 3 ) grid%xp%kmsy=0
6085 IF ( setinitval .EQ. 3 ) grid%xp%kmey=0
6086 IF ( setinitval .EQ. 3 ) grid%xp%itsy=0
6087 IF ( setinitval .EQ. 3 ) grid%xp%itey=0
6088 IF ( setinitval .EQ. 3 ) grid%xp%jtsy=0
6089 IF ( setinitval .EQ. 3 ) grid%xp%jtey=0
6090 IF ( setinitval .EQ. 3 ) grid%xp%ktsy=0
6091 IF ( setinitval .EQ. 3 ) grid%xp%ktey=0
6092 IF ( setinitval .EQ. 3 ) grid%xp%ipsy=0
6093 IF ( setinitval .EQ. 3 ) grid%xp%ipey=0
6094 IF ( setinitval .EQ. 3 ) grid%xp%jpsy=0
6095 IF ( setinitval .EQ. 3 ) grid%xp%jpey=0
6096 IF ( setinitval .EQ. 3 ) grid%xp%kpsy=0
6097 IF ( setinitval .EQ. 3 ) grid%xp%kpey=0
6098 IF(.NOT.inter_domain)THEN
6099 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))) * RWORDSIZE
6100 ALLOCATE(grid%xp%vxy(sm31:em31,sm32:em32),STAT=ierr)
6101  if (ierr.ne.0) then
6102  CALL wrf_error_fatal ( &
6103 'frame/module_domain.f: Failed to allocate grid%xp%vxy(sm31:em31,sm32:em32). ')
6104  endif
6105 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xp%vxy=initial_data_value
6106 ELSE
6107 ALLOCATE(grid%xp%vxy(1,1),STAT=ierr)
6108  if (ierr.ne.0) then
6109  CALL wrf_error_fatal ( &
6110 'frame/module_domain.f: Failed to allocate grid%xp%vxy(1,1).  ')
6111  endif
6112 ENDIF
6113 IF(.NOT.inter_domain)THEN
6114 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
6115 ALLOCATE(grid%xp%v1z(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
6116  if (ierr.ne.0) then
6117  CALL wrf_error_fatal ( &
6118 'frame/module_domain.f: Failed to allocate grid%xp%v1z(sm31:em31,sm32:em32,sm33:em33). ')
6119  endif
6120 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xp%v1z=initial_data_value
6121 ELSE
6122 ALLOCATE(grid%xp%v1z(1,1,1),STAT=ierr)
6123  if (ierr.ne.0) then
6124  CALL wrf_error_fatal ( &
6125 'frame/module_domain.f: Failed to allocate grid%xp%v1z(1,1,1).  ')
6126  endif
6127 ENDIF
6128 IF(.NOT.inter_domain)THEN
6129 num_bytes_allocated = num_bytes_allocated + ((((em31x)-(sm31x)+1))*(((em32x)-(sm32x)+1))*(((em33x)-(sm33x)+1))) * RWORDSIZE
6130 ALLOCATE(grid%xp%v1x(sm31x:em31x,sm32x:em32x,sm33x:em33x),STAT=ierr)
6131  if (ierr.ne.0) then
6132  CALL wrf_error_fatal ( &
6133 'frame/module_domain.f: Failed to allocate grid%xp%v1x(sm31x:em31x,sm32x:em32x,sm33x:em33x). ')
6134  endif
6135 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xp%v1x=initial_data_value
6136 ELSE
6137 ALLOCATE(grid%xp%v1x(1,1,1),STAT=ierr)
6138  if (ierr.ne.0) then
6139  CALL wrf_error_fatal ( &
6140 'frame/module_domain.f: Failed to allocate grid%xp%v1x(1,1,1).  ')
6141  endif
6142 ENDIF
6143 IF(.NOT.inter_domain)THEN
6144 num_bytes_allocated = num_bytes_allocated + ((((em31y)-(sm31y)+1))*(((em32y)-(sm32y)+1))*(((em33y)-(sm33y)+1))) * RWORDSIZE
6145 ALLOCATE(grid%xp%v1y(sm31y:em31y,sm32y:em32y,sm33y:em33y),STAT=ierr)
6146  if (ierr.ne.0) then
6147  CALL wrf_error_fatal ( &
6148 'frame/module_domain.f: Failed to allocate grid%xp%v1y(sm31y:em31y,sm32y:em32y,sm33y:em33y). ')
6149  endif
6150 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xp%v1y=initial_data_value
6151 ELSE
6152 ALLOCATE(grid%xp%v1y(1,1,1),STAT=ierr)
6153  if (ierr.ne.0) then
6154  CALL wrf_error_fatal ( &
6155 'frame/module_domain.f: Failed to allocate grid%xp%v1y(1,1,1).  ')
6156  endif
6157 ENDIF
6158 IF(.NOT.inter_domain)THEN
6159 num_bytes_allocated = num_bytes_allocated + ((((em31)-(sm31)+1))*(((em32)-(sm32)+1))*(((em33)-(sm33)+1))) * RWORDSIZE
6160 ALLOCATE(grid%xp%v2z(sm31:em31,sm32:em32,sm33:em33),STAT=ierr)
6161  if (ierr.ne.0) then
6162  CALL wrf_error_fatal ( &
6163 'frame/module_domain.f: Failed to allocate grid%xp%v2z(sm31:em31,sm32:em32,sm33:em33). ')
6164  endif
6165 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xp%v2z=initial_data_value
6166 ELSE
6167 ALLOCATE(grid%xp%v2z(1,1,1),STAT=ierr)
6168  if (ierr.ne.0) then
6169  CALL wrf_error_fatal ( &
6170 'frame/module_domain.f: Failed to allocate grid%xp%v2z(1,1,1).  ')
6171  endif
6172 ENDIF
6173 IF(.NOT.inter_domain)THEN
6174 num_bytes_allocated = num_bytes_allocated + ((((em31x)-(sm31x)+1))*(((em32x)-(sm32x)+1))*(((em33x)-(sm33x)+1))) * RWORDSIZE
6175 ALLOCATE(grid%xp%v2x(sm31x:em31x,sm32x:em32x,sm33x:em33x),STAT=ierr)
6176  if (ierr.ne.0) then
6177  CALL wrf_error_fatal ( &
6178 'frame/module_domain.f: Failed to allocate grid%xp%v2x(sm31x:em31x,sm32x:em32x,sm33x:em33x). ')
6179  endif
6180 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xp%v2x=initial_data_value
6181 ELSE
6182 ALLOCATE(grid%xp%v2x(1,1,1),STAT=ierr)
6183  if (ierr.ne.0) then
6184  CALL wrf_error_fatal ( &
6185 'frame/module_domain.f: Failed to allocate grid%xp%v2x(1,1,1).  ')
6186  endif
6187 ENDIF
6188 IF(.NOT.inter_domain)THEN
6189 num_bytes_allocated = num_bytes_allocated + ((((em31y)-(sm31y)+1))*(((em32y)-(sm32y)+1))*(((em33y)-(sm33y)+1))) * RWORDSIZE
6190 ALLOCATE(grid%xp%v2y(sm31y:em31y,sm32y:em32y,sm33y:em33y),STAT=ierr)
6191  if (ierr.ne.0) then
6192  CALL wrf_error_fatal ( &
6193 'frame/module_domain.f: Failed to allocate grid%xp%v2y(sm31y:em31y,sm32y:em32y,sm33y:em33y). ')
6194  endif
6195 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%xp%v2y=initial_data_value
6196 ELSE
6197 ALLOCATE(grid%xp%v2y(1,1,1),STAT=ierr)
6198  if (ierr.ne.0) then
6199  CALL wrf_error_fatal ( &
6200 'frame/module_domain.f: Failed to allocate grid%xp%v2y(1,1,1).  ')
6201  endif
6202 ENDIF
6203 IF ( setinitval .EQ. 3 ) grid%fdob%domain_tot=0
6204 IF ( setinitval .EQ. 3 ) grid%fdob%domain_init=0
6205 IF ( setinitval .EQ. 3 ) grid%fdob%ieodi=0
6206 IF ( setinitval .EQ. 3 ) grid%fdob%iwtsig=0
6207 IF ( setinitval .EQ. 3 ) grid%fdob%nstat=0
6208 IF ( setinitval .EQ. 3 ) grid%fdob%ktaur=0
6209 IF ( setinitval .EQ. 3 ) grid%fdob%sn_maxcg=0
6210 IF ( setinitval .EQ. 3 ) grid%fdob%we_maxcg=0
6211 IF ( setinitval .EQ. 3 ) grid%fdob%sn_end=0
6212 IF ( setinitval .EQ. 3 ) grid%fdob%levidn(max_domains)=0
6213 IF ( setinitval .EQ. 3 ) grid%fdob%ds_cg=initial_data_value
6214 IF ( setinitval .EQ. 3 ) grid%fdob%window=initial_data_value
6215 IF ( setinitval .EQ. 3 ) grid%fdob%rtlast=initial_data_value
6216 IF ( setinitval .EQ. 3 ) grid%fdob%datend=initial_data_value
6217 IF ( setinitval .EQ. 3 ) grid%fdob%rinfmn=initial_data_value
6218 IF ( setinitval .EQ. 3 ) grid%fdob%rinfmx=initial_data_value
6219 IF ( setinitval .EQ. 3 ) grid%fdob%pfree=initial_data_value
6220 IF ( setinitval .EQ. 3 ) grid%fdob%dcon=initial_data_value
6221 IF ( setinitval .EQ. 3 ) grid%fdob%dpsmx=initial_data_value
6222 IF ( setinitval .EQ. 3 ) grid%fdob%tfaci=initial_data_value
6223 IF ( setinitval .EQ. 3 ) grid%fdob%xn=initial_data_value
6224 IF(.NOT.inter_domain)THEN
6225 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%nobs_ndg_vars)-(1)+1))*(((model_config_rec%max_obs)-(1)+1))) * RWORDSIZE
6226 ALLOCATE(grid%fdob%varobs(1:model_config_rec%nobs_ndg_vars,1:model_config_rec%max_obs),STAT=ierr)
6227  if (ierr.ne.0) then
6228  CALL wrf_error_fatal ( &
6229 'frame/module_domain.f: Failed to allocate grid%fdob%varobs(1:model_config_rec%nobs_ndg_vars,1:model_config_rec%max_obs). ')
6230  endif
6231 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%fdob%varobs=initial_data_value
6232 ELSE
6233 ALLOCATE(grid%fdob%varobs(1,1),STAT=ierr)
6234  if (ierr.ne.0) then
6235  CALL wrf_error_fatal ( &
6236 'frame/module_domain.f: Failed to allocate grid%fdob%varobs(1,1).  ')
6237  endif
6238 ENDIF
6239 IF(.NOT.inter_domain)THEN
6240 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%nobs_err_flds)-(1)+1))*(((model_config_rec%max_obs)-(1)+1))) * RWORDSIZE
6241 ALLOCATE(grid%fdob%errf(1:model_config_rec%nobs_err_flds,1:model_config_rec%max_obs),STAT=ierr)
6242  if (ierr.ne.0) then
6243  CALL wrf_error_fatal ( &
6244 'frame/module_domain.f: Failed to allocate grid%fdob%errf(1:model_config_rec%nobs_err_flds,1:model_config_rec%max_obs). ')
6245  endif
6246 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%fdob%errf=initial_data_value
6247 ELSE
6248 ALLOCATE(grid%fdob%errf(1,1),STAT=ierr)
6249  if (ierr.ne.0) then
6250  CALL wrf_error_fatal ( &
6251 'frame/module_domain.f: Failed to allocate grid%fdob%errf(1,1).  ')
6252  endif
6253 ENDIF
6254 IF(.NOT.inter_domain)THEN
6255 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%max_obs)-(1)+1))) * RWORDSIZE
6256 ALLOCATE(grid%fdob%timeob(1:model_config_rec%max_obs),STAT=ierr)
6257  if (ierr.ne.0) then
6258  CALL wrf_error_fatal ( &
6259 'frame/module_domain.f: Failed to allocate grid%fdob%timeob(1:model_config_rec%max_obs). ')
6260  endif
6261 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%fdob%timeob=initial_data_value
6262 ELSE
6263 ALLOCATE(grid%fdob%timeob(1),STAT=ierr)
6264  if (ierr.ne.0) then
6265  CALL wrf_error_fatal ( &
6266 'frame/module_domain.f: Failed to allocate grid%fdob%timeob(1).  ')
6267  endif
6268 ENDIF
6269 IF(.NOT.inter_domain)THEN
6270 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%max_obs)-(1)+1))) * RWORDSIZE
6271 ALLOCATE(grid%fdob%nlevs_ob(1:model_config_rec%max_obs),STAT=ierr)
6272  if (ierr.ne.0) then
6273  CALL wrf_error_fatal ( &
6274 'frame/module_domain.f: Failed to allocate grid%fdob%nlevs_ob(1:model_config_rec%max_obs). ')
6275  endif
6276 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%fdob%nlevs_ob=initial_data_value
6277 ELSE
6278 ALLOCATE(grid%fdob%nlevs_ob(1),STAT=ierr)
6279  if (ierr.ne.0) then
6280  CALL wrf_error_fatal ( &
6281 'frame/module_domain.f: Failed to allocate grid%fdob%nlevs_ob(1).  ')
6282  endif
6283 ENDIF
6284 IF(.NOT.inter_domain)THEN
6285 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%max_obs)-(1)+1))) * RWORDSIZE
6286 ALLOCATE(grid%fdob%lev_in_ob(1:model_config_rec%max_obs),STAT=ierr)
6287  if (ierr.ne.0) then
6288  CALL wrf_error_fatal ( &
6289 'frame/module_domain.f: Failed to allocate grid%fdob%lev_in_ob(1:model_config_rec%max_obs). ')
6290  endif
6291 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%fdob%lev_in_ob=initial_data_value
6292 ELSE
6293 ALLOCATE(grid%fdob%lev_in_ob(1),STAT=ierr)
6294  if (ierr.ne.0) then
6295  CALL wrf_error_fatal ( &
6296 'frame/module_domain.f: Failed to allocate grid%fdob%lev_in_ob(1).  ')
6297  endif
6298 ENDIF
6299 IF(.NOT.inter_domain)THEN
6300 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%max_obs)-(1)+1))) * RWORDSIZE
6301 ALLOCATE(grid%fdob%plfo(1:model_config_rec%max_obs),STAT=ierr)
6302  if (ierr.ne.0) then
6303  CALL wrf_error_fatal ( &
6304 'frame/module_domain.f: Failed to allocate grid%fdob%plfo(1:model_config_rec%max_obs). ')
6305  endif
6306 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%fdob%plfo=initial_data_value
6307 ELSE
6308 ALLOCATE(grid%fdob%plfo(1),STAT=ierr)
6309  if (ierr.ne.0) then
6310  CALL wrf_error_fatal ( &
6311 'frame/module_domain.f: Failed to allocate grid%fdob%plfo(1).  ')
6312  endif
6313 ENDIF
6314 IF(.NOT.inter_domain)THEN
6315 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%max_obs)-(1)+1))) * RWORDSIZE
6316 ALLOCATE(grid%fdob%elevob(1:model_config_rec%max_obs),STAT=ierr)
6317  if (ierr.ne.0) then
6318  CALL wrf_error_fatal ( &
6319 'frame/module_domain.f: Failed to allocate grid%fdob%elevob(1:model_config_rec%max_obs). ')
6320  endif
6321 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%fdob%elevob=initial_data_value
6322 ELSE
6323 ALLOCATE(grid%fdob%elevob(1),STAT=ierr)
6324  if (ierr.ne.0) then
6325  CALL wrf_error_fatal ( &
6326 'frame/module_domain.f: Failed to allocate grid%fdob%elevob(1).  ')
6327  endif
6328 ENDIF
6329 IF(.NOT.inter_domain)THEN
6330 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%max_obs)-(1)+1))) * RWORDSIZE
6331 ALLOCATE(grid%fdob%rio(1:model_config_rec%max_obs),STAT=ierr)
6332  if (ierr.ne.0) then
6333  CALL wrf_error_fatal ( &
6334 'frame/module_domain.f: Failed to allocate grid%fdob%rio(1:model_config_rec%max_obs). ')
6335  endif
6336 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%fdob%rio=initial_data_value
6337 ELSE
6338 ALLOCATE(grid%fdob%rio(1),STAT=ierr)
6339  if (ierr.ne.0) then
6340  CALL wrf_error_fatal ( &
6341 'frame/module_domain.f: Failed to allocate grid%fdob%rio(1).  ')
6342  endif
6343 ENDIF
6344 IF(.NOT.inter_domain)THEN
6345 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%max_obs)-(1)+1))) * RWORDSIZE
6346 ALLOCATE(grid%fdob%rjo(1:model_config_rec%max_obs),STAT=ierr)
6347  if (ierr.ne.0) then
6348  CALL wrf_error_fatal ( &
6349 'frame/module_domain.f: Failed to allocate grid%fdob%rjo(1:model_config_rec%max_obs). ')
6350  endif
6351 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%fdob%rjo=initial_data_value
6352 ELSE
6353 ALLOCATE(grid%fdob%rjo(1),STAT=ierr)
6354  if (ierr.ne.0) then
6355  CALL wrf_error_fatal ( &
6356 'frame/module_domain.f: Failed to allocate grid%fdob%rjo(1).  ')
6357  endif
6358 ENDIF
6359 IF(.NOT.inter_domain)THEN
6360 num_bytes_allocated = num_bytes_allocated + ((((model_config_rec%max_obs)-(1)+1))) * RWORDSIZE
6361 ALLOCATE(grid%fdob%rko(1:model_config_rec%max_obs),STAT=ierr)
6362  if (ierr.ne.0) then
6363  CALL wrf_error_fatal ( &
6364 'frame/module_domain.f: Failed to allocate grid%fdob%rko(1:model_config_rec%max_obs). ')
6365  endif
6366 IF ( setinitval .EQ. 1 .OR. setinitval .EQ. 3 ) grid%fdob%rko=initial_data_value
6367 ELSE
6368 ALLOCATE(grid%fdob%rko(1),STAT=ierr)
6369  if (ierr.ne.0) then
6370  CALL wrf_error_fatal ( &
6371 'frame/module_domain.f: Failed to allocate grid%fdob%rko(1).  ')
6372  endif
6373 ENDIF
6374 !ENDOFREGISTRYGENERATEDINCLUDE