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