1 | !> @file init_masks.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
6 | ! terms of the GNU General Public License as published by the Free Software |
---|
7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
8 | ! version. |
---|
9 | ! |
---|
10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
13 | ! |
---|
14 | ! You should have received a copy of the GNU General Public License along with |
---|
15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
16 | ! |
---|
17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: init_masks.f90 3435 2018-10-26 18:25:44Z eckhard $ |
---|
27 | ! Add checks for chemistry and radiation model |
---|
28 | ! Set indices for terrain-following masked output |
---|
29 | ! |
---|
30 | ! 3421 2018-10-24 18:39:32Z gronemeier |
---|
31 | ! Renamed output variables |
---|
32 | ! |
---|
33 | ! 3419 2018-10-24 17:27:31Z gronemeier |
---|
34 | ! ocean renamed ocean_mode |
---|
35 | ! |
---|
36 | ! 3274 2018-09-24 15:42:55Z knoop |
---|
37 | ! Modularization of all bulk cloud physics code components |
---|
38 | ! |
---|
39 | ! 3065 2018-06-12 07:03:02Z Giersch |
---|
40 | ! dz_stretch_level was replaced by dz_stretch_level_start |
---|
41 | ! |
---|
42 | ! 3049 2018-05-29 13:52:36Z Giersch |
---|
43 | ! Error messages revised |
---|
44 | ! |
---|
45 | ! 3045 2018-05-28 07:55:41Z Giersch |
---|
46 | ! Error messages revised |
---|
47 | ! |
---|
48 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
49 | ! Corrected "Former revisions" section |
---|
50 | ! |
---|
51 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
52 | ! Change in file header (GPL part) |
---|
53 | ! |
---|
54 | ! 2344 2017-08-09 11:00:34Z raasch |
---|
55 | ! explicit setting of initial values for array domask required due to a bug |
---|
56 | ! in the Cray compiler (appears only if option -eD is used) |
---|
57 | ! |
---|
58 | ! 2301 2017-06-29 16:41:21Z gronemeier |
---|
59 | ! Bugfix: set variable name length to global value |
---|
60 | ! |
---|
61 | ! |
---|
62 | ! Implementation of new microphysic scheme: cloud_scheme = 'morrison' |
---|
63 | ! includes two more prognostic equations for cloud drop concentration (nc) |
---|
64 | ! and cloud water content (qc). |
---|
65 | ! |
---|
66 | ! 2271 2017-06-09 12:34:55Z sward |
---|
67 | ! Changed error message |
---|
68 | ! |
---|
69 | ! 2101 2017-01-05 16:42:31Z suehring |
---|
70 | ! |
---|
71 | ! 2031 2016-10-21 15:11:58Z knoop |
---|
72 | ! renamed variable rho to rho_ocean |
---|
73 | ! |
---|
74 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
75 | ! Forced header and separation lines into 80 columns |
---|
76 | ! |
---|
77 | ! 1822 2016-04-07 07:49:42Z hoffmann |
---|
78 | ! icloud_scheme replaced by microphysics_* |
---|
79 | ! |
---|
80 | ! 1804 2016-04-05 16:30:18Z maronga |
---|
81 | ! Removed code for parameter file check (__check) |
---|
82 | ! |
---|
83 | ! 1783 2016-03-06 18:36:17Z raasch |
---|
84 | ! netcdf module name changed + related changes |
---|
85 | ! |
---|
86 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
87 | ! Code annotations made doxygen readable |
---|
88 | ! |
---|
89 | ! 1438 2014-07-22 14:14:06Z heinze |
---|
90 | ! +nr, qc, qr |
---|
91 | ! |
---|
92 | ! 1414 2014-05-31 11:19:48Z gronemeier |
---|
93 | ! Bugfix: first and last grid points as they appear in 3D volume data can now |
---|
94 | ! be included to masked data output |
---|
95 | ! |
---|
96 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
97 | ! REAL constants provided with KIND-attribute |
---|
98 | ! |
---|
99 | ! 1324 2014-03-21 09:13:16Z suehring |
---|
100 | ! Bugfix: ONLY statement for module netcdf_control removed |
---|
101 | ! |
---|
102 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
103 | ! ONLY-attribute added to USE-statements, |
---|
104 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
105 | ! kinds are defined in new module kinds, |
---|
106 | ! revision history before 2012 removed, |
---|
107 | ! comment fields (!:) to be used for variable explanations added to |
---|
108 | ! all variable declaration statements |
---|
109 | ! |
---|
110 | ! 1186 2013-06-18 06:22:52Z raasch |
---|
111 | ! bugfix: 0.0 replaced by zu(nzb) as the lowest default height level for masks, |
---|
112 | ! because a zero value does not work in case of ocean runs |
---|
113 | ! |
---|
114 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
115 | ! code put under GPL (PALM 3.9) |
---|
116 | ! |
---|
117 | ! 1032 2012-10-21 13:03:21Z letzel |
---|
118 | ! mask locations determined based on scalar positions |
---|
119 | ! |
---|
120 | ! 1031 2012-10-19 14:35:30Z raasch |
---|
121 | ! netCDF4 without parallel file support implemented |
---|
122 | ! |
---|
123 | ! 996 2012-09-07 10:41:47Z raasch |
---|
124 | ! little reformatting |
---|
125 | ! |
---|
126 | ! 978 2012-08-09 08:28:32Z fricke |
---|
127 | ! +z0h* |
---|
128 | ! |
---|
129 | ! 809 2012-01-30 13:32:58Z maronga |
---|
130 | ! Bugfix: replaced .AND. and .NOT. with && and ! in the preprocessor directives |
---|
131 | ! |
---|
132 | ! 807 2012-01-25 11:53:51Z maronga |
---|
133 | ! New cpp directive "__check" implemented which is used by check_namelist_files |
---|
134 | ! |
---|
135 | ! 410 2009-12-04 17:05:40Z letzel |
---|
136 | ! Initial revision |
---|
137 | ! |
---|
138 | ! |
---|
139 | ! Description: |
---|
140 | ! ------------ |
---|
141 | !> Initialize masked data output |
---|
142 | !------------------------------------------------------------------------------! |
---|
143 | SUBROUTINE init_masks |
---|
144 | |
---|
145 | USE arrays_3d, & |
---|
146 | ONLY: zu, zw |
---|
147 | |
---|
148 | USE bulk_cloud_model_mod, & |
---|
149 | ONLY: bulk_cloud_model, microphysics_morrison, microphysics_seifert |
---|
150 | |
---|
151 | USE chemistry_model_mod, & |
---|
152 | ONLY: chem_check_data_output |
---|
153 | |
---|
154 | USE control_parameters, & |
---|
155 | ONLY: air_chemistry, & |
---|
156 | constant_diffusion, cloud_droplets, & |
---|
157 | data_output_masks, data_output_masks_user, & |
---|
158 | doav, doav_n, domask, domask_no, dz, dz_stretch_level_start, & |
---|
159 | humidity, mask, masks, mask_scale, mask_i, & |
---|
160 | mask_i_global, mask_j, mask_j_global, mask_k, mask_k_global, & |
---|
161 | mask_k_over_surface, & |
---|
162 | mask_loop, mask_size, mask_size_l, mask_start_l, & |
---|
163 | mask_surface, mask_x, & |
---|
164 | mask_x_loop, mask_xyz_dimension, mask_y, mask_y_loop, mask_z, & |
---|
165 | mask_z_loop, max_masks, message_string, mid, & |
---|
166 | passive_scalar, ocean_mode, varnamelength |
---|
167 | |
---|
168 | USE grid_variables, & |
---|
169 | ONLY: dx, dy |
---|
170 | |
---|
171 | USE indices, & |
---|
172 | ONLY: nx, nxl, nxr, ny, nyn, nys, nz, nzb, nzt |
---|
173 | |
---|
174 | USE kinds |
---|
175 | |
---|
176 | USE netcdf_interface, & |
---|
177 | ONLY: domask_unit, netcdf_data_format |
---|
178 | |
---|
179 | USE particle_attributes, & |
---|
180 | ONLY: particle_advection |
---|
181 | |
---|
182 | USE pegrid |
---|
183 | |
---|
184 | USE radiation_model_mod, & |
---|
185 | ONLY: radiation, radiation_check_data_output |
---|
186 | |
---|
187 | IMPLICIT NONE |
---|
188 | |
---|
189 | CHARACTER (LEN=varnamelength) :: var !< |
---|
190 | CHARACTER (LEN=7) :: unit !< |
---|
191 | |
---|
192 | CHARACTER (LEN=varnamelength), DIMENSION(max_masks,100) :: do_mask !< |
---|
193 | CHARACTER (LEN=varnamelength), DIMENSION(max_masks,100) :: do_mask_user !< |
---|
194 | |
---|
195 | INTEGER(iwp) :: count !< counting masking indices along a dimension |
---|
196 | INTEGER(iwp) :: i !< |
---|
197 | INTEGER(iwp) :: ilen !< |
---|
198 | INTEGER(iwp) :: ind(6) !< |
---|
199 | INTEGER(iwp) :: ind_array(1) !< |
---|
200 | INTEGER(iwp) :: j !< |
---|
201 | INTEGER(iwp) :: k !< |
---|
202 | INTEGER(iwp) :: m !< mask index |
---|
203 | INTEGER(iwp) :: n !< |
---|
204 | INTEGER(iwp) :: sender !< |
---|
205 | |
---|
206 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: tmp_array !< |
---|
207 | |
---|
208 | LOGICAL :: found !< |
---|
209 | |
---|
210 | ! |
---|
211 | !-- Initial values are explicitly set here due to a bug in the Cray compiler |
---|
212 | !-- in case of assignments of initial values in declaration statements for |
---|
213 | !-- arrays with more than 9999 elements (appears with -eD only) |
---|
214 | domask = ' ' |
---|
215 | |
---|
216 | ! |
---|
217 | !-- Allocation and initialization |
---|
218 | ALLOCATE( tmp_array( MAX(nx,ny,nz)+2 ) ) |
---|
219 | |
---|
220 | ALLOCATE( mask_i(max_masks,nxr-nxl+2), & |
---|
221 | mask_j(max_masks,nyn-nys+2), & |
---|
222 | mask_k(max_masks,nzt-nzb+2) ) |
---|
223 | ! |
---|
224 | !-- internal mask arrays ("mask,dimension,selection") |
---|
225 | ALLOCATE( mask(max_masks,3,mask_xyz_dimension), & |
---|
226 | mask_loop(max_masks,3,3) ) |
---|
227 | |
---|
228 | ! |
---|
229 | !-- Parallel mask output not yet supported. In check_parameters data format |
---|
230 | !-- is restricted and is switched back to non-parallel output. Therefore the |
---|
231 | !-- following error can not occur at the moment. |
---|
232 | IF ( netcdf_data_format > 4 ) THEN |
---|
233 | message_string = 'netCDF file formats '// & |
---|
234 | '5 and 6 (with parallel I/O support)'// & |
---|
235 | ' are currently not supported.' |
---|
236 | CALL message( 'init_masks', 'PA0328', 1, 2, 0, 6, 0 ) |
---|
237 | ENDIF |
---|
238 | |
---|
239 | ! |
---|
240 | !-- Store data output parameters for masked data output in few shared arrays |
---|
241 | DO mid = 1, masks |
---|
242 | |
---|
243 | do_mask (mid,:) = data_output_masks(mid,:) |
---|
244 | do_mask_user(mid,:) = data_output_masks_user(mid,:) |
---|
245 | mask (mid,1,:) = mask_x(mid,:) |
---|
246 | mask (mid,2,:) = mask_y(mid,:) |
---|
247 | mask (mid,3,:) = mask_z(mid,:) |
---|
248 | ! |
---|
249 | !-- Flag a mask as terrain following |
---|
250 | IF ( mask_k_over_surface(mid,1) /= -1_iwp ) THEN |
---|
251 | mask_surface(mid) = .TRUE. |
---|
252 | ENDIF |
---|
253 | |
---|
254 | IF ( mask_x_loop(mid,1) == -1.0_wp .AND. mask_x_loop(mid,2) == -1.0_wp& |
---|
255 | .AND. mask_x_loop(mid,3) == -1.0_wp ) THEN |
---|
256 | mask_loop(mid,1,1:2) = -1.0_wp |
---|
257 | mask_loop(mid,1,3) = 0.0_wp |
---|
258 | ELSE |
---|
259 | mask_loop(mid,1,:) = mask_x_loop(mid,:) |
---|
260 | ENDIF |
---|
261 | IF ( mask_y_loop(mid,1) == -1.0_wp .AND. mask_y_loop(mid,2) == -1.0_wp& |
---|
262 | .AND. mask_y_loop(mid,3) == -1.0_wp ) THEN |
---|
263 | mask_loop(mid,2,1:2) = -1.0_wp |
---|
264 | mask_loop(mid,2,3) = 0.0_wp |
---|
265 | ELSE |
---|
266 | mask_loop(mid,2,:) = mask_y_loop(mid,:) |
---|
267 | ENDIF |
---|
268 | IF ( mask_z_loop(mid,1) == -1.0_wp .AND. mask_z_loop(mid,2) == -1.0_wp& |
---|
269 | .AND. mask_z_loop(mid,3) == -1.0_wp ) THEN |
---|
270 | mask_loop(mid,3,1:2) = -1.0_wp |
---|
271 | mask_loop(mid,3,3) = 0.0_wp |
---|
272 | ELSE |
---|
273 | mask_loop(mid,3,:) = mask_z_loop(mid,:) |
---|
274 | ENDIF |
---|
275 | |
---|
276 | ENDDO |
---|
277 | |
---|
278 | mask_i = -1; mask_j = -1; mask_k = -1 |
---|
279 | |
---|
280 | ! |
---|
281 | !-- Global arrays are required by define_netcdf_header. |
---|
282 | IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN |
---|
283 | ALLOCATE( mask_i_global(max_masks,nx+2), & |
---|
284 | mask_j_global(max_masks,ny+2), & |
---|
285 | mask_k_global(max_masks,nz+2) ) |
---|
286 | mask_i_global = -1; mask_j_global = -1; mask_k_global = -1 |
---|
287 | ENDIF |
---|
288 | |
---|
289 | ! |
---|
290 | !-- Determine variable names for each mask |
---|
291 | DO mid = 1, masks |
---|
292 | ! |
---|
293 | !-- Append user-defined data output variables to the standard data output |
---|
294 | IF ( do_mask_user(mid,1) /= ' ' ) THEN |
---|
295 | i = 1 |
---|
296 | DO WHILE ( do_mask(mid,i) /= ' ' .AND. i <= 100 ) |
---|
297 | i = i + 1 |
---|
298 | ENDDO |
---|
299 | j = 1 |
---|
300 | DO WHILE ( do_mask_user(mid,j) /= ' ' .AND. j <= 100 ) |
---|
301 | IF ( i > 100 ) THEN |
---|
302 | WRITE ( message_string, * ) 'number of output quantitities ', & |
---|
303 | 'given by data_output_mask and data_output_mask_user ', & |
---|
304 | 'exceeds the limit of 100' |
---|
305 | CALL message( 'init_masks', 'PA0329', 1, 2, 0, 6, 0 ) |
---|
306 | ENDIF |
---|
307 | do_mask(mid,i) = do_mask_user(mid,j) |
---|
308 | i = i + 1 |
---|
309 | j = j + 1 |
---|
310 | ENDDO |
---|
311 | ENDIF |
---|
312 | |
---|
313 | ! |
---|
314 | !-- Check and set steering parameters for mask data output and averaging |
---|
315 | i = 1 |
---|
316 | DO WHILE ( do_mask(mid,i) /= ' ' .AND. i <= 100 ) |
---|
317 | ! |
---|
318 | !-- Check for data averaging |
---|
319 | ilen = LEN_TRIM( do_mask(mid,i) ) |
---|
320 | j = 0 ! no data averaging |
---|
321 | IF ( ilen > 3 ) THEN |
---|
322 | IF ( do_mask(mid,i)(ilen-2:ilen) == '_av' ) THEN |
---|
323 | j = 1 ! data averaging |
---|
324 | do_mask(mid,i) = do_mask(mid,i)(1:ilen-3) |
---|
325 | ENDIF |
---|
326 | ENDIF |
---|
327 | var = TRIM( do_mask(mid,i) ) |
---|
328 | ! |
---|
329 | !-- Check for allowed value and set units |
---|
330 | SELECT CASE ( TRIM( var ) ) |
---|
331 | |
---|
332 | CASE ( 'e' ) |
---|
333 | IF ( constant_diffusion ) THEN |
---|
334 | WRITE ( message_string, * ) 'output of "', TRIM( var ), & |
---|
335 | '" requires constant_diffusion = .FALSE.' |
---|
336 | CALL message( 'init_masks', 'PA0103', 1, 2, 0, 6, 0 ) |
---|
337 | ENDIF |
---|
338 | unit = 'm2/s2' |
---|
339 | |
---|
340 | CASE ( 'thetal' ) |
---|
341 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
342 | WRITE ( message_string, * ) 'output of "', TRIM( var ), & |
---|
343 | '" requires bulk_cloud_model = .TRUE.' |
---|
344 | CALL message( 'init_masks', 'PA0108', 1, 2, 0, 6, 0 ) |
---|
345 | ENDIF |
---|
346 | unit = 'K' |
---|
347 | |
---|
348 | CASE ( 'nc' ) |
---|
349 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
350 | WRITE ( message_string, * ) 'output of "', TRIM( var ), & |
---|
351 | '" requires bulk_cloud_model = .TRUE.' |
---|
352 | CALL message( 'init_masks', 'PA0108', 1, 2, 0, 6, 0 ) |
---|
353 | ELSEIF ( .NOT. microphysics_morrison ) THEN |
---|
354 | message_string = 'output of "' // TRIM( var ) // '" ' // & |
---|
355 | 'requires = morrison' |
---|
356 | CALL message( 'check_parameters', 'PA0359', 1, 2, 0, 6, 0 ) |
---|
357 | ENDIF |
---|
358 | unit = '1/m3' |
---|
359 | |
---|
360 | CASE ( 'nr' ) |
---|
361 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
362 | WRITE ( message_string, * ) 'output of "', TRIM( var ), & |
---|
363 | '" requires bulk_cloud_model = .TRUE.' |
---|
364 | CALL message( 'init_masks', 'PA0108', 1, 2, 0, 6, 0 ) |
---|
365 | ELSEIF ( .NOT. microphysics_seifert ) THEN |
---|
366 | message_string = 'output of "' // TRIM( var ) // '"' // & |
---|
367 | 'requires cloud_scheme = seifert_beheng' |
---|
368 | CALL message( 'check_parameters', 'PA0359', 1, 2, 0, 6, 0 ) |
---|
369 | ENDIF |
---|
370 | unit = '1/m3' |
---|
371 | |
---|
372 | CASE ( 'pc', 'pr' ) |
---|
373 | IF ( .NOT. particle_advection ) THEN |
---|
374 | WRITE ( message_string, * ) 'output of "', TRIM( var ), & |
---|
375 | '" requires a "particles_par"-NAMELIST in the ', & |
---|
376 | 'parameter file (PARIN)' |
---|
377 | CALL message( 'init_masks', 'PA0104', 1, 2, 0, 6, 0 ) |
---|
378 | ENDIF |
---|
379 | IF ( TRIM( var ) == 'pc' ) unit = 'number' |
---|
380 | IF ( TRIM( var ) == 'pr' ) unit = 'm' |
---|
381 | |
---|
382 | CASE ( 'q', 'thetav' ) |
---|
383 | IF ( .NOT. humidity ) THEN |
---|
384 | WRITE ( message_string, * ) 'output of "', TRIM( var ), & |
---|
385 | '" requires humidity = .TRUE.' |
---|
386 | CALL message( 'init_masks', 'PA0105', 1, 2, 0, 6, 0 ) |
---|
387 | ENDIF |
---|
388 | IF ( TRIM( var ) == 'q' ) unit = 'kg/kg' |
---|
389 | IF ( TRIM( var ) == 'thetav' ) unit = 'K' |
---|
390 | |
---|
391 | CASE ( 'qc' ) |
---|
392 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
393 | message_string = 'output of "' // TRIM( var ) // '"' // & |
---|
394 | 'requires bulk_cloud_model = .TRUE.' |
---|
395 | CALL message( 'check_parameters', 'PA0108', 1, 2, 0, 6, 0 ) |
---|
396 | ENDIF |
---|
397 | unit = 'kg/kg' |
---|
398 | |
---|
399 | CASE ( 'ql' ) |
---|
400 | IF ( .NOT. ( bulk_cloud_model .OR. cloud_droplets ) ) THEN |
---|
401 | WRITE ( message_string, * ) 'output of "', TRIM( var ), & |
---|
402 | '" requires bulk_cloud_model = .TRUE. or ', & |
---|
403 | 'cloud_droplets = .TRUE.' |
---|
404 | CALL message( 'init_masks', 'PA0106', 1, 2, 0, 6, 0 ) |
---|
405 | ENDIF |
---|
406 | unit = 'kg/kg' |
---|
407 | |
---|
408 | CASE ( 'ql_c', 'ql_v', 'ql_vp' ) |
---|
409 | IF ( .NOT. cloud_droplets ) THEN |
---|
410 | WRITE ( message_string, * ) 'output of "', TRIM( var ), & |
---|
411 | '" requires cloud_droplets = .TRUE.' |
---|
412 | CALL message( 'init_masks', 'PA0107', 1, 2, 0, 6, 0 ) |
---|
413 | ENDIF |
---|
414 | IF ( TRIM( var ) == 'ql_c' ) unit = 'kg/kg' |
---|
415 | IF ( TRIM( var ) == 'ql_v' ) unit = 'm3' |
---|
416 | IF ( TRIM( var ) == 'ql_vp' ) unit = 'none' |
---|
417 | |
---|
418 | CASE ( 'qv' ) |
---|
419 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
420 | WRITE ( message_string, * ) 'output of "', TRIM( var ), & |
---|
421 | '" requires bulk_cloud_model = .TRUE.' |
---|
422 | CALL message( 'init_masks', 'PA0108', 1, 2, 0, 6, 0 ) |
---|
423 | ENDIF |
---|
424 | unit = 'kg/kg' |
---|
425 | |
---|
426 | CASE ( 'qr' ) |
---|
427 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
428 | message_string = 'output of "' // TRIM( var ) // '" ' // & |
---|
429 | 'requires bulk_cloud_model = .TRUE.' |
---|
430 | CALL message( 'check_parameters', 'PA0108', 1, 2, 0, 6, 0 ) |
---|
431 | ELSEIF ( .NOT. microphysics_seifert ) THEN |
---|
432 | message_string = 'output of "' // TRIM( var ) // '" ' // & |
---|
433 | 'requires cloud_scheme = seifert_beheng' |
---|
434 | CALL message( 'check_parameters', 'PA0359', 1, 2, 0, 6, 0 ) |
---|
435 | ENDIF |
---|
436 | unit = 'kg/kg' |
---|
437 | |
---|
438 | CASE ( 'rho_sea_water' ) |
---|
439 | IF ( .NOT. ocean_mode ) THEN |
---|
440 | WRITE ( message_string, * ) 'output of "', TRIM( var ), & |
---|
441 | '" requires ocean mode' |
---|
442 | CALL message( 'init_masks', 'PA0109', 1, 2, 0, 6, 0 ) |
---|
443 | ENDIF |
---|
444 | unit = 'kg/m3' |
---|
445 | |
---|
446 | CASE ( 's' ) |
---|
447 | IF ( .NOT. passive_scalar ) THEN |
---|
448 | WRITE ( message_string, * ) 'output of "', TRIM( var ), & |
---|
449 | '" requires passive_scalar = .TRUE.' |
---|
450 | CALL message( 'init_masks', 'PA0110', 1, 2, 0, 6, 0 ) |
---|
451 | ENDIF |
---|
452 | unit = 'conc' |
---|
453 | |
---|
454 | CASE ( 'sa' ) |
---|
455 | IF ( .NOT. ocean_mode ) THEN |
---|
456 | WRITE ( message_string, * ) 'output of "', TRIM( var ), & |
---|
457 | '" requires ocean mode' |
---|
458 | CALL message( 'init_masks', 'PA0109', 1, 2, 0, 6, 0 ) |
---|
459 | ENDIF |
---|
460 | unit = 'psu' |
---|
461 | |
---|
462 | CASE ( 'us*', 't*', 'lwp*', 'pra*', 'prr*', 'z0*', 'z0h*' ) |
---|
463 | WRITE ( message_string, * ) 'illegal value for data_', & |
---|
464 | 'output: "', TRIM( var ), '" is only allowed', & |
---|
465 | 'for horizontal cross section' |
---|
466 | CALL message( 'init_masks', 'PA0111', 1, 2, 0, 6, 0 ) |
---|
467 | |
---|
468 | CASE ( 'p', 'theta', 'u', 'v', 'w' ) |
---|
469 | IF ( TRIM( var ) == 'p' ) unit = 'Pa' |
---|
470 | IF ( TRIM( var ) == 'theta' ) unit = 'K' |
---|
471 | IF ( TRIM( var ) == 'u' ) unit = 'm/s' |
---|
472 | IF ( TRIM( var ) == 'v' ) unit = 'm/s' |
---|
473 | IF ( TRIM( var ) == 'w' ) unit = 'm/s' |
---|
474 | CONTINUE |
---|
475 | |
---|
476 | CASE DEFAULT |
---|
477 | |
---|
478 | CALL user_check_data_output( var, unit ) |
---|
479 | |
---|
480 | IF ( unit == 'illegal' .AND. air_chemistry & |
---|
481 | .AND. (var(1:3) == 'kc_' .OR. var(1:3) == 'em_') ) THEN |
---|
482 | CALL chem_check_data_output( var, unit, 0, 0, 0 ) |
---|
483 | ENDIF |
---|
484 | |
---|
485 | IF ( unit == 'illegal' ) THEN |
---|
486 | CALL radiation_check_data_output( var, unit, 0, 0, 0 ) |
---|
487 | ENDIF |
---|
488 | |
---|
489 | IF ( unit == 'illegal' ) THEN |
---|
490 | IF ( do_mask_user(mid,1) /= ' ' ) THEN |
---|
491 | WRITE ( message_string, * ) 'illegal value for data_', & |
---|
492 | 'output_masks or data_output_masks_user: "', & |
---|
493 | TRIM( do_mask(mid,i) ), '"' |
---|
494 | CALL message( 'init_masks', 'PA0018', 1, 2, 0, 6, 0 ) |
---|
495 | ELSE |
---|
496 | WRITE ( message_string, * ) 'illegal value for data_', & |
---|
497 | ' output_masks : "', TRIM( do_mask(mid,i) ), '"' |
---|
498 | CALL message( 'init_masks', 'PA0330', 1, 2, 0, 6, 0 ) |
---|
499 | ENDIF |
---|
500 | ENDIF |
---|
501 | |
---|
502 | END SELECT |
---|
503 | ! |
---|
504 | !-- Set the internal steering parameters appropriately |
---|
505 | domask_no(mid,j) = domask_no(mid,j) + 1 |
---|
506 | domask(mid,j,domask_no(mid,j)) = do_mask(mid,i) |
---|
507 | domask_unit(mid,j,domask_no(mid,j)) = unit |
---|
508 | |
---|
509 | IF ( j == 1 ) THEN |
---|
510 | ! |
---|
511 | !-- Check, if variable is already subject to averaging |
---|
512 | found = .FALSE. |
---|
513 | DO k = 1, doav_n |
---|
514 | IF ( TRIM( doav(k) ) == TRIM( var ) ) found = .TRUE. |
---|
515 | ENDDO |
---|
516 | |
---|
517 | IF ( .NOT. found ) THEN |
---|
518 | doav_n = doav_n + 1 |
---|
519 | doav(doav_n) = var |
---|
520 | ENDIF |
---|
521 | ENDIF |
---|
522 | |
---|
523 | i = i + 1 |
---|
524 | |
---|
525 | ENDDO ! do_mask(mid,i) |
---|
526 | ENDDO ! mid |
---|
527 | |
---|
528 | |
---|
529 | ! |
---|
530 | !-- Determine mask locations for each mask |
---|
531 | DO mid = 1, masks |
---|
532 | ! |
---|
533 | !-- Set local masks for each subdomain along all three dimensions |
---|
534 | CALL set_mask_locations( 1, dx, 'dx', nx, 'nx', nxl, nxr ) |
---|
535 | CALL set_mask_locations( 2, dy, 'dy', ny, 'ny', nys, nyn ) |
---|
536 | IF ( .NOT. mask_surface(mid) ) THEN |
---|
537 | CALL set_mask_locations( 3, dz(1), 'dz', nz, 'nz', nzb, nzt ) |
---|
538 | ELSE |
---|
539 | ! |
---|
540 | !-- Set vertical mask locations and size in case of terrain-following |
---|
541 | !-- output |
---|
542 | count = 0 |
---|
543 | DO WHILE ( mask_k_over_surface(mid, count+1) >= 0 ) |
---|
544 | m = mask_k_over_surface(mid, count+1) |
---|
545 | IF ( m > nz+1 ) THEN |
---|
546 | WRITE ( message_string, '(I3,A,I3,A,I1,3A,I3)' ) & |
---|
547 | m,' in mask ',mid,' along dimension ', 3, & |
---|
548 | ' exceeds (nz+1) = ',nz+1 |
---|
549 | CALL message( 'init_masks', 'PA0331', 1, 2, 0, 6, 0 ) |
---|
550 | ENDIF |
---|
551 | count = count + 1 |
---|
552 | mask_k(mid,count) = mask_k_over_surface(mid, count) |
---|
553 | IF ( count == mask_xyz_dimension ) EXIT |
---|
554 | ENDDO |
---|
555 | mask_start_l(mid,3) = 1 |
---|
556 | mask_size(mid,3) = count |
---|
557 | mask_size_l(mid,3) = count |
---|
558 | ENDIF |
---|
559 | ! |
---|
560 | !-- Set global masks along all three dimensions (required by |
---|
561 | !-- define_netcdf_header). |
---|
562 | #if defined( __parallel ) |
---|
563 | ! |
---|
564 | !-- PE0 receives partial arrays from all processors of the respective mask |
---|
565 | !-- and outputs them. Here a barrier has to be set, because otherwise |
---|
566 | !-- "-MPI- FATAL: Remote protocol queue full" may occur. |
---|
567 | |
---|
568 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
569 | |
---|
570 | IF ( myid == 0 ) THEN |
---|
571 | ! |
---|
572 | !-- Local arrays can be relocated directly. |
---|
573 | mask_i_global(mid,mask_start_l(mid,1): & |
---|
574 | mask_start_l(mid,1)+mask_size_l(mid,1)-1) = & |
---|
575 | mask_i(mid,:mask_size_l(mid,1)) |
---|
576 | mask_j_global(mid,mask_start_l(mid,2): & |
---|
577 | mask_start_l(mid,2)+mask_size_l(mid,2)-1) = & |
---|
578 | mask_j(mid,:mask_size_l(mid,2)) |
---|
579 | mask_k_global(mid,mask_start_l(mid,3): & |
---|
580 | mask_start_l(mid,3)+mask_size_l(mid,3)-1) = & |
---|
581 | mask_k(mid,:mask_size_l(mid,3)) |
---|
582 | ! |
---|
583 | !-- Receive data from all other PEs. |
---|
584 | DO n = 1, numprocs-1 |
---|
585 | ! |
---|
586 | !-- Receive index limits first, then arrays. |
---|
587 | !-- Index limits are received in arbitrary order from the PEs. |
---|
588 | CALL MPI_RECV( ind(1), 6, MPI_INTEGER, MPI_ANY_SOURCE, 0, & |
---|
589 | comm2d, status, ierr ) |
---|
590 | ! |
---|
591 | !-- Not all PEs have data for the mask. |
---|
592 | IF ( ind(1) /= -9999 ) THEN |
---|
593 | sender = status(MPI_SOURCE) |
---|
594 | CALL MPI_RECV( tmp_array(ind(1)), ind(2)-ind(1)+1, & |
---|
595 | MPI_INTEGER, sender, 1, comm2d, status, ierr ) |
---|
596 | mask_i_global(mid,ind(1):ind(2)) = tmp_array(ind(1):ind(2)) |
---|
597 | CALL MPI_RECV( tmp_array(ind(3)), ind(4)-ind(3)+1, & |
---|
598 | MPI_INTEGER, sender, 2, comm2d, status, ierr ) |
---|
599 | mask_j_global(mid,ind(3):ind(4)) = tmp_array(ind(3):ind(4)) |
---|
600 | CALL MPI_RECV( tmp_array(ind(5)), ind(6)-ind(5)+1, & |
---|
601 | MPI_INTEGER, sender, 3, comm2d, status, ierr ) |
---|
602 | mask_k_global(mid,ind(5):ind(6)) = tmp_array(ind(5):ind(6)) |
---|
603 | ENDIF |
---|
604 | ENDDO |
---|
605 | |
---|
606 | ELSE |
---|
607 | ! |
---|
608 | !-- If at least part of the mask resides on the PE, send the index limits |
---|
609 | !-- for the target array, otherwise send -9999 to PE0. |
---|
610 | IF ( mask_size_l(mid,1) > 0 .AND. mask_size_l(mid,2) > 0 .AND. & |
---|
611 | mask_size_l(mid,3) > 0 ) THEN |
---|
612 | ind(1) = mask_start_l(mid,1) |
---|
613 | ind(2) = mask_start_l(mid,1) + mask_size_l(mid,1) - 1 |
---|
614 | ind(3) = mask_start_l(mid,2) |
---|
615 | ind(4) = mask_start_l(mid,2) + mask_size_l(mid,2) - 1 |
---|
616 | ind(5) = mask_start_l(mid,3) |
---|
617 | ind(6) = mask_start_l(mid,3) + mask_size_l(mid,3) - 1 |
---|
618 | ELSE |
---|
619 | ind(1) = -9999; ind(2) = -9999 |
---|
620 | ind(3) = -9999; ind(4) = -9999 |
---|
621 | ind(5) = -9999; ind(6) = -9999 |
---|
622 | ENDIF |
---|
623 | CALL MPI_SEND( ind(1), 6, MPI_INTEGER, 0, 0, comm2d, ierr ) |
---|
624 | ! |
---|
625 | !-- If applicable, send data to PE0. |
---|
626 | IF ( ind(1) /= -9999 ) THEN |
---|
627 | tmp_array(:mask_size_l(mid,1)) = mask_i(mid,:mask_size_l(mid,1)) |
---|
628 | CALL MPI_SEND( tmp_array(1), mask_size_l(mid,1), & |
---|
629 | MPI_INTEGER, 0, 1, comm2d, ierr ) |
---|
630 | tmp_array(:mask_size_l(mid,2)) = mask_j(mid,:mask_size_l(mid,2)) |
---|
631 | CALL MPI_SEND( tmp_array(1), mask_size_l(mid,2), & |
---|
632 | MPI_INTEGER, 0, 2, comm2d, ierr ) |
---|
633 | tmp_array(:mask_size_l(mid,3)) = mask_k(mid,:mask_size_l(mid,3)) |
---|
634 | CALL MPI_SEND( tmp_array(1), mask_size_l(mid,3), & |
---|
635 | MPI_INTEGER, 0, 3, comm2d, ierr ) |
---|
636 | ENDIF |
---|
637 | ENDIF |
---|
638 | ! |
---|
639 | !-- A barrier has to be set, because otherwise some PEs may proceed too fast |
---|
640 | !-- so that PE0 may receive wrong data on tag 0. |
---|
641 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
642 | |
---|
643 | IF ( netcdf_data_format > 4 ) THEN |
---|
644 | |
---|
645 | CALL MPI_BCAST( mask_i_global(mid,:), nx+2, MPI_INTEGER, 0, comm2d, & |
---|
646 | ierr ) |
---|
647 | CALL MPI_BCAST( mask_j_global(mid,:), ny+2, MPI_INTEGER, 0, comm2d, & |
---|
648 | ierr ) |
---|
649 | CALL MPI_BCAST( mask_k_global(mid,:), nz+2, MPI_INTEGER, 0, comm2d, & |
---|
650 | ierr ) |
---|
651 | |
---|
652 | ENDIF |
---|
653 | |
---|
654 | #else |
---|
655 | ! |
---|
656 | !-- Local arrays can be relocated directly. |
---|
657 | mask_i_global(mid,:) = mask_i(mid,:) |
---|
658 | mask_j_global(mid,:) = mask_j(mid,:) |
---|
659 | mask_k_global(mid,:) = mask_k(mid,:) |
---|
660 | #endif |
---|
661 | ENDDO ! mid |
---|
662 | |
---|
663 | DEALLOCATE( tmp_array ) |
---|
664 | ! |
---|
665 | !-- Internal mask arrays cannot be deallocated on PE 0 because they are |
---|
666 | !-- required for header output on PE 0. |
---|
667 | IF ( myid /= 0 ) DEALLOCATE( mask, mask_loop ) |
---|
668 | |
---|
669 | CONTAINS |
---|
670 | |
---|
671 | !------------------------------------------------------------------------------! |
---|
672 | ! Description: |
---|
673 | ! ------------ |
---|
674 | !> Set local mask for each subdomain along 'dim' direction. |
---|
675 | !------------------------------------------------------------------------------! |
---|
676 | SUBROUTINE set_mask_locations( dim, dxyz, dxyz_string, nxyz, nxyz_string, & |
---|
677 | lb, ub ) |
---|
678 | |
---|
679 | IMPLICIT NONE |
---|
680 | |
---|
681 | CHARACTER (LEN=2) :: dxyz_string !< |
---|
682 | CHARACTER (LEN=2) :: nxyz_string !< |
---|
683 | |
---|
684 | INTEGER(iwp) :: count !< |
---|
685 | INTEGER(iwp) :: count_l !< |
---|
686 | INTEGER(iwp) :: dim !< |
---|
687 | INTEGER(iwp) :: m !< |
---|
688 | INTEGER(iwp) :: loop_begin !< |
---|
689 | INTEGER(iwp) :: loop_end !< |
---|
690 | INTEGER(iwp) :: loop_stride !< |
---|
691 | INTEGER(iwp) :: lb !< |
---|
692 | INTEGER(iwp) :: nxyz !< |
---|
693 | INTEGER(iwp) :: ub !< |
---|
694 | |
---|
695 | REAL(wp) :: dxyz !< |
---|
696 | REAL(wp) :: ddxyz !< |
---|
697 | REAL(wp) :: tmp1 !< |
---|
698 | REAL(wp) :: tmp2 !< |
---|
699 | |
---|
700 | count = 0; count_l = 0 |
---|
701 | ddxyz = 1.0_wp / dxyz |
---|
702 | tmp1 = 0.0_wp |
---|
703 | tmp2 = 0.0_wp |
---|
704 | |
---|
705 | IF ( mask(mid,dim,1) >= 0.0_wp ) THEN |
---|
706 | ! |
---|
707 | !-- use predefined mask_* array |
---|
708 | DO WHILE ( mask(mid,dim,count+1) >= 0.0_wp ) |
---|
709 | count = count + 1 |
---|
710 | IF ( dim == 1 .OR. dim == 2 ) THEN |
---|
711 | m = NINT( mask(mid,dim,count) * mask_scale(dim) * ddxyz - 0.5_wp ) |
---|
712 | IF ( m < 0 ) m = 0 ! avoid negative values |
---|
713 | ELSEIF ( dim == 3 ) THEN |
---|
714 | ind_array = & |
---|
715 | MINLOC( ABS( mask(mid,dim,count) * mask_scale(dim) - zu ) ) |
---|
716 | m = ind_array(1) - 1 + nzb ! MINLOC uses lower array bound 1 |
---|
717 | ENDIF |
---|
718 | IF ( m > (nxyz+1) ) THEN |
---|
719 | WRITE ( message_string, '(I3,A,I3,A,I1,3A,I3)' ) & |
---|
720 | m,' in mask ',mid,' along dimension ',dim, & |
---|
721 | ' exceeds (',nxyz_string,'+1) = ',nxyz+1 |
---|
722 | CALL message( 'init_masks', 'PA0331', 1, 2, 0, 6, 0 ) |
---|
723 | ENDIF |
---|
724 | IF ( ( m >= lb .AND. m <= ub ) .OR. & |
---|
725 | ( m == (nxyz+1) .AND. ub == nxyz ) ) THEN |
---|
726 | IF ( count_l == 0 ) mask_start_l(mid,dim) = count |
---|
727 | count_l = count_l + 1 |
---|
728 | IF ( dim == 1 ) THEN |
---|
729 | mask_i(mid,count_l) = m |
---|
730 | ELSEIF ( dim == 2 ) THEN |
---|
731 | mask_j(mid,count_l) = m |
---|
732 | ELSEIF ( dim == 3 ) THEN |
---|
733 | mask_k(mid,count_l) = m |
---|
734 | ENDIF |
---|
735 | ENDIF |
---|
736 | IF ( count == mask_xyz_dimension ) EXIT |
---|
737 | ENDDO |
---|
738 | mask_size(mid,dim) = count |
---|
739 | mask_size_l(mid,dim) = count_l |
---|
740 | |
---|
741 | ELSE |
---|
742 | ! |
---|
743 | !-- use predefined mask_loop_* array, or use the default (all grid points |
---|
744 | !-- along this direction) |
---|
745 | IF ( mask_loop(mid,dim,1) < 0.0_wp ) THEN |
---|
746 | tmp1 = mask_loop(mid,dim,1) |
---|
747 | mask_loop(mid,dim,1) = zw(nzb) ! lowest level (default) |
---|
748 | ENDIF |
---|
749 | IF ( dim == 1 .OR. dim == 2 ) THEN |
---|
750 | IF ( mask_loop(mid,dim,2) < 0.0_wp ) THEN |
---|
751 | tmp2 = mask_loop(mid,dim,2) |
---|
752 | mask_loop(mid,dim,2) = (nxyz+1)*dxyz / mask_scale(dim) ! (default) |
---|
753 | ENDIF |
---|
754 | IF ( MAXVAL( mask_loop(mid,dim,1:2) ) & |
---|
755 | > (nxyz+1) * dxyz / mask_scale(dim) ) THEN |
---|
756 | WRITE ( message_string, '(2(A,I3,A,I1,A,F9.3),5A,I1,A,F9.3)' ) & |
---|
757 | 'mask_loop(',mid,',',dim,',1)=',mask_loop(mid,dim,1), & |
---|
758 | ' and/or mask_loop(',mid,',',dim,',2)=', & |
---|
759 | mask_loop(mid,dim,2),' exceed (', & |
---|
760 | nxyz_string,'+1)*',dxyz_string,'/mask_scale(',dim,')=', & |
---|
761 | (nxyz+1)*dxyz/mask_scale(dim) |
---|
762 | CALL message( 'init_masks', 'PA0332', 1, 2, 0, 6, 0 ) |
---|
763 | ENDIF |
---|
764 | loop_begin = NINT( mask_loop(mid,dim,1) * mask_scale(dim) & |
---|
765 | * ddxyz - 0.5_wp ) |
---|
766 | loop_end = NINT( mask_loop(mid,dim,2) * mask_scale(dim) & |
---|
767 | * ddxyz - 0.5_wp ) |
---|
768 | loop_stride = NINT( mask_loop(mid,dim,3) * mask_scale(dim) & |
---|
769 | * ddxyz ) |
---|
770 | IF ( loop_begin == -1 ) loop_begin = 0 ! avoid negative values |
---|
771 | ELSEIF ( dim == 3 ) THEN |
---|
772 | IF ( mask_loop(mid,dim,2) < 0.0_wp ) THEN |
---|
773 | tmp2 = mask_loop(mid,dim,2) |
---|
774 | mask_loop(mid,dim,2) = zu(nz+1) / mask_scale(dim) ! (default) |
---|
775 | ENDIF |
---|
776 | IF ( MAXVAL( mask_loop(mid,dim,1:2) ) & |
---|
777 | > zu(nz+1) / mask_scale(dim) ) THEN |
---|
778 | WRITE ( message_string, '(2(A,I3,A,I1,A,F9.3),A,I1,A,F9.3)' ) & |
---|
779 | 'mask_loop(',mid,',',dim,',1)=',mask_loop(mid,dim,1), & |
---|
780 | ' and/or mask_loop(',mid,',',dim,',2)=', & |
---|
781 | mask_loop(mid,dim,2),' exceed zu(nz+1)/mask_scale(',dim, & |
---|
782 | ')=',zu(nz+1)/mask_scale(dim) |
---|
783 | CALL message( 'init_masks', 'PA0333', 1, 2, 0, 6, 0 ) |
---|
784 | ENDIF |
---|
785 | ind_array = & |
---|
786 | MINLOC( ABS( mask_loop(mid,dim,1) * mask_scale(dim) - zu ) ) |
---|
787 | loop_begin = & |
---|
788 | ind_array(1) - 1 + nzb ! MINLOC uses lower array bound 1 |
---|
789 | ind_array = & |
---|
790 | MINLOC( ABS( mask_loop(mid,dim,2) * mask_scale(dim) - zu ) ) |
---|
791 | loop_end = ind_array(1) - 1 + nzb ! MINLOC uses lower array bound 1 |
---|
792 | ! |
---|
793 | !-- The following line assumes a constant vertical grid spacing within |
---|
794 | !-- the vertical mask range; it fails for vertical grid stretching. |
---|
795 | !-- Maybe revise later. Issue warning but continue execution. ABS(...) |
---|
796 | !-- within the IF statement is necessary because the default value of |
---|
797 | !-- dz_stretch_level_start is -9999999.9_wp. |
---|
798 | loop_stride = NINT( mask_loop(mid,dim,3) * mask_scale(dim) * ddxyz ) |
---|
799 | |
---|
800 | IF ( mask_loop(mid,dim,2) * mask_scale(dim) > & |
---|
801 | ABS( dz_stretch_level_start(1) ) ) THEN |
---|
802 | WRITE ( message_string, '(A,I3,A,I1,A,F9.3,A,F8.2,3A)' ) & |
---|
803 | 'mask_loop(',mid,',',dim,',2)=', mask_loop(mid,dim,2), & |
---|
804 | ' exceeds dz_stretch_level=',dz_stretch_level_start(1), & |
---|
805 | '.&Vertical mask locations will not ', & |
---|
806 | 'match the desired heights within the stretching ', & |
---|
807 | 'region.' |
---|
808 | CALL message( 'init_masks', 'PA0334', 0, 1, 0, 6, 0 ) |
---|
809 | ENDIF |
---|
810 | |
---|
811 | ENDIF |
---|
812 | ! |
---|
813 | !-- If necessary, reset mask_loop(mid,dim,1) and mask_loop(mid,dim,2). |
---|
814 | IF ( tmp1 < 0.0_wp ) mask_loop(mid,dim,1) = tmp1 |
---|
815 | IF ( tmp2 < 0.0_wp ) mask_loop(mid,dim,2) = tmp2 |
---|
816 | ! |
---|
817 | !-- The default stride +/-1 (every grid point) applies if |
---|
818 | !-- mask_loop(mid,dim,3) is not specified (its default is zero). |
---|
819 | IF ( loop_stride == 0 ) THEN |
---|
820 | IF ( loop_end >= loop_begin ) THEN |
---|
821 | loop_stride = 1 |
---|
822 | ELSE |
---|
823 | loop_stride = -1 |
---|
824 | ENDIF |
---|
825 | ENDIF |
---|
826 | DO m = loop_begin, loop_end, loop_stride |
---|
827 | count = count + 1 |
---|
828 | IF ( ( m >= lb .AND. m <= ub ) .OR. & |
---|
829 | ( m == (nxyz+1) .AND. ub == nxyz ) ) THEN |
---|
830 | IF ( count_l == 0 ) mask_start_l(mid,dim) = count |
---|
831 | count_l = count_l + 1 |
---|
832 | IF ( dim == 1 ) THEN |
---|
833 | mask_i(mid,count_l) = m |
---|
834 | ELSEIF ( dim == 2 ) THEN |
---|
835 | mask_j(mid,count_l) = m |
---|
836 | ELSEIF ( dim == 3 ) THEN |
---|
837 | mask_k(mid,count_l) = m |
---|
838 | ENDIF |
---|
839 | ENDIF |
---|
840 | ENDDO |
---|
841 | mask_size(mid,dim) = count |
---|
842 | mask_size_l(mid,dim) = count_l |
---|
843 | |
---|
844 | ENDIF |
---|
845 | |
---|
846 | END SUBROUTINE set_mask_locations |
---|
847 | |
---|
848 | END SUBROUTINE init_masks |
---|