Skip to content
Snippets Groups Projects

[BugFix] Fix missing comunicated PDFs for FreeSlip

Merged Markus Holzer requested to merge holzer/lbmpy:FixComm into master
1 file
+ 4
7
Compare changes
  • Side-by-side
  • Inline
import itertools
import itertools
from pystencils import Field, Assignment
from pystencils import Field, Assignment
from pystencils.slicing import shift_slice, get_slice_before_ghost_layer, normalize_slice
from pystencils.slicing import shift_slice, get_slice_before_ghost_layer, normalize_slice
from lbmpy.advanced_streaming.utility import is_inplace, get_accessor, numeric_index, \
from lbmpy.advanced_streaming.utility import is_inplace, get_accessor, numeric_index, Timestep, get_timesteps
numeric_offsets, Timestep, get_timesteps
from pystencils.datahandling import SerialDataHandling
from pystencils.datahandling import SerialDataHandling
from pystencils.enums import Target
from pystencils.enums import Target
from itertools import chain
from itertools import chain
@@ -60,7 +59,7 @@ def get_communication_slices(
@@ -60,7 +59,7 @@ def get_communication_slices(
Return the source and destination slices for periodicity handling or communication between blocks.
Return the source and destination slices for periodicity handling or communication between blocks.
:param stencil: The stencil used by the LB method.
:param stencil: The stencil used by the LB method.
:param comm_stencil: The stencil defining the communication directions. If None, it will be set to the
:param comm_stencil: The stencil defining the communication directions. If None, it will be set to the
full stencil (D2Q9 in 2D, D3Q27 in 3D, etc.).
full stencil (D2Q9 in 2D, D3Q27 in 3D, etc.).
:param streaming_pattern: The streaming pattern.
:param streaming_pattern: The streaming pattern.
:param prev_timestep: Timestep after which communication is run.
:param prev_timestep: Timestep after which communication is run.
@@ -83,13 +82,10 @@ def get_communication_slices(
@@ -83,13 +82,10 @@ def get_communication_slices(
for streaming_dir in set(_extend_dir(comm_dir)) & set(stencil):
for streaming_dir in set(_extend_dir(comm_dir)) & set(stencil):
d = stencil.index(streaming_dir)
d = stencil.index(streaming_dir)
write_offsets = numeric_offsets(write_accesses[d])
write_index = numeric_index(write_accesses[d])[0]
write_index = numeric_index(write_accesses[d])[0]
tangential_dir = tuple(s - c for s, c in zip(streaming_dir, comm_dir))
origin_slice = get_slice_before_ghost_layer(comm_dir, ghost_layers=ghost_layers, thickness=1)
origin_slice = get_slice_before_ghost_layer(comm_dir, ghost_layers=ghost_layers, thickness=1)
origin_slice = _fix_length_one_slices(origin_slice)
src_slice = _fix_length_one_slices(origin_slice)
src_slice = shift_slice(_trim_slice_in_direction(origin_slice, tangential_dir), write_offsets)
neighbour_transform = _get_neighbour_transform(comm_dir, ghost_layers)
neighbour_transform = _get_neighbour_transform(comm_dir, ghost_layers)
dst_slice = shift_slice(src_slice, neighbour_transform)
dst_slice = shift_slice(src_slice, neighbour_transform)
@@ -114,6 +110,7 @@ def periodic_pdf_copy_kernel(pdf_field, src_slice, dst_slice,
@@ -114,6 +110,7 @@ def periodic_pdf_copy_kernel(pdf_field, src_slice, dst_slice,
src_slice = src_slice[:-1]
src_slice = src_slice[:-1]
dst_slice = dst_slice[:-1]
dst_slice = dst_slice[:-1]
 
# TODO this is the domain_size with GL
if domain_size is None:
if domain_size is None:
domain_size = pdf_field.spatial_shape
domain_size = pdf_field.spatial_shape
Loading