Skip to content
Snippets Groups Projects
Commit c1d68465 authored by Markus Holzer's avatar Markus Holzer Committed by Helen Schottenhamml
Browse files

[Fix] Zeroth Timestep for outflow boundary

parent 64f117da
Branches
No related merge requests found
from pystencils import Target
from pystencils.stencil import inverse_direction
from lbmpy.advanced_streaming import AccessPdfValues, numeric_offsets, numeric_index
from lbmpy.advanced_streaming import AccessPdfValues, numeric_offsets, numeric_index, Timestep, is_inplace
from lbmpy.advanced_streaming.indexing import MirroredStencilDirections
from lbmpy.boundaries.boundaryconditions import LbBoundary
from lbmpy.boundaries import ExtrapolationOutflow, FreeSlip, UBB
......@@ -26,7 +26,6 @@ def default_additional_data_handler(boundary_obj: LbBoundary, lb_method, field_n
class FreeSlipAdditionalDataHandler(AdditionalDataHandler):
def __init__(self, stencil, boundary_object):
assert isinstance(boundary_object, FreeSlip)
self._boundary_object = boundary_object
super(FreeSlipAdditionalDataHandler, self).__init__(stencil=stencil)
@property
......@@ -110,7 +109,6 @@ class FreeSlipAdditionalDataHandler(AdditionalDataHandler):
class UBBAdditionalDataHandler(AdditionalDataHandler):
def __init__(self, stencil, boundary_object):
assert isinstance(boundary_object, UBB)
self._boundary_object = boundary_object
super(UBBAdditionalDataHandler, self).__init__(stencil=stencil)
@property
......@@ -146,14 +144,18 @@ class UBBAdditionalDataHandler(AdditionalDataHandler):
class OutflowAdditionalDataHandler(AdditionalDataHandler):
def __init__(self, stencil, boundary_object, target=Target.CPU, field_name='pdfs'):
def __init__(self, stencil, boundary_object, target=Target.CPU, field_name='pdfs', zeroth_timestep=None):
assert isinstance(boundary_object, ExtrapolationOutflow)
self._boundary_object = boundary_object
self._stencil = boundary_object.stencil
self._lb_method = boundary_object.lb_method
self._normal_direction = boundary_object.normal_direction
self._field_name = field_name
self._target = target
self._streaming_pattern = boundary_object.streaming_pattern
if zeroth_timestep:
self._zeroth_timestep = zeroth_timestep
else:
self._zeroth_timestep = Timestep.EVEN if is_inplace(self._streaming_pattern) else Timestep.BOTH
super(OutflowAdditionalDataHandler, self).__init__(stencil=stencil)
assert sum([a != 0 for a in self._normal_direction]) == 1, \
......@@ -174,9 +176,9 @@ class OutflowAdditionalDataHandler(AdditionalDataHandler):
f"{len(self._stencil)}> >({self._field_name}{identifier}ID); "
def data_initialisation(self, direction_index):
pdf_acc = AccessPdfValues(self._boundary_object.stencil,
streaming_pattern=self._boundary_object.streaming_pattern,
timestep=self._boundary_object.zeroth_timestep,
pdf_acc = AccessPdfValues(self._stencil,
streaming_pattern=self._streaming_pattern,
timestep=self._zeroth_timestep,
streaming_dir='out')
init_list = []
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment