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