Skip to content
Snippets Groups Projects

Link-Wise Extrapolation Outflow

Merged Frederik Hennig requested to merge da15siwa/lbmpy:extrapolation_outflow_fix into master
Files
2
@@ -221,10 +221,6 @@ class SimpleExtrapolationOutflow(LbBoundary):
name: optional name of the boundary.
"""
# We need each fluid cell only once, the direction of the outflow is given
# in the constructor.
single_link = True
def __init__(self, normal_direction, stencil, name=None):
if isinstance(normal_direction, str):
normal_direction = direction_string_to_offset(normal_direction, dim=len(stencil[0]))
@@ -235,17 +231,23 @@ class SimpleExtrapolationOutflow(LbBoundary):
self.normal_direction = normal_direction
super(SimpleExtrapolationOutflow, self).__init__(name)
def __call__(self, f_out, f_in, dir_symbol, inv_dir, lb_method, index_field):
stencil = lb_method.stencil
def get_additional_code_nodes(self, lb_method):
"""Return a list of code nodes that will be added in the generated code before the index field loop.
boundary_assignments = []
for i, stencil_dir in enumerate(stencil):
if all(n == 0 or n == -s for s, n in zip(stencil_dir, self.normal_direction)):
asm = Assignment(f_out[self.normal_direction](i), f_out.center(i))
boundary_assignments.append(asm)
Args:
lb_method: Lattice Boltzmann method. See :func:`lbmpy.creationfunctions.create_lb_method`
print(boundary_assignments)
return boundary_assignments
Returns:
list containing LbmWeightInfo and NeighbourOffsetArrays
"""
return [NeighbourOffsetArrays(lb_method.stencil)]
def __call__(self, f_out, f_in, dir_symbol, inv_dir, lb_method, index_field):
neighbor_offset = NeighbourOffsetArrays.neighbour_offset(dir_symbol, lb_method.stencil)
tangential_offset = tuple(offset - normal for offset, normal in zip(neighbor_offset, self.normal_direction))
return Assignment(f_in.center(inv_dir[dir_symbol]), f_out[tangential_offset](inv_dir[dir_symbol]))
# end class SimpleExtrapolationOutflow
Loading