One dimension decomposition.
Will decompose across the X or Y axis depending upon which is greater - it selects the greater to maximise the decomposition
263 type(model_state_type),
intent(inout) :: current_state
265 integer :: x_size, y_size, split_size, dimension_division, dimension_extra
267 call apply_halo_information_and_allocate_neighbours(current_state)
269 current_state%parallel%wrapped_around=.false.
271 x_size = merge(current_state%global_grid%size(x_index), 1, current_state%global_grid%active(x_index))
272 y_size = merge(current_state%global_grid%size(y_index), 1, current_state%global_grid%active(y_index))
274 split_size = merge(x_size, y_size, x_size .gt. y_size)
275 dimension_division = split_size / current_state%parallel%processes
276 dimension_extra = split_size - (dimension_division * current_state%parallel%processes)
278 current_state%local_grid%active = current_state%global_grid%active
279 current_state%local_grid%dimensions = current_state%global_grid%dimensions
280 current_state%parallel%neighbour_comm = current_state%parallel%monc_communicator
281 call apply_z_dimension_information(current_state)
283 if (x_size .gt. y_size)
then
285 current_state%local_grid%start(y_index)=1
286 current_state%local_grid%end(y_index)=y_size
287 current_state%local_grid%size(y_index)=y_size
288 current_state%parallel%my_coords(y_index)=0
289 current_state%parallel%dim_sizes(y_index)=1
290 current_state%local_grid%start(x_index)=dimension_division*current_state%parallel%my_rank+merge(&
291 dimension_extra, current_state%parallel%my_rank, dimension_extra .lt. current_state%parallel%my_rank) + 1
292 current_state%local_grid%end(x_index)=(current_state%local_grid%start(x_index)-1) + dimension_division + merge(&
293 1, 0, current_state%parallel%my_rank .lt. dimension_extra)
294 current_state%local_grid%size(x_index)=(current_state%local_grid%end(x_index) - current_state%local_grid%start(x_index)) + 1
295 current_state%parallel%my_coords(x_index) = current_state%parallel%my_rank
296 current_state%parallel%dim_sizes(x_index) = current_state%parallel%processes
297 current_state%local_grid%neighbours(y_index,:) = current_state%parallel%my_rank
299 current_state%local_grid%neighbours(x_index,1:2) = merge(current_state%parallel%my_rank, current_state%parallel%processes, &
300 current_state%parallel%my_rank .gt. 0) - 1
301 current_state%parallel%wrapped_around(x_index, 1)=&
302 current_state%local_grid%neighbours(x_index,1)==current_state%parallel%processes-1
303 current_state%local_grid%neighbours(x_index,3:4) = merge(current_state%parallel%my_rank+1, 0, &
304 current_state%parallel%my_rank .lt. current_state%parallel%processes-1)
305 current_state%parallel%wrapped_around(x_index, 2)=current_state%local_grid%neighbours(x_index,3)==0
306 current_state%local_grid%corner_neighbours(1,:)=current_state%local_grid%neighbours(x_index,1)
307 current_state%local_grid%corner_neighbours(3,:)=current_state%local_grid%neighbours(x_index,1)
308 current_state%local_grid%corner_neighbours(2,:)=current_state%local_grid%neighbours(x_index,3)
309 current_state%local_grid%corner_neighbours(4,:)=current_state%local_grid%neighbours(x_index,3)
310 current_state%parallel%wrapped_around(y_index, :)=.true.
313 current_state%local_grid%start(x_index)=1
314 current_state%local_grid%end(x_index)=x_size
315 current_state%local_grid%size(x_index)=x_size
316 current_state%parallel%my_coords(x_index)=0
317 current_state%parallel%dim_sizes(x_index)=1
318 current_state%local_grid%start(y_index)=dimension_division*current_state%parallel%my_rank+merge(&
319 dimension_extra, current_state%parallel%my_rank, dimension_extra .lt. current_state%parallel%my_rank) + 1
320 current_state%local_grid%end(y_index)=(current_state%local_grid%start(y_index)-1) + dimension_division + merge(&
321 1, 0, current_state%parallel%my_rank .lt. dimension_extra)
322 current_state%local_grid%size(y_index)=(current_state%local_grid%end(y_index) - current_state%local_grid%start(y_index)) + 1
323 current_state%parallel%my_coords(y_index)=current_state%parallel%my_rank
324 current_state%parallel%dim_sizes(y_index) = current_state%parallel%processes
325 current_state%local_grid%neighbours(x_index,:) = current_state%parallel%my_rank
326 current_state%local_grid%neighbours(y_index,1:2) = merge(current_state%parallel%my_rank, current_state%parallel%processes, &
327 current_state%parallel%my_rank .gt. 0) - 1
328 current_state%parallel%wrapped_around(y_index, 1)=&
329 current_state%local_grid%neighbours(y_index,1)==current_state%parallel%processes-1
330 current_state%local_grid%neighbours(y_index,3:4) = merge(current_state%parallel%my_rank+1, 0, &
331 current_state%parallel%my_rank .lt. current_state%parallel%processes-1)
332 current_state%parallel%wrapped_around(y_index, 2)=current_state%local_grid%neighbours(y_index,3)==0
333 current_state%local_grid%corner_neighbours(1:2,:)=current_state%local_grid%neighbours(y_index,1)
334 current_state%local_grid%corner_neighbours(3:4,:)=current_state%local_grid%neighbours(y_index,3)
335 current_state%parallel%wrapped_around(x_index, :)=.true.
338 call apply_data_start_end_bounds(current_state%local_grid)
339 call display_decomposition_information(current_state,
"OneDim")