1 !WRF:MEDIATION_LAYER:adtl_grid_utilities
4 MODULE module_adtl_grid_utilities
5 USE module_domain, ONLY : domain, get_ijk_from_grid
6 USE module_configure, ONLY : grid_config_rec_type
7 USE module_state_description, ONLY : PARAM_FIRST_SCALAR, num_moist, num_scalar, num_tracer
8 USE module_tiles, ONLY : set_tiles
9 USE module_driver_constants, ONLY: max_sens
11 REAL, ALLOCATABLE :: s_u_2(:,:,:), s_v_2(:,:,:), s_w_2(:,:,:)
12 REAL, ALLOCATABLE :: s_ph_2(:,:,:), s_t_2(:,:,:), s_mu_2(:,:)
13 REAL, ALLOCATABLE :: s_moist(:,:,:,:), s_scalar(:,:,:,:), s_tracer(:,:,:,:)
14 REAL, ALLOCATABLE :: s_tke_2(:,:,:)
16 REAL, ALLOCATABLE :: s_p(:,:,:), s_al(:,:,:), s_h_diabatic(:,:,:)
17 REAL, ALLOCATABLE :: s_qv_diabatic(:,:,:), s_qc_diabatic(:,:,:)
18 REAL, ALLOCATABLE :: s_ustm(:,:), s_hfx(:,:), s_qfx(:,:)
20 REAL, ALLOCATABLE :: s_dtaux3d(:,:,:), s_dtauy3d(:,:,:)
21 REAL, ALLOCATABLE :: s_dusfcg(:,:), s_dvsfcg(:,:)
23 REAL, ALLOCATABLE :: s_u_bxs(:,:,:), s_u_bxe(:,:,:), s_u_bys(:,:,:), s_u_bye(:,:,:)
24 REAL, ALLOCATABLE :: s_u_btxs(:,:,:), s_u_btxe(:,:,:), s_u_btys(:,:,:), s_u_btye(:,:,:)
25 REAL, ALLOCATABLE :: s_v_bxs(:,:,:), s_v_bxe(:,:,:), s_v_bys(:,:,:), s_v_bye(:,:,:)
26 REAL, ALLOCATABLE :: s_v_btxs(:,:,:), s_v_btxe(:,:,:), s_v_btys(:,:,:), s_v_btye(:,:,:)
27 REAL, ALLOCATABLE :: s_w_bxs(:,:,:), s_w_bxe(:,:,:), s_w_bys(:,:,:), s_w_bye(:,:,:)
28 REAL, ALLOCATABLE :: s_w_btxs(:,:,:), s_w_btxe(:,:,:), s_w_btys(:,:,:), s_w_btye(:,:,:)
29 REAL, ALLOCATABLE :: s_ph_bxs(:,:,:), s_ph_bxe(:,:,:), s_ph_bys(:,:,:), s_ph_bye(:,:,:)
30 REAL, ALLOCATABLE :: s_ph_btxs(:,:,:), s_ph_btxe(:,:,:), s_ph_btys(:,:,:), s_ph_btye(:,:,:)
31 REAL, ALLOCATABLE :: s_t_bxs(:,:,:), s_t_bxe(:,:,:), s_t_bys(:,:,:), s_t_bye(:,:,:)
32 REAL, ALLOCATABLE :: s_t_btxs(:,:,:), s_t_btxe(:,:,:), s_t_btys(:,:,:), s_t_btye(:,:,:)
33 REAL, ALLOCATABLE :: s_mu_bxs(:,:,:), s_mu_bxe(:,:,:), s_mu_bys(:,:,:), s_mu_bye(:,:,:)
34 REAL, ALLOCATABLE :: s_mu_btxs(:,:,:), s_mu_btxe(:,:,:), s_mu_btys(:,:,:), s_mu_btye(:,:,:)
35 REAL, ALLOCATABLE :: s_moist_bxs(:,:,:,:), s_moist_bxe(:,:,:,:), s_moist_bys(:,:,:,:), s_moist_bye(:,:,:,:)
36 REAL, ALLOCATABLE :: s_moist_btxs(:,:,:,:), s_moist_btxe(:,:,:,:), s_moist_btys(:,:,:,:), s_moist_btye(:,:,:,:)
37 REAL, ALLOCATABLE :: s_scalar_bxs(:,:,:,:), s_scalar_bxe(:,:,:,:), s_scalar_bys(:,:,:,:), s_scalar_bye(:,:,:,:)
38 REAL, ALLOCATABLE :: s_scalar_btxs(:,:,:,:), s_scalar_btxe(:,:,:,:), s_scalar_btys(:,:,:,:), s_scalar_btye(:,:,:,:)
39 REAL, ALLOCATABLE :: s_tracer_bxs(:,:,:,:), s_tracer_bxe(:,:,:,:), s_tracer_bys(:,:,:,:), s_tracer_bye(:,:,:,:)
40 REAL, ALLOCATABLE :: s_tracer_btxs(:,:,:,:), s_tracer_btxe(:,:,:,:), s_tracer_btys(:,:,:,:), s_tracer_btye(:,:,:,:)
42 REAL, ALLOCATABLE :: b_u_2(:,:,:), b_v_2(:,:,:), b_w_2(:,:,:)
43 REAL, ALLOCATABLE :: b_ph_2(:,:,:), b_t_2(:,:,:), b_mu_2(:,:)
44 REAL, ALLOCATABLE :: b_moist(:,:,:,:), b_scalar(:,:,:,:), b_tracer(:,:,:,:)
45 REAL, ALLOCATABLE :: b_tke_2(:,:,:)
47 REAL, ALLOCATABLE :: b_p(:,:,:), b_al(:,:,:), b_h_diabatic(:,:,:)
48 REAL, ALLOCATABLE :: b_qv_diabatic(:,:,:), b_qc_diabatic(:,:,:)
49 REAL, ALLOCATABLE :: b_ustm(:,:), b_hfx(:,:), b_qfx(:,:)
51 REAL, ALLOCATABLE :: b_dtaux3d(:,:,:), b_dtauy3d(:,:,:)
52 REAL, ALLOCATABLE :: b_dusfcg(:,:), b_dvsfcg(:,:)
54 REAL, ALLOCATABLE :: b_u_bxs(:,:,:), b_u_bxe(:,:,:), b_u_bys(:,:,:), b_u_bye(:,:,:)
55 REAL, ALLOCATABLE :: b_u_btxs(:,:,:), b_u_btxe(:,:,:), b_u_btys(:,:,:), b_u_btye(:,:,:)
56 REAL, ALLOCATABLE :: b_v_bxs(:,:,:), b_v_bxe(:,:,:), b_v_bys(:,:,:), b_v_bye(:,:,:)
57 REAL, ALLOCATABLE :: b_v_btxs(:,:,:), b_v_btxe(:,:,:), b_v_btys(:,:,:), b_v_btye(:,:,:)
58 REAL, ALLOCATABLE :: b_w_bxs(:,:,:), b_w_bxe(:,:,:), b_w_bys(:,:,:), b_w_bye(:,:,:)
59 REAL, ALLOCATABLE :: b_w_btxs(:,:,:), b_w_btxe(:,:,:), b_w_btys(:,:,:), b_w_btye(:,:,:)
60 REAL, ALLOCATABLE :: b_ph_bxs(:,:,:), b_ph_bxe(:,:,:), b_ph_bys(:,:,:), b_ph_bye(:,:,:)
61 REAL, ALLOCATABLE :: b_ph_btxs(:,:,:), b_ph_btxe(:,:,:), b_ph_btys(:,:,:), b_ph_btye(:,:,:)
62 REAL, ALLOCATABLE :: b_t_bxs(:,:,:), b_t_bxe(:,:,:), b_t_bys(:,:,:), b_t_bye(:,:,:)
63 REAL, ALLOCATABLE :: b_t_btxs(:,:,:), b_t_btxe(:,:,:), b_t_btys(:,:,:), b_t_btye(:,:,:)
64 REAL, ALLOCATABLE :: b_mu_bxs(:,:,:), b_mu_bxe(:,:,:), b_mu_bys(:,:,:), b_mu_bye(:,:,:)
65 REAL, ALLOCATABLE :: b_mu_btxs(:,:,:), b_mu_btxe(:,:,:), b_mu_btys(:,:,:), b_mu_btye(:,:,:)
66 REAL, ALLOCATABLE :: b_moist_bxs(:,:,:,:), b_moist_bxe(:,:,:,:), b_moist_bys(:,:,:,:), b_moist_bye(:,:,:,:)
67 REAL, ALLOCATABLE :: b_moist_btxs(:,:,:,:), b_moist_btxe(:,:,:,:), b_moist_btys(:,:,:,:), b_moist_btye(:,:,:,:)
68 REAL, ALLOCATABLE :: b_scalar_bxs(:,:,:,:), b_scalar_bxe(:,:,:,:), b_scalar_bys(:,:,:,:), b_scalar_bye(:,:,:,:)
69 REAL, ALLOCATABLE :: b_scalar_btxs(:,:,:,:), b_scalar_btxe(:,:,:,:), b_scalar_btys(:,:,:,:), b_scalar_btye(:,:,:,:)
70 REAL, ALLOCATABLE :: b_tracer_bxs(:,:,:,:), b_tracer_bxe(:,:,:,:), b_tracer_bys(:,:,:,:), b_tracer_bye(:,:,:,:)
71 REAL, ALLOCATABLE :: b_tracer_btxs(:,:,:,:), b_tracer_btxe(:,:,:,:), b_tracer_btys(:,:,:,:), b_tracer_btye(:,:,:,:)
73 REAL, ALLOCATABLE :: b_rainnc(:,:), b_rainncv(:,:)
74 REAL, ALLOCATABLE :: b_rainc(:,:), b_raincv(:,:)
76 INTEGER :: sm31, em31, sm32, em32, sm33, em33, spec_bdy_width, kts, kte
79 INTEGER :: ids , ide , jds , jde , kds , kde , &
80 ims , ime , jms , jme , kms , kme , &
81 ips , ipe , jps , jpe , kps , kpe
86 SUBROUTINE init_domain_size ( grid, config_flags )
87 TYPE (domain), INTENT(INOUT) :: grid
88 TYPE (grid_config_rec_type), INTENT(IN) :: config_flags
91 ! Obtain dimension information stored in the grid data structure.
93 CALL get_ijk_from_grid ( grid , &
94 ids, ide, jds, jde, kds, kde, &
95 ims, ime, jms, jme, kms, kme, &
96 ips, ipe, jps, jpe, kps, kpe )
98 ! Compute these starting and stopping locations for each tile and number of tiles.
99 ! See: http://www.mmm.ucar.edu/wrf/WG2/topics/settiles
100 CALL set_tiles ( grid , ids , ide , jds , jde , ips , ipe , jps , jpe )
112 CALL nl_get_spec_bdy_width( 1, spec_bdy_width )
113 CALL nl_get_gwd_opt( 1, gwd_opt )
115 END SUBROUTINE init_domain_size
117 SUBROUTINE allocate_grid ( )
119 ALLOCATE ( s_scalar(sm31:em31, sm32:em32, sm33:em33, num_scalar), STAT=ierr )
121 CALL wrf_error_fatal ( &
122 'share/module_adtl_grid_utilities.f: Failed to allocate s_scalar(sm31:em31, sm32:em32, sm33:em33, num_scalar). ')
124 ALLOCATE ( s_tke_2(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
126 CALL wrf_error_fatal ( &
127 'share/module_adtl_grid_utilities.f: Failed to allocate s_tke_2(sm31:em31, sm32:em32, sm33:em33). ')
130 ALLOCATE ( s_p(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
132 CALL wrf_error_fatal ( &
133 'share/module_adtl_grid_utilities.f: Failed to allocate s_p(sm31:em31, sm32:em32, sm33:em33). ')
135 ALLOCATE ( s_al(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
137 CALL wrf_error_fatal ( &
138 'share/module_adtl_grid_utilities.f: Failed to allocate s_al(sm31:em31, sm32:em32, sm33:em33). ')
140 ALLOCATE ( s_h_diabatic(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
142 CALL wrf_error_fatal ( &
143 'share/module_adtl_grid_utilities.f: Failed to allocate s_h_diabatic(sm31:em31, sm32:em32, sm33:em33). ')
145 ALLOCATE ( s_qv_diabatic(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
147 CALL wrf_error_fatal ( &
148 'share/module_adtl_grid_utilities.f: Failed to allocate s_qv_diabatic(sm31:em31, sm32:em32, sm33:em33). ')
150 ALLOCATE ( s_qc_diabatic(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
152 CALL wrf_error_fatal ( &
153 'share/module_adtl_grid_utilities.f: Failed to allocate s_qc_diabatic(sm31:em31, sm32:em32, sm33:em33). ')
156 ALLOCATE ( s_ustm(sm31:em31, sm33:em33), STAT=ierr )
158 CALL wrf_error_fatal ( &
159 'share/module_adtl_grid_utilities.f: Failed to allocate s_ustm(sm31:em31, sm33:em33). ')
161 ALLOCATE ( s_hfx(sm31:em31, sm33:em33), STAT=ierr )
163 CALL wrf_error_fatal ( &
164 'share/module_adtl_grid_utilities.f: Failed to allocate s_hfx(sm31:em31, sm33:em33). ')
166 ALLOCATE ( s_qfx(sm31:em31, sm33:em33), STAT=ierr )
168 CALL wrf_error_fatal ( &
169 'share/module_adtl_grid_utilities.f: Failed to allocate s_qfx(sm31:em31, sm33:em33). ')
172 IF (gwd_opt .EQ. 1) THEN
174 ALLOCATE ( s_dtaux3d(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
176 CALL wrf_error_fatal ( &
177 'share/module_adtl_grid_utilities.f: Failed to allocate s_dtaux3d(sm31:em31, sm32:em32, sm33:em33). ')
179 ALLOCATE ( s_dtauy3d(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
181 CALL wrf_error_fatal ( &
182 'share/module_adtl_grid_utilities.f: Failed to allocate s_dtauy3d(sm31:em31, sm32:em32, sm33:em33). ')
184 ALLOCATE ( s_dusfcg(sm31:em31, sm33:em33), STAT=ierr )
186 CALL wrf_error_fatal ( &
187 'share/module_adtl_grid_utilities.f: Failed to allocate s_dusfcg(sm31:em31, sm33:em33). ')
189 ALLOCATE ( s_dvsfcg(sm31:em31, sm33:em33), STAT=ierr )
191 CALL wrf_error_fatal ( &
192 'share/module_adtl_grid_utilities.f: Failed to allocate s_dvsfcg(sm31:em31, sm33:em33). ')
198 ALLOCATE(s_scalar_bxs(sm33:em33,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
200 CALL wrf_error_fatal ( &
201 'share/module_adtl_grid_utilities.f: Failed to allocate s_scalar_bxs(sm33:em33,sm32:em32,spec_bdy_width,num_scalar). ')
203 ALLOCATE(s_scalar_bxe(sm33:em33,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
205 CALL wrf_error_fatal ( &
206 'share/module_adtl_grid_utilities.f: Failed to allocate s_scalar_bxe(sm33:em33,sm32:em32,spec_bdy_width,num_scalar). ')
208 ALLOCATE(s_scalar_bys(sm31:em31,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
210 CALL wrf_error_fatal ( &
211 'share/module_adtl_grid_utilities.f: Failed to allocate s_scalar_bys(sm31:em31,sm32:em32,spec_bdy_width,num_scalar). ')
213 ALLOCATE(s_scalar_bye(sm31:em31,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
215 CALL wrf_error_fatal ( &
216 'share/module_adtl_grid_utilities.f: Failed to allocate s_scalar_bye(sm31:em31,sm32:em32,spec_bdy_width,num_scalar). ')
218 ALLOCATE(s_scalar_btxs(sm33:em33,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
220 CALL wrf_error_fatal ( &
221 'share/module_adtl_grid_utilities.f: Failed to allocate s_scalar_btxs(sm33:em33,sm32:em32,spec_bdy_width,num_scalar). ')
223 ALLOCATE(s_scalar_btxe(sm33:em33,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
225 CALL wrf_error_fatal ( &
226 'share/module_adtl_grid_utilities.f: Failed to allocate s_scalar_btxe(sm33:em33,sm32:em32,spec_bdy_width,num_scalar). ')
228 ALLOCATE(s_scalar_btys(sm31:em31,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
230 CALL wrf_error_fatal ( &
231 'share/module_adtl_grid_utilities.f: Failed to allocate s_scalar_btys(sm31:em31,sm32:em32,spec_bdy_width,num_scalar). ')
233 ALLOCATE(s_scalar_btye(sm31:em31,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
235 CALL wrf_error_fatal ( &
236 'share/module_adtl_grid_utilities.f: Failed to allocate s_scalar_btye(sm31:em31,sm32:em32,spec_bdy_width,num_scalar). ')
239 ALLOCATE ( s_u_2(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
241 CALL wrf_error_fatal ( &
242 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_2(sm31:em31, sm32:em32, sm33:em33). ')
244 ALLOCATE ( s_v_2(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
246 CALL wrf_error_fatal ( &
247 'share/module_adtl_grid_utilities.f: Failed to allocate s_v_2(sm31:em31, sm32:em32, sm33:em33). ')
249 ALLOCATE ( s_w_2(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
251 CALL wrf_error_fatal ( &
252 'share/module_adtl_grid_utilities.f: Failed to allocate s_w_2(sm31:em31, sm32:em32, sm33:em33). ')
254 ALLOCATE ( s_ph_2(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
256 CALL wrf_error_fatal ( &
257 'share/module_adtl_grid_utilities.f: Failed to allocate s_ph_2(sm31:em31, sm32:em32, sm33:em33). ')
259 ALLOCATE ( s_t_2(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
261 CALL wrf_error_fatal ( &
262 'share/module_adtl_grid_utilities.f: Failed to allocate s_t_2(sm31:em31, sm32:em32, sm33:em33). ')
264 ALLOCATE ( s_mu_2(sm31:em31, sm33:em33), STAT=ierr )
266 CALL wrf_error_fatal ( &
267 'share/module_adtl_grid_utilities.f: Failed to allocate s_mu_2(sm31:em31, sm33:em33). ')
269 ALLOCATE ( s_moist(sm31:em31, sm32:em32, sm33:em33, num_moist), STAT=ierr )
271 CALL wrf_error_fatal ( &
272 'share/module_adtl_grid_utilities.f: Failed to allocate s_moist(sm31:em31, sm32:em32, sm33:em33, num_moist). ')
274 ALLOCATE ( s_tracer(sm31:em31, sm32:em32, sm33:em33, num_tracer), STAT=ierr )
276 CALL wrf_error_fatal ( &
277 'share/module_adtl_grid_utilities.f: Failed to allocate s_tracer(sm31:em31, sm32:em32, sm33:em33, num_tracer). ')
280 ALLOCATE(s_u_bxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
282 CALL wrf_error_fatal ( &
283 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_bxs(sm33:em33,sm32:em32,spec_bdy_width). ')
285 ALLOCATE(s_u_bxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
287 CALL wrf_error_fatal ( &
288 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_bxe(sm33:em33,sm32:em32,spec_bdy_width). ')
290 ALLOCATE(s_u_bys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
292 CALL wrf_error_fatal ( &
293 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_bys(sm31:em31,sm32:em32,spec_bdy_width). ')
295 ALLOCATE(s_u_bye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
297 CALL wrf_error_fatal ( &
298 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_bye(sm31:em31,sm32:em32,spec_bdy_width). ')
300 ALLOCATE(s_u_btxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
302 CALL wrf_error_fatal ( &
303 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_btxs(sm33:em33,sm32:em32,spec_bdy_width). ')
305 ALLOCATE(s_u_btxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
307 CALL wrf_error_fatal ( &
308 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_btxe(sm33:em33,sm32:em32,spec_bdy_width). ')
310 ALLOCATE(s_u_btys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
312 CALL wrf_error_fatal ( &
313 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_btys(sm31:em31,sm32:em32,spec_bdy_width). ')
315 ALLOCATE(s_u_btye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
317 CALL wrf_error_fatal ( &
318 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_btye(sm31:em31,sm32:em32,spec_bdy_width). ')
322 ALLOCATE(s_v_bxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
324 CALL wrf_error_fatal ( &
325 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_bxs(sm33:em33,sm32:em32,spec_bdy_width). ')
327 ALLOCATE(s_v_bxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
329 CALL wrf_error_fatal ( &
330 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_bxe(sm33:em33,sm32:em32,spec_bdy_width). ')
332 ALLOCATE(s_v_bys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
334 CALL wrf_error_fatal ( &
335 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_bys(sm31:em31,sm32:em32,spec_bdy_width). ')
337 ALLOCATE(s_v_bye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
339 CALL wrf_error_fatal ( &
340 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_bye(sm31:em31,sm32:em32,spec_bdy_width). ')
342 ALLOCATE(s_v_btxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
344 CALL wrf_error_fatal ( &
345 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_btxs(sm33:em33,sm32:em32,spec_bdy_width). ')
347 ALLOCATE(s_v_btxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
349 CALL wrf_error_fatal ( &
350 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_btxe(sm33:em33,sm32:em32,spec_bdy_width). ')
352 ALLOCATE(s_v_btys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
354 CALL wrf_error_fatal ( &
355 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_btys(sm31:em31,sm32:em32,spec_bdy_width). ')
357 ALLOCATE(s_v_btye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
359 CALL wrf_error_fatal ( &
360 'share/module_adtl_grid_utilities.f: Failed to allocate s_u_btye(sm31:em31,sm32:em32,spec_bdy_width). ')
364 ALLOCATE(s_t_bxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
366 CALL wrf_error_fatal ( &
367 'share/module_adtl_grid_utilities.f: Failed to allocate s_t_bxs(sm33:em33,sm32:em32,spec_bdy_width). ')
369 ALLOCATE(s_t_bxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
371 CALL wrf_error_fatal ( &
372 'share/module_adtl_grid_utilities.f: Failed to allocate s_t_bxe(sm33:em33,sm32:em32,spec_bdy_width). ')
374 ALLOCATE(s_t_bys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
376 CALL wrf_error_fatal ( &
377 'share/module_adtl_grid_utilities.f: Failed to allocate s_t_bys(sm31:em31,sm32:em32,spec_bdy_width). ')
379 ALLOCATE(s_t_bye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
381 CALL wrf_error_fatal ( &
382 'share/module_adtl_grid_utilities.f: Failed to allocate s_t_bye(sm31:em31,sm32:em32,spec_bdy_width). ')
384 ALLOCATE(s_t_btxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
386 CALL wrf_error_fatal ( &
387 'share/module_adtl_grid_utilities.f: Failed to allocate s_t_btxs(sm33:em33,sm32:em32,spec_bdy_width). ')
389 ALLOCATE(s_t_btxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
391 CALL wrf_error_fatal ( &
392 'share/module_adtl_grid_utilities.f: Failed to allocate s_t_btxe(sm33:em33,sm32:em32,spec_bdy_width). ')
394 ALLOCATE(s_t_btys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
396 CALL wrf_error_fatal ( &
397 'share/module_adtl_grid_utilities.f: Failed to allocate s_t_btys(sm31:em31,sm32:em32,spec_bdy_width). ')
399 ALLOCATE(s_t_btye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
401 CALL wrf_error_fatal ( &
402 'share/module_adtl_grid_utilities.f: Failed to allocate s_t_btye(sm31:em31,sm32:em32,spec_bdy_width). ')
406 ALLOCATE(s_w_bxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
408 CALL wrf_error_fatal ( &
409 'share/module_adtl_grid_utilities.f: Failed to allocate s_w_bxs(sm33:em33,sm32:em32,spec_bdy_width). ')
411 ALLOCATE(s_w_bxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
413 CALL wrf_error_fatal ( &
414 'share/module_adtl_grid_utilities.f: Failed to allocate s_w_bxe(sm33:em33,sm32:em32,spec_bdy_width). ')
416 ALLOCATE(s_w_bys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
418 CALL wrf_error_fatal ( &
419 'share/module_adtl_grid_utilities.f: Failed to allocate s_w_bys(sm31:em31,sm32:em32,spec_bdy_width). ')
421 ALLOCATE(s_w_bye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
423 CALL wrf_error_fatal ( &
424 'share/module_adtl_grid_utilities.f: Failed to allocate s_w_bye(sm31:em31,sm32:em32,spec_bdy_width). ')
426 ALLOCATE(s_w_btxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
428 CALL wrf_error_fatal ( &
429 'share/module_adtl_grid_utilities.f: Failed to allocate s_w_btxs(sm33:em33,sm32:em32,spec_bdy_width). ')
431 ALLOCATE(s_w_btxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
433 CALL wrf_error_fatal ( &
434 'share/module_adtl_grid_utilities.f: Failed to allocate s_w_btxe(sm33:em33,sm32:em32,spec_bdy_width). ')
436 ALLOCATE(s_w_btys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
438 CALL wrf_error_fatal ( &
439 'share/module_adtl_grid_utilities.f: Failed to allocate s_w_btys(sm31:em31,sm32:em32,spec_bdy_width). ')
441 ALLOCATE(s_w_btye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
443 CALL wrf_error_fatal ( &
444 'share/module_adtl_grid_utilities.f: Failed to allocate s_w_btye(sm31:em31,sm32:em32,spec_bdy_width). ')
448 ALLOCATE(s_ph_bxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
450 CALL wrf_error_fatal ( &
451 'share/module_adtl_grid_utilities.f: Failed to allocate s_ph_bxs(sm33:em33,sm32:em32,spec_bdy_width). ')
453 ALLOCATE(s_ph_bxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
455 CALL wrf_error_fatal ( &
456 'share/module_adtl_grid_utilities.f: Failed to allocate s_ph_bxe(sm33:em33,sm32:em32,spec_bdy_width). ')
458 ALLOCATE(s_ph_bys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
460 CALL wrf_error_fatal ( &
461 'share/module_adtl_grid_utilities.f: Failed to allocate s_ph_bys(sm31:em31,sm32:em32,spec_bdy_width). ')
463 ALLOCATE(s_ph_bye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
465 CALL wrf_error_fatal ( &
466 'share/module_adtl_grid_utilities.f: Failed to allocate s_ph_bye(sm31:em31,sm32:em32,spec_bdy_width). ')
468 ALLOCATE(s_ph_btxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
470 CALL wrf_error_fatal ( &
471 'share/module_adtl_grid_utilities.f: Failed to allocate s_ph_btxs(sm33:em33,sm32:em32,spec_bdy_width). ')
473 ALLOCATE(s_ph_btxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
475 CALL wrf_error_fatal ( &
476 'share/module_adtl_grid_utilities.f: Failed to allocate s_ph_btxe(sm33:em33,sm32:em32,spec_bdy_width). ')
478 ALLOCATE(s_ph_btys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
480 CALL wrf_error_fatal ( &
481 'share/module_adtl_grid_utilities.f: Failed to allocate s_ph_btys(sm31:em31,sm32:em32,spec_bdy_width). ')
483 ALLOCATE(s_ph_btye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
485 CALL wrf_error_fatal ( &
486 'share/module_adtl_grid_utilities.f: Failed to allocate s_ph_btye(sm31:em31,sm32:em32,spec_bdy_width). ')
490 ALLOCATE(s_mu_bxs(sm33:em33,1,spec_bdy_width),STAT=ierr)
492 CALL wrf_error_fatal ( &
493 'share/module_adtl_grid_utilities.f: Failed to allocate s_mu_bxs(sm33:em33,1,spec_bdy_width). ')
495 ALLOCATE(s_mu_bxe(sm33:em33,1,spec_bdy_width),STAT=ierr)
497 CALL wrf_error_fatal ( &
498 'share/module_adtl_grid_utilities.f: Failed to allocate s_mu_bxe(sm33:em33,1,spec_bdy_width). ')
500 ALLOCATE(s_mu_bys(sm31:em31,1,spec_bdy_width),STAT=ierr)
502 CALL wrf_error_fatal ( &
503 'share/module_adtl_grid_utilities.f: Failed to allocate s_mu_bys(sm31:em31,1,spec_bdy_width). ')
505 ALLOCATE(s_mu_bye(sm31:em31,1,spec_bdy_width),STAT=ierr)
507 CALL wrf_error_fatal ( &
508 'share/module_adtl_grid_utilities.f: Failed to allocate s_mu_bye(sm31:em31,1,spec_bdy_width). ')
510 ALLOCATE(s_mu_btxs(sm33:em33,1,spec_bdy_width),STAT=ierr)
512 CALL wrf_error_fatal ( &
513 'share/module_adtl_grid_utilities.f: Failed to allocate s_mu_btxs(sm33:em33,1,spec_bdy_width). ')
515 ALLOCATE(s_mu_btxe(sm33:em33,1,spec_bdy_width),STAT=ierr)
517 CALL wrf_error_fatal ( &
518 'share/module_adtl_grid_utilities.f: Failed to allocate s_mu_btxe(sm33:em33,1,spec_bdy_width). ')
520 ALLOCATE(s_mu_btys(sm31:em31,1,spec_bdy_width),STAT=ierr)
522 CALL wrf_error_fatal ( &
523 'share/module_adtl_grid_utilities.f: Failed to allocate s_mu_btys(sm31:em31,1,spec_bdy_width). ')
525 ALLOCATE(s_mu_btye(sm31:em31,1,spec_bdy_width),STAT=ierr)
527 CALL wrf_error_fatal ( &
528 'share/module_adtl_grid_utilities.f: Failed to allocate s_mu_btye(sm31:em31,1,spec_bdy_width). ')
532 ALLOCATE(s_moist_bxs(sm33:em33,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
534 CALL wrf_error_fatal ( &
535 'share/module_adtl_grid_utilities.f: Failed to allocate s_moist_bxs(sm33:em33,sm32:em32,spec_bdy_width,num_moist). ')
537 ALLOCATE(s_moist_bxe(sm33:em33,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
539 CALL wrf_error_fatal ( &
540 'share/module_adtl_grid_utilities.f: Failed to allocate s_moist_bxe(sm33:em33,sm32:em32,spec_bdy_width,num_moist). ')
542 ALLOCATE(s_moist_bys(sm31:em31,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
544 CALL wrf_error_fatal ( &
545 'share/module_adtl_grid_utilities.f: Failed to allocate s_moist_bys(sm31:em31,sm32:em32,spec_bdy_width,num_moist). ')
547 ALLOCATE(s_moist_bye(sm31:em31,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
549 CALL wrf_error_fatal ( &
550 'share/module_adtl_grid_utilities.f: Failed to allocate s_moist_bye(sm31:em31,sm32:em32,spec_bdy_width,num_moist). ')
552 ALLOCATE(s_moist_btxs(sm33:em33,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
554 CALL wrf_error_fatal ( &
555 'share/module_adtl_grid_utilities.f: Failed to allocate s_moist_btxs(sm33:em33,sm32:em32,spec_bdy_width,num_moist). ')
557 ALLOCATE(s_moist_btxe(sm33:em33,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
559 CALL wrf_error_fatal ( &
560 'share/module_adtl_grid_utilities.f: Failed to allocate s_moist_btxe(sm33:em33,sm32:em32,spec_bdy_width,num_moist). ')
562 ALLOCATE(s_moist_btys(sm31:em31,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
564 CALL wrf_error_fatal ( &
565 'share/module_adtl_grid_utilities.f: Failed to allocate s_moist_btys(sm31:em31,sm32:em32,spec_bdy_width,num_moist). ')
567 ALLOCATE(s_moist_btye(sm31:em31,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
569 CALL wrf_error_fatal ( &
570 'share/module_adtl_grid_utilities.f: Failed to allocate s_moist_btye(sm31:em31,sm32:em32,spec_bdy_width,num_moist). ')
574 ALLOCATE(s_tracer_bxs(sm33:em33,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
576 CALL wrf_error_fatal ( &
577 'share/module_adtl_grid_utilities.f: Failed to allocate s_tracer_bxs(sm33:em33,sm32:em32,spec_bdy_width,num_tracer). ')
579 ALLOCATE(s_tracer_bxe(sm33:em33,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
581 CALL wrf_error_fatal ( &
582 'share/module_adtl_grid_utilities.f: Failed to allocate s_tracer_bxe(sm33:em33,sm32:em32,spec_bdy_width,num_tracer). ')
584 ALLOCATE(s_tracer_bys(sm31:em31,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
586 CALL wrf_error_fatal ( &
587 'share/module_adtl_grid_utilities.f: Failed to allocate s_tracer_bys(sm31:em31,sm32:em32,spec_bdy_width,num_tracer). ')
589 ALLOCATE(s_tracer_bye(sm31:em31,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
591 CALL wrf_error_fatal ( &
592 'share/module_adtl_grid_utilities.f: Failed to allocate s_tracer_bye(sm31:em31,sm32:em32,spec_bdy_width,num_tracer). ')
594 ALLOCATE(s_tracer_btxs(sm33:em33,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
596 CALL wrf_error_fatal ( &
597 'share/module_adtl_grid_utilities.f: Failed to allocate s_tracer_btxs(sm33:em33,sm32:em32,spec_bdy_width,num_tracer). ')
599 ALLOCATE(s_tracer_btxe(sm33:em33,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
601 CALL wrf_error_fatal ( &
602 'share/module_adtl_grid_utilities.f: Failed to allocate s_tracer_btxe(sm33:em33,sm32:em32,spec_bdy_width,num_tracer). ')
604 ALLOCATE(s_tracer_btys(sm31:em31,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
606 CALL wrf_error_fatal ( &
607 'share/module_adtl_grid_utilities.f: Failed to allocate s_tracer_btys(sm31:em31,sm32:em32,spec_bdy_width,num_tracer). ')
609 ALLOCATE(s_tracer_btye(sm31:em31,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
611 CALL wrf_error_fatal ( &
612 'share/module_adtl_grid_utilities.f: Failed to allocate s_tracer_btye(sm31:em31,sm32:em32,spec_bdy_width,num_tracer). ')
615 ALLOCATE ( b_scalar(sm31:em31, sm32:em32, sm33:em33, num_scalar), STAT=ierr )
617 CALL wrf_error_fatal ( &
618 'share/module_adtl_grid_utilities.f: Failed to allocate b_scalar(sm31:em31, sm32:em32, sm33:em33, num_scalar). ')
620 ALLOCATE ( b_tke_2(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
622 CALL wrf_error_fatal ( &
623 'share/module_adtl_grid_utilities.f: Failed to allocate b_tke_2(sm31:em31, sm32:em32, sm33:em33). ')
626 ALLOCATE ( b_p(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
628 CALL wrf_error_fatal ( &
629 'share/module_adtl_grid_utilities.f: Failed to allocate b_p(sm31:em31, sm32:em32, sm33:em33). ')
631 ALLOCATE ( b_al(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
633 CALL wrf_error_fatal ( &
634 'share/module_adtl_grid_utilities.f: Failed to allocate b_al(sm31:em31, sm32:em32, sm33:em33). ')
636 ALLOCATE ( b_h_diabatic(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
638 CALL wrf_error_fatal ( &
639 'share/module_adtl_grid_utilities.f: Failed to allocate b_h_diabatic(sm31:em31, sm32:em32, sm33:em33). ')
641 ALLOCATE ( b_qv_diabatic(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
643 CALL wrf_error_fatal ( &
644 'share/module_adtl_grid_utilities.f: Failed to allocate b_qv_diabatic(sm31:em31, sm32:em32, sm33:em33). ')
646 ALLOCATE ( b_qc_diabatic(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
648 CALL wrf_error_fatal ( &
649 'share/module_adtl_grid_utilities.f: Failed to allocate b_qc_diabatic(sm31:em31, sm32:em32, sm33:em33). ')
652 ALLOCATE ( b_ustm(sm31:em31, sm33:em33), STAT=ierr )
654 CALL wrf_error_fatal ( &
655 'share/module_adtl_grid_utilities.f: Failed to allocate b_ustm(sm31:em31, sm33:em33). ')
657 ALLOCATE ( b_hfx(sm31:em31, sm33:em33), STAT=ierr )
659 CALL wrf_error_fatal ( &
660 'share/module_adtl_grid_utilities.f: Failed to allocate b_hfx(sm31:em31, sm33:em33). ')
662 ALLOCATE ( b_qfx(sm31:em31, sm33:em33), STAT=ierr )
664 CALL wrf_error_fatal ( &
665 'share/module_adtl_grid_utilities.f: Failed to allocate b_qfx(sm31:em31, sm33:em33). ')
668 IF (gwd_opt .EQ. 1) THEN
670 ALLOCATE ( b_dtaux3d(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
672 CALL wrf_error_fatal ( &
673 'share/module_adtl_grid_utilities.f: Failed to allocate b_dtaux3d(sm31:em31, sm32:em32, sm33:em33). ')
675 ALLOCATE ( b_dtauy3d(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
677 CALL wrf_error_fatal ( &
678 'share/module_adtl_grid_utilities.f: Failed to allocate b_dtauy3d(sm31:em31, sm32:em32, sm33:em33). ')
680 ALLOCATE ( b_dusfcg(sm31:em31, sm33:em33), STAT=ierr )
682 CALL wrf_error_fatal ( &
683 'share/module_adtl_grid_utilities.f: Failed to allocate b_dusfcg(sm31:em31, sm33:em33). ')
685 ALLOCATE ( b_dvsfcg(sm31:em31, sm33:em33), STAT=ierr )
687 CALL wrf_error_fatal ( &
688 'share/module_adtl_grid_utilities.f: Failed to allocate b_dvsfcg(sm31:em31, sm33:em33). ')
694 ALLOCATE(b_scalar_bxs(sm33:em33,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
696 CALL wrf_error_fatal ( &
697 'share/module_adtl_grid_utilities.f: Failed to allocate b_scalar_bxs(sm33:em33,sm32:em32,spec_bdy_width,num_scalar). ')
699 ALLOCATE(b_scalar_bxe(sm33:em33,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
701 CALL wrf_error_fatal ( &
702 'share/module_adtl_grid_utilities.f: Failed to allocate b_scalar_bxe(sm33:em33,sm32:em32,spec_bdy_width,num_scalar). ')
704 ALLOCATE(b_scalar_bys(sm31:em31,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
706 CALL wrf_error_fatal ( &
707 'share/module_adtl_grid_utilities.f: Failed to allocate b_scalar_bys(sm31:em31,sm32:em32,spec_bdy_width,num_scalar). ')
709 ALLOCATE(b_scalar_bye(sm31:em31,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
711 CALL wrf_error_fatal ( &
712 'share/module_adtl_grid_utilities.f: Failed to allocate b_scalar_bye(sm31:em31,sm32:em32,spec_bdy_width,num_scalar). ')
714 ALLOCATE(b_scalar_btxs(sm33:em33,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
716 CALL wrf_error_fatal ( &
717 'share/module_adtl_grid_utilities.f: Failed to allocate b_scalar_btxs(sm33:em33,sm32:em32,spec_bdy_width,num_scalar). ')
719 ALLOCATE(b_scalar_btxe(sm33:em33,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
721 CALL wrf_error_fatal ( &
722 'share/module_adtl_grid_utilities.f: Failed to allocate b_scalar_btxe(sm33:em33,sm32:em32,spec_bdy_width,num_scalar). ')
724 ALLOCATE(b_scalar_btys(sm31:em31,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
726 CALL wrf_error_fatal ( &
727 'share/module_adtl_grid_utilities.f: Failed to allocate b_scalar_btys(sm31:em31,sm32:em32,spec_bdy_width,num_scalar). ')
729 ALLOCATE(b_scalar_btye(sm31:em31,sm32:em32,spec_bdy_width,num_scalar),STAT=ierr)
731 CALL wrf_error_fatal ( &
732 'share/module_adtl_grid_utilities.f: Failed to allocate b_scalar_btye(sm31:em31,sm32:em32,spec_bdy_width,num_scalar). ')
735 ALLOCATE ( b_u_2(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
737 CALL wrf_error_fatal ( &
738 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_2(sm31:em31, sm32:em32, sm33:em33). ')
740 ALLOCATE ( b_v_2(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
742 CALL wrf_error_fatal ( &
743 'share/module_adtl_grid_utilities.f: Failed to allocate b_v_2(sm31:em31, sm32:em32, sm33:em33). ')
745 ALLOCATE ( b_w_2(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
747 CALL wrf_error_fatal ( &
748 'share/module_adtl_grid_utilities.f: Failed to allocate b_w_2(sm31:em31, sm32:em32, sm33:em33). ')
750 ALLOCATE ( b_ph_2(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
752 CALL wrf_error_fatal ( &
753 'share/module_adtl_grid_utilities.f: Failed to allocate b_ph_2(sm31:em31, sm32:em32, sm33:em33). ')
755 ALLOCATE ( b_t_2(sm31:em31, sm32:em32, sm33:em33), STAT=ierr )
757 CALL wrf_error_fatal ( &
758 'share/module_adtl_grid_utilities.f: Failed to allocate b_t_2(sm31:em31, sm32:em32, sm33:em33). ')
760 ALLOCATE ( b_mu_2(sm31:em31, sm33:em33), STAT=ierr )
762 CALL wrf_error_fatal ( &
763 'share/module_adtl_grid_utilities.f: Failed to allocate b_mu_2(sm31:em31, sm33:em33). ')
765 ALLOCATE ( b_moist(sm31:em31, sm32:em32, sm33:em33, num_moist), STAT=ierr )
767 CALL wrf_error_fatal ( &
768 'share/module_adtl_grid_utilities.f: Failed to allocate b_moist(sm31:em31, sm32:em32, sm33:em33, num_moist). ')
770 ALLOCATE ( b_tracer(sm31:em31, sm32:em32, sm33:em33, num_tracer), STAT=ierr )
772 CALL wrf_error_fatal ( &
773 'share/module_adtl_grid_utilities.f: Failed to allocate b_tracer(sm31:em31, sm32:em32, sm33:em33, num_tracer). ')
777 ALLOCATE(b_u_bxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
779 CALL wrf_error_fatal ( &
780 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_bxs(sm33:em33,sm32:em32,spec_bdy_width). ')
782 ALLOCATE(b_u_bxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
784 CALL wrf_error_fatal ( &
785 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_bxe(sm33:em33,sm32:em32,spec_bdy_width). ')
787 ALLOCATE(b_u_bys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
789 CALL wrf_error_fatal ( &
790 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_bys(sm31:em31,sm32:em32,spec_bdy_width). ')
792 ALLOCATE(b_u_bye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
794 CALL wrf_error_fatal ( &
795 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_bye(sm31:em31,sm32:em32,spec_bdy_width). ')
797 ALLOCATE(b_u_btxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
799 CALL wrf_error_fatal ( &
800 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_btxs(sm33:em33,sm32:em32,spec_bdy_width). ')
802 ALLOCATE(b_u_btxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
804 CALL wrf_error_fatal ( &
805 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_btxe(sm33:em33,sm32:em32,spec_bdy_width). ')
807 ALLOCATE(b_u_btys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
809 CALL wrf_error_fatal ( &
810 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_btys(sm31:em31,sm32:em32,spec_bdy_width). ')
812 ALLOCATE(b_u_btye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
814 CALL wrf_error_fatal ( &
815 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_btye(sm31:em31,sm32:em32,spec_bdy_width). ')
819 ALLOCATE(b_v_bxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
821 CALL wrf_error_fatal ( &
822 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_bxs(sm33:em33,sm32:em32,spec_bdy_width). ')
824 ALLOCATE(b_v_bxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
826 CALL wrf_error_fatal ( &
827 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_bxe(sm33:em33,sm32:em32,spec_bdy_width). ')
829 ALLOCATE(b_v_bys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
831 CALL wrf_error_fatal ( &
832 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_bys(sm31:em31,sm32:em32,spec_bdy_width). ')
834 ALLOCATE(b_v_bye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
836 CALL wrf_error_fatal ( &
837 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_bye(sm31:em31,sm32:em32,spec_bdy_width). ')
839 ALLOCATE(b_v_btxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
841 CALL wrf_error_fatal ( &
842 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_btxs(sm33:em33,sm32:em32,spec_bdy_width). ')
844 ALLOCATE(b_v_btxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
846 CALL wrf_error_fatal ( &
847 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_btxe(sm33:em33,sm32:em32,spec_bdy_width). ')
849 ALLOCATE(b_v_btys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
851 CALL wrf_error_fatal ( &
852 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_btys(sm31:em31,sm32:em32,spec_bdy_width). ')
854 ALLOCATE(b_v_btye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
856 CALL wrf_error_fatal ( &
857 'share/module_adtl_grid_utilities.f: Failed to allocate b_u_btye(sm31:em31,sm32:em32,spec_bdy_width). ')
861 ALLOCATE(b_t_bxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
863 CALL wrf_error_fatal ( &
864 'share/module_adtl_grid_utilities.f: Failed to allocate b_t_bxs(sm33:em33,sm32:em32,spec_bdy_width). ')
866 ALLOCATE(b_t_bxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
868 CALL wrf_error_fatal ( &
869 'share/module_adtl_grid_utilities.f: Failed to allocate b_t_bxe(sm33:em33,sm32:em32,spec_bdy_width). ')
871 ALLOCATE(b_t_bys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
873 CALL wrf_error_fatal ( &
874 'share/module_adtl_grid_utilities.f: Failed to allocate b_t_bys(sm31:em31,sm32:em32,spec_bdy_width). ')
876 ALLOCATE(b_t_bye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
878 CALL wrf_error_fatal ( &
879 'share/module_adtl_grid_utilities.f: Failed to allocate b_t_bye(sm31:em31,sm32:em32,spec_bdy_width). ')
881 ALLOCATE(b_t_btxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
883 CALL wrf_error_fatal ( &
884 'share/module_adtl_grid_utilities.f: Failed to allocate b_t_btxs(sm33:em33,sm32:em32,spec_bdy_width). ')
886 ALLOCATE(b_t_btxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
888 CALL wrf_error_fatal ( &
889 'share/module_adtl_grid_utilities.f: Failed to allocate b_t_btxe(sm33:em33,sm32:em32,spec_bdy_width). ')
891 ALLOCATE(b_t_btys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
893 CALL wrf_error_fatal ( &
894 'share/module_adtl_grid_utilities.f: Failed to allocate b_t_btys(sm31:em31,sm32:em32,spec_bdy_width). ')
896 ALLOCATE(b_t_btye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
898 CALL wrf_error_fatal ( &
899 'share/module_adtl_grid_utilities.f: Failed to allocate b_t_btye(sm31:em31,sm32:em32,spec_bdy_width). ')
903 ALLOCATE(b_w_bxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
905 CALL wrf_error_fatal ( &
906 'share/module_adtl_grid_utilities.f: Failed to allocate b_w_bxs(sm33:em33,sm32:em32,spec_bdy_width). ')
908 ALLOCATE(b_w_bxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
910 CALL wrf_error_fatal ( &
911 'share/module_adtl_grid_utilities.f: Failed to allocate b_w_bxe(sm33:em33,sm32:em32,spec_bdy_width). ')
913 ALLOCATE(b_w_bys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
915 CALL wrf_error_fatal ( &
916 'share/module_adtl_grid_utilities.f: Failed to allocate b_w_bys(sm31:em31,sm32:em32,spec_bdy_width). ')
918 ALLOCATE(b_w_bye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
920 CALL wrf_error_fatal ( &
921 'share/module_adtl_grid_utilities.f: Failed to allocate b_w_bye(sm31:em31,sm32:em32,spec_bdy_width). ')
923 ALLOCATE(b_w_btxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
925 CALL wrf_error_fatal ( &
926 'share/module_adtl_grid_utilities.f: Failed to allocate b_w_btxs(sm33:em33,sm32:em32,spec_bdy_width). ')
928 ALLOCATE(b_w_btxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
930 CALL wrf_error_fatal ( &
931 'share/module_adtl_grid_utilities.f: Failed to allocate b_w_btxe(sm33:em33,sm32:em32,spec_bdy_width). ')
933 ALLOCATE(b_w_btys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
935 CALL wrf_error_fatal ( &
936 'share/module_adtl_grid_utilities.f: Failed to allocate b_w_btys(sm31:em31,sm32:em32,spec_bdy_width). ')
938 ALLOCATE(b_w_btye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
940 CALL wrf_error_fatal ( &
941 'share/module_adtl_grid_utilities.f: Failed to allocate b_w_btye(sm31:em31,sm32:em32,spec_bdy_width). ')
945 ALLOCATE(b_ph_bxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
947 CALL wrf_error_fatal ( &
948 'share/module_adtl_grid_utilities.f: Failed to allocate b_ph_bxs(sm33:em33,sm32:em32,spec_bdy_width). ')
950 ALLOCATE(b_ph_bxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
952 CALL wrf_error_fatal ( &
953 'share/module_adtl_grid_utilities.f: Failed to allocate b_ph_bxe(sm33:em33,sm32:em32,spec_bdy_width). ')
955 ALLOCATE(b_ph_bys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
957 CALL wrf_error_fatal ( &
958 'share/module_adtl_grid_utilities.f: Failed to allocate b_ph_bys(sm31:em31,sm32:em32,spec_bdy_width). ')
960 ALLOCATE(b_ph_bye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
962 CALL wrf_error_fatal ( &
963 'share/module_adtl_grid_utilities.f: Failed to allocate b_ph_bye(sm31:em31,sm32:em32,spec_bdy_width). ')
965 ALLOCATE(b_ph_btxs(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
967 CALL wrf_error_fatal ( &
968 'share/module_adtl_grid_utilities.f: Failed to allocate b_ph_btxs(sm33:em33,sm32:em32,spec_bdy_width). ')
970 ALLOCATE(b_ph_btxe(sm33:em33,sm32:em32,spec_bdy_width),STAT=ierr)
972 CALL wrf_error_fatal ( &
973 'share/module_adtl_grid_utilities.f: Failed to allocate b_ph_btxe(sm33:em33,sm32:em32,spec_bdy_width). ')
975 ALLOCATE(b_ph_btys(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
977 CALL wrf_error_fatal ( &
978 'share/module_adtl_grid_utilities.f: Failed to allocate b_ph_btys(sm31:em31,sm32:em32,spec_bdy_width). ')
980 ALLOCATE(b_ph_btye(sm31:em31,sm32:em32,spec_bdy_width),STAT=ierr)
982 CALL wrf_error_fatal ( &
983 'share/module_adtl_grid_utilities.f: Failed to allocate b_ph_btye(sm31:em31,sm32:em32,spec_bdy_width). ')
987 ALLOCATE(b_mu_bxs(sm33:em33,1,spec_bdy_width),STAT=ierr)
989 CALL wrf_error_fatal ( &
990 'share/module_adtl_grid_utilities.f: Failed to allocate b_mu_bxs(sm33:em33,1,spec_bdy_width). ')
992 ALLOCATE(b_mu_bxe(sm33:em33,1,spec_bdy_width),STAT=ierr)
994 CALL wrf_error_fatal ( &
995 'share/module_adtl_grid_utilities.f: Failed to allocate b_mu_bxe(sm33:em33,1,spec_bdy_width). ')
997 ALLOCATE(b_mu_bys(sm31:em31,1,spec_bdy_width),STAT=ierr)
999 CALL wrf_error_fatal ( &
1000 'share/module_adtl_grid_utilities.f: Failed to allocate b_mu_bys(sm31:em31,1,spec_bdy_width). ')
1002 ALLOCATE(b_mu_bye(sm31:em31,1,spec_bdy_width),STAT=ierr)
1004 CALL wrf_error_fatal ( &
1005 'share/module_adtl_grid_utilities.f: Failed to allocate b_mu_bye(sm31:em31,1,spec_bdy_width). ')
1007 ALLOCATE(b_mu_btxs(sm33:em33,1,spec_bdy_width),STAT=ierr)
1009 CALL wrf_error_fatal ( &
1010 'share/module_adtl_grid_utilities.f: Failed to allocate b_mu_btxs(sm33:em33,1,spec_bdy_width). ')
1012 ALLOCATE(b_mu_btxe(sm33:em33,1,spec_bdy_width),STAT=ierr)
1014 CALL wrf_error_fatal ( &
1015 'share/module_adtl_grid_utilities.f: Failed to allocate b_mu_btxe(sm33:em33,1,spec_bdy_width). ')
1017 ALLOCATE(b_mu_btys(sm31:em31,1,spec_bdy_width),STAT=ierr)
1019 CALL wrf_error_fatal ( &
1020 'share/module_adtl_grid_utilities.f: Failed to allocate b_mu_btys(sm31:em31,1,spec_bdy_width). ')
1022 ALLOCATE(b_mu_btye(sm31:em31,1,spec_bdy_width),STAT=ierr)
1024 CALL wrf_error_fatal ( &
1025 'share/module_adtl_grid_utilities.f: Failed to allocate b_mu_btye(sm31:em31,1,spec_bdy_width). ')
1029 ALLOCATE(b_moist_bxs(sm33:em33,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
1031 CALL wrf_error_fatal ( &
1032 'share/module_adtl_grid_utilities.f: Failed to allocate b_moist_bxs(sm33:em33,sm32:em32,spec_bdy_width,num_moist). ')
1034 ALLOCATE(b_moist_bxe(sm33:em33,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
1036 CALL wrf_error_fatal ( &
1037 'share/module_adtl_grid_utilities.f: Failed to allocate b_moist_bxe(sm33:em33,sm32:em32,spec_bdy_width,num_moist). ')
1039 ALLOCATE(b_moist_bys(sm31:em31,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
1041 CALL wrf_error_fatal ( &
1042 'share/module_adtl_grid_utilities.f: Failed to allocate b_moist_bys(sm31:em31,sm32:em32,spec_bdy_width,num_moist). ')
1044 ALLOCATE(b_moist_bye(sm31:em31,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
1046 CALL wrf_error_fatal ( &
1047 'share/module_adtl_grid_utilities.f: Failed to allocate b_moist_bye(sm31:em31,sm32:em32,spec_bdy_width,num_moist). ')
1049 ALLOCATE(b_moist_btxs(sm33:em33,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
1051 CALL wrf_error_fatal ( &
1052 'share/module_adtl_grid_utilities.f: Failed to allocate b_moist_btxs(sm33:em33,sm32:em32,spec_bdy_width,num_moist). ')
1054 ALLOCATE(b_moist_btxe(sm33:em33,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
1056 CALL wrf_error_fatal ( &
1057 'share/module_adtl_grid_utilities.f: Failed to allocate b_moist_btxe(sm33:em33,sm32:em32,spec_bdy_width,num_moist). ')
1059 ALLOCATE(b_moist_btys(sm31:em31,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
1061 CALL wrf_error_fatal ( &
1062 'share/module_adtl_grid_utilities.f: Failed to allocate b_moist_btys(sm31:em31,sm32:em32,spec_bdy_width,num_moist). ')
1064 ALLOCATE(b_moist_btye(sm31:em31,sm32:em32,spec_bdy_width,num_moist),STAT=ierr)
1066 CALL wrf_error_fatal ( &
1067 'share/module_adtl_grid_utilities.f: Failed to allocate b_moist_btye(sm31:em31,sm32:em32,spec_bdy_width,num_moist). ')
1071 ALLOCATE(b_tracer_bxs(sm33:em33,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
1073 CALL wrf_error_fatal ( &
1074 'share/module_adtl_grid_utilities.f: Failed to allocate b_tracer_bxs(sm33:em33,sm32:em32,spec_bdy_width,num_tracer). ')
1076 ALLOCATE(b_tracer_bxe(sm33:em33,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
1078 CALL wrf_error_fatal ( &
1079 'share/module_adtl_grid_utilities.f: Failed to allocate b_tracer_bxe(sm33:em33,sm32:em32,spec_bdy_width,num_tracer). ')
1081 ALLOCATE(b_tracer_bys(sm31:em31,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
1083 CALL wrf_error_fatal ( &
1084 'share/module_adtl_grid_utilities.f: Failed to allocate b_tracer_bys(sm31:em31,sm32:em32,spec_bdy_width,num_tracer). ')
1086 ALLOCATE(b_tracer_bye(sm31:em31,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
1088 CALL wrf_error_fatal ( &
1089 'share/module_adtl_grid_utilities.f: Failed to allocate b_tracer_bye(sm31:em31,sm32:em32,spec_bdy_width,num_tracer). ')
1091 ALLOCATE(b_tracer_btxs(sm33:em33,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
1093 CALL wrf_error_fatal ( &
1094 'share/module_adtl_grid_utilities.f: Failed to allocate b_tracer_btxs(sm33:em33,sm32:em32,spec_bdy_width,num_tracer). ')
1096 ALLOCATE(b_tracer_btxe(sm33:em33,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
1098 CALL wrf_error_fatal ( &
1099 'share/module_adtl_grid_utilities.f: Failed to allocate b_tracer_btxe(sm33:em33,sm32:em32,spec_bdy_width,num_tracer). ')
1101 ALLOCATE(b_tracer_btys(sm31:em31,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
1103 CALL wrf_error_fatal ( &
1104 'share/module_adtl_grid_utilities.f: Failed to allocate b_tracer_btys(sm31:em31,sm32:em32,spec_bdy_width,num_tracer). ')
1106 ALLOCATE(b_tracer_btye(sm31:em31,sm32:em32,spec_bdy_width,num_tracer),STAT=ierr)
1108 CALL wrf_error_fatal ( &
1109 'share/module_adtl_grid_utilities.f: Failed to allocate b_tracer_btye(sm31:em31,sm32:em32,spec_bdy_width,num_tracer). ')
1112 ALLOCATE(b_rainnc(sm31:em31,sm33:em33),STAT=ierr)
1114 CALL wrf_error_fatal ( &
1115 'share/module_adtl_grid_utilities.f: Failed to allocate b_rainnc(sm31:em31,sm33:em33). ')
1117 ALLOCATE(b_rainncv(sm31:em31,sm33:em33),STAT=ierr)
1119 CALL wrf_error_fatal ( &
1120 'share/module_adtl_grid_utilities.f: Failed to allocate b_rainncv(sm31:em31,sm33:em33). ')
1122 ALLOCATE(b_rainc(sm31:em31,sm33:em33),STAT=ierr)
1124 CALL wrf_error_fatal ( &
1125 'share/module_adtl_grid_utilities.f: Failed to allocate b_rainc(sm31:em31,sm33:em33). ')
1127 ALLOCATE(b_raincv(sm31:em31,sm33:em33),STAT=ierr)
1129 CALL wrf_error_fatal ( &
1130 'share/module_adtl_grid_utilities.f: Failed to allocate b_raincv(sm31:em31,sm33:em33). ')
1134 END SUBROUTINE allocate_grid
1136 SUBROUTINE copy_grid_to_s ( grid, its, ite, jts, jte )
1137 TYPE (domain), INTENT(IN) :: grid
1138 INTEGER, INTENT(IN) :: its, ite, jts, jte
1141 DO j = jts,MIN(jte,jde-1)
1144 s_u_2(i,k,j) = grid%u_2(i,k,j)
1152 DO i = its,MIN(ite,ide-1)
1153 s_v_2(i,k,j) = grid%v_2(i,k,j)
1160 DO j = jts,MIN(jte,jde-1)
1162 DO i = its,MIN(ite,ide-1)
1163 s_w_2(i,k,j) = grid%w_2(i,k,j)
1164 s_ph_2(i,k,j) = grid%ph_2(i,k,j)
1170 DO j = jts,MIN(jte,jde-1)
1172 DO i = its,MIN(ite,ide-1)
1173 s_t_2(i,k,j) = grid%t_2(i,k,j)
1179 DO j = jts,MIN(jte,jde-1)
1180 DO i = its,MIN(ite,ide-1)
1181 s_mu_2(i,j) = grid%mu_2(i,j)
1186 DO mm = PARAM_FIRST_SCALAR, num_moist
1187 DO j = jts,MIN(jte,jde-1)
1189 DO i = its,MIN(ite,ide-1)
1190 s_moist(i,k,j,mm) = grid%moist(i,k,j,mm)
1196 IF ( gwd_opt .EQ. 1 ) THEN
1201 DO j = jts,MIN(jte,jde-1)
1203 DO i = its,MIN(ite,ide-1)
1204 s_dtaux3d(i,k,j) = grid%dtaux3d(i,k,j)
1205 s_dtauy3d(i,k,j) = grid%dtauy3d(i,k,j)
1209 DO j = jts,MIN(jte,jde-1)
1210 DO i = its,MIN(ite,ide-1)
1211 s_dusfcg(i,j) = grid%dusfcg(i,j)
1212 s_dvsfcg(i,j) = grid%dvsfcg(i,j)
1218 DO mm = PARAM_FIRST_SCALAR, num_tracer
1219 DO j = jts,MIN(jte,jde-1)
1221 DO i = its,MIN(ite,ide-1)
1222 s_tracer(i,k,j,mm) = grid%tracer(i,k,j,mm)
1229 DO mm = PARAM_FIRST_SCALAR, num_scalar
1230 DO j = jts,MIN(jte,jde-1)
1232 DO i = its,MIN(ite,ide-1)
1233 s_scalar(i,k,j,mm) = grid%scalar(i,k,j,mm)
1239 s_tke_2 = grid%tke_2
1242 s_h_diabatic = grid%h_diabatic
1243 s_qv_diabatic = grid%qv_diabatic
1244 s_qc_diabatic = grid%qc_diabatic
1249 s_u_bxs = grid%u_bxs; s_u_bxe = grid%u_bxe; s_u_bys = grid%u_bys; s_u_bye = grid%u_bye
1250 s_u_btxs = grid%u_btxs; s_u_btxe = grid%u_btxe; s_u_btys = grid%u_btys; s_u_btye = grid%u_btye
1251 s_v_bxs = grid%v_bxs; s_v_bxe = grid%v_bxe; s_v_bys =grid%v_bys; s_v_bye=grid%v_bye
1252 s_v_btxs = grid%v_btxs; s_v_btxe = grid%v_btxe; s_v_btys =grid%v_btys; s_v_btye=grid%v_btye
1253 s_w_bxs = grid%w_bxs; s_w_bxe = grid%w_bxe; s_w_bys = grid%w_bys; s_w_bye = grid%w_bye
1254 s_w_btxs = grid%w_btxs; s_w_btxe = grid%w_btxe; s_w_btys = grid%w_btys; s_w_btye = grid%w_btye
1255 s_ph_bxs = grid%ph_bxs; s_ph_bxe = grid%ph_bxe; s_ph_bys = grid%ph_bys; s_ph_bye = grid%ph_bye
1256 s_ph_btxs = grid%ph_btxs; s_ph_btxe = grid%ph_btxe; s_ph_btys = grid%ph_btys; s_ph_btye = grid%ph_btye
1257 s_t_bxs = grid%t_bxs; s_t_bxe = grid%t_bxe; s_t_bys = grid%t_bys; s_t_bye = grid%t_bye
1258 s_t_btxs = grid%t_btxs; s_t_btxe = grid%t_btxe; s_t_btys = grid%t_btys; s_t_btye = grid%t_btye
1259 s_mu_bxs = grid%mu_bxs; s_mu_bxe = grid%mu_bxe; s_mu_bys = grid%mu_bys; s_mu_bye = grid%mu_bye
1260 s_mu_btxs = grid%mu_btxs; s_mu_btxe = grid%mu_btxe; s_mu_btys = grid%mu_btys; s_mu_btye = grid%mu_btye
1261 s_moist_bxs = grid%moist_bxs; s_moist_bxe = grid%moist_bxe; s_moist_bys = grid%moist_bys; s_moist_bye = grid%moist_bye
1262 s_moist_btxs = grid%moist_btxs; s_moist_btxe = grid%moist_btxe; s_moist_btys = grid%moist_btys; s_moist_btye = grid%moist_btye
1263 s_scalar_bxs = grid%scalar_bxs; s_scalar_bxe = grid%scalar_bxe; s_scalar_bys = grid%scalar_bys; s_scalar_bye = grid%scalar_bye
1264 s_scalar_btxs = grid%scalar_btxs; s_scalar_btxe = grid%scalar_btxe; s_scalar_btys = grid%scalar_btys; s_scalar_btye = grid%scalar_btye
1265 s_tracer_bxs = grid%tracer_bxs; s_tracer_bxe = grid%tracer_bxe; s_tracer_bys = grid%tracer_bys; s_tracer_bye = grid%tracer_bye
1266 s_tracer_btxs = grid%tracer_btxs; s_tracer_btxe = grid%tracer_btxe; s_tracer_btys = grid%tracer_btys; s_tracer_btye = grid%tracer_btye
1269 END SUBROUTINE copy_grid_to_s
1271 SUBROUTINE copy_grid_to_b ( grid )
1272 TYPE (domain), INTENT(IN) :: grid
1280 b_moist = grid%moist
1281 b_tracer = grid%tracer
1283 b_h_diabatic = grid%h_diabatic
1284 b_qv_diabatic = grid%qv_diabatic
1285 b_qc_diabatic = grid%qc_diabatic
1288 b_rainnc = grid%rainnc
1289 b_rainncv = grid%rainncv
1290 b_rainc = grid%rainc
1291 b_raincv = grid%raincv
1293 b_scalar = grid%scalar
1295 IF ( gwd_opt .EQ. 1 ) THEN
1296 b_dtaux3d = grid%dtaux3d
1297 b_dtauy3d = grid%dtauy3d
1298 b_dusfcg = grid%dusfcg
1299 b_dvsfcg = grid%dvsfcg
1302 ! b_tke_2 = grid%tke_2
1307 END SUBROUTINE copy_grid_to_b
1309 SUBROUTINE restore_grid ( grid )
1310 TYPE (domain), INTENT(INOUT) :: grid
1318 grid%moist = s_moist
1319 grid%tracer = s_tracer
1320 grid%scalar = s_scalar
1321 grid%tke_2 = s_tke_2
1325 grid%h_diabatic = s_h_diabatic
1326 grid%qv_diabatic = s_qv_diabatic
1327 grid%qc_diabatic = s_qc_diabatic
1332 IF ( gwd_opt .EQ. 1 ) THEN
1333 grid%dtaux3d = s_dtaux3d
1334 grid%dtauy3d = s_dtauy3d
1335 grid%dusfcg = s_dusfcg
1336 grid%dvsfcg = s_dvsfcg
1339 grid%u_bxs = s_u_bxs; grid%u_bxe = s_u_bxe; grid%u_bys = s_u_bys; grid%u_bye = s_u_bye
1340 grid%u_btxs = s_u_btxs; grid%u_btxe = s_u_btxe; grid%u_btys = s_u_btys; grid%u_btye = s_u_btye
1341 grid%v_bxs = s_v_bxs; grid%v_bxe = s_v_bxe; grid%v_bys = s_v_bys; grid%v_bye = s_v_bye
1342 grid%v_btxs = s_v_btxs; grid%v_btxe = s_v_btxe; grid%v_btys = s_v_btys; grid%v_btye = s_v_btye
1343 grid%w_bxs = s_w_bxs; grid%w_bxe = s_w_bxe; grid%w_bys = s_w_bys; grid%w_bye = s_w_bye
1344 grid%w_btxs = s_w_btxs; grid%w_btxe = s_w_btxe; grid%w_btys = s_w_btys; grid%w_btye = s_w_btye
1345 grid%ph_bxs = s_ph_bxs; grid%ph_bxe = s_ph_bxe; grid%ph_bys = s_ph_bys; grid%ph_bye = s_ph_bye
1346 grid%ph_btxs = s_ph_btxs; grid%ph_btxe = s_ph_btxe; grid%ph_btys = s_ph_btys; grid%ph_btye = s_ph_btye
1347 grid%t_bxs = s_t_bxs; grid%t_bxe = s_t_bxe; grid%t_bys = s_t_bys; grid%t_bye = s_t_bye
1348 grid%t_btxs = s_t_btxs; grid%t_btxe = s_t_btxe; grid%t_btys = s_t_btys; grid%t_btye = s_t_btye
1349 grid%mu_bxs = s_mu_bxs; grid%mu_bxe = s_mu_bxe; grid%mu_bys = s_mu_bys; grid%mu_bye = s_mu_bye
1350 grid%mu_btxs = s_mu_btxs; grid%mu_btxe = s_mu_btxe; grid%mu_btys = s_mu_btys; grid%mu_btye = s_mu_btye
1351 grid%moist_bxs = s_moist_bxs; grid%moist_bxe = s_moist_bxe; grid%moist_bys = s_moist_bys; grid%moist_bye = s_moist_bye
1352 grid%moist_btxs = s_moist_btxs; grid%moist_btxe = s_moist_btxe; grid%moist_btys = s_moist_btys; grid%moist_btye = s_moist_btye
1353 grid%scalar_bxs = s_scalar_bxs; grid%scalar_bxe = s_scalar_bxe; grid%scalar_bys = s_scalar_bys; grid%scalar_bye = s_scalar_bye
1354 grid%scalar_btxs = s_scalar_btxs; grid%scalar_btxe = s_scalar_btxe; grid%scalar_btys = s_scalar_btys; grid%scalar_btye = s_scalar_btye
1355 grid%tracer_bxs = s_tracer_bxs; grid%tracer_bxe = s_tracer_bxe; grid%tracer_bys = s_tracer_bys; grid%tracer_bye = s_tracer_bye
1356 grid%tracer_btxs = s_tracer_btxs; grid%tracer_btxe = s_tracer_btxe; grid%tracer_btys = s_tracer_btys; grid%tracer_btye = s_tracer_btye
1358 END SUBROUTINE restore_grid
1360 SUBROUTINE copy_s_to_g_adjtest ( grid, factor )
1361 TYPE (domain), INTENT(INOUT) :: grid
1362 REAL, INTENT(IN) :: factor
1363 REAL :: factor_u, factor_v, factor_w, factor_ph, factor_t, factor_mu, &
1364 factor_moist, factor_tracer
1366 if (grid%check_u) then
1371 if (grid%check_v) then
1376 if (grid%check_w) then
1381 if (grid%check_ph) then
1386 if (grid%check_t) then
1391 if (grid%check_mu) then
1396 if (grid%check_moist) then
1397 factor_moist =factor
1401 if (grid%check_tracer) then
1402 factor_tracer =factor
1409 grid%g_u_2 = factor_u*s_u_2
1410 grid%g_v_2 = factor_v*s_v_2
1411 grid%g_w_2 = factor_w*s_w_2
1412 grid%g_ph_2 = factor_ph*s_ph_2
1413 grid%g_t_2 = factor_t*s_t_2
1414 grid%g_mu_2 = factor_mu*s_mu_2
1415 grid%g_moist = factor_moist*s_moist
1416 grid%g_tracer = factor_tracer*s_tracer
1418 grid%g_scalar = 0.0*s_scalar
1419 grid%g_tke_2 = 0.0*s_tke_2
1421 grid%g_al = 0.0*s_al
1424 grid%g_ustm = 0.0*s_ustm
1425 grid%g_hfx = 0.0*s_hfx
1426 grid%g_qfx = 0.0*s_qfx
1428 IF ( gwd_opt .EQ. 1 ) THEN
1429 grid%g_dtaux3d = factor_u*s_dtaux3d
1430 grid%g_dtauy3d = factor_u*s_dtauy3d
1431 grid%g_dusfcg = factor_u*s_dusfcg
1432 grid%g_dvsfcg = factor_u*s_dvsfcg
1435 grid%g_u_bxs = factor_u*s_u_bxs; grid%g_u_bxe = factor_u*s_u_bxe; grid%g_u_bys = factor_u*s_u_bys; grid%g_u_bye = factor_u*s_u_bye
1436 grid%g_u_btxs = factor_u*s_u_btxs; grid%g_u_btxe = factor_u*s_u_btxe; grid%g_u_btys = factor_u*s_u_btys; grid%g_u_btye = factor_u*s_u_btye
1437 grid%g_v_bxs = factor_v*s_v_bxs; grid%g_v_bxe = factor_v*s_v_bxe; grid%g_v_bys = factor_v*s_v_bys; grid%g_v_bye = factor_v*s_v_bye
1438 grid%g_v_btxs = factor_v*s_v_btxs; grid%g_v_btxe = factor_v*s_v_btxe; grid%g_v_btys = factor_v*s_v_btys; grid%g_v_btye = factor_v*s_v_btye
1439 grid%g_w_bxs = factor_w*s_w_bxs; grid%g_w_bxe = factor_w*s_w_bxe; grid%g_w_bys = factor_w*s_w_bys; grid%g_w_bye = factor_w*s_w_bye
1440 grid%g_w_btxs = factor_w*s_w_btxs; grid%g_w_btxe = factor_w*s_w_btxe; grid%g_w_btys = factor_w*s_w_btys; grid%g_w_btye = factor_w*s_w_btye
1441 grid%g_ph_bxs = factor_ph*s_ph_bxs; grid%g_ph_bxe = factor_ph*s_ph_bxe; grid%g_ph_bys = factor_ph*s_ph_bys; grid%g_ph_bye = factor_ph*s_ph_bye
1442 grid%g_ph_btxs = factor_ph*s_ph_btxs; grid%g_ph_btxe = factor_ph*s_ph_btxe; grid%g_ph_btys = factor_ph*s_ph_btys; grid%g_ph_btye = factor_ph*s_ph_btye
1443 grid%g_t_bxs = factor_t*s_t_bxs; grid%g_t_bxe = factor_t*s_t_bxe; grid%g_t_bys = factor_t*s_t_bys; grid%g_t_bye = factor_t*s_t_bye
1444 grid%g_t_btxs = factor_t*s_t_btxs; grid%g_t_btxe = factor_t*s_t_btxe; grid%g_t_btys = factor_t*s_t_btys; grid%g_t_btye = factor_t*s_t_btye
1445 grid%g_mu_bxs = factor_mu*s_mu_bxs; grid%g_mu_bxe = factor_mu*s_mu_bxe; grid%g_mu_bys = factor_mu*s_mu_bys; grid%g_mu_bye = factor_mu*s_mu_bye
1446 grid%g_mu_btxs = factor_mu*s_mu_btxs; grid%g_mu_btxe = factor_mu*s_mu_btxe; grid%g_mu_btys = factor_mu*s_mu_btys; grid%g_mu_btye = factor_mu*s_mu_btye
1447 grid%g_moist_bxs = factor_moist*s_moist_bxs; grid%g_moist_bxe = factor_moist*s_moist_bxe; grid%g_moist_bys = factor_moist*s_moist_bys; grid%g_moist_bye = factor_moist*s_moist_bye
1448 grid%g_moist_btxs = factor_moist*s_moist_btxs; grid%g_moist_btxe = factor_moist*s_moist_btxe; grid%g_moist_btys = factor_moist*s_moist_btys; grid%g_moist_btye = factor_moist*s_moist_btye
1449 grid%g_tracer_bxs = factor_tracer*s_tracer_bxs; grid%g_tracer_bxe = factor_tracer*s_tracer_bxe; grid%g_tracer_bys = factor_tracer*s_tracer_bys; grid%g_tracer_bye = factor_tracer*s_tracer_bye
1450 grid%g_tracer_btxs = factor_tracer*s_tracer_btxs; grid%g_tracer_btxe = factor_tracer*s_tracer_btxe; grid%g_tracer_btys = factor_tracer*s_tracer_btys; grid%g_tracer_btye = factor_tracer*s_tracer_btye
1452 grid%g_scalar_bxs = 0.0*s_scalar_bxs; grid%g_scalar_bxe = 0.0*s_scalar_bxe; grid%g_scalar_bys = 0.0*s_scalar_bys; grid%g_scalar_bye = 0.0*s_scalar_bye
1453 grid%g_scalar_btxs = 0.0*s_scalar_btxs; grid%g_scalar_btxe = 0.0*s_scalar_btxe; grid%g_scalar_btys = 0.0*s_scalar_btys; grid%g_scalar_btye = 0.0*s_scalar_btye
1473 grid%g_p_hyd_w = 0.0
1482 grid%g_nba_mij = 0.0
1483 grid%g_nba_rij = 0.0
1484 grid%g_defor11 = 0.0
1485 grid%g_defor22 = 0.0
1486 grid%g_defor33 = 0.0
1487 grid%g_defor12 = 0.0
1488 grid%g_defor13 = 0.0
1489 grid%g_defor23 = 0.0
1495 grid%g_ru_tend = 0.0
1496 grid%g_rv_tend = 0.0
1500 grid%g_rthften = 0.0
1501 grid%g_rqvften = 0.0
1508 grid%g_h_diabatic = 0.0
1509 grid%g_qv_diabatic = 0.0
1510 grid%g_qc_diabatic = 0.0
1512 grid%g_rainncv = 0.0
1516 END SUBROUTINE copy_s_to_g_adjtest
1518 SUBROUTINE copy_g_to_b_adjtest ( grid )
1519 TYPE (domain), INTENT(IN) :: grid
1524 b_ph_2 = grid%g_ph_2
1526 b_mu_2 = grid%g_mu_2
1527 b_tke_2 = grid%g_tke_2
1528 b_moist = grid%g_moist
1529 b_tracer = grid%g_tracer
1530 b_scalar = grid%g_scalar
1531 b_tke_2 = grid%g_tke_2
1536 b_ustm = grid%g_ustm
1539 b_h_diabatic = grid%g_h_diabatic
1540 b_qv_diabatic = grid%g_qv_diabatic
1541 b_qc_diabatic = grid%g_qc_diabatic
1543 IF ( gwd_opt .EQ. 1 ) THEN
1544 b_dtaux3d = grid%g_dtaux3d
1545 b_dtauy3d = grid%g_dtauy3d
1546 b_dusfcg = grid%g_dusfcg
1547 b_dvsfcg = grid%g_dvsfcg
1550 b_u_bxs = grid%g_u_bxs; b_u_bxe = grid%g_u_bxe; b_u_bys = grid%g_u_bys; b_u_bye = grid%g_u_bye
1551 b_v_bxs = grid%g_v_bxs; b_v_bxe = grid%g_v_bxe; b_v_bys = grid%g_v_bys; b_v_bye = grid%g_v_bye
1552 b_w_bxs = grid%g_w_bxs; b_w_bxe = grid%g_w_bxe; b_w_bys = grid%g_w_bys; b_w_bye = grid%g_w_bye
1553 b_ph_bxs = grid%g_ph_bxs; b_ph_bxe = grid%g_ph_bxe; b_ph_bys = grid%g_ph_bys; b_ph_bye = grid%g_ph_bye
1554 b_t_bxs = grid%g_t_bxs; b_t_bxe = grid%g_t_bxe; b_t_bys = grid%g_t_bys; b_t_bye = grid%g_t_bye
1555 b_mu_bxs = grid%g_mu_bxs; b_mu_bxe = grid%g_mu_bxe; b_mu_bys = grid%g_mu_bys; b_mu_bye = grid%g_mu_bye
1556 b_moist_bxs = grid%g_moist_bxs; b_moist_bxe = grid%g_moist_bxe; b_moist_bys = grid%g_moist_bys; b_moist_bye = grid%g_moist_bye
1557 b_tracer_bxs = grid%g_tracer_bxs; b_tracer_bxe = grid%g_tracer_bxe; b_tracer_bys = grid%g_tracer_bys; b_tracer_bye = grid%g_tracer_bye
1558 b_u_btxs = grid%g_u_btxs; b_u_btxe = grid%g_u_btxe; b_u_btys = grid%g_u_btys; b_u_btye = grid%g_u_btye
1559 b_v_btxs = grid%g_v_btxs; b_v_btxe = grid%g_v_btxe; b_v_btys = grid%g_v_btys; b_v_btye = grid%g_v_btye
1560 b_w_btxs = grid%g_w_btxs; b_w_btxe = grid%g_w_btxe; b_w_btys = grid%g_w_btys; b_w_btye = grid%g_w_btye
1561 b_ph_btxs = grid%g_ph_btxs; b_ph_btxe = grid%g_ph_btxe; b_ph_btys = grid%g_ph_btys; b_ph_btye = grid%g_ph_btye
1562 b_t_btxs = grid%g_t_btxs; b_t_btxe = grid%g_t_btxe; b_t_btys = grid%g_t_btys; b_t_btye = grid%g_t_btye
1563 b_mu_btxs = grid%g_mu_btxs; b_mu_btxe = grid%g_mu_btxe; b_mu_btys = grid%g_mu_btys; b_mu_btye = grid%g_mu_btye
1564 b_moist_btxs = grid%g_moist_btxs; b_moist_btxe = grid%g_moist_btxe; b_moist_btys = grid%g_moist_btys; b_moist_btye = grid%g_moist_btye
1565 b_tracer_btxs = grid%g_tracer_btxs; b_tracer_btxe = grid%g_tracer_btxe; b_tracer_btys = grid%g_tracer_btys; b_tracer_btye = grid%g_tracer_btye
1567 b_scalar_bxs = grid%g_scalar_bxs; b_scalar_bxe = grid%g_scalar_bxe; b_scalar_bys = grid%g_scalar_bys; b_scalar_bye = grid%g_scalar_bye
1568 b_scalar_btxs = grid%g_scalar_btxs; b_scalar_btxe = grid%g_scalar_btxe; b_scalar_btys = grid%g_scalar_btys; b_scalar_btye = grid%g_scalar_btye
1571 END SUBROUTINE copy_g_to_b_adjtest
1573 SUBROUTINE inner_dot_g ( grid, save, its, ite, jts, jte )
1574 TYPE (domain), INTENT(IN) :: grid
1575 REAL, INTENT(INOUT) :: save
1576 INTEGER, INTENT(IN) :: its, ite, jts, jte
1577 INTEGER :: i, k, j, mm
1579 DO j = jts,MIN(jte,jde-1)
1583 + grid%g_u_2(i,k,j) * grid%g_u_2(i,k,j)
1590 DO i = its,MIN(ite,ide-1)
1592 + grid%g_v_2(i,k,j) * grid%g_v_2(i,k,j)
1597 DO j = jts,MIN(jte,jde-1)
1599 DO i = its,MIN(ite,ide-1)
1601 + grid%g_w_2(i,k,j) * grid%g_w_2(i,k,j)
1606 DO j = jts,MIN(jte,jde-1)
1608 DO i = its,MIN(ite,ide-1)
1610 + grid%g_ph_2(i,k,j) * grid%g_ph_2(i,k,j)
1615 DO j = jts,MIN(jte,jde-1)
1617 DO i = its,MIN(ite,ide-1)
1619 + grid%g_t_2(i,k,j) * grid%g_t_2(i,k,j)
1625 DO j = jts,MIN(jte,jde-1)
1626 DO i = its,MIN(ite,ide-1)
1628 + grid%g_mu_2(i,j) * grid%g_mu_2(i,j)
1632 DO mm = PARAM_FIRST_SCALAR, num_moist
1633 DO j = jts,MIN(jte,jde-1)
1635 DO i = its,MIN(ite,ide-1)
1636 save = save + grid%g_moist(i,k,j,mm) * grid%g_moist(i,k,j,mm)
1642 DO mm = PARAM_FIRST_SCALAR, num_tracer
1643 DO j = jts,MIN(jte,jde-1)
1645 DO i = its,MIN(ite,ide-1)
1646 save = save + grid%g_tracer(i,k,j,mm) * grid%g_tracer(i,k,j,mm)
1652 DO j = jts,MIN(jte,jde-1)
1654 DO i = its,MIN(ite,ide-1)
1655 save = save + grid%g_h_diabatic(i,k,j) * grid%g_h_diabatic(i,k,j)
1660 DO j = jts,MIN(jte,jde-1)
1662 DO i = its,MIN(ite,ide-1)
1663 save = save + grid%g_qv_diabatic(i,k,j) * grid%g_qv_diabatic(i,k,j)
1668 DO j = jts,MIN(jte,jde-1)
1670 DO i = its,MIN(ite,ide-1)
1671 save = save + grid%g_qc_diabatic(i,k,j) * grid%g_qc_diabatic(i,k,j)
1676 DO j = jts,MIN(jte,jde-1)
1678 DO i = its,MIN(ite,ide-1)
1679 save = save + grid%g_p(i,k,j) * grid%g_p(i,k,j)
1684 DO j = jts,MIN(jte,jde-1)
1685 DO i = its,MIN(ite,ide-1)
1686 save = save + grid%g_rainnc(i,j) * grid%g_rainnc(i,j) &
1687 + grid%g_rainncv(i,j) * grid%g_rainncv(i,j)
1691 DO j = jts,MIN(jte,jde-1)
1692 DO i = its,MIN(ite,ide-1)
1693 save = save + grid%g_rainc(i,j) * grid%g_rainc(i,j) &
1694 + grid%g_raincv(i,j) * grid%g_raincv(i,j)
1698 IF ( gwd_opt .EQ. 1 ) THEN
1699 DO j = jts,MIN(jte,jde-1)
1701 DO i = its,MIN(ite,ide-1)
1702 save = save + grid%g_dtaux3d(i,k,j) * grid%g_dtaux3d(i,k,j) &
1703 + grid%g_dtauy3d(i,k,j) * grid%g_dtauy3d(i,k,j)
1708 DO j = jts,MIN(jte,jde-1)
1709 DO i = its,MIN(ite,ide-1)
1710 save = save + grid%g_dusfcg(i,j) * grid%g_dusfcg(i,j) &
1711 + grid%g_dvsfcg(i,j) * grid%g_dvsfcg(i,j)
1717 END SUBROUTINE inner_dot_g
1719 SUBROUTINE inner_dot_g_adjtest ( grid, save, its, ite, jts, jte )
1720 TYPE (domain), INTENT(IN) :: grid
1721 REAL, INTENT(INOUT) :: save
1722 INTEGER, INTENT(IN) :: its, ite, jts, jte
1723 INTEGER :: i, k, j, mm
1725 DO j = jts,MIN(jte,jde-1)
1728 save = save + grid%g_u_2(i,k,j) * grid%g_u_2(i,k,j)
1735 DO i = its,MIN(ite,ide-1)
1736 save = save + grid%g_v_2(i,k,j) * grid%g_v_2(i,k,j)
1741 DO j = jts,MIN(jte,jde-1)
1743 DO i = its,MIN(ite,ide-1)
1744 save = save + grid%g_w_2(i,k,j) * grid%g_w_2(i,k,j)
1749 DO j = jts,MIN(jte,jde-1)
1751 DO i = its,MIN(ite,ide-1)
1752 save = save + grid%g_ph_2(i,k,j) * grid%g_ph_2(i,k,j)
1757 DO j = jts,MIN(jte,jde-1)
1759 DO i = its,MIN(ite,ide-1)
1760 save = save + grid%g_t_2(i,k,j) * grid%g_t_2(i,k,j)
1765 DO j = jts,MIN(jte,jde-1)
1766 DO i = its,MIN(ite,ide-1)
1767 save = save + grid%g_mu_2(i,j) * grid%g_mu_2(i,j)
1771 DO mm = PARAM_FIRST_SCALAR, num_moist
1772 DO j = jts,MIN(jte,jde-1)
1774 DO i = its,MIN(ite,ide-1)
1775 save = save + grid%g_moist(i,k,j,mm) * grid%g_moist(i,k,j,mm)
1781 DO mm = PARAM_FIRST_SCALAR, num_tracer
1782 DO j = jts,MIN(jte,jde-1)
1784 DO i = its,MIN(ite,ide-1)
1785 save = save + grid%g_tracer(i,k,j,mm) * grid%g_tracer(i,k,j,mm)
1791 DO j = jts,MIN(jte,jde-1)
1793 DO i = its,MIN(ite,ide-1)
1794 save = save + grid%g_h_diabatic(i,k,j) * grid%g_h_diabatic(i,k,j)
1799 DO j = jts,MIN(jte,jde-1)
1801 DO i = its,MIN(ite,ide-1)
1802 save = save + grid%g_qv_diabatic(i,k,j) * grid%g_qv_diabatic(i,k,j)
1807 DO j = jts,MIN(jte,jde-1)
1809 DO i = its,MIN(ite,ide-1)
1810 save = save + grid%g_qc_diabatic(i,k,j) * grid%g_qc_diabatic(i,k,j)
1815 DO j = jts,MIN(jte,jde-1)
1817 DO i = its,MIN(ite,ide-1)
1818 save = save + grid%g_p(i,k,j) * grid%g_p(i,k,j)
1823 DO j = jts,MIN(jte,jde-1)
1824 DO i = its,MIN(ite,ide-1)
1825 save = save + grid%g_rainnc(i,j) * grid%g_rainnc(i,j) &
1826 + grid%g_rainncv(i,j) * grid%g_rainncv(i,j)
1830 DO j = jts,MIN(jte,jde-1)
1831 DO i = its,MIN(ite,ide-1)
1832 save = save + grid%g_rainc(i,j) * grid%g_rainc(i,j) &
1833 + grid%g_raincv(i,j) * grid%g_raincv(i,j)
1837 IF ( gwd_opt .EQ. 1 ) THEN
1838 DO j = jts,MIN(jte,jde-1)
1840 DO i = its,MIN(ite,ide-1)
1841 save = save + grid%g_dtaux3d(i,k,j) * grid%g_dtaux3d(i,k,j) &
1842 + grid%g_dtauy3d(i,k,j) * grid%g_dtauy3d(i,k,j)
1847 DO j = jts,MIN(jte,jde-1)
1848 DO i = its,MIN(ite,ide-1)
1849 save = save + grid%g_dusfcg(i,j) * grid%g_dusfcg(i,j) &
1850 + grid%g_dvsfcg(i,j) * grid%g_dvsfcg(i,j)
1857 END SUBROUTINE inner_dot_g_adjtest
1859 SUBROUTINE add_grid ( grid, factor )
1860 TYPE (domain), INTENT(INOUT) :: grid
1861 REAL, INTENT(IN) :: factor
1862 REAL :: factor_u, factor_v, factor_w, factor_ph, factor_t, factor_mu, factor_moist, factor_tracer
1864 if (grid%check_u) then
1869 if (grid%check_v) then
1874 if (grid%check_w) then
1879 if (grid%check_ph) then
1884 if (grid%check_t) then
1889 if (grid%check_mu) then
1894 if (grid%check_moist) then
1895 factor_moist =factor
1899 if (grid%check_tracer) then
1900 factor_tracer =factor
1905 grid%u_2 = factor_u*s_u_2
1906 grid%v_2 = factor_v*s_v_2
1907 grid%w_2 = factor_w*s_w_2
1908 grid%ph_2 = factor_ph*s_ph_2
1909 grid%t_2 = factor_t*s_t_2
1910 grid%mu_2 = factor_mu*s_mu_2
1911 grid%moist = factor_moist*s_moist
1912 grid%tracer = factor_tracer*s_tracer
1913 grid%scalar = s_scalar
1914 grid%tke_2 = s_tke_2
1918 grid%h_diabatic = s_h_diabatic
1919 grid%qv_diabatic = s_qv_diabatic
1920 grid%qc_diabatic = s_qc_diabatic
1925 IF ( gwd_opt .EQ. 1 ) THEN
1926 grid%dtaux3d = factor_u*s_dtaux3d
1927 grid%dtauy3d = factor_u*s_dtauy3d
1928 grid%dusfcg = factor_u*s_dusfcg
1929 grid%dvsfcg = factor_u*s_dvsfcg
1932 grid%u_bxs = factor_u*s_u_bxs; grid%u_bxe = factor_u*s_u_bxe; grid%u_bys = factor_u*s_u_bys; grid%u_bye = factor_u*s_u_bye
1933 grid%u_btxs = factor_u*s_u_btxs; grid%u_btxe = factor_u*s_u_btxe; grid%u_btys = factor_u*s_u_btys; grid%u_btye = factor_u*s_u_btye
1934 grid%v_bxs = factor_v*s_v_bxs; grid%v_bxe = factor_v*s_v_bxe; grid%v_bys = factor_v*s_v_bys; grid%v_bye = factor_v*s_v_bye
1935 grid%v_btxs = factor_v*s_v_btxs; grid%v_btxe = factor_v*s_v_btxe; grid%v_btys = factor_v*s_v_btys; grid%v_btye = factor_v*s_v_btye
1936 grid%w_bxs = factor_w*s_w_bxs; grid%w_bxe = factor_w*s_w_bxe; grid%w_bys = factor_w*s_w_bys; grid%w_bye = factor_w*s_w_bye
1937 grid%w_btxs = factor_w*s_w_btxs; grid%w_btxe = factor_w*s_w_btxe; grid%w_btys = factor_w*s_w_btys; grid%w_btye = factor_w*s_w_btye
1938 grid%ph_bxs = factor_ph*s_ph_bxs; grid%ph_bxe = factor_ph*s_ph_bxe; grid%ph_bys = factor_ph*s_ph_bys; grid%ph_bye = factor_ph*s_ph_bye
1939 grid%ph_btxs = factor_ph*s_ph_btxs; grid%ph_btxe = factor_ph*s_ph_btxe; grid%ph_btys = factor_ph*s_ph_btys; grid%ph_btye = factor_ph*s_ph_btye
1940 grid%t_bxs = factor_t*s_t_bxs; grid%t_bxe = factor_t*s_t_bxe; grid%t_bys = factor_t*s_t_bys; grid%t_bye = factor_t*s_t_bye
1941 grid%t_btxs = factor_t*s_t_btxs; grid%t_btxe = factor_t*s_t_btxe; grid%t_btys = factor_t*s_t_btys; grid%t_btye = factor_t*s_t_btye
1942 grid%mu_bxs = factor_mu*s_mu_bxs; grid%mu_bxe = factor_mu*s_mu_bxe; grid%mu_bys = factor_mu*s_mu_bys; grid%mu_bye = factor_mu*s_mu_bye
1943 grid%mu_btxs = factor_mu*s_mu_btxs; grid%mu_btxe = factor_mu*s_mu_btxe; grid%mu_btys = factor_mu*s_mu_btys; grid%mu_btye = factor_mu*s_mu_btye
1944 grid%moist_bxs = factor_moist*s_moist_bxs; grid%moist_bxe = factor_moist*s_moist_bxe; grid%moist_bys = factor_moist*s_moist_bys; grid%moist_bye = factor_moist*s_moist_bye
1945 grid%moist_btxs = factor_moist*s_moist_btxs; grid%moist_btxe = factor_moist*s_moist_btxe; grid%moist_btys = factor_moist*s_moist_btys; grid%moist_btye = factor_moist*s_moist_btye
1946 grid%tracer_bxs = factor_tracer*s_tracer_bxs; grid%tracer_bxe = factor_tracer*s_tracer_bxe; grid%tracer_bys = factor_tracer*s_tracer_bys; grid%tracer_bye = factor_tracer*s_tracer_bye
1947 grid%tracer_btxs = factor_tracer*s_tracer_btxs; grid%tracer_btxe = factor_tracer*s_tracer_btxe; grid%tracer_btys = factor_tracer*s_tracer_btys; grid%tracer_btye = factor_tracer*s_tracer_btye
1948 grid%scalar_bxs = s_scalar_bxs; grid%scalar_bxe = s_scalar_bxe; grid%scalar_bys = s_scalar_bys; grid%scalar_bye = s_scalar_bye
1949 grid%scalar_btxs = s_scalar_btxs; grid%scalar_btxe = s_scalar_btxe; grid%scalar_btys = s_scalar_btys; grid%scalar_btye = s_scalar_btye
1952 END SUBROUTINE add_grid
1954 SUBROUTINE inner_dot ( grid, save, its, ite, jts, jte )
1955 TYPE (domain), INTENT(IN) :: grid
1956 INTEGER, INTENT(IN) :: its, ite, jts, jte
1957 REAL, INTENT(INOUT) :: save
1958 INTEGER :: i, k, j, mm
1960 DO j = jts,MIN(jte,jde-1)
1964 + (grid%u_2(i,k,j)-b_u_2(i,k,j)) * (grid%u_2(i,k,j)-b_u_2(i,k,j))
1971 DO i = its,MIN(ite,ide-1)
1973 + (grid%v_2(i,k,j)-b_v_2(i,k,j)) * (grid%v_2(i,k,j)-b_v_2(i,k,j))
1978 DO j = jts,MIN(jte,jde-1)
1980 DO i = its,MIN(ite,ide-1)
1982 + (grid%w_2(i,k,j)-b_w_2(i,k,j)) * (grid%w_2(i,k,j)-b_w_2(i,k,j))
1987 DO j = jts,MIN(jte,jde-1)
1989 DO i = its,MIN(ite,ide-1)
1991 + (grid%ph_2(i,k,j)-b_ph_2(i,k,j)) * (grid%ph_2(i,k,j)-b_ph_2(i,k,j))
1996 DO j = jts,MIN(jte,jde-1)
1998 DO i = its,MIN(ite,ide-1)
2000 + (grid%t_2(i,k,j)-b_t_2(i,k,j)) * (grid%t_2(i,k,j)-b_t_2(i,k,j))
2006 DO j = jts,MIN(jte,jde-1)
2007 DO i = its,MIN(ite,ide-1)
2009 + (grid%mu_2(i,j)-b_mu_2(i,j)) * (grid%mu_2(i,j)-b_mu_2(i,j))
2013 DO mm = PARAM_FIRST_SCALAR, num_moist
2014 DO j = jts,MIN(jte,jde-1)
2016 DO i = its,MIN(ite,ide-1)
2017 save = save + (grid%moist(i,k,j,mm)-b_moist(i,k,j,mm)) * (grid%moist(i,k,j,mm)-b_moist(i,k,j,mm))
2023 DO mm = PARAM_FIRST_SCALAR, num_tracer
2024 DO j = jts,MIN(jte,jde-1)
2026 DO i = its,MIN(ite,ide-1)
2027 save = save + (grid%tracer(i,k,j,mm)-b_tracer(i,k,j,mm)) * (grid%tracer(i,k,j,mm)-b_tracer(i,k,j,mm))
2033 DO j = jts,MIN(jte,jde-1)
2035 DO i = its,MIN(ite,ide-1)
2037 + (grid%h_diabatic(i,k,j)-b_h_diabatic(i,k,j)) * (grid%h_diabatic(i,k,j)-b_h_diabatic(i,k,j))
2042 DO j = jts,MIN(jte,jde-1)
2044 DO i = its,MIN(ite,ide-1)
2046 + (grid%qv_diabatic(i,k,j)-b_qv_diabatic(i,k,j)) * (grid%qv_diabatic(i,k,j)-b_qv_diabatic(i,k,j))
2051 DO j = jts,MIN(jte,jde-1)
2053 DO i = its,MIN(ite,ide-1)
2055 + (grid%qc_diabatic(i,k,j)-b_qc_diabatic(i,k,j)) * (grid%qc_diabatic(i,k,j)-b_qc_diabatic(i,k,j))
2060 DO j = jts,MIN(jte,jde-1)
2062 DO i = its,MIN(ite,ide-1)
2064 + (grid%p(i,k,j)-b_p(i,k,j)) * (grid%p(i,k,j)-b_p(i,k,j))
2069 DO j = jts,MIN(jte,jde-1)
2070 DO i = its,MIN(ite,ide-1)
2071 save = save + (grid%rainnc(i,j)-b_rainnc(i,j)) * (grid%rainnc(i,j)-b_rainnc(i,j)) &
2072 + (grid%rainncv(i,j)-b_rainncv(i,j)) * (grid%rainncv(i,j)-b_rainncv(i,j))
2076 DO j = jts,MIN(jte,jde-1)
2077 DO i = its,MIN(ite,ide-1)
2078 save = save + (grid%rainc(i,j)-b_rainc(i,j)) * (grid%rainc(i,j)-b_rainc(i,j)) &
2079 + (grid%raincv(i,j)-b_raincv(i,j)) * (grid%raincv(i,j)-b_raincv(i,j))
2083 IF ( gwd_opt .EQ. 1 ) THEN
2084 DO j = jts,MIN(jte,jde-1)
2086 DO i = its,MIN(ite,ide-1)
2087 save = save + (grid%dtaux3d(i,k,j)-b_dtaux3d(i,k,j)) * (grid%dtaux3d(i,k,j)-b_dtaux3d(i,k,j)) &
2088 + (grid%dtauy3d(i,k,j)-b_dtauy3d(i,k,j)) * (grid%dtauy3d(i,k,j)-b_dtauy3d(i,k,j))
2093 DO j = jts,MIN(jte,jde-1)
2094 DO i = its,MIN(ite,ide-1)
2095 save = save + (grid%dusfcg(i,j)-b_dusfcg(i,j)) * (grid%dusfcg(i,j)-b_dusfcg(i,j)) &
2096 + (grid%dvsfcg(i,j)-b_dvsfcg(i,j)) * (grid%dvsfcg(i,j)-b_dvsfcg(i,j))
2102 END SUBROUTINE inner_dot
2104 SUBROUTINE copy_g_to_a_adjtest ( grid, its, ite, jts, jte )
2105 TYPE (domain), INTENT(INOUT) :: grid
2106 INTEGER, INTENT(IN) :: its, ite, jts, jte
2107 INTEGER :: i, k, j, mm
2109 CALL zero_out_ad ( grid )
2111 DO j = jts,MIN(jte,jde-1)
2114 grid%a_u_2(i,k,j) = grid%g_u_2(i,k,j)
2121 DO i = its,MIN(ite,ide-1)
2122 grid%a_v_2(i,k,j) = grid%g_v_2(i,k,j)
2127 DO j = jts,MIN(jte,jde-1)
2129 DO i = its,MIN(ite,ide-1)
2130 grid%a_w_2(i,k,j) = grid%g_w_2(i,k,j)
2135 DO j = jts,MIN(jte,jde-1)
2137 DO i = its,MIN(ite,ide-1)
2138 grid%a_t_2(i,k,j) = grid%g_t_2(i,k,j)
2143 DO j = jts,MIN(jte,jde-1)
2145 DO i = its,MIN(ite,ide-1)
2146 grid%a_ph_2(i,k,j) = grid%g_ph_2(i,k,j)
2151 DO j = jts,MIN(jte,jde-1)
2152 DO i = its,MIN(ite,ide-1)
2153 grid%a_mu_2(i,j) = grid%g_mu_2(i,j)
2157 DO mm = PARAM_FIRST_SCALAR, num_moist
2158 DO j = jts,MIN(jte,jde-1)
2160 DO i = its,MIN(ite,ide-1)
2161 grid%a_moist(i,k,j,mm) = grid%g_moist(i,k,j,mm)
2167 DO mm = PARAM_FIRST_SCALAR, num_tracer
2168 DO j = jts,MIN(jte,jde-1)
2170 DO i = its,MIN(ite,ide-1)
2171 grid%a_tracer(i,k,j,mm) = grid%g_tracer(i,k,j,mm)
2177 DO mm = PARAM_FIRST_SCALAR, num_scalar
2178 DO j = jts,MIN(jte,jde-1)
2180 DO i = its,MIN(ite,ide-1)
2181 grid%a_scalar(i,k,j,mm) = grid%g_scalar(i,k,j,mm)
2187 DO j = jts,MIN(jte,jde-1)
2189 DO i = its,MIN(ite,ide-1)
2190 grid%a_h_diabatic(i,k,j) = grid%g_h_diabatic(i,k,j)
2191 grid%a_qv_diabatic(i,k,j) = grid%g_qv_diabatic(i,k,j)
2192 grid%a_qc_diabatic(i,k,j) = grid%g_qc_diabatic(i,k,j)
2197 DO j = jts,MIN(jte,jde-1)
2198 DO i = its,MIN(ite,ide-1)
2199 grid%a_rainnc(i,j) = grid%g_rainnc(i,j)
2200 grid%a_rainncv(i,j) = grid%g_rainncv(i,j)
2202 grid%a_rainc(i,j) = grid%g_rainc(i,j)
2203 grid%a_raincv(i,j) = grid%g_raincv(i,j)
2207 DO j = jts,MIN(jte,jde-1)
2209 DO i = its,MIN(ite,ide-1)
2210 grid%a_p(i,k,j) = grid%g_p(i,k,j)
2215 IF ( gwd_opt .EQ. 1 ) THEN
2216 DO j = jts,MIN(jte,jde-1)
2218 DO i = its,MIN(ite,ide-1)
2219 grid%a_dtaux3d(i,k,j) = grid%g_dtaux3d(i,k,j)
2220 grid%a_dtauy3d(i,k,j) = grid%g_dtauy3d(i,k,j)
2224 DO j = jts,MIN(jte,jde-1)
2225 DO i = its,MIN(ite,ide-1)
2226 grid%a_dusfcg(i,j) = grid%g_dusfcg(i,j)
2227 grid%a_dvsfcg(i,j) = grid%g_dvsfcg(i,j)
2233 END SUBROUTINE copy_g_to_a_adjtest
2235 SUBROUTINE zero_out_ad ( grid )
2236 TYPE (domain), INTENT(INOUT) :: grid
2261 grid%a_h_diabatic = 0.0
2262 grid%a_qv_diabatic = 0.0
2263 grid%a_qc_diabatic = 0.0
2266 grid%a_rainncv = 0.0
2288 grid%a_p_hyd_w = 0.0
2297 grid%a_nba_mij = 0.0
2298 grid%a_nba_rij = 0.0
2299 grid%a_defor11 = 0.0
2300 grid%a_defor22 = 0.0
2301 grid%a_defor33 = 0.0
2302 grid%a_defor12 = 0.0
2303 grid%a_defor13 = 0.0
2304 grid%a_defor23 = 0.0
2310 grid%a_ru_tend = 0.0
2311 grid%a_rv_tend = 0.0
2315 grid%a_rthften = 0.0
2316 grid%a_rqvften = 0.0
2323 grid%a_rublten = 0.0
2324 grid%a_rvblten = 0.0
2325 grid%a_rqvblten = 0.0
2331 IF ( gwd_opt .EQ. 1 ) THEN
2332 grid%a_dtaux3d = 0.0
2333 grid%a_dtauy3d = 0.0
2338 grid%a_u_bxs = 0.0; grid%a_u_bxe = 0.0; grid%a_u_bys = 0.0; grid%a_u_bye = 0.0
2339 grid%a_v_bxs = 0.0; grid%a_v_bxe = 0.0; grid%a_v_bys = 0.0; grid%a_v_bye = 0.0
2340 grid%a_w_bxs = 0.0; grid%a_w_bxe = 0.0; grid%a_w_bys = 0.0; grid%a_w_bye = 0.0
2341 grid%a_ph_bxs = 0.0; grid%a_ph_bxe = 0.0; grid%a_ph_bys = 0.0; grid%a_ph_bye = 0.0
2342 grid%a_t_bxs = 0.0; grid%a_t_bxe = 0.0; grid%a_t_bys = 0.0; grid%a_t_bye = 0.0
2343 grid%a_mu_bxs = 0.0; grid%a_mu_bxe = 0.0; grid%a_mu_bys = 0.0; grid%a_mu_bye = 0.0
2344 grid%a_moist_bxs = 0.0; grid%a_moist_bxe = 0.0; grid%a_moist_bys = 0.0; grid%a_moist_bye = 0.0
2345 grid%a_tracer_bxs = 0.0; grid%a_tracer_bxe = 0.0; grid%a_tracer_bys = 0.0; grid%a_tracer_bye = 0.0
2346 grid%a_scalar_bxs = 0.0; grid%a_scalar_bxe = 0.0; grid%a_scalar_bys = 0.0; grid%a_scalar_bye = 0.0
2348 grid%a_u_btxs = 0.0; grid%a_u_btxe = 0.0; grid%a_u_btys = 0.0; grid%a_u_btye = 0.0
2349 grid%a_v_btxs = 0.0; grid%a_v_btxe = 0.0; grid%a_v_btys = 0.0; grid%a_v_btye = 0.0
2350 grid%a_w_btxs = 0.0; grid%a_w_btxe = 0.0; grid%a_w_btys = 0.0; grid%a_w_btye = 0.0
2351 grid%a_ph_btxs = 0.0; grid%a_ph_btxe = 0.0; grid%a_ph_btys = 0.0; grid%a_ph_btye = 0.0
2352 grid%a_t_btxs = 0.0; grid%a_t_btxe = 0.0; grid%a_t_btys = 0.0; grid%a_t_btye = 0.0
2353 grid%a_mu_btxs = 0.0; grid%a_mu_btxe = 0.0; grid%a_mu_btys = 0.0; grid%a_mu_btye = 0.0
2354 grid%a_moist_btxs = 0.0; grid%a_moist_btxe = 0.0; grid%a_moist_btys = 0.0; grid%a_moist_btye = 0.0
2355 grid%a_tracer_btxs = 0.0; grid%a_tracer_btxe = 0.0; grid%a_tracer_btys = 0.0; grid%a_tracer_btye = 0.0
2356 grid%a_scalar_btxs = 0.0; grid%a_scalar_btxe = 0.0; grid%a_scalar_btys = 0.0; grid%a_scalar_btye = 0.0
2359 END SUBROUTINE zero_out_ad
2362 SUBROUTINE zero_out_tl ( grid )
2363 TYPE (domain), INTENT(INOUT) :: grid
2388 grid%g_h_diabatic = 0.0
2389 grid%g_qv_diabatic = 0.0
2390 grid%g_qc_diabatic = 0.0
2393 grid%g_rainncv = 0.0
2415 grid%g_p_hyd_w = 0.0
2424 grid%g_nba_mij = 0.0
2425 grid%g_nba_rij = 0.0
2426 grid%g_defor11 = 0.0
2427 grid%g_defor22 = 0.0
2428 grid%g_defor33 = 0.0
2429 grid%g_defor12 = 0.0
2430 grid%g_defor13 = 0.0
2431 grid%g_defor23 = 0.0
2437 grid%g_ru_tend = 0.0
2438 grid%g_rv_tend = 0.0
2442 grid%g_rthften = 0.0
2443 grid%g_rqvften = 0.0
2450 grid%g_rublten = 0.0
2451 grid%g_rvblten = 0.0
2452 grid%g_rqvblten = 0.0
2459 IF ( gwd_opt .EQ. 1 ) THEN
2460 grid%g_dtaux3d = 0.0
2461 grid%g_dtauy3d = 0.0
2466 grid%g_u_bxs = 0.0; grid%g_u_bxe = 0.0; grid%g_u_bys = 0.0; grid%g_u_bye = 0.0
2467 grid%g_v_bxs = 0.0; grid%g_v_bxe = 0.0; grid%g_v_bys = 0.0; grid%g_v_bye = 0.0
2468 grid%g_w_bxs = 0.0; grid%g_w_bxe = 0.0; grid%g_w_bys = 0.0; grid%g_w_bye = 0.0
2469 grid%g_ph_bxs = 0.0; grid%g_ph_bxe = 0.0; grid%g_ph_bys = 0.0; grid%g_ph_bye = 0.0
2470 grid%g_t_bxs = 0.0; grid%g_t_bxe = 0.0; grid%g_t_bys = 0.0; grid%g_t_bye = 0.0
2471 grid%g_mu_bxs = 0.0; grid%g_mu_bxe = 0.0; grid%g_mu_bys = 0.0; grid%g_mu_bye = 0.0
2472 grid%g_moist_bxs = 0.0; grid%g_moist_bxe = 0.0; grid%g_moist_bys = 0.0; grid%g_moist_bye = 0.0
2473 grid%g_tracer_bxs = 0.0; grid%g_tracer_bxe = 0.0; grid%g_tracer_bys = 0.0; grid%g_tracer_bye = 0.0
2474 grid%g_scalar_bxs = 0.0; grid%g_scalar_bxe = 0.0; grid%g_scalar_bys = 0.0; grid%g_scalar_bye = 0.0
2476 grid%g_u_btxs = 0.0; grid%g_u_btxe = 0.0; grid%g_u_btys = 0.0; grid%g_u_btye = 0.0
2477 grid%g_v_btxs = 0.0; grid%g_v_btxe = 0.0; grid%g_v_btys = 0.0; grid%g_v_btye = 0.0
2478 grid%g_w_btxs = 0.0; grid%g_w_btxe = 0.0; grid%g_w_btys = 0.0; grid%g_w_btye = 0.0
2479 grid%g_ph_btxs = 0.0; grid%g_ph_btxe = 0.0; grid%g_ph_btys = 0.0; grid%g_ph_btye = 0.0
2480 grid%g_t_btxs = 0.0; grid%g_t_btxe = 0.0; grid%g_t_btys = 0.0; grid%g_t_btye = 0.0
2481 grid%g_mu_btxs = 0.0; grid%g_mu_btxe = 0.0; grid%g_mu_btys = 0.0; grid%g_mu_btye = 0.0
2482 grid%g_moist_btxs = 0.0; grid%g_moist_btxe = 0.0; grid%g_moist_btys = 0.0; grid%g_moist_btye = 0.0
2483 grid%g_tracer_btxs = 0.0; grid%g_tracer_btxe = 0.0; grid%g_tracer_btys = 0.0; grid%g_tracer_btye = 0.0
2484 grid%g_scalar_btxs = 0.0; grid%g_scalar_btxe = 0.0; grid%g_scalar_btys = 0.0; grid%g_scalar_btye = 0.0
2487 END SUBROUTINE zero_out_tl
2489 SUBROUTINE inner_dot_a_b_adjtest ( grid, save, its, ite, jts, jte )
2490 TYPE (domain), INTENT(IN) :: grid
2491 INTEGER, INTENT(IN) :: its, ite, jts, jte
2492 REAL, INTENT(INOUT) :: save
2493 INTEGER :: i, k, j, mm
2494 INTEGER :: is, ie, js, je
2501 IF (its .eq. ids) is = ims
2502 IF (ite .eq. ide) ie = ime
2503 IF (jts .eq. jds) js = jms
2504 IF (jte .eq. jde) je = jme
2506 DO j = jts,MIN(jte,jde-1)
2509 save = save + grid%a_u_2(i,k,j) * b_u_2(i,k,j)
2516 DO i = its,MIN(ite,ide-1)
2517 save = save + grid%a_v_2(i,k,j) * b_v_2(i,k,j)
2522 DO j = jts,MIN(jte,jde-1)
2524 DO i = its,MIN(ite,ide-1)
2525 save = save + grid%a_w_2(i,k,j) * b_w_2(i,k,j) &
2526 + grid%a_ph_2(i,k,j) * b_ph_2(i,k,j)
2531 DO j = jts,MIN(jte,jde-1)
2533 DO i = its,MIN(ite,ide-1)
2534 save = save + grid%a_t_2(i,k,j) * b_t_2(i,k,j)
2539 DO j = jts,MIN(jte,jde-1)
2541 DO i = its,MIN(ite,ide-1)
2542 save = save + grid%a_tke_2(i,k,j) * b_tke_2(i,k,j)
2547 DO j = jts,MIN(jte,jde-1)
2549 DO i = its,MIN(ite,ide-1)
2550 save = save + grid%a_p(i,k,j) * b_p(i,k,j)
2555 !DO j = jts,MIN(jte,jde-1)
2557 !DO i = its,MIN(ite,ide-1)
2558 ! save = save + grid%a_al(i,k,j) * b_al(i,k,j)
2563 DO j = jts,MIN(jte,jde-1)
2565 DO i = its,MIN(ite,ide-1)
2566 save = save + grid%a_h_diabatic(i,k,j) * b_h_diabatic(i,k,j)
2571 DO j = jts,MIN(jte,jde-1)
2573 DO i = its,MIN(ite,ide-1)
2574 save = save + grid%a_qv_diabatic(i,k,j) * b_qv_diabatic(i,k,j)
2579 DO j = jts,MIN(jte,jde-1)
2581 DO i = its,MIN(ite,ide-1)
2582 save = save + grid%a_qc_diabatic(i,k,j) * b_qc_diabatic(i,k,j)
2587 !DO j = jts,MIN(jte,jde-1)
2588 !DO i = its,MIN(ite,ide-1)
2589 ! save = save + grid%a_ustm(i,j) * b_ustm(i,j)
2593 !DO j = jts,MIN(jte,jde-1)
2594 !DO i = its,MIN(ite,ide-1)
2595 ! save = save + grid%a_hfx(i,j) * b_hfx(i,j)
2599 !DO j = jts,MIN(jte,jde-1)
2600 !DO i = its,MIN(ite,ide-1)
2601 ! save = save + grid%a_qfx(i,j) * b_qfx(i,j)
2605 DO j = jts,MIN(jte,jde-1)
2606 DO i = its,MIN(ite,ide-1)
2607 save = save + grid%a_mu_2(i,j) * b_mu_2(i,j)
2611 DO mm = PARAM_FIRST_SCALAR, num_moist
2612 DO j = jts,MIN(jte,jde-1)
2614 DO i = its,MIN(ite,ide-1)
2615 save = save + grid%a_moist(i,k,j,mm) * b_moist(i,k,j,mm)
2621 DO mm = PARAM_FIRST_SCALAR, num_tracer
2622 DO j = jts,MIN(jte,jde-1)
2624 DO i = its,MIN(ite,ide-1)
2625 save = save + grid%a_tracer(i,k,j,mm) * b_tracer(i,k,j,mm)
2631 DO mm = 1, num_scalar
2632 DO j = jts,MIN(jte,jde-1)
2634 DO i = its,MIN(ite,ide-1)
2635 save = save + grid%a_scalar(i,k,j,mm) * b_scalar(i,k,j,mm)
2641 IF ( gwd_opt .EQ. 1 ) THEN
2642 DO j = jts,MIN(jte,jde-1)
2644 DO i = its,MIN(ite,ide-1)
2645 save = save + grid%a_dtaux3d(i,k,j) * b_dtaux3d(i,k,j)
2646 save = save + grid%a_dtauy3d(i,k,j) * b_dtauy3d(i,k,j)
2650 DO j = jts,MIN(jte,jde-1)
2651 DO i = its,MIN(ite,ide-1)
2652 save = save + grid%a_dusfcg(i,j) * b_dusfcg(i,j)
2653 save = save + grid%a_dvsfcg(i,j) * b_dvsfcg(i,j)
2658 DO j=1,spec_bdy_width
2660 DO i=jts,MIN(jte,jde-1)
2661 save=save + grid%a_u_bxs(i,k,j)*b_u_bxs(i,k,j)
2662 save=save + grid%a_u_bxe(i,k,j)*b_u_bxe(i,k,j)
2663 save=save + grid%a_u_btxs(i,k,j)*b_u_btxs(i,k,j)
2664 save=save + grid%a_u_btxe(i,k,j)*b_u_btxe(i,k,j)
2669 DO j=1,spec_bdy_width
2672 save=save + grid%a_v_bxs(i,k,j)*b_v_bxs(i,k,j)
2673 save=save + grid%a_v_bxe(i,k,j)*b_v_bxe(i,k,j)
2674 save=save + grid%a_v_btxs(i,k,j)*b_v_btxs(i,k,j)
2675 save=save + grid%a_v_btxe(i,k,j)*b_v_btxe(i,k,j)
2680 DO j=1,spec_bdy_width
2682 DO i=jts,MIN(jte,jde-1)
2683 save=save + grid%a_t_bxs(i,k,j)*b_t_bxs(i,k,j)
2684 save=save + grid%a_t_bxe(i,k,j)*b_t_bxe(i,k,j)
2685 save=save + grid%a_t_btxs(i,k,j)*b_t_btxs(i,k,j)
2686 save=save + grid%a_t_btxe(i,k,j)*b_t_btxe(i,k,j)
2691 DO j=1,spec_bdy_width
2693 DO i=jts,MIN(jte,jde-1)
2694 save=save + grid%a_w_bxs(i,k,j)*b_w_bxs(i,k,j)
2695 save=save + grid%a_w_bxe(i,k,j)*b_w_bxe(i,k,j)
2696 save=save + grid%a_ph_bxs(i,k,j)*b_ph_bxs(i,k,j)
2697 save=save + grid%a_ph_bxe(i,k,j)*b_ph_bxe(i,k,j)
2698 save=save + grid%a_w_btxs(i,k,j)*b_w_btxs(i,k,j)
2699 save=save + grid%a_w_btxe(i,k,j)*b_w_btxe(i,k,j)
2702 save=save + grid%a_ph_btxs(i,k,j)*b_ph_btxs(i,k,j)
2703 save=save + grid%a_ph_btxe(i,k,j)*b_ph_btxe(i,k,j)
2709 DO j=1,spec_bdy_width
2712 save=save + grid%a_u_bys(i,k,j)*b_u_bys(i,k,j)
2713 save=save + grid%a_u_bye(i,k,j)*b_u_bye(i,k,j)
2714 save=save + grid%a_u_btys(i,k,j)*b_u_btys(i,k,j)
2715 save=save + grid%a_u_btye(i,k,j)*b_u_btye(i,k,j)
2722 DO j=1,spec_bdy_width
2724 DO i=its,MIN(ite,ide-1)
2725 save=save + grid%a_v_bys(i,k,j)*b_v_bys(i,k,j)
2726 save=save + grid%a_v_bye(i,k,j)*b_v_bye(i,k,j)
2727 save=save + grid%a_v_btys(i,k,j)*b_v_btys(i,k,j)
2728 save=save + grid%a_v_btye(i,k,j)*b_v_btye(i,k,j)
2735 DO j=1,spec_bdy_width
2737 DO i=its,MIN(ite,ide-1)
2738 save=save + grid%a_t_bys(i,k,j)*b_t_bys(i,k,j)
2739 save=save + grid%a_t_bye(i,k,j)*b_t_bye(i,k,j)
2740 save=save + grid%a_t_btys(i,k,j)*b_t_btys(i,k,j)
2741 save=save + grid%a_t_btye(i,k,j)*b_t_btye(i,k,j)
2746 DO j=1,spec_bdy_width
2748 DO i=its,MIN(ite,ide-1)
2749 save=save + grid%a_w_bys(i,k,j)*b_w_bys(i,k,j)
2750 save=save + grid%a_w_bye(i,k,j)*b_w_bye(i,k,j)
2751 save=save + grid%a_ph_bys(i,k,j)*b_ph_bys(i,k,j)
2752 save=save + grid%a_ph_bye(i,k,j)*b_ph_bye(i,k,j)
2753 save=save + grid%a_w_btys(i,k,j)*b_w_btys(i,k,j)
2754 save=save + grid%a_w_btye(i,k,j)*b_w_btye(i,k,j)
2755 save=save + grid%a_ph_btys(i,k,j)*b_ph_btys(i,k,j)
2756 save=save + grid%a_ph_btye(i,k,j)*b_ph_btye(i,k,j)
2762 DO j=1,spec_bdy_width
2764 DO i=jts,MIN(jte,jde-1)
2765 save=save + grid%a_mu_bxs(i,k,j)*b_mu_bxs(i,k,j)
2766 save=save + grid%a_mu_bxe(i,k,j)*b_mu_bxe(i,k,j)
2767 save=save + grid%a_mu_btxs(i,k,j)*b_mu_btxs(i,k,j)
2768 save=save + grid%a_mu_btxe(i,k,j)*b_mu_btxe(i,k,j)
2774 DO j=1,spec_bdy_width
2776 DO i=its,MIN(ite,ide-1)
2777 save=save + grid%a_mu_bys(i,k,j)*b_mu_bys(i,k,j)
2778 save=save + grid%a_mu_bye(i,k,j)*b_mu_bye(i,k,j)
2779 save=save + grid%a_mu_btys(i,k,j)*b_mu_btys(i,k,j)
2780 save=save + grid%a_mu_btye(i,k,j)*b_mu_btye(i,k,j)
2786 DO mm=PARAM_FIRST_SCALAR, num_moist
2787 DO j=1,spec_bdy_width
2789 DO i=jts,MIN(jte,jde-1)
2790 save=save + grid%a_moist_bxs(i,k,j,mm)*b_moist_bxs(i,k,j,mm)
2791 save=save + grid%a_moist_bxe(i,k,j,mm)*b_moist_bxe(i,k,j,mm)
2792 save=save + grid%a_moist_btxs(i,k,j,mm)*b_moist_btxs(i,k,j,mm)
2793 save=save + grid%a_moist_btxe(i,k,j,mm)*b_moist_btxe(i,k,j,mm)
2800 DO mm=PARAM_FIRST_SCALAR, num_moist
2801 DO j=1,spec_bdy_width
2803 DO i=its,MIN(ite,ide-1)
2804 save=save + grid%a_moist_bys(i,k,j,mm)*b_moist_bys(i,k,j,mm)
2805 save=save + grid%a_moist_bye(i,k,j,mm)*b_moist_bye(i,k,j,mm)
2806 save=save + grid%a_moist_btys(i,k,j,mm)*b_moist_btys(i,k,j,mm)
2807 save=save + grid%a_moist_btye(i,k,j,mm)*b_moist_btye(i,k,j,mm)
2814 DO mm=PARAM_FIRST_SCALAR, num_tracer
2815 DO j=1,spec_bdy_width
2817 DO i=jts,MIN(jte,jde-1)
2818 save=save + grid%a_tracer_bxs(i,k,j,mm)*b_tracer_bxs(i,k,j,mm)
2819 save=save + grid%a_tracer_bxe(i,k,j,mm)*b_tracer_bxe(i,k,j,mm)
2820 save=save + grid%a_tracer_btxs(i,k,j,mm)*b_tracer_btxs(i,k,j,mm)
2821 save=save + grid%a_tracer_btxe(i,k,j,mm)*b_tracer_btxe(i,k,j,mm)
2828 DO mm=PARAM_FIRST_SCALAR, num_tracer
2829 DO j=1,spec_bdy_width
2831 DO i=its,MIN(ite,ide-1)
2832 save=save + grid%a_tracer_bys(i,k,j,mm)*b_tracer_bys(i,k,j,mm)
2833 save=save + grid%a_tracer_bye(i,k,j,mm)*b_tracer_bye(i,k,j,mm)
2834 save=save + grid%a_tracer_btys(i,k,j,mm)*b_tracer_btys(i,k,j,mm)
2835 save=save + grid%a_tracer_btye(i,k,j,mm)*b_tracer_btye(i,k,j,mm)
2842 ! DO mm=1,num_scalar
2843 ! DO j=1,spec_bdy_width
2846 ! save=save + grid%a_scalar_bxs(i,k,j,mm)*b_scalar_bxs(i,k,j,mm)
2847 ! save=save + grid%a_scalar_bxe(i,k,j,mm)*b_scalar_bxe(i,k,j,mm)
2848 ! save=save + grid%a_scalar_btxs(i,k,j,mm)*b_scalar_btxs(i,k,j,mm)
2849 ! save=save + grid%a_scalar_btxe(i,k,j,mm)*b_scalar_btxe(i,k,j,mm)
2855 ! DO mm=1,num_scalar
2856 ! DO j=1,spec_bdy_width
2859 ! save=save + grid%a_scalar_bys(i,k,j,mm)*b_scalar_bys(i,k,j,mm)
2860 ! save=save + grid%a_scalar_bye(i,k,j,mm)*b_scalar_bye(i,k,j,mm)
2861 ! save=save + grid%a_scalar_btys(i,k,j,mm)*b_scalar_btys(i,k,j,mm)
2862 ! save=save + grid%a_scalar_btye(i,k,j,mm)*b_scalar_btye(i,k,j,mm)
2869 END SUBROUTINE inner_dot_a_b_adjtest
2871 SUBROUTINE spot_force_ad ( grid, i, j, k, factor, nvars )
2872 TYPE (domain), INTENT(INOUT) :: grid
2873 INTEGER, INTENT(IN) :: i, j, k, nvars
2874 REAL, DIMENSION(nvars), INTENT(IN) :: factor
2877 grid%a_u_2(i,k,j) = factor(1)
2878 grid%a_v_2(i,k,j) = factor(2)
2879 grid%a_w_2(i,k,j) = factor(3)
2880 grid%a_t_2(i,k,j) = factor(4)
2881 grid%a_ph_2(i,k,j) = factor(5)
2882 grid%a_mu_2(i,j) = factor(6)
2884 DO mm = PARAM_FIRST_SCALAR, num_moist
2885 grid%a_moist(i,k,j,mm) = factor(6+mm)
2887 DO mm = PARAM_FIRST_SCALAR, num_tracer
2888 grid%a_tracer(i,k,j,mm) = factor(6+mm+num_moist)
2891 END SUBROUTINE spot_force_ad
2894 SUBROUTINE spot_force_tl ( grid, i, j, k, factor, nvars )
2895 TYPE (domain), INTENT(INOUT) :: grid
2896 INTEGER, INTENT(IN) :: i, j, k, nvars
2897 REAL, DIMENSION(nvars), INTENT(IN) :: factor
2900 grid%g_u_2(i,k,j) = factor(1)
2901 grid%g_v_2(i,k,j) = factor(2)
2902 grid%g_w_2(i,k,j) = factor(3)
2903 grid%g_t_2(i,k,j) = factor(4)
2904 grid%g_ph_2(i,k,j) = factor(5)
2905 grid%g_mu_2(i,j) = factor(6)
2907 DO mm = PARAM_FIRST_SCALAR, num_moist
2908 grid%g_moist(i,k,j,mm) = factor(6+mm)
2910 DO mm = PARAM_FIRST_SCALAR, num_tracer
2911 grid%g_tracer(i,k,j,mm) = factor(6+mm+num_moist)
2914 END SUBROUTINE spot_force_tl
2917 SUBROUTINE spot_force_nl ( grid, i, j, k, factor, nvars, nl_pert )
2918 TYPE (domain), INTENT(INOUT) :: grid
2919 INTEGER, INTENT(IN) :: i, j, k, nvars
2920 REAL, DIMENSION(nvars), INTENT(IN) :: factor
2921 REAL, INTENT(IN) :: nl_pert
2924 grid%u_2(i,k,j) = ( 1.0 + nl_pert * factor(1) ) * s_u_2(i,k,j)
2925 grid%v_2(i,k,j) = ( 1.0 + nl_pert * factor(2) ) * s_v_2(i,k,j)
2926 grid%w_2(i,k,j) = ( 1.0 + nl_pert * factor(3) ) * s_w_2(i,k,j)
2927 grid%t_2(i,k,j) = ( 1.0 + nl_pert * factor(4) ) * s_t_2(i,k,j)
2928 grid%ph_2(i,k,j) = ( 1.0 + nl_pert * factor(5) ) * s_ph_2(i,k,j)
2929 grid%mu_2(i,j) = ( 1.0 + nl_pert * factor(6) ) * s_mu_2(i,j)
2931 DO mm = PARAM_FIRST_SCALAR, num_moist
2932 grid%moist(i,k,j,mm) = ( 1.0 + nl_pert * factor(6+mm) ) * s_moist(i,k,j,mm)
2934 DO mm = PARAM_FIRST_SCALAR, num_tracer
2935 grid%tracer(i,k,j,mm) = ( 1.0 + nl_pert * factor(6+mm+num_moist) ) * s_tracer(i,k,j,mm)
2938 END SUBROUTINE spot_force_nl
2941 SUBROUTINE extract_ad_der ( grid, der, i, j , k, factor, nvars )
2942 TYPE (domain), INTENT(INOUT) :: grid
2943 INTEGER, INTENT(IN) :: i, j, k, nvars
2944 REAL, DIMENSION(nvars), INTENT(IN) :: factor
2945 REAL, INTENT(OUT) :: der
2949 der = grid%a_u_2(i,k,j) * factor(1) + der
2950 der = grid%a_v_2(i,k,j) * factor(2) + der
2951 der = grid%a_w_2(i,k,j) * factor(3) + der
2952 der = grid%a_t_2(i,k,j) * factor(4) + der
2953 der = grid%a_ph_2(i,k,j) * factor(5) + der
2954 der = grid%a_mu_2(i,j) * factor(6) + der
2956 DO mm = PARAM_FIRST_SCALAR, num_moist
2957 der = grid%a_moist(i,k,j,mm) * factor(6+mm) + der
2959 DO mm = PARAM_FIRST_SCALAR, num_tracer
2960 der = grid%a_tracer(i,k,j,mm) * factor(6+mm+num_moist) + der
2963 END SUBROUTINE extract_ad_der
2966 SUBROUTINE extract_tl_der ( grid, der, i, j , k, factor, nvars )
2967 TYPE (domain), INTENT(INOUT) :: grid
2968 INTEGER, INTENT(IN) :: i, j, k, nvars
2969 REAL, DIMENSION(nvars), INTENT(IN) :: factor
2970 REAL, INTENT(OUT) :: der
2973 der = grid%g_u_2(i,k,j) * factor(1) + der
2974 der = grid%g_v_2(i,k,j) * factor(2) + der
2975 der = grid%g_w_2(i,k,j) * factor(3) + der
2976 der = grid%g_t_2(i,k,j) * factor(4) + der
2977 der = grid%g_ph_2(i,k,j) * factor(5) + der
2978 der = grid%g_mu_2(i,j) * factor(6) + der
2980 DO mm = PARAM_FIRST_SCALAR, num_moist
2981 der = grid%g_moist(i,k,j,mm) * factor(6+mm) + der
2983 DO mm = PARAM_FIRST_SCALAR, num_tracer
2984 der = grid%g_tracer(i,k,j,mm) * factor(6+mm+num_moist) + der
2987 END SUBROUTINE extract_tl_der
2990 SUBROUTINE extract_nl_num ( grid, num, i, j , k, factor, nvars )
2991 TYPE (domain), INTENT(INOUT) :: grid
2992 INTEGER, INTENT(IN) :: i, j, k, nvars
2993 REAL, DIMENSION(nvars), INTENT(IN) :: factor
2994 REAL, INTENT(OUT) :: num
2998 num = (grid%u_2(i,k,j) - b_u_2(i,k,j)) * factor(1) + num
2999 num = (grid%v_2(i,k,j) - b_v_2(i,k,j)) * factor(2) + num
3000 num = (grid%w_2(i,k,j) - b_w_2(i,k,j)) * factor(3) + num
3001 num = (grid%t_2(i,k,j) - b_t_2(i,k,j)) * factor(4) + num
3002 num = (grid%ph_2(i,k,j) - b_ph_2(i,k,j)) * factor(5) + num
3003 num = (grid%mu_2(i,j) - b_mu_2(i,j)) * factor(6) + num
3005 DO mm = PARAM_FIRST_SCALAR, num_moist
3006 num = (grid%moist(i,k,j,mm) - b_moist(i,k,j,mm)) * factor(6+mm) + num
3008 DO mm = PARAM_FIRST_SCALAR, num_tracer
3009 num = (grid%tracer(i,k,j,mm) - b_tracer(i,k,j,mm)) * factor(6+mm+num_moist) + num
3012 END SUBROUTINE extract_nl_num
3015 SUBROUTINE extract_nl_den ( den, i, j, k, factor, nvars, nl_pert )
3016 INTEGER, INTENT(IN) :: i, j, k, nvars
3017 REAL, DIMENSION(nvars), INTENT(IN) :: factor
3018 REAL, INTENT(OUT) :: den
3019 REAL, INTENT(IN) :: nl_pert
3023 den = nl_pert * s_u_2(i,k,j) * factor(1) + den
3024 den = nl_pert * s_v_2(i,k,j) * factor(2) + den
3025 den = nl_pert * s_w_2(i,k,j) * factor(3) + den
3026 den = nl_pert * s_t_2(i,k,j) * factor(4) + den
3027 den = nl_pert * s_ph_2(i,k,j) * factor(5) + den
3028 den = nl_pert * s_mu_2(i,j) * factor(6) + den
3030 DO mm = PARAM_FIRST_SCALAR, num_moist
3031 den = nl_pert * s_moist(i,k,j,mm) * factor(6+mm) + den
3033 DO mm = PARAM_FIRST_SCALAR, num_tracer
3034 den = nl_pert * s_tracer(i,k,j,mm) * factor(6+mm+num_moist) + den
3037 END SUBROUTINE extract_nl_den
3040 SUBROUTINE gen_scenario_matrix(config_flags, scenario, nvars, numer_vars, denom_vars)
3041 TYPE (grid_config_rec_type), INTENT(IN) :: config_flags
3042 INTEGER, INTENT(IN) :: nvars
3043 INTEGER, DIMENSION(nvars,nvars), INTENT(INOUT) :: scenario
3044 INTEGER, DIMENSION(max_sens), INTENT(IN) :: numer_vars, denom_vars
3045 INTEGER :: i, j, k, l
3047 IF(config_flags%scenario_type .EQ. 1) THEN
3048 !List form for test variables (more targeted)
3049 IF(config_flags%max_numer .NE. config_flags%max_denom) THEN
3050 CALL wrf_error_fatal ( &
3051 'share/module_adtl_grid_utilities.f: Failed gen_scenario' )
3053 DO i = 1, config_flags%max_numer
3056 IF ( k .GT. nvars .OR. l .GT. nvars) CYCLE
3060 !Combination form for test variables (only use when you want to cross-reference every variable in the lists)
3061 DO i = 1, config_flags%max_numer
3063 IF ( k .GT. nvars ) CYCLE
3064 DO j = 1, config_flags%max_denom
3066 IF ( l .GT. nvars ) CYCLE
3073 END SUBROUTINE gen_scenario_matrix
3075 SUBROUTINE allocate_locations( filename, locations, nloc, ierr )
3076 INTEGER, EXTERNAL :: get_unused_unit
3078 CHARACTER(LEN=*), INTENT(IN) :: filename
3079 INTEGER, DIMENSION(:,:), ALLOCATABLE, INTENT(INOUT) :: locations
3080 INTEGER, INTENT(OUT) :: nloc, ierr
3081 CHARACTER*256 :: message
3082 INTEGER :: loc, iunit, index1, index2, index3
3084 iunit = get_unused_unit()
3086 FILE=TRIM(filename), &
3088 ACCESS='SEQUENTIAL', &
3091 IF( ierr .NE. 0 ) THEN
3092 WRITE(UNIT=message, FMT='(3(A))') &
3093 'Error reading file ',filename,' in allocate_locations.'
3094 CALL wrf_message(TRIM(message))
3101 READ(UNIT=iunit, FMT='(3(I6))',IOSTAT=ierr) index1, index2, index3
3102 IF( ierr .NE. 0 ) exit points
3107 IF( ierr .LT. 0 ) ALLOCATE(locations(nloc,3))
3109 END SUBROUTINE allocate_locations
3112 SUBROUTINE get_forc_locations( filename, locations, nloc, ierr )
3113 INTEGER, EXTERNAL :: get_unused_unit
3115 CHARACTER(LEN=*), INTENT(IN) :: filename
3116 INTEGER, DIMENSION(nloc,3), INTENT(INOUT) :: locations
3117 INTEGER, INTENT(IN) :: nloc
3118 INTEGER, INTENT(OUT) :: ierr
3119 CHARACTER*256 :: message
3120 INTEGER :: loc, iunit, index1, index2, index3
3122 iunit = get_unused_unit()
3124 FILE=TRIM(filename), &
3126 ACCESS='SEQUENTIAL', &
3129 IF( ierr .NE. 0 ) THEN
3130 WRITE(UNIT=message, FMT='(3(A))') &
3131 'Error reading file ',filename,' in get_forc_locations.'
3132 CALL wrf_message(TRIM(message))
3139 READ(UNIT=iunit, FMT='(3(I6))',IOSTAT=ierr) index1, index2, index3
3140 IF( ierr .NE. 0 ) exit points
3141 locations(loc,1) = index1
3142 locations(loc,2) = index2
3143 locations(loc,3) = index3
3147 END SUBROUTINE get_forc_locations
3149 SUBROUTINE deallocate_grid ( )
3152 DEALLOCATE ( s_scalar, STAT=ierr )
3154 CALL wrf_error_fatal ( &
3155 'share/module_adtl_grid_utilities.f: Failed to deallocate s_scalar. ')
3157 DEALLOCATE ( s_tke_2, STAT=ierr )
3159 CALL wrf_error_fatal ( &
3160 'share/module_adtl_grid_utilities.f: Failed to deallocate s_tke_2. ')
3163 DEALLOCATE ( s_p, STAT=ierr )
3165 CALL wrf_error_fatal ( &
3166 'share/module_adtl_grid_utilities.f: Failed to deallocate s_p. ')
3168 DEALLOCATE ( s_al, STAT=ierr )
3170 CALL wrf_error_fatal ( &
3171 'share/module_adtl_grid_utilities.f: Failed to deallocate s_al. ')
3173 DEALLOCATE ( s_h_diabatic, STAT=ierr )
3175 CALL wrf_error_fatal ( &
3176 'share/module_adtl_grid_utilities.f: Failed to deallocate s_h_diabatic. ')
3178 DEALLOCATE ( s_qv_diabatic, STAT=ierr )
3180 CALL wrf_error_fatal ( &
3181 'share/module_adtl_grid_utilities.f: Failed to deallocate s_qv_diabatic. ')
3183 DEALLOCATE ( s_qc_diabatic, STAT=ierr )
3185 CALL wrf_error_fatal ( &
3186 'share/module_adtl_grid_utilities.f: Failed to deallocate s_qc_diabatic. ')
3189 DEALLOCATE ( s_ustm, STAT=ierr )
3191 CALL wrf_error_fatal ( &
3192 'share/module_adtl_grid_utilities.f: Failed to deallocate s_ustm. ')
3194 DEALLOCATE ( s_hfx, STAT=ierr )
3196 CALL wrf_error_fatal ( &
3197 'share/module_adtl_grid_utilities.f: Failed to deallocate s_hfx. ')
3199 DEALLOCATE ( s_qfx, STAT=ierr )
3201 CALL wrf_error_fatal ( &
3202 'share/module_adtl_grid_utilities.f: Failed to deallocate s_qfx. ')
3205 IF ( gwd_opt .EQ. 1 ) THEN
3207 DEALLOCATE ( s_dtaux3d, STAT=ierr )
3209 CALL wrf_error_fatal ( &
3210 'share/module_adtl_grid_utilities.f: Failed to deallocate s_dtaux3d. ')
3212 DEALLOCATE ( s_dtauy3d, STAT=ierr )
3214 CALL wrf_error_fatal ( &
3215 'share/module_adtl_grid_utilities.f: Failed to deallocate s_dtauy3d. ')
3217 DEALLOCATE ( s_dusfcg, STAT=ierr )
3219 CALL wrf_error_fatal ( &
3220 'share/module_adtl_grid_utilities.f: Failed to deallocate s_dusfcg. ')
3222 DEALLOCATE ( s_dvsfcg, STAT=ierr )
3224 CALL wrf_error_fatal ( &
3225 'share/module_adtl_grid_utilities.f: Failed to deallocate s_dvsfcg. ')
3231 DEALLOCATE(s_scalar_bxs,STAT=ierr)
3233 CALL wrf_error_fatal ( &
3234 'share/module_adtl_grid_utilities.f: Failed to deallocate s_scalar_bxs. ')
3236 DEALLOCATE(s_scalar_bxe,STAT=ierr)
3238 CALL wrf_error_fatal ( &
3239 'share/module_adtl_grid_utilities.f: Failed to deallocate s_scalar_bxe. ')
3241 DEALLOCATE(s_scalar_bys,STAT=ierr)
3243 CALL wrf_error_fatal ( &
3244 'share/module_adtl_grid_utilities.f: Failed to deallocate s_scalar_bys. ')
3246 DEALLOCATE(s_scalar_bye,STAT=ierr)
3248 CALL wrf_error_fatal ( &
3249 'share/module_adtl_grid_utilities.f: Failed to deallocate s_scalar_bye. ')
3251 DEALLOCATE(s_scalar_btxs,STAT=ierr)
3253 CALL wrf_error_fatal ( &
3254 'share/module_adtl_grid_utilities.f: Failed to deallocate s_scalar_btxs. ')
3256 DEALLOCATE(s_scalar_btxe,STAT=ierr)
3258 CALL wrf_error_fatal ( &
3259 'share/module_adtl_grid_utilities.f: Failed to deallocate s_scalar_btxe. ')
3261 DEALLOCATE(s_scalar_btys,STAT=ierr)
3263 CALL wrf_error_fatal ( &
3264 'share/module_adtl_grid_utilities.f: Failed to deallocate s_scalar_btys. ')
3266 DEALLOCATE(s_scalar_btye,STAT=ierr)
3268 CALL wrf_error_fatal ( &
3269 'share/module_adtl_grid_utilities.f: Failed to deallocate s_scalar_btye. ')
3272 DEALLOCATE ( s_u_2, STAT=ierr )
3274 CALL wrf_error_fatal ( &
3275 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_2. ')
3277 DEALLOCATE ( s_v_2, STAT=ierr )
3279 CALL wrf_error_fatal ( &
3280 'share/module_adtl_grid_utilities.f: Failed to deallocate s_v_2. ')
3282 DEALLOCATE ( s_w_2, STAT=ierr )
3284 CALL wrf_error_fatal ( &
3285 'share/module_adtl_grid_utilities.f: Failed to deallocate s_w_2. ')
3287 DEALLOCATE ( s_ph_2, STAT=ierr )
3289 CALL wrf_error_fatal ( &
3290 'share/module_adtl_grid_utilities.f: Failed to deallocate s_ph_2. ')
3292 DEALLOCATE ( s_t_2, STAT=ierr )
3294 CALL wrf_error_fatal ( &
3295 'share/module_adtl_grid_utilities.f: Failed to deallocate s_t_2. ')
3297 DEALLOCATE ( s_mu_2, STAT=ierr )
3299 CALL wrf_error_fatal ( &
3300 'share/module_adtl_grid_utilities.f: Failed to deallocate s_mu_2. ')
3302 DEALLOCATE ( s_moist, STAT=ierr )
3304 CALL wrf_error_fatal ( &
3305 'share/module_adtl_grid_utilities.f: Failed to deallocate s_moist. ')
3307 DEALLOCATE ( s_tracer, STAT=ierr )
3309 CALL wrf_error_fatal ( &
3310 'share/module_adtl_grid_utilities.f: Failed to deallocate s_tracer. ')
3314 DEALLOCATE(s_u_bxs,STAT=ierr)
3316 CALL wrf_error_fatal ( &
3317 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_bxs. ')
3319 DEALLOCATE(s_u_bxe,STAT=ierr)
3321 CALL wrf_error_fatal ( &
3322 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_bxe. ')
3324 DEALLOCATE(s_u_bys,STAT=ierr)
3326 CALL wrf_error_fatal ( &
3327 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_bys. ')
3329 DEALLOCATE(s_u_bye,STAT=ierr)
3331 CALL wrf_error_fatal ( &
3332 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_bye. ')
3334 DEALLOCATE(s_u_btxs,STAT=ierr)
3336 CALL wrf_error_fatal ( &
3337 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_btxs. ')
3339 DEALLOCATE(s_u_btxe,STAT=ierr)
3341 CALL wrf_error_fatal ( &
3342 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_btxe. ')
3344 DEALLOCATE(s_u_btys,STAT=ierr)
3346 CALL wrf_error_fatal ( &
3347 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_btys. ')
3349 DEALLOCATE(s_u_btye,STAT=ierr)
3351 CALL wrf_error_fatal ( &
3352 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_btye. ')
3356 DEALLOCATE(s_v_bxs,STAT=ierr)
3358 CALL wrf_error_fatal ( &
3359 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_bxs. ')
3361 DEALLOCATE(s_v_bxe,STAT=ierr)
3363 CALL wrf_error_fatal ( &
3364 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_bxe. ')
3366 DEALLOCATE(s_v_bys,STAT=ierr)
3368 CALL wrf_error_fatal ( &
3369 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_bys. ')
3371 DEALLOCATE(s_v_bye,STAT=ierr)
3373 CALL wrf_error_fatal ( &
3374 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_bye. ')
3376 DEALLOCATE(s_v_btxs,STAT=ierr)
3378 CALL wrf_error_fatal ( &
3379 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_btxs. ')
3381 DEALLOCATE(s_v_btxe,STAT=ierr)
3383 CALL wrf_error_fatal ( &
3384 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_btxe. ')
3386 DEALLOCATE(s_v_btys,STAT=ierr)
3388 CALL wrf_error_fatal ( &
3389 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_btys. ')
3391 DEALLOCATE(s_v_btye,STAT=ierr)
3393 CALL wrf_error_fatal ( &
3394 'share/module_adtl_grid_utilities.f: Failed to deallocate s_u_btye. ')
3398 DEALLOCATE(s_t_bxs,STAT=ierr)
3400 CALL wrf_error_fatal ( &
3401 'share/module_adtl_grid_utilities.f: Failed to deallocate s_t_bxs. ')
3403 DEALLOCATE(s_t_bxe,STAT=ierr)
3405 CALL wrf_error_fatal ( &
3406 'share/module_adtl_grid_utilities.f: Failed to deallocate s_t_bxe. ')
3408 DEALLOCATE(s_t_bys,STAT=ierr)
3410 CALL wrf_error_fatal ( &
3411 'share/module_adtl_grid_utilities.f: Failed to deallocate s_t_bys. ')
3413 DEALLOCATE(s_t_bye,STAT=ierr)
3415 CALL wrf_error_fatal ( &
3416 'share/module_adtl_grid_utilities.f: Failed to deallocate s_t_bye. ')
3418 DEALLOCATE(s_t_btxs,STAT=ierr)
3420 CALL wrf_error_fatal ( &
3421 'share/module_adtl_grid_utilities.f: Failed to deallocate s_t_btxs. ')
3423 DEALLOCATE(s_t_btxe,STAT=ierr)
3425 CALL wrf_error_fatal ( &
3426 'share/module_adtl_grid_utilities.f: Failed to deallocate s_t_btxe. ')
3428 DEALLOCATE(s_t_btys,STAT=ierr)
3430 CALL wrf_error_fatal ( &
3431 'share/module_adtl_grid_utilities.f: Failed to deallocate s_t_btys. ')
3433 DEALLOCATE(s_t_btye,STAT=ierr)
3435 CALL wrf_error_fatal ( &
3436 'share/module_adtl_grid_utilities.f: Failed to deallocate s_t_btye. ')
3440 DEALLOCATE(s_w_bxs,STAT=ierr)
3442 CALL wrf_error_fatal ( &
3443 'share/module_adtl_grid_utilities.f: Failed to deallocate s_w_bxs. ')
3445 DEALLOCATE(s_w_bxe,STAT=ierr)
3447 CALL wrf_error_fatal ( &
3448 'share/module_adtl_grid_utilities.f: Failed to deallocate s_w_bxe. ')
3450 DEALLOCATE(s_w_bys,STAT=ierr)
3452 CALL wrf_error_fatal ( &
3453 'share/module_adtl_grid_utilities.f: Failed to deallocate s_w_bys. ')
3455 DEALLOCATE(s_w_bye,STAT=ierr)
3457 CALL wrf_error_fatal ( &
3458 'share/module_adtl_grid_utilities.f: Failed to deallocate s_w_bye. ')
3460 DEALLOCATE(s_w_btxs,STAT=ierr)
3462 CALL wrf_error_fatal ( &
3463 'share/module_adtl_grid_utilities.f: Failed to deallocate s_w_btxs. ')
3465 DEALLOCATE(s_w_btxe,STAT=ierr)
3467 CALL wrf_error_fatal ( &
3468 'share/module_adtl_grid_utilities.f: Failed to deallocate s_w_btxe. ')
3470 DEALLOCATE(s_w_btys,STAT=ierr)
3472 CALL wrf_error_fatal ( &
3473 'share/module_adtl_grid_utilities.f: Failed to deallocate s_w_btys. ')
3475 DEALLOCATE(s_w_btye,STAT=ierr)
3477 CALL wrf_error_fatal ( &
3478 'share/module_adtl_grid_utilities.f: Failed to deallocate s_w_btye. ')
3482 DEALLOCATE(s_ph_bxs,STAT=ierr)
3484 CALL wrf_error_fatal ( &
3485 'share/module_adtl_grid_utilities.f: Failed to deallocate s_ph_bxs. ')
3487 DEALLOCATE(s_ph_bxe,STAT=ierr)
3489 CALL wrf_error_fatal ( &
3490 'share/module_adtl_grid_utilities.f: Failed to deallocate s_ph_bxe. ')
3492 DEALLOCATE(s_ph_bys,STAT=ierr)
3494 CALL wrf_error_fatal ( &
3495 'share/module_adtl_grid_utilities.f: Failed to deallocate s_ph_bys. ')
3497 DEALLOCATE(s_ph_bye,STAT=ierr)
3499 CALL wrf_error_fatal ( &
3500 'share/module_adtl_grid_utilities.f: Failed to deallocate s_ph_bye. ')
3502 DEALLOCATE(s_ph_btxs,STAT=ierr)
3504 CALL wrf_error_fatal ( &
3505 'share/module_adtl_grid_utilities.f: Failed to deallocate s_ph_btxs. ')
3507 DEALLOCATE(s_ph_btxe,STAT=ierr)
3509 CALL wrf_error_fatal ( &
3510 'share/module_adtl_grid_utilities.f: Failed to deallocate s_ph_btxe. ')
3512 DEALLOCATE(s_ph_btys,STAT=ierr)
3514 CALL wrf_error_fatal ( &
3515 'share/module_adtl_grid_utilities.f: Failed to deallocate s_ph_btys. ')
3517 DEALLOCATE(s_ph_btye,STAT=ierr)
3519 CALL wrf_error_fatal ( &
3520 'share/module_adtl_grid_utilities.f: Failed to deallocate s_ph_btye. ')
3524 DEALLOCATE(s_mu_bxs,STAT=ierr)
3526 CALL wrf_error_fatal ( &
3527 'share/module_adtl_grid_utilities.f: Failed to deallocate s_mu_bxs. ')
3529 DEALLOCATE(s_mu_bxe,STAT=ierr)
3531 CALL wrf_error_fatal ( &
3532 'share/module_adtl_grid_utilities.f: Failed to deallocate s_mu_bxe. ')
3534 DEALLOCATE(s_mu_bys,STAT=ierr)
3536 CALL wrf_error_fatal ( &
3537 'share/module_adtl_grid_utilities.f: Failed to deallocate s_mu_bys. ')
3539 DEALLOCATE(s_mu_bye,STAT=ierr)
3541 CALL wrf_error_fatal ( &
3542 'share/module_adtl_grid_utilities.f: Failed to deallocate s_mu_bye. ')
3544 DEALLOCATE(s_mu_btxs,STAT=ierr)
3546 CALL wrf_error_fatal ( &
3547 'share/module_adtl_grid_utilities.f: Failed to deallocate s_mu_btxs. ')
3549 DEALLOCATE(s_mu_btxe,STAT=ierr)
3551 CALL wrf_error_fatal ( &
3552 'share/module_adtl_grid_utilities.f: Failed to deallocate s_mu_btxe. ')
3554 DEALLOCATE(s_mu_btys,STAT=ierr)
3556 CALL wrf_error_fatal ( &
3557 'share/module_adtl_grid_utilities.f: Failed to deallocate s_mu_btys. ')
3559 DEALLOCATE(s_mu_btye,STAT=ierr)
3561 CALL wrf_error_fatal ( &
3562 'share/module_adtl_grid_utilities.f: Failed to deallocate s_mu_btye. ')
3566 DEALLOCATE(s_moist_bxs,STAT=ierr)
3568 CALL wrf_error_fatal ( &
3569 'share/module_adtl_grid_utilities.f: Failed to deallocate s_moist_bxs. ')
3571 DEALLOCATE(s_moist_bxe,STAT=ierr)
3573 CALL wrf_error_fatal ( &
3574 'share/module_adtl_grid_utilities.f: Failed to deallocate s_moist_bxe. ')
3576 DEALLOCATE(s_moist_bys,STAT=ierr)
3578 CALL wrf_error_fatal ( &
3579 'share/module_adtl_grid_utilities.f: Failed to deallocate s_moist_bys. ')
3581 DEALLOCATE(s_moist_bye,STAT=ierr)
3583 CALL wrf_error_fatal ( &
3584 'share/module_adtl_grid_utilities.f: Failed to deallocate s_moist_bye. ')
3586 DEALLOCATE(s_moist_btxs,STAT=ierr)
3588 CALL wrf_error_fatal ( &
3589 'share/module_adtl_grid_utilities.f: Failed to deallocate s_moist_btxs. ')
3591 DEALLOCATE(s_moist_btxe,STAT=ierr)
3593 CALL wrf_error_fatal ( &
3594 'share/module_adtl_grid_utilities.f: Failed to deallocate s_moist_btxe. ')
3596 DEALLOCATE(s_moist_btys,STAT=ierr)
3598 CALL wrf_error_fatal ( &
3599 'share/module_adtl_grid_utilities.f: Failed to deallocate s_moist_btys. ')
3601 DEALLOCATE(s_moist_btye,STAT=ierr)
3603 CALL wrf_error_fatal ( &
3604 'share/module_adtl_grid_utilities.f: Failed to deallocate s_moist_btye. ')
3608 DEALLOCATE(s_tracer_bxs,STAT=ierr)
3610 CALL wrf_error_fatal ( &
3611 'share/module_adtl_grid_utilities.f: Failed to deallocate s_tracer_bxs. ')
3613 DEALLOCATE(s_tracer_bxe,STAT=ierr)
3615 CALL wrf_error_fatal ( &
3616 'share/module_adtl_grid_utilities.f: Failed to deallocate s_tracer_bxe. ')
3618 DEALLOCATE(s_tracer_bys,STAT=ierr)
3620 CALL wrf_error_fatal ( &
3621 'share/module_adtl_grid_utilities.f: Failed to deallocate s_tracer_bys. ')
3623 DEALLOCATE(s_tracer_bye,STAT=ierr)
3625 CALL wrf_error_fatal ( &
3626 'share/module_adtl_grid_utilities.f: Failed to deallocate s_tracer_bye. ')
3628 DEALLOCATE(s_tracer_btxs,STAT=ierr)
3630 CALL wrf_error_fatal ( &
3631 'share/module_adtl_grid_utilities.f: Failed to deallocate s_tracer_btxs. ')
3633 DEALLOCATE(s_tracer_btxe,STAT=ierr)
3635 CALL wrf_error_fatal ( &
3636 'share/module_adtl_grid_utilities.f: Failed to deallocate s_tracer_btxe. ')
3638 DEALLOCATE(s_tracer_btys,STAT=ierr)
3640 CALL wrf_error_fatal ( &
3641 'share/module_adtl_grid_utilities.f: Failed to deallocate s_tracer_btys. ')
3643 DEALLOCATE(s_tracer_btye,STAT=ierr)
3645 CALL wrf_error_fatal ( &
3646 'share/module_adtl_grid_utilities.f: Failed to deallocate s_tracer_btye. ')
3649 DEALLOCATE ( b_scalar, STAT=ierr )
3651 CALL wrf_error_fatal ( &
3652 'share/module_adtl_grid_utilities.f: Failed to deallocate b_scalar. ')
3654 DEALLOCATE ( b_tke_2, STAT=ierr )
3656 CALL wrf_error_fatal ( &
3657 'share/module_adtl_grid_utilities.f: Failed to deallocate b_tke_2. ')
3660 DEALLOCATE ( b_p, STAT=ierr )
3662 CALL wrf_error_fatal ( &
3663 'share/module_adtl_grid_utilities.f: Failed to deallocate b_p. ')
3665 DEALLOCATE ( b_al, STAT=ierr )
3667 CALL wrf_error_fatal ( &
3668 'share/module_adtl_grid_utilities.f: Failed to deallocate b_al. ')
3670 DEALLOCATE ( b_h_diabatic, STAT=ierr )
3672 CALL wrf_error_fatal ( &
3673 'share/module_adtl_grid_utilities.f: Failed to deallocate b_h_diabatic. ')
3675 DEALLOCATE ( b_qv_diabatic, STAT=ierr )
3677 CALL wrf_error_fatal ( &
3678 'share/module_adtl_grid_utilities.f: Failed to deallocate b_qv_diabatic. ')
3680 DEALLOCATE ( b_qc_diabatic, STAT=ierr )
3682 CALL wrf_error_fatal ( &
3683 'share/module_adtl_grid_utilities.f: Failed to deallocate b_qc_diabatic. ')
3686 DEALLOCATE ( b_ustm, STAT=ierr )
3688 CALL wrf_error_fatal ( &
3689 'share/module_adtl_grid_utilities.f: Failed to deallocate b_ustm. ')
3691 DEALLOCATE ( b_hfx, STAT=ierr )
3693 CALL wrf_error_fatal ( &
3694 'share/module_adtl_grid_utilities.f: Failed to deallocate b_hfx. ')
3696 DEALLOCATE ( b_qfx, STAT=ierr )
3698 CALL wrf_error_fatal ( &
3699 'share/module_adtl_grid_utilities.f: Failed to deallocate b_qfx. ')
3702 IF ( gwd_opt .EQ. 1 ) THEN
3704 DEALLOCATE ( b_dtaux3d, STAT=ierr )
3706 CALL wrf_error_fatal ( &
3707 'share/module_adtl_grid_utilities.f: Failed to deallocate b_dtaux3d. ')
3709 DEALLOCATE ( b_dtauy3d, STAT=ierr )
3711 CALL wrf_error_fatal ( &
3712 'share/module_adtl_grid_utilities.f: Failed to deallocate b_dtauy3d. ')
3714 DEALLOCATE ( b_dusfcg, STAT=ierr )
3716 CALL wrf_error_fatal ( &
3717 'share/module_adtl_grid_utilities.f: Failed to deallocate b_dusfcg. ')
3719 DEALLOCATE ( b_dvsfcg, STAT=ierr )
3721 CALL wrf_error_fatal ( &
3722 'share/module_adtl_grid_utilities.f: Failed to deallocate b_dvsfcg. ')
3728 DEALLOCATE(b_scalar_bxs,STAT=ierr)
3730 CALL wrf_error_fatal ( &
3731 'share/module_adtl_grid_utilities.f: Failed to deallocate b_scalar_bxs. ')
3733 DEALLOCATE(b_scalar_bxe,STAT=ierr)
3735 CALL wrf_error_fatal ( &
3736 'share/module_adtl_grid_utilities.f: Failed to deallocate b_scalar_bxe. ')
3738 DEALLOCATE(b_scalar_bys,STAT=ierr)
3740 CALL wrf_error_fatal ( &
3741 'share/module_adtl_grid_utilities.f: Failed to deallocate b_scalar_bys. ')
3743 DEALLOCATE(b_scalar_bye,STAT=ierr)
3745 CALL wrf_error_fatal ( &
3746 'share/module_adtl_grid_utilities.f: Failed to deallocate b_scalar_bye. ')
3748 DEALLOCATE(b_scalar_btxs,STAT=ierr)
3750 CALL wrf_error_fatal ( &
3751 'share/module_adtl_grid_utilities.f: Failed to deallocate b_scalar_btxs. ')
3753 DEALLOCATE(b_scalar_btxe,STAT=ierr)
3755 CALL wrf_error_fatal ( &
3756 'share/module_adtl_grid_utilities.f: Failed to deallocate b_scalar_btxe. ')
3758 DEALLOCATE(b_scalar_btys,STAT=ierr)
3760 CALL wrf_error_fatal ( &
3761 'share/module_adtl_grid_utilities.f: Failed to deallocate b_scalar_btys. ')
3763 DEALLOCATE(b_scalar_btye,STAT=ierr)
3765 CALL wrf_error_fatal ( &
3766 'share/module_adtl_grid_utilities.f: Failed to deallocate b_scalar_btye. ')
3769 DEALLOCATE ( b_u_2, STAT=ierr )
3771 CALL wrf_error_fatal ( &
3772 'share/module_adtl_grid_utilities.f: Failed to deallocate b_u_2. ')
3774 DEALLOCATE ( b_v_2, STAT=ierr )
3776 CALL wrf_error_fatal ( &
3777 'share/module_adtl_grid_utilities.f: Failed to deallocate b_v_2. ')
3779 DEALLOCATE ( b_w_2, STAT=ierr )
3781 CALL wrf_error_fatal ( &
3782 'share/module_adtl_grid_utilities.f: Failed to deallocate b_w_2. ')
3784 DEALLOCATE ( b_ph_2, STAT=ierr )
3786 CALL wrf_error_fatal ( &
3787 'share/module_adtl_grid_utilities.f: Failed to deallocate b_ph_2. ')
3789 DEALLOCATE ( b_t_2, STAT=ierr )
3791 CALL wrf_error_fatal ( &
3792 'share/module_adtl_grid_utilities.f: Failed to deallocate b_t_2. ')
3794 DEALLOCATE ( b_mu_2, STAT=ierr )
3796 CALL wrf_error_fatal ( &
3797 'share/module_adtl_grid_utilities.f: Failed to deallocate b_mu_2. ')
3799 DEALLOCATE ( b_moist, STAT=ierr )
3801 CALL wrf_error_fatal ( &
3802 'share/module_adtl_grid_utilities.f: Failed to deallocate b_moist. ')
3804 DEALLOCATE ( b_tracer, STAT=ierr )
3806 CALL wrf_error_fatal ( &
3807 'share/module_adtl_grid_utilities.f: Failed to deallocate b_tracer. ')
3809 DEALLOCATE ( b_rainnc, STAT=ierr )
3811 CALL wrf_error_fatal ( &
3812 'share/module_adtl_grid_utilities.f: Failed to deallocate b_rainnc. ')
3814 DEALLOCATE ( b_rainncv, STAT=ierr )
3816 CALL wrf_error_fatal ( &
3817 'share/module_adtl_grid_utilities.f: Failed to deallocate b_rainncv. ')
3819 DEALLOCATE ( b_rainc, STAT=ierr )
3821 CALL wrf_error_fatal ( &
3822 'share/module_adtl_grid_utilities.f: Failed to deallocate b_rainc. ')
3824 DEALLOCATE ( b_raincv, STAT=ierr )
3826 CALL wrf_error_fatal ( &
3827 'share/module_adtl_grid_utilities.f: Failed to deallocate b_raincv. ')
3831 END SUBROUTINE deallocate_grid
3833 END MODULE module_adtl_grid_utilities